com.ibm.di.connector
Class CommandLineConnector

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

public class CommandLineConnector
extends Connector
implements ConnectorInterface

The command line Connector enables you to read the output from a command line or pipe data to a command line's standard input. Every command argument is separated by a space character, and quotes are ignored. The command is executed on the local machine. The Connector supports Iterator and AddOnly mode, as well as CallReply mode.


Field Summary
static java.lang.String ATTR_COMMAND_LINE
          The name of the attribute in which the command line has to be put in CallReply mode
static java.lang.String ATTR_COMMAND_OUTPUT
          The name of the attribute in which the result of the executed command in CallReply mode is stored
 
Fields inherited from class com.ibm.di.connector.Connector
ALL_MODES, myLog, PROPERTY_MESSAGE, PROPERTY_READER, PROPERTY_WRITER
 
Constructor Summary
CommandLineConnector()
          Constructor.
 
Method Summary
 Entry getNextEntry()
          Return the next Entry from the connector.
 java.lang.String getVersion()
          Version information.
 void initialize(java.lang.Object o)
          Initialize the connector.
 void putEntry(Entry entry)
          Add a new entry to the data source
 Entry queryReply(Entry aEntry)
          In a CallReply mode executes the command stored in the attribute of the given Entry with name CommandLineConnector.ATTR_COMMAND_LINE and stores the result in the returned Entry in an attribute with name CommandLineConnector.ATTR_COMMAND_OUTPUT.
 void selectEntries()
          Empty.
 void terminate()
          Terminate the connector.
 
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, querySchema, queryTables, reconnect, reconnect, registerScriptBeans, replyEntry, setConfiguration, setContext, setCurrent, setDebugMode, setLog, setMaxDuplicateEntries, setModes, setModes, setName, setParam, setParser, setProperty, setRSInterface, 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, querySchema, reconnect, registerScriptBeans, replyEntry, setConfiguration, setContext, setCurrent, setLog, setMaxDuplicateEntries, setName, setParam, setRSInterface, terminateServer
 

Field Detail

ATTR_COMMAND_LINE

public static final java.lang.String ATTR_COMMAND_LINE
The name of the attribute in which the command line has to be put in CallReply mode

See Also:
Constant Field Values

ATTR_COMMAND_OUTPUT

public static final java.lang.String ATTR_COMMAND_OUTPUT
The name of the attribute in which the result of the executed command in CallReply mode is stored

See Also:
Constant Field Values
Constructor Detail

CommandLineConnector

public CommandLineConnector()
Constructor. Initializes the connector to work in AddOnly, Iterator and CallReply modes

Method Detail

initialize

public void initialize(java.lang.Object o)
                throws java.lang.Exception
Initialize the connector. The connector may be passed a parameter of any kind by the user. It is up to the connector to determine whether this object can be used or not. The parameter is typically provided by a user script. When an AssemblyLine initializes it's Connectors, they are passed a ConnectorMode object.

Specified by:
initialize in interface ConnectorInterface
Overrides:
initialize in class Connector
Parameters:
o - Expects the ConnectorMode
Throws:
java.lang.Exception - if the initialization of this connector fails.

terminate

public void terminate()
               throws java.lang.Exception
Terminate the connector. If a parser exists it is being closed.

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

selectEntries

public void selectEntries()
                   throws java.lang.Exception
Empty.

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

getNextEntry

public Entry getNextEntry()
                   throws java.lang.Exception
Return the next Entry from the connector.

Specified by:
getNextEntry in interface ConnectorInterface
Overrides:
getNextEntry in class Connector
Returns:
- the next Entry, or null if no more data
Throws:
java.lang.Exception - if an error occurs.
See Also:
ConnectorInterface.selectEntries()

putEntry

public void putEntry(Entry entry)
              throws java.lang.Exception
Add a new entry to the data source

Specified by:
putEntry in interface ConnectorInterface
Overrides:
putEntry in class Connector
Parameters:
entry - The entry data to add
Throws:
java.lang.Exception - if an error occurs.

queryReply

public Entry queryReply(Entry aEntry)
                 throws java.lang.Exception
In a CallReply mode executes the command stored in the attribute of the given Entry with name CommandLineConnector.ATTR_COMMAND_LINE and stores the result in the returned Entry in an attribute with name CommandLineConnector.ATTR_COMMAND_OUTPUT.

Specified by:
queryReply in interface ConnectorInterface
Overrides:
queryReply in class Connector
Parameters:
aEntry - The Entry with the command line to be executed.
Returns:
an Entry containing the result from the executed command line.
Throws:
java.lang.Exception - if an error occurs.

getVersion

public java.lang.String getVersion()
Version information.

Specified by:
getVersion in interface VersionInfoInterface
Returns:
version information