com.ibm.di.connector
Class TCPServerConnector

java.lang.Object
  extended by com.ibm.di.connector.Connector
      extended by 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
TCPServerConnector()
          Default constructor.
 
Method Summary
 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.
 String getVersion()
          Version information.
 void initialize(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, 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
 

Constructor Detail

TCPServerConnector

public TCPServerConnector()
Default constructor.

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(Object aObj)
                throws 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 interface ConnectorInterface
Overrides:
initialize in class Connector
Parameters:
aObj - Null, Socket or ConnectorMode class
Throws:
Exception - if the initialization of this connector fails.

getNextClient

public ConnectorInterface getNextClient()
                                 throws Exception
Server mode - returns a new instance of the Connector for each client connection.

Specified by:
getNextClient in interface ConnectorInterface
Overrides:
getNextClient in class Connector
Returns:
the clone of itself
Throws:
Exception - if an error occurs.

getNextEntry

public Entry getNextEntry()
                   throws Exception
Returns the next Entry from the TCP client.

Specified by:
getNextEntry in interface ConnectorInterface
Overrides:
getNextEntry in class Connector
Returns:
- the next Entry, or null if the client connection has been closed.
Throws:
Exception - if an error occurs.
See Also:
ConnectorInterface.selectEntries()

putEntry

public void putEntry(Entry aEntry)
              throws Exception
Flushes the output stream to the client.

Specified by:
putEntry in interface ConnectorInterface
Overrides:
putEntry in class Connector
Parameters:
aEntry - This parameter is ignored
Throws:
Exception - if an error occurs.

replyEntry

public void replyEntry(Entry aEntry)
                throws Exception
Flushes the output stream to the client and closes the connection.

Specified by:
replyEntry in interface ConnectorInterface
Overrides:
replyEntry in class Connector
Parameters:
aEntry - This parameter is ignored
Throws:
Exception - if an error occurs.

terminateServer

public void terminateServer()
                     throws 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 interface ConnectorInterface
Overrides:
terminateServer in class Connector
Throws:
Exception - if an error occurs

terminate

public void terminate()
               throws Exception
Terminate the connector.

Specified by:
terminate in interface ConnectorInterface
Overrides:
terminate in class Connector
Throws:
Exception - if an error occurs.

getVersion

public String getVersion()
Version information.

Specified by:
getVersion in interface VersionInfoInterface
Returns:
version information