com.ibm.di.connector
Class StreamConnector

java.lang.Object
  extended by com.ibm.di.connector.Connector
      extended by com.ibm.di.connector.StreamConnector
All Implemented Interfaces:
ConnectorInterface, VersionInfoInterface

public class StreamConnector
extends Connector
implements ConnectorInterface

The Memory Stream Connector can read from or write to any Java(TM) stream, but is most often used to write into memory, where the formatted data can be retrieved later. The allocated buffer is retrieved/accessed as needed.


Field Summary
 
Fields inherited from class com.ibm.di.connector.Connector
ALL_MODES, myLog, PROPERTY_MESSAGE, PROPERTY_READER, PROPERTY_WRITER
 
Constructor Summary
StreamConnector()
          Class constructor
 
Method Summary
 String getDataBuffer()
          Retrieves data from the buffer
 Entry getNextEntry()
          uses the provided parser to read an entry
 String getVersion()
          Return version information
 void initialize(Object o)
          The Connector can only operate in Iterator mode, AddOnly mode, or Passive state.
 void putEntry(Entry entry)
          Writes an entry using the provided parser
 void selectEntries()
          Default implementation
 
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, 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, terminate, 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, terminate, terminateServer
 

Constructor Detail

StreamConnector

public StreamConnector()
Class constructor

Method Detail

selectEntries

public void selectEntries()
                   throws Exception
Default implementation

Specified by:
selectEntries in interface ConnectorInterface
Overrides:
selectEntries in class Connector
Throws:
Exception - never

initialize

public void initialize(Object o)
                throws Exception
The Connector can only operate in Iterator mode, AddOnly mode, or Passive state. The behavior of the Connector depends on the way it has been initialized. initialize(null) This is the default behavior. The Connector writes into memory, and the formatted data can be retrieved with the method getDataBuffer(), only available in Memory Stream Connectors. Assuming the Connector is named MM, this code can be used anywhere (for example, Prolog, Epilog, all Hooks, script components, and even inside attribute mapping):
        var str = MM.connector.getDataBuffer();
        // use str for something.
        // To clear the data buffer and ready the Connector 
                        for more output, re-initialize
        MM.connector.initialize(null); 
        
 

initialize(Reader r): The Connector reads from r. This can be used if you want to read from a stream.
initialize(Writer w): The Connector writes to w.
initialize(Socket s): The Connector can both read from and write to a Socket s.

Specified by:
initialize in interface ConnectorInterface
Overrides:
initialize in class Connector
Parameters:
o - null/Writer/Reader or Socket
Throws:
Exception - if an error occurs

getNextEntry

public Entry getNextEntry()
                   throws Exception
uses the provided parser to read an entry

Specified by:
getNextEntry in interface ConnectorInterface
Overrides:
getNextEntry in class Connector
Returns:
the read entry
Throws:
Exception - if no parser provided or an error occurs
See Also:
ConnectorInterface.selectEntries()

putEntry

public void putEntry(Entry entry)
              throws Exception
Writes an entry using the provided parser

Specified by:
putEntry in interface ConnectorInterface
Overrides:
putEntry in class Connector
Parameters:
entry - the entry to be written
Throws:
Exception - if no parser provided or an error occurs

getDataBuffer

public String getDataBuffer()
                     throws Exception
Retrieves data from the buffer

Returns:
the buffered data
Throws:
Exception - if an I/O error occurs

getVersion

public String getVersion()
Return version information

Specified by:
getVersion in interface VersionInfoInterface
Returns:
version info