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_MODESstatic java.lang.StringDELTA_PREFIXDelta store table prefixstatic java.lang.StringPS_PREFIXProperty store table prefixstatic intREAD_ALLspecifies read all selection modestatic intREAD_DELETEDspecifies read deleted selection modestatic intREAD_EXISTINGspecifies read existing selection modejava.lang.StringVERSION_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 booleanchkforDML(java.lang.String table)Check whether DML operations are allowed on the specified table.voidcommit()Commit the last transactionsvoiddeleteEntry(Entry entry, SearchCriteria search)Deletes an existing entry.voiddropPesTable(java.lang.String table)Drop table of given name.EntryfindEntry(SearchCriteria search)Finds an existing entry.EntryfindEntryWithFlag(SearchCriteria search, boolean returnWrappedEntry)Wrapped functionality for backward compatibility.java.lang.StringgetAttrName(Entry entry)Returns Attr name if not keyAttributejava.lang.StringgetCreateTable(java.lang.String driver)EntrygetNextEntry()Returns the next entry from the result set created by selectEntriesjava.lang.StringgetUniqueKey(Entry e, java.util.Vector<java.lang.String> keys)Generate unique key from list of key Attributesjava.lang.StringgetVersion()Return version informationjava.lang.StringgetWhereClause(SearchCriteria search, boolean ps)Creates where clause for SQL statementvoidinitialize(java.lang.Object p1)Method initializes the connectorbooleanisEOCFlag()Is end of cycle reachedvoidmodEntry(Entry entry, SearchCriteria search)Modifies an existing entry.voidmodEntry(Entry entry, SearchCriteria search, Entry old)Modify the entry in the System Store.voidputEntry(Entry entry)Adds a new entry.java.lang.ObjectquerySchema(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 namesvoidrollback()Rollback the last transactions since the last commitvoidsaveMetaData(java.sql.ResultSetMetaData md)Saves the Meta Data infovoidselectEntries()Prepares for getNextEntry().booleansetCommitMode(java.lang.String mode)Set the commit behavior of this PES Connector.voidsetEOCFlag(boolean flag)Sets the value for EOC reachedvoidsetResultSet(java.sql.ResultSet rs)Instructs this connector to use the provided result set instead of its own.voidsetSelectionMode(int mode)Set selection modevoidterminate()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.ExceptionMethod initializes the connector- Specified by:
initializein interfaceConnectorInterface- Overrides:
initializein 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:
terminatein interfaceConnectorInterface- Overrides:
terminatein 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:
putEntryin interfaceConnectorInterface- Overrides:
putEntryin 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:
modEntryin interfaceConnectorInterface- Overrides:
modEntryin 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:
modEntryin interfaceConnectorInterface- Overrides:
modEntryin 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:
findEntryin interfaceConnectorInterface- Overrides:
findEntryin 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
Entryobject - 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:
deleteEntryin interfaceConnectorInterface- Overrides:
deleteEntryin 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.ExceptionPrepares for getNextEntry(). If no SQL stament is specified use "SELECT * FROM " + getParam("dbTableName") as default- Specified by:
selectEntriesin interfaceConnectorInterface- Overrides:
selectEntriesin 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:
getNextEntryin interfaceConnectorInterface- Overrides:
getNextEntryin 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.SQLExceptionSaves 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.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:
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.ExceptionInstructs 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.SQLExceptionCommit the last transactions- Throws:
java.sql.SQLException- Any exceptions thrown by the connector's underlying classes
-
rollback
public void rollback() throws java.sql.SQLExceptionRollback 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
driveris known
-
queryTables
public java.util.Vector<java.lang.String> queryTables() throws java.lang.ExceptionMethod returns list of table names- Overrides:
queryTablesin 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:
getVersionin 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
-
-