Package com.ibm.di.connector
Class PESConnector
- java.lang.Object
-
- com.ibm.di.connector.Connector
-
- com.ibm.di.connector.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 Summary
Fields Modifier and Type Field Description java.lang.String[]
CONNECTOR_MODES
static java.lang.String
DELTA_PREFIX
Delta store table prefixstatic java.lang.String
PS_PREFIX
Property store table prefixstatic int
READ_ALL
specifies read all selection modestatic int
READ_DELETED
specifies read deleted selection modestatic int
READ_EXISTING
specifies read existing selection modejava.lang.String
VERSION_INFO
-
Fields inherited from class com.ibm.di.connector.Connector
ALL_MODES, myLog, PROPERTY_MESSAGE, PROPERTY_READER, PROPERTY_WRITER
-
-
Constructor Summary
Constructors Constructor Description PESConnector()
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
chkforDML(java.lang.String table)
Check whether DML operations are allowed on the specified table.void
commit()
Commit the last transactionsvoid
deleteEntry(Entry entry, SearchCriteria search)
Deletes an existing entry.void
dropPesTable(java.lang.String table)
Drop table of given name.Entry
findEntry(SearchCriteria search)
Finds an existing entry.Entry
findEntryWithFlag(SearchCriteria search, boolean returnWrappedEntry)
Wrapped functionality for backward compatibility.java.lang.String
getAttrName(Entry entry)
Returns Attr name if not keyAttributejava.lang.String
getCreateTable(java.lang.String driver)
Entry
getNextEntry()
Returns the next entry from the result set created by selectEntriesjava.lang.String
getUniqueKey(Entry e, java.util.Vector<java.lang.String> keys)
Generate unique key from list of key Attributesjava.lang.String
getVersion()
Return version informationjava.lang.String
getWhereClause(SearchCriteria search, boolean ps)
Creates where clause for SQL statementvoid
initialize(java.lang.Object p1)
Method initializes the connectorboolean
isEOCFlag()
Is end of cycle reachedvoid
modEntry(Entry entry, SearchCriteria search)
Modifies an existing entry.void
modEntry(Entry entry, SearchCriteria search, Entry old)
Modify the entry in the System Store.void
putEntry(Entry entry)
Adds a new entry.java.lang.Object
querySchema(java.lang.Object table)
This function translates to whatever means a connector has to discover schema for a connection.java.util.Vector<java.lang.String>
queryTables()
Method returns list of table namesvoid
rollback()
Rollback the last transactions since the last commitvoid
saveMetaData(java.sql.ResultSetMetaData md)
Saves the Meta Data infovoid
selectEntries()
Prepares for getNextEntry().boolean
setCommitMode(java.lang.String mode)
Set the commit behavior of this PES Connector.void
setEOCFlag(boolean flag)
Sets the value for EOC reachedvoid
setResultSet(java.sql.ResultSet rs)
Instructs this connector to use the provided result set instead of its own.void
setSelectionMode(int mode)
Set selection modevoid
terminate()
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, getModes, getName, getNextClient, getNextFindEntry, getParam, getParser, getProperty, getPushbackEntry, getRawConnectorConfiguration, getRSInterface, getUI, hasConfigValue, hasParser, initParser, isDeltaSupported, isExceptionFatal, isIOException, logError, logmsg, pushback, queryOperations, queryReply, 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, pushback, queryOperations, queryReply, reconnect, registerScriptBeans, replyEntry, setConfiguration, setContext, setCurrent, setLog, setMaxDuplicateEntries, setName, setParam, setRSInterface, terminateServer
-
-
-
-
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
-
-
Method Detail
-
initialize
public void initialize(java.lang.Object p1) throws java.lang.Exception
Method initializes the connector- Specified by:
initialize
in interfaceConnectorInterface
- Overrides:
initialize
in classConnector
- 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 interfaceConnectorInterface
- Overrides:
terminate
in classConnector
-
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 objectkeys
- 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 interfaceConnectorInterface
- Overrides:
putEntry
in classConnector
- 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 interfaceConnectorInterface
- Overrides:
modEntry
in classConnector
- 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 interfaceConnectorInterface
- Overrides:
modEntry
in classConnector
- Parameters:
entry
- The entry datasearch
- 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 interfaceConnectorInterface
- Overrides:
findEntry
in classConnector
- 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 criteriareturnWrappedEntry
- 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 interfaceConnectorInterface
- Overrides:
deleteEntry
in classConnector
- Parameters:
entry
- The entry datasearch
- 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 interfaceConnectorInterface
- Overrides:
selectEntries
in classConnector
- Throws:
java.lang.Exception
- Any exceptions thrown by the connector's underlying classes- See Also:
getNextEntry()
-
getNextEntry
public Entry getNextEntry() throws java.lang.Exception
Returns the next entry from the result set created by selectEntries- Specified by:
getNextEntry
in interfaceConnectorInterface
- Overrides:
getNextEntry
in classConnector
- Returns:
- The nextEntry value
- Throws:
java.lang.Exception
- Exception thrown during database operations- See Also:
ConnectorInterface.selectEntries()
-
getWhereClause
public java.lang.String getWhereClause(SearchCriteria search, boolean ps) throws java.lang.Exception
Creates where clause for SQL statement- Parameters:
search
- SearchCriteriaps
- 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 interfaceConnectorInterface
- Overrides:
querySchema
in classConnector
- 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 classConnector
- 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 interfaceVersionInfoInterface
- 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
-
-