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.StringPARAM_SYSTEM_TCP_BACKLOGname of the backlog in the global properties filestatic java.lang.StringPARAM_TCP_BACKLOGname 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.EntrygetNextEntry()Returns the next Entry from the connector.java.io.ReadergetReader()Returns a reader object for the socketjava.net.SocketgetSocket()Returns the Socket we are reading from or writing tojava.lang.StringgetVersion()Return version informationjava.io.WritergetWriter()Returns a writer object for the socketvoidinitialize(java.lang.Object o)Initialize the connector.voidputEntry(Entry entry)Adds a new entry to the data sourcevoidselectEntries()default implementationvoidterminate()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.Exceptiondefault implementation- Specified by:
selectEntriesin interfaceConnectorInterface- Overrides:
selectEntriesin 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:
terminatein interfaceConnectorInterface- Overrides:
terminatein classConnector
-
initialize
public void initialize(java.lang.Object o) throws java.lang.ExceptionInitialize 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:
initializein interfaceConnectorInterface- Overrides:
initializein 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:
getNextEntryin interfaceConnectorInterface- Overrides:
getNextEntryin 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:
putEntryin interfaceConnectorInterface- Overrides:
putEntryin 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.ExceptionReturns 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.ExceptionReturns 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.SSLPeerUnverifiedExceptionReturns 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:
getVersionin interfaceVersionInfoInterface- Returns:
- version info
-
-