Class PESConnector

  • All Implemented Interfaces:
    ConnectorInterface, VersionInfoInterface

    public class PESConnector
    extends Connector
    implements ConnectorInterface
    The PES Connector provides access to the underlying System Store. The primary use of the System Store Connector/PES Connector is to store Entry objects into the System Store tables.
    • Field Detail

      • READ_EXISTING

        public static final int READ_EXISTING
        specifies read existing selection mode
        See Also:
        Constant Field Values
      • READ_ALL

        public static final int READ_ALL
        specifies read all selection mode
        See Also:
        Constant Field Values
      • READ_DELETED

        public static final int READ_DELETED
        specifies read deleted selection mode
        See Also:
        Constant Field Values
      • DELTA_PREFIX

        public static final java.lang.String DELTA_PREFIX
        Delta store table prefix
        See Also:
        Constant Field Values
      • PS_PREFIX

        public static final java.lang.String PS_PREFIX
        Property store table prefix
        See Also:
        Constant Field Values
      • CONNECTOR_MODES

        public java.lang.String[] CONNECTOR_MODES
      • VERSION_INFO

        public java.lang.String VERSION_INFO
    • Constructor Detail

      • PESConnector

        public PESConnector()
        Constructor
    • Method Detail

      • initialize

        public void initialize​(java.lang.Object p1)
                        throws java.lang.Exception
        Method initializes the connector
        Specified by:
        initialize in interface ConnectorInterface
        Overrides:
        initialize in class Connector
        Parameters:
        p1 - Entry object
        Throws:
        java.lang.Exception - Thrown if error occurs during initialization
      • terminate

        public void terminate()
        Terminate the connector. This function closes all connection and releases all resources used by the connector.
        Specified by:
        terminate in interface ConnectorInterface
        Overrides:
        terminate in class Connector
      • dropPesTable

        public void dropPesTable​(java.lang.String table)
        Drop table of given name. Note: This method does not work for Delta and Property Store tables.
        Parameters:
        table - Table Name
      • setSelectionMode

        public void setSelectionMode​(int mode)
        Set selection mode
        Parameters:
        mode - mode to be set
      • chkforDML

        public boolean chkforDML​(java.lang.String table)
        Check whether DML operations are allowed on the specified table.
        Parameters:
        table - Table Name
        Returns:
        true; if the table is not a Delta, Property store or the Systable
      • getUniqueKey

        public java.lang.String getUniqueKey​(Entry e,
                                             java.util.Vector<java.lang.String> keys)
        Generate unique key from list of key Attributes
        Parameters:
        e - Entry object
        keys - List of keys
        Returns:
        uniqueKey from list of keys
      • getAttrName

        public java.lang.String getAttrName​(Entry entry)
        Returns Attr name if not keyAttribute
        Parameters:
        entry - Entry object
        Returns:
        Returns a String object representing the name of the first non-key Attribute in the supplied Entry. The key Attribute is specified by the "keyAttribute" Connector configuration parameter. If there are no non-key Attributes present in the supplied Entry, then the String "ENTRY" is returned.
      • putEntry

        public void putEntry​(Entry entry)
                      throws java.lang.Exception
        Adds a new entry.
        Specified by:
        putEntry in interface ConnectorInterface
        Overrides:
        putEntry in class Connector
        Parameters:
        entry - The entry object
        Throws:
        java.lang.Exception - Any exceptions thrown by the connector's underlying classes
      • modEntry

        public void modEntry​(Entry entry,
                             SearchCriteria search,
                             Entry old)
                      throws java.lang.Exception
        Modify the entry in the System Store. The supplied entry should contain a the Attribute(s) which are modified. The old entry object has the attributes which are persisted in the System Store
        Specified by:
        modEntry in interface ConnectorInterface
        Overrides:
        modEntry in class Connector
        Parameters:
        entry - An Entry containing the new values to be set in the System Store.
        search - Search Criteria used for updating the specific record in the System Store.
        old - The old values persisted in the System Store.
        Throws:
        java.lang.Exception - If no distinguished record is found in the System Store.
      • modEntry

        public void modEntry​(Entry entry,
                             SearchCriteria search)
                      throws java.lang.Exception
        Modifies an existing entry. The new entry data is given by the entry parameter and the search criteria specifies which entry to modify.
        Specified by:
        modEntry in interface ConnectorInterface
        Overrides:
        modEntry in class Connector
        Parameters:
        entry - The entry data
        search - The search criteria used to locate the entry to be modified
        Throws:
        java.lang.Exception - Any exceptions thrown by the connector's underlying classes
      • findEntry

        public Entry findEntry​(SearchCriteria search)
                        throws java.lang.Exception
        Finds an existing entry. The search criteria specifies which entry to modify.
        Specified by:
        findEntry in interface ConnectorInterface
        Overrides:
        findEntry in class Connector
        Parameters:
        search - The search criteria used to locate the entry to be modified *
        Returns:
        Entry obj
        Throws:
        java.lang.Exception - derived from the connector's underlying classes
      • findEntryWithFlag

        public Entry findEntryWithFlag​(SearchCriteria search,
                                       boolean returnWrappedEntry)
                                throws java.lang.Exception
        Wrapped functionality for backward compatibility. See method findEntry( ) and determineIfReturnWrappedEntry().Call this method with returnWrappedEntry to "true", and this method will be findEntry( ) equivalent of TDI6.0 and prior. In TDI61, we wanted an unwrapped Entry, therefore the findEntry( ) method calls this with returnWrappedEntry set to "false".
        Parameters:
        search - search criteria
        returnWrappedEntry - type of the returned entry
        Returns:
        Entry Entry object
        Throws:
        java.lang.Exception - if an error occurs
      • deleteEntry

        public void deleteEntry​(Entry entry,
                                SearchCriteria search)
                         throws java.lang.Exception
        Deletes an existing entry. The search criteria specifies which entry to modify.
        Specified by:
        deleteEntry in interface ConnectorInterface
        Overrides:
        deleteEntry in class Connector
        Parameters:
        entry - The entry data
        search - The search criteria used to locate the entry to be modified
        Throws:
        java.lang.Exception - derived from the connector's underlying classes
      • selectEntries

        public void selectEntries()
                           throws java.lang.Exception
        Prepares for getNextEntry(). If no SQL stament is specified use "SELECT * FROM " + getParam("dbTableName") as default
        Specified by:
        selectEntries in interface ConnectorInterface
        Overrides:
        selectEntries in class Connector
        Throws:
        java.lang.Exception - Any exceptions thrown by the connector's underlying classes
        See Also:
        getNextEntry()
      • getWhereClause

        public java.lang.String getWhereClause​(SearchCriteria search,
                                               boolean ps)
                                        throws java.lang.Exception
        Creates where clause for SQL statement
        Parameters:
        search - SearchCriteria
        ps - Boolean which determines if is a prepared statement.
        Returns:
        sql SQL string with generated where clause
        Throws:
        java.lang.Exception - Any exceptions thrown by the connector's underlying classes
      • saveMetaData

        public void saveMetaData​(java.sql.ResultSetMetaData md)
                          throws java.sql.SQLException
        Saves the Meta Data info
        Parameters:
        md - ResultSetMetaData
        Throws:
        java.sql.SQLException - Any exceptions thrown by the connector's underlying classes
      • querySchema

        public java.lang.Object querySchema​(java.lang.Object table)
                                     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:
        table - 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
      • setResultSet

        public void setResultSet​(java.sql.ResultSet rs)
                          throws java.lang.Exception
        Instructs this connector to use the provided result set instead of its own.
        Parameters:
        rs - The new resultSet value
        Throws:
        java.lang.Exception - Any exceptions thrown by the connector's underlying classes
      • commit

        public void commit()
                    throws java.sql.SQLException
        Commit the last transactions
        Throws:
        java.sql.SQLException - Any exceptions thrown by the connector's underlying classes
      • rollback

        public void rollback()
                      throws java.sql.SQLException
        Rollback the last transactions since the last commit
        Throws:
        java.sql.SQLException - Thrown if an error occurs
        See Also:
        commit(), setCommitMode(java.lang.String)
      • setCommitMode

        public boolean setCommitMode​(java.lang.String mode)
        Set the commit behavior of this PES Connector.
        Parameters:
        mode - The intended behavior. Possible values are:
        • "After every database operation"
        • "On Connector close"
        • "Manual"
        Returns:
        false if the requested mode is not a legal value
        See Also:
        commit()
      • getCreateTable

        public java.lang.String getCreateTable​(java.lang.String driver)
        Parameters:
        driver - java class name of the JDBC driver
        Returns:
        the configured createTable or proper 'CREATE TABLE' statement if the specified driver is known
      • queryTables

        public java.util.Vector<java.lang.String> queryTables()
                                                       throws java.lang.Exception
        Method returns list of table names
        Overrides:
        queryTables in class Connector
        Returns:
        List of tables
        Throws:
        java.lang.Exception - Any exceptions thrown by the connector's underlying classes
        See Also:
        Vector
      • getVersion

        public java.lang.String getVersion()
        Return version information
        Specified by:
        getVersion in interface VersionInfoInterface
        Returns:
        version info
      • isEOCFlag

        public boolean isEOCFlag()
        Is end of cycle reached
        Returns:
        true if EOC is reached
      • setEOCFlag

        public void setEOCFlag​(boolean flag)
        Sets the value for EOC reached
        Parameters:
        flag - true , if EOC is reached, false otherwise