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 ConnectorInterfacegetNextClient()Server mode - returns a new instance of the Connector for each client connection.EntrygetNextEntry()Returns the next Entry from the TCP client.TCPServerConnectorgetServerConnector()Retrieves server connector.java.lang.StringgetVersion()Version information.voidinitialize(java.lang.Object aObj)Initialize the Connector.booleanisAccepting()Checks whether this Connector is currently waiting for a client connection.booleanisTerminating()Checks if a termination is requested.voidputEntry(Entry aEntry)Flushes the output stream to the client.voidreplyEntry(Entry aEntry)Flushes the output stream to the client and closes the connection.voidsetServerConnector(TCPServerConnector aServerConnector)Sets the server Connector for this Connector.voidterminate()Terminate the connector.voidterminateServer()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.ExceptionInitialize 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:
initializein interfaceConnectorInterface- Overrides:
initializein 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:
getNextClientin interfaceConnectorInterface- Overrides:
getNextClientin 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:
getNextEntryin interfaceConnectorInterface- Overrides:
getNextEntryin 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:
putEntryin interfaceConnectorInterface- Overrides:
putEntryin 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:
replyEntryin interfaceConnectorInterface- Overrides:
replyEntryin classConnector- Parameters:
aEntry- This parameter is ignored- Throws:
java.lang.Exception- if an error occurs.
-
terminateServer
public void terminateServer() throws java.lang.ExceptionThis 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:
terminateServerin interfaceConnectorInterface- Overrides:
terminateServerin classConnector- Throws:
java.lang.Exception- if an error occurs
-
terminate
public void terminate() throws java.lang.ExceptionTerminate the connector.- Specified by:
terminatein interfaceConnectorInterface- Overrides:
terminatein classConnector- Throws:
java.lang.Exception- if an error occurs.
-
getVersion
public java.lang.String getVersion()
Version information.- Specified by:
getVersionin interfaceVersionInfoInterface- Returns:
- version information
-
-