Package com.ibm.di.connector
Class TCPConnector
- java.lang.Object
-
- com.ibm.di.connector.Connector
-
- 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
Fields Modifier and Type Field Description static java.lang.String
PARAM_SYSTEM_TCP_BACKLOG
name of the backlog in the global properties filestatic java.lang.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
Constructors Constructor Description TCPConnector()
Class constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.security.cert.Certificate[]
getCertificates()
Returns the Certificates of the peer.Entry
getNextEntry()
Returns the next Entry from the connector.java.io.Reader
getReader()
Returns a reader object for the socketjava.net.Socket
getSocket()
Returns the Socket we are reading from or writing tojava.lang.String
getVersion()
Return version informationjava.io.Writer
getWriter()
Returns a writer object for the socketvoid
initialize(java.lang.Object o)
Initialize the connector.void
putEntry(Entry entry)
Adds a new entry to the data sourcevoid
selectEntries()
default implementationvoid
terminate()
Terminate the connector.-
Methods inherited from class com.ibm.di.connector.Connector
addFindEntry, allModes, clearFindEntries, debug, debugMode, deleteEntry, extractExceptionInformation, 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 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
-
-
Method Detail
-
selectEntries
public void selectEntries() throws java.lang.Exception
default implementation- Specified by:
selectEntries
in interfaceConnectorInterface
- Overrides:
selectEntries
in classConnector
- Throws:
java.lang.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 interfaceConnectorInterface
- Overrides:
terminate
in classConnector
-
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 interfaceConnectorInterface
- Overrides:
initialize
in classConnector
- 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 interfaceConnectorInterface
- Overrides:
getNextEntry
in classConnector
- 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 sourceExample:
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 interfaceConnectorInterface
- Overrides:
putEntry
in classConnector
- 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 asgetSocket().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 interfaceVersionInfoInterface
- Returns:
- version info
-
-