Package com.ibm.di.connector
Class TCPServerConnector
- java.lang.Object
-
- com.ibm.di.connector.Connector
-
- com.ibm.di.connector.TCPServerConnector
-
- All Implemented Interfaces:
ConnectorInterface
,VersionInfoInterface
public class TCPServerConnector extends Connector implements ConnectorInterface
Simple TCP Server that accepts TCP connections. Supports SSL and client certificates.
-
-
Field Summary
-
Fields inherited from class com.ibm.di.connector.Connector
ALL_MODES, myLog, PROPERTY_MESSAGE, PROPERTY_READER, PROPERTY_WRITER
-
-
Constructor Summary
Constructors Constructor Description TCPServerConnector()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConnectorInterface
getNextClient()
Server mode - returns a new instance of the Connector for each client connection.Entry
getNextEntry()
Returns the next Entry from the TCP client.TCPServerConnector
getServerConnector()
Retrieves server connector.java.lang.String
getVersion()
Version information.void
initialize(java.lang.Object aObj)
Initialize the Connector.boolean
isAccepting()
Checks whether this Connector is currently waiting for a client connection.boolean
isTerminating()
Checks if a termination is requested.void
putEntry(Entry aEntry)
Flushes the output stream to the client.void
replyEntry(Entry aEntry)
Flushes the output stream to the client and closes the connection.void
setServerConnector(TCPServerConnector aServerConnector)
Sets the server Connector for this Connector.void
terminate()
Terminate the connector.void
terminateServer()
This method tries to terminate the server by setting the termination flag for the Connector returned by getServerConnector and immediately connecting to its port.-
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, 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, selectEntries, setConfiguration, setContext, setCurrent, setDebugMode, setLog, setMaxDuplicateEntries, setModes, setModes, setName, setParam, setParser, setProperty, setRSInterface
-
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, getNextFindEntry, getParam, getPushbackEntry, getRawConnectorConfiguration, isDeltaSupported, isExceptionFatal, isIOException, modEntry, modEntry, pushback, queryOperations, queryReply, querySchema, reconnect, registerScriptBeans, selectEntries, setConfiguration, setContext, setCurrent, setLog, setMaxDuplicateEntries, setName, setParam, setRSInterface
-
-
-
-
Method Detail
-
getServerConnector
public TCPServerConnector getServerConnector()
Retrieves server connector.- Returns:
- The server Connector if this Connector is handling a TCP client session.
-
setServerConnector
public void setServerConnector(TCPServerConnector aServerConnector)
Sets the server Connector for this Connector.- Parameters:
aServerConnector
- The serverConnector.
-
isAccepting
public boolean isAccepting()
Checks whether this Connector is currently waiting for a client connection.- Returns:
- true if this Connector is currently waiting for a client connection.
-
isTerminating
public boolean isTerminating()
Checks if a termination is requested.- Returns:
- true if this Connector has the termination flag set.
-
initialize
public void initialize(java.lang.Object aObj) throws java.lang.Exception
Initialize the Connector. To initialize this Connector with a TCP client session provide a java.net.Socket object for the obj parameter. In all other cases, the Connector will initialize a TCP server session.- Specified by:
initialize
in interfaceConnectorInterface
- Overrides:
initialize
in classConnector
- Parameters:
aObj
- Null, Socket or ConnectorMode class- Throws:
java.lang.Exception
- if the initialization of this connector fails.
-
getNextClient
public ConnectorInterface getNextClient() throws java.lang.Exception
Server mode - returns a new instance of the Connector for each client connection.- Specified by:
getNextClient
in interfaceConnectorInterface
- Overrides:
getNextClient
in classConnector
- Returns:
- the clone of itself
- Throws:
java.lang.Exception
- if an error occurs.
-
getNextEntry
public Entry getNextEntry() throws java.lang.Exception
Returns the next Entry from the TCP client.- Specified by:
getNextEntry
in interfaceConnectorInterface
- Overrides:
getNextEntry
in classConnector
- Returns:
- - the next Entry, or null if the client connection has been closed.
- Throws:
java.lang.Exception
- if an error occurs.- See Also:
ConnectorInterface.selectEntries()
-
putEntry
public void putEntry(Entry aEntry) throws java.lang.Exception
Flushes the output stream to the client.- Specified by:
putEntry
in interfaceConnectorInterface
- Overrides:
putEntry
in classConnector
- Parameters:
aEntry
- This parameter is ignored- Throws:
java.lang.Exception
- if an error occurs.
-
replyEntry
public void replyEntry(Entry aEntry) throws java.lang.Exception
Flushes the output stream to the client and closes the connection.- Specified by:
replyEntry
in interfaceConnectorInterface
- Overrides:
replyEntry
in classConnector
- Parameters:
aEntry
- This parameter is ignored- Throws:
java.lang.Exception
- if an error occurs.
-
terminateServer
public void terminateServer() throws java.lang.Exception
This method tries to terminate the server by setting the termination flag for the Connector returned by getServerConnector and immediately connecting to its port.- Specified by:
terminateServer
in interfaceConnectorInterface
- Overrides:
terminateServer
in classConnector
- Throws:
java.lang.Exception
- if an error occurs
-
terminate
public void terminate() throws java.lang.Exception
Terminate the connector.- Specified by:
terminate
in interfaceConnectorInterface
- Overrides:
terminate
in classConnector
- Throws:
java.lang.Exception
- if an error occurs.
-
getVersion
public java.lang.String getVersion()
Version information.- Specified by:
getVersion
in interfaceVersionInfoInterface
- Returns:
- version information
-
-