com.ibm.di.connector
Class AssemblyLineConnector

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

public class AssemblyLineConnector
extends Connector
implements ConnectorInterface

This class uses the AssemblyLineFC function to invoke operations on an AssemblyLine. The behavior of this class depends on the operations defined by the target AssemblyLine. If the target AL has defined connector interface methods that match the connector interface names, this connector will invoke the corresponding operation in the target AL. If a mode ends up in an internal connector interface method with no corresponding operation defined an exception is thrown. The exception is the CallReply mode which is the default for all non-standard modes. A connector interface based adapter AssemblyLine must define operations that correspond to the names found in the connector interface. This means that in order to act as an Iterator it should define "selectentries" and "getnext" as valid operations. This connector will compute the valid modes an AssemblyLine provides by looking at the operation names.

When the target AssemblyLine has its operations invoked through the native connector interface methods (e.g. getnext, selectentries etc) the AssemblyLine connector will provide a work entry with predefined attribute names. These attributes are:

conn - the entry (or entries) passed between this connector and the adapter. The value can be null, a single entry or an array/collection of entries in case there are multiple.

search - the search criteria as specified by the user. See SearchCriteria

current - the current target object. this is used when modifying existing entries. Conversely, when the target AssemblyLine returns data for these methods/operations it should return an entry with these attribute names.


Field Summary
 
Fields inherited from class com.ibm.di.connector.Connector
ALL_MODES, myLog, PROPERTY_MESSAGE, PROPERTY_READER, PROPERTY_WRITER
 
Constructor Summary
AssemblyLineConnector()
          The default constructor for this connector.
 
Method Summary
 void deleteEntry(Entry entry, SearchCriteria search)
          This method runs the target AL.
 Entry findEntry(SearchCriteria search)
          This method runs the target AL.
 Vector<String> getALModes(ConnectorConfig config)
          This method checks the defined operations of the target AL and returns them as a Vector of names.
 Vector<String> getModes(ConnectorConfig config)
          This method checks the defined operations of the target AL and returns them as a Vector of names.
 Entry getNextEntry()
          This method runs the target AL.
 String getVersion()
          Version information.
 void initialize(Object o)
          Initialize the connector.
 void modEntry(Entry entry, SearchCriteria search, Entry old)
          This method runs the target AL.
 Entry performOperation(Entry workEntry, String operation)
          This method invokes the named operation in the target AssemblyLine.
 Entry performOperation(Entry workEntry, String operation, Entry opentry)
          This method invokes the named operation in the target AssemblyLine.
 void putEntry(Entry entry)
          This method runs the target AL.
 Entry queryReply(Entry entry)
          This method runs the target AL.
 Object querySchema(Object source)
          This function translates to whatever means a connector has to discover schema for a connection.
 void selectEntries()
          This method prepares the connector if the configured target AL have an operation called "selectEntries" then that operation is invoked.
 void terminate()
          Terminate the connector.
 
Methods inherited from class com.ibm.di.connector.Connector
addFindEntry, allModes, clearFindEntries, debug, debugMode, findEntry, getBoolean, getClassInstance, getConfiguration, getContext, getFindEntryCount, getFirstFindEntry, getLog, getMaxDuplicateEntries, getModes, getName, getNextClient, getNextFindEntry, getParam, getParser, getProperty, getPushbackEntry, getRawConnectorConfiguration, getRSInterface, getUI, hasConfigValue, hasParser, initParser, isDeltaSupported, isExceptionFatal, isIOException, logError, logmsg, modEntry, pushback, queryOperations, 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
getConfiguration, getContext, getFindEntryCount, getFirstFindEntry, getMaxDuplicateEntries, getName, getNextClient, getNextFindEntry, getParam, getPushbackEntry, getRawConnectorConfiguration, isDeltaSupported, isExceptionFatal, isIOException, modEntry, pushback, queryOperations, reconnect, registerScriptBeans, replyEntry, setConfiguration, setContext, setCurrent, setLog, setMaxDuplicateEntries, setName, setParam, setRSInterface, terminateServer
 

Constructor Detail

AssemblyLineConnector

public AssemblyLineConnector()
The default constructor for this connector. This call will set the base connector modes.

Method Detail

initialize

public void initialize(Object o)
                throws 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 - User provided parameter
Throws:
Exception - if the initialization of this connector fails.

terminate

public void terminate()
Terminate the connector. This function closes all connection and releases all resources used by the connector. This function also calls the parser's closeParser() method if a parser is active.

Specified by:
terminate in interface ConnectorInterface
Overrides:
terminate in class Connector

selectEntries

public void selectEntries()
                   throws Exception
This method prepares the connector if the configured target AL have an operation called "selectEntries" then that operation is invoked. If no such operation exists then the underlying AssemblyLineFC initialization will take place.

Specified by:
selectEntries in interface ConnectorInterface
Overrides:
selectEntries in class Connector
Throws:
Exception - if error occurs while calling the "selectEntries" operation of the target AL.

getNextEntry

public Entry getNextEntry()
                   throws Exception
This method runs the target AL. If the target AL have the "getNextEntry" operation defined then that operation is invoked, otherwise the target AL is just executed with no IWE.

Specified by:
getNextEntry in interface ConnectorInterface
Overrides:
getNextEntry in class Connector
Returns:
the result entry of the AL's execution.
Throws:
Exception - if the connector have been terminated.
See Also:
ConnectorInterface.selectEntries()

queryReply

public Entry queryReply(Entry entry)
                 throws Exception
This method runs the target AL. If the target AL have the "queryReply" operation defined then that operation is invoked, otherwise the target AL is just executed.

Specified by:
queryReply in interface ConnectorInterface
Overrides:
queryReply in class Connector
Parameters:
entry - the Entry object passed as the work entry to the target AL.
Returns:
the result entry of the AL's execution.
Throws:
Exception - if an error occurs while executing the target AL.

querySchema

public Object querySchema(Object source)
                   throws Exception
This function translates to whatever means a connector has to discover schema for a connection. The connector may implement this, in which case a Vector of Entry objects is returned for each column/attribute it discovered. For a database connector this would typically be column names and their attributes.

Each Entry in the Vector returned should contain the following attributes:

Name Value
name The name of the column/attribute/field ....
syntax The syntax or expected value type
size If specified this will give the user a hint as to how long the field may be

Specified by:
querySchema in interface ConnectorInterface
Overrides:
querySchema in class Connector
Parameters:
source - The object on which to discover schema. This may be an Entry or a string value
Returns:
A Vector of com.ibm.di.entry.Entry objects describing each entity
Throws:
Exception - if an error while retrieving the schema occurs.
See Also:
Entry, Vector

getVersion

public String getVersion()
Version information.

Specified by:
getVersion in interface VersionInfoInterface
Returns:
version information

getModes

public Vector<String> getModes(ConnectorConfig config)
This method checks the defined operations of the target AL and returns them as a Vector of names. If the connector is in debug mode then additional messages are printed to the log.

Overrides:
getModes in class Connector
Parameters:
config - the configuration object containing parameters used to connect to a target AL. If this is null then the default modes are returned.
Returns:
a Vector containing the operations names defined by the target AL.

getALModes

public Vector<String> getALModes(ConnectorConfig config)
This method checks the defined operations of the target AL and returns them as a Vector of names.

Parameters:
config - the configuration object containing parameters used to connect to a target AL. If this is null then the default modes are returned.
Returns:
a Vector containing the operations names defined by the target AL.

deleteEntry

public void deleteEntry(Entry entry,
                        SearchCriteria search)
                 throws Exception
This method runs the target AL. If the target AL have the "deleteEntry" operation defined then that operation is invoked, otherwise the target AL is just executed.

Specified by:
deleteEntry in interface ConnectorInterface
Overrides:
deleteEntry in class Connector
Parameters:
entry - the Entry object passed as the work entry to the target AL.
search - the SearchCriteria object passed to the target AL as an attribute of the op-entry.
Throws:
Exception - if an error occurs while executing the target AL.

findEntry

public Entry findEntry(SearchCriteria search)
                throws Exception
This method runs the target AL. If the target AL have the "findEntry" operation defined then that operation is invoked, otherwise unsupported operation exception is thrown.

Specified by:
findEntry in interface ConnectorInterface
Overrides:
findEntry in class Connector
Parameters:
search - the SearchCriteria object passed to the target AL as an attribute of the op-entry.
Returns:
the result Entry object produced by the target AL.
Throws:
Exception - if an error occurs while executing the target AL or the target AL does not have an operation with that name.

modEntry

public void modEntry(Entry entry,
                     SearchCriteria search,
                     Entry old)
              throws Exception
This method runs the target AL. If the target AL have the "modEntry" operation defined then that operation is invoked, otherwise unsupported operation exception is thrown.

Specified by:
modEntry in interface ConnectorInterface
Overrides:
modEntry in class Connector
Parameters:
entry - the work entry object of the target AL
search - the SearchCriteria object passed to the target AL as an attribute of the op-entry.
old - the Entry object passed to the target AL as an attribute of the op-entry.
Throws:
Exception - if an error occurs while executing the target AL or the target AL does not have an operation with that name.

putEntry

public void putEntry(Entry entry)
              throws Exception
This method runs the target AL. If the target AL have the "putEntry" operation defined then that operation is invoked, otherwise unsupported operation exception is thrown.

Specified by:
putEntry in interface ConnectorInterface
Overrides:
putEntry in class Connector
Parameters:
entry - the work entry object of the target AL
Throws:
Exception - if an error occurs while executing the target AL or the target AL does not have an operation with that name.

performOperation

public Entry performOperation(Entry workEntry,
                              String operation)
                       throws Exception
This method invokes the named operation in the target AssemblyLine.

Parameters:
workEntry - The work entry provided to the AssemblyLine
operation - The operation to invoke
Returns:
Result from operation
Throws:
Exception - if an error occurs.

performOperation

public Entry performOperation(Entry workEntry,
                              String operation,
                              Entry opentry)
                       throws Exception
This method invokes the named operation in the target AssemblyLine.

Parameters:
workEntry - The work entry provided to the AssemblyLine
operation - The operation to invoke
opentry - the op-entry passed to the target AL.
Returns:
the result Entry object from the executed operation
Throws:
Exception - if an error occurs.