Package com.ibm.di.connector
Class AssemblyLineConnector
- java.lang.Object
-
- com.ibm.di.connector.Connector
-
- 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. SeeSearchCriteriacurrent - 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
Constructors Constructor Description AssemblyLineConnector()The default constructor for this connector.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeleteEntry(Entry entry, SearchCriteria search)This method runs the target AL.EntryfindEntry(SearchCriteria search)This method runs the target AL.java.util.Vector<java.lang.String>getALModes(ConnectorConfig config)This method checks the defined operations of the target AL and returns them as a Vector of names.java.util.Vector<java.lang.String>getModes(ConnectorConfig config)This method checks the defined operations of the target AL and returns them as a Vector of names.EntrygetNextEntry()This method runs the target AL.java.lang.StringgetVersion()Version information.voidinitialize(java.lang.Object o)Initialize the connector.voidmodEntry(Entry entry, SearchCriteria search, Entry old)This method runs the target AL.EntryperformOperation(Entry workEntry, java.lang.String operation)This method invokes the named operation in the target AssemblyLine.EntryperformOperation(Entry workEntry, java.lang.String operation, Entry opentry)This method invokes the named operation in the target AssemblyLine.voidputEntry(Entry entry)This method runs the target AL.EntryqueryReply(Entry entry)This method runs the target AL.java.lang.ObjectquerySchema(java.lang.Object source)This function translates to whatever means a connector has to discover schema for a connection.voidselectEntries()This method prepares the connector if the configured target AL have an operation called "selectEntries" then that operation is invoked.voidterminate()Terminate the connector.-
Methods inherited from class com.ibm.di.connector.Connector
addFindEntry, allModes, clearFindEntries, debug, debugMode, extractExceptionInformation, 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
-
-
-
-
Method Detail
-
initialize
public void initialize(java.lang.Object o) throws java.lang.ExceptionInitialize 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:
initializein interfaceConnectorInterface- Overrides:
initializein classConnector- Parameters:
o- User provided parameter- Throws:
java.lang.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:
terminatein interfaceConnectorInterface- Overrides:
terminatein classConnector
-
selectEntries
public void selectEntries() throws java.lang.ExceptionThis 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 underlyingAssemblyLineFCinitialization will take place.- Specified by:
selectEntriesin interfaceConnectorInterface- Overrides:
selectEntriesin classConnector- Throws:
java.lang.Exception- if error occurs while calling the "selectEntries" operation of the target AL.
-
getNextEntry
public Entry getNextEntry() throws java.lang.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:
getNextEntryin interfaceConnectorInterface- Overrides:
getNextEntryin classConnector- Returns:
- the result entry of the AL's execution.
- Throws:
java.lang.Exception- if the connector have been terminated.- See Also:
ConnectorInterface.selectEntries()
-
queryReply
public Entry queryReply(Entry entry) throws java.lang.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:
queryReplyin interfaceConnectorInterface- Overrides:
queryReplyin classConnector- Parameters:
entry- theEntryobject passed as the work entry to the target AL.- Returns:
- the result entry of the AL's execution.
- Throws:
java.lang.Exception- if an error occurs while executing the target AL.
-
querySchema
public java.lang.Object querySchema(java.lang.Object source) throws java.lang.ExceptionThis 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:
querySchemain interfaceConnectorInterface- Overrides:
querySchemain classConnector- 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:
java.lang.Exception- if an error while retrieving the schema occurs.- See Also:
Entry,Vector
-
getVersion
public java.lang.String getVersion()
Version information.- Specified by:
getVersionin interfaceVersionInfoInterface- Returns:
- version information
-
getModes
public java.util.Vector<java.lang.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.
-
getALModes
public java.util.Vector<java.lang.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 isnullthen 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 java.lang.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:
deleteEntryin interfaceConnectorInterface- Overrides:
deleteEntryin classConnector- Parameters:
entry- theEntryobject passed as the work entry to the target AL.search- theSearchCriteriaobject passed to the target AL as an attribute of the op-entry.- Throws:
java.lang.Exception- if an error occurs while executing the target AL.
-
findEntry
public Entry findEntry(SearchCriteria search) throws java.lang.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:
findEntryin interfaceConnectorInterface- Overrides:
findEntryin classConnector- Parameters:
search- theSearchCriteriaobject passed to the target AL as an attribute of the op-entry.- Returns:
- the result
Entryobject produced by the target AL. - Throws:
java.lang.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 java.lang.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:
modEntryin interfaceConnectorInterface- Overrides:
modEntryin classConnector- Parameters:
entry- the work entry object of the target ALsearch- theSearchCriteriaobject passed to the target AL as an attribute of the op-entry.old- theEntryobject passed to the target AL as an attribute of the op-entry.- Throws:
java.lang.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 java.lang.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:
putEntryin interfaceConnectorInterface- Overrides:
putEntryin classConnector- Parameters:
entry- the work entry object of the target AL- Throws:
java.lang.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, java.lang.String operation) throws java.lang.Exception
This method invokes the named operation in the target AssemblyLine.- Parameters:
workEntry- The work entry provided to the AssemblyLineoperation- The operation to invoke- Returns:
- Result from operation
- Throws:
java.lang.Exception- if an error occurs.
-
performOperation
public Entry performOperation(Entry workEntry, java.lang.String operation, Entry opentry) throws java.lang.Exception
This method invokes the named operation in the target AssemblyLine.- Parameters:
workEntry- The work entry provided to the AssemblyLineoperation- The operation to invokeopentry- the op-entry passed to the target AL.- Returns:
- the result
Entryobject from the executed operation - Throws:
java.lang.Exception- if an error occurs.
-
-