Class 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.

    • 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​(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 - 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:
        terminate in interface ConnectorInterface
        Overrides:
        terminate in class Connector
      • selectEntries

        public void selectEntries()
                           throws java.lang.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:
        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:
        getNextEntry in interface ConnectorInterface
        Overrides:
        getNextEntry in class Connector
        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:
        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:
        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.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:
        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:
        getVersion in interface VersionInfoInterface
        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.
        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 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 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 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:
        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:
        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:
        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:
        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:
        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:
        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:
        putEntry in interface ConnectorInterface
        Overrides:
        putEntry in class Connector
        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 AssemblyLine
        operation - 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 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:
        java.lang.Exception - if an error occurs.