Class TCPConnector

    • Field Detail

      • PARAM_TCP_BACKLOG

        public static final java.lang.String PARAM_TCP_BACKLOG
        name of backlog parameter
        See Also:
        Constant Field Values
      • PARAM_SYSTEM_TCP_BACKLOG

        public static final java.lang.String PARAM_SYSTEM_TCP_BACKLOG
        name of the backlog in the global properties file
        See Also:
        Constant Field Values
    • Constructor Detail

      • TCPConnector

        public TCPConnector()
        Class constructor
    • Method Detail

      • terminate

        public void terminate()
        Terminate the connector. This function closes all connection and releases all resources used by the connector. This function also calls the parser's closeParser() method if a parser is active.
        Specified by:
        terminate in interface ConnectorInterface
        Overrides:
        terminate in class Connector
      • initialize

        public void initialize​(java.lang.Object o)
                        throws java.lang.Exception
        Initialize the connector. The connector may be passed a parameter of any kind by the user. It is up to the connector to determine whether this object can be used or not. The parameter is typically provided by a user script. When an AssemblyLine initializes it's Connectors, they are passed a ConnectorMode object.
        Specified by:
        initialize in interface ConnectorInterface
        Overrides:
        initialize in class Connector
        Parameters:
        o - User provided parameter
        Throws:
        java.lang.Exception - if the initialization of this connector fails.
      • getNextEntry

        public Entry getNextEntry()
                           throws java.lang.Exception
        Returns the next Entry from the connector. If we are in Server mode, accept a new Connection. If there is a Parser connected to this Connector, the Parser is used to read the next Entry. The Entry will have three special Properties:
        • socket - The socket we are reading from
        • inp - a BufferedReader using the socket
        • out - a BufferedWriter using the socket
        Specified by:
        getNextEntry in interface ConnectorInterface
        Overrides:
        getNextEntry in class Connector
        Returns:
        - the next Entry, or null if no more data
        Throws:
        java.lang.Exception - if an error occurs
        See Also:
        selectEntries()
      • putEntry

        public void putEntry​(Entry entry)
                      throws java.lang.Exception
        Adds a new entry to the data source

        Example:

         var ctor = write.getConnector();
         
         for (i = 0; i < 10; i++) {
                var entry = system.newEntry();
                entry.setAttribute("linenumber", i);
                entry.setAttribute("line", i + " line of text...");
         
                main.logmsg("Writes entry to output...");
                main.dumpEntry(entry);
                ctor.putEntry(entry);
         }
         
        Specified by:
        putEntry in interface ConnectorInterface
        Overrides:
        putEntry in class Connector
        Parameters:
        entry - The entry data to add
        Throws:
        java.lang.Exception - if an error occurs.
      • getReader

        public java.io.Reader getReader()
                                 throws java.lang.Exception
        Returns a reader object for the socket
        Returns:
        the input reader
        Throws:
        java.lang.Exception - if an error occurs
      • getWriter

        public java.io.Writer getWriter()
                                 throws java.lang.Exception
        Returns a writer object for the socket
        Returns:
        the output writer
        Throws:
        java.lang.Exception - if an error occurs
      • getSocket

        public java.net.Socket getSocket()
        Returns the Socket we are reading from or writing to
        Returns:
        the Socket we are reading from or writing to
      • getCertificates

        public java.security.cert.Certificate[] getCertificates()
                                                         throws javax.net.ssl.SSLPeerUnverifiedException
        Returns the Certificates of the peer. If this is not an SSL Session, return null, otherwise return the same as
         getSocket().getSession().getPeerCertificates();
         
        Returns:
        an ordered array of peer certificates, with the peer's own certificate first followed by any certificate authorities.
        Throws:
        javax.net.ssl.SSLPeerUnverifiedException - if the peer's identity has not been verified
      • getVersion

        public java.lang.String getVersion()
        Return version information
        Specified by:
        getVersion in interface VersionInfoInterface
        Returns:
        version info