Package com.ibm.di.connector
Class StreamConnector
- java.lang.Object
-
- com.ibm.di.connector.Connector
-
- 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
Constructors Constructor Description StreamConnector()
Class constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getDataBuffer()
Retrieves data from the bufferEntry
getNextEntry()
uses the provided parser to read an entryjava.lang.String
getVersion()
Return version informationvoid
initialize(java.lang.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 parservoid
selectEntries()
Default implementation-
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, 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
-
-
-
-
Method Detail
-
selectEntries
public void selectEntries() throws java.lang.Exception
Default implementation- Specified by:
selectEntries
in interfaceConnectorInterface
- Overrides:
selectEntries
in classConnector
- Throws:
java.lang.Exception
- never
-
initialize
public void initialize(java.lang.Object o) throws java.lang.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 interfaceConnectorInterface
- Overrides:
initialize
in classConnector
- Parameters:
o
- null/Writer/Reader or Socket- Throws:
java.lang.Exception
- if an error occurs
-
getNextEntry
public Entry getNextEntry() throws java.lang.Exception
uses the provided parser to read an entry- Specified by:
getNextEntry
in interfaceConnectorInterface
- Overrides:
getNextEntry
in classConnector
- Returns:
- the read entry
- Throws:
java.lang.Exception
- if no parser provided or an error occurs- See Also:
ConnectorInterface.selectEntries()
-
putEntry
public void putEntry(Entry entry) throws java.lang.Exception
Writes an entry using the provided parser- Specified by:
putEntry
in interfaceConnectorInterface
- Overrides:
putEntry
in classConnector
- Parameters:
entry
- the entry to be written- Throws:
java.lang.Exception
- if no parser provided or an error occurs
-
getDataBuffer
public java.lang.String getDataBuffer() throws java.lang.Exception
Retrieves data from the buffer- Returns:
- the buffered data
- Throws:
java.lang.Exception
- if an I/O error occurs
-
getVersion
public java.lang.String getVersion()
Return version information- Specified by:
getVersion
in interfaceVersionInfoInterface
- Returns:
- version info
-
-