com.ibm.di.connector
Class TCPConnector

java.lang.Object
  extended by com.ibm.di.connector.Connector
      extended by com.ibm.di.connector.TCPConnector
All Implemented Interfaces:
ConnectorInterface, VersionInfoInterface

public class TCPConnector
extends Connector
implements ConnectorInterface

The TCP Connector is a transport Connector using TCP sockets for transport. You can use the TCP Connector in Iterator and AddOnly mode only.


Field Summary
static String PARAM_SYSTEM_TCP_BACKLOG
          name of the backlog in the global properties file
static String PARAM_TCP_BACKLOG
          name of backlog parameter
 
Fields inherited from class com.ibm.di.connector.Connector
ALL_MODES, myLog, PROPERTY_MESSAGE, PROPERTY_READER, PROPERTY_WRITER
 
Constructor Summary
TCPConnector()
          Class constructor
 
Method Summary
 Certificate[] getCertificates()
          Returns the Certificates of the peer.
 Entry getNextEntry()
          Returns the next Entry from the connector.
 Reader getReader()
          Returns a reader object for the socket
 Socket getSocket()
          Returns the Socket we are reading from or writing to
 String getVersion()
          Return version information
 Writer getWriter()
          Returns a writer object for the socket
 void initialize(Object o)
          Initialize the connector.
 void putEntry(Entry entry)
          Adds a new entry to the data source
 void selectEntries()
          default implementation
 void terminate()
          Terminate the connector.
 
Methods inherited from class com.ibm.di.connector.Connector
addFindEntry, allModes, clearFindEntries, debug, debugMode, deleteEntry, findEntry, findEntry, getBoolean, getClassInstance, getConfiguration, getContext, getFindEntryCount, getFirstFindEntry, getLog, getMaxDuplicateEntries, getModes, getModes, getName, getNextClient, getNextFindEntry, getParam, getParser, getProperty, getPushbackEntry, getRawConnectorConfiguration, getRSInterface, getUI, hasConfigValue, hasParser, initParser, isDeltaSupported, isExceptionFatal, isIOException, logError, logmsg, modEntry, modEntry, pushback, queryOperations, queryReply, querySchema, queryTables, reconnect, reconnect, registerScriptBeans, replyEntry, setConfiguration, setContext, setCurrent, setDebugMode, setLog, setMaxDuplicateEntries, setModes, setModes, setName, setParam, setParser, setProperty, setRSInterface, terminateServer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.di.connector.ConnectorInterface
deleteEntry, findEntry, getConfiguration, getContext, getFindEntryCount, getFirstFindEntry, getMaxDuplicateEntries, getName, getNextClient, getNextFindEntry, getParam, getPushbackEntry, getRawConnectorConfiguration, isDeltaSupported, isExceptionFatal, isIOException, modEntry, modEntry, pushback, queryOperations, queryReply, querySchema, reconnect, registerScriptBeans, replyEntry, setConfiguration, setContext, setCurrent, setLog, setMaxDuplicateEntries, setName, setParam, setRSInterface, terminateServer
 

Field Detail

PARAM_TCP_BACKLOG

public static final String PARAM_TCP_BACKLOG
name of backlog parameter

See Also:
Constant Field Values

PARAM_SYSTEM_TCP_BACKLOG

public static final 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

selectEntries

public void selectEntries()
                   throws Exception
default implementation

Specified by:
selectEntries in interface ConnectorInterface
Overrides:
selectEntries in class Connector
Throws:
Exception - never

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(Object o)
                throws 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:
Exception - if the initialization of this connector fails.

getNextEntry

public Entry getNextEntry()
                   throws 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:

Specified by:
getNextEntry in interface ConnectorInterface
Overrides:
getNextEntry in class Connector
Returns:
- the next Entry, or null if no more data
Throws:
Exception - if an error occurs
See Also:
selectEntries()

putEntry

public void putEntry(Entry entry)
              throws 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:
Exception - if an error occurs.

getReader

public Reader getReader()
                 throws Exception
Returns a reader object for the socket

Returns:
the input reader
Throws:
Exception - if an error occurs

getWriter

public Writer getWriter()
                 throws Exception
Returns a writer object for the socket

Returns:
the output writer
Throws:
Exception - if an error occurs

getSocket

public Socket getSocket()
Returns the Socket we are reading from or writing to

Returns:
the Socket we are reading from or writing to

getCertificates

public Certificate[] getCertificates()
                              throws 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:
SSLPeerUnverifiedException - if the peer's identity has not been verified

getVersion

public String getVersion()
Return version information

Specified by:
getVersion in interface VersionInfoInterface
Returns:
version info