IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

com.ibm.btt.services.jdbc
Class JDBCJournal

java.lang.Object
  extended by com.ibm.btt.base.BTTProcessorNotifier
      extended by com.ibm.btt.base.Service
          extended by com.ibm.btt.services.jdbc.JDBCService
              extended by com.ibm.btt.services.jdbc.Journal
                  extended by com.ibm.btt.services.jdbc.JDBCJournal
All Implemented Interfaces:
ProcessorNotifier, DatabaseConnect, JournalService, Poolable, java.io.Externalizable, java.io.Serializable

See Also:
Serialized Form

Field Summary
protected  Hashtable columnsTable
          
Fields inherited from class com.ibm.btt.services.jdbc.Journal
COMPID, currentSingleTableReset, entity, fromPool, lastRecordNumber, recIdFromTable, recIdSem, singleTable, singleTableLastRecordNumber
 
Fields inherited from class com.ibm.btt.services.jdbc.JDBCService
addPstmt, addString, autoCommit, connectionProperties, databaseConnection, databaseURL, dataSourceName, metaData, password, poolName, sharedConnection, STMT_POOL_SIZE_DEFAULT, stmtPool, stmtPoolSize, updateString, user, waitRetry
 
Fields inherited from class com.ibm.btt.base.Service
externalizer, name
 
Fields inherited from class com.ibm.btt.base.BTTProcessorNotifier
handlersList
 
Constructor Summary
JDBCJournal()
          
Method Summary
 int addRecord(Context aContext, HashtableFormat aHashtableFormat)
          
Methods inherited from class com.ibm.btt.services.jdbc.Journal
close, getDate, getEntity, getInUse, getLastRecordNumber, getSingleTableLastRecordNumber, getState, initialize, isActive, isCurrentSingleTableReset, isFromPool, isRecIdFromTable, isSingleTable, open, reset, setCurrentSingleTableReset, setFromPool, setInUse, setLastRecordNumber, setRecIdFromTable, setSingleTable, setSingleTableLastRecordNumber, setState, terminate, today
 
Methods inherited from class com.ibm.btt.services.jdbc.JDBCService
buildStatementArray, connect, connect, connect, connect, connect, connect, connect, disconnect, getAddPstmt, getAddString, getAutoCommit, getConnectionManager, getConnectionProperties, getConnMgrID, getDatabaseURL, getDataSourceName, getPassword, getPoolName, getSharedConnection, getUpdateString, getUser, isWaitRetry, requestConnectionToConnectionManager, requestConnectionToConnectionManager, setAddPstmt, setAddString, setAutoCommit, setConnectionManager, setConnectionProperties, setConnMgrID, setDatabaseURL, setDataSourceName, setPassword, setPoolName, setSharedConnection, setStatementPoolSize, setUpdateString, setUser, setWaitRetry, verifyConnection
 
Methods inherited from class com.ibm.btt.base.Service
externalizer, getExternalizer, getTagName, readExternal, readExternal, readObject, removeExternal, setExternalizer, toString, toTags, writeExternal, writeExternal
 
Methods inherited from class com.ibm.btt.base.BTTProcessorNotifier
addHandler, getHandlersList, getName, removeHandler, setName, signalEvent, signalEvent, signalEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ibm.btt.services.jdbc.JournalService
getAutoCommit, setAutoCommit
 
Methods inherited from interface com.ibm.btt.services.jdbc.DatabaseConnect
connect, connect, connect, connect, connect, connect, disconnect, getDatabaseURL, getDataSourceName, getPoolName, getSharedConnection, isWaitRetry, setDatabaseURL, setDataSourceName, setPoolName, setSharedConnection, setWaitRetry
 
Methods inherited from interface com.ibm.btt.base.Externalizable
getName, setName
 

Field Detail

columnsTable

protected Hashtable columnsTable
Contains information about the relationship between a column in the database table and a data field in the context. Has the following structure: key = column_name, value = data_field_name


JDBCDriver

protected java.lang.String JDBCDriver
Keeps the name of the JDBC driver to be used to access the database.


createSchema

protected boolean createSchema
Keeps whether the journal schema was also created in the database or not.


schemaName

protected java.lang.String schemaName
Keeps the name of the schema where all journal tables are defined.


wrapNumber

protected int wrapNumber
Keeps the number of the generation being used by the current journal.


date

protected java.lang.String date
Keeps the today date


tableName

protected java.lang.String tableName
Keeps the table name that is schemaName.entity_wrapNumber.


var_insert

protected static final java.lang.String var_insert
See Also:
Constant Field Values

var_update

protected static final java.lang.String var_update
See Also:
Constant Field Values

var_where

protected static final java.lang.String var_where
See Also:
Constant Field Values

poolSem

protected static java.lang.Object poolSem

resetSem

protected static java.lang.Object resetSem

singleTableReset

protected static boolean singleTableReset

schemasMetaData

protected static Hashtable schemasMetaData
Contains a hashtable that, for each schema created by the JDBCJournal, will keep a DatabaseResultSetMetaData object containing the definition of the columns of the schema tables.

Constructor Detail

JDBCJournal

public JDBCJournal()
This constructor creates a JDBCJournal object.


JDBCJournal

public JDBCJournal(java.lang.String anEntityName,
                   java.lang.String aSchemaName)
            throws DSEInvalidRequestException
This constructor creates a JDBCJournal object. It sets the entityName and the schemaName attributes to the values passed as arguments.

Parameters:
anEntityName - java.lang.String - the Entity name
aSchemaName - java.lang.String - the Schema name
Throws:
DSEInvalidRequestException - if the request is not valid
Method Detail

addRecord

public int addRecord(Context aContext,
                     HashtableFormat aHashtableFormat)
              throws DSEInvalidArgumentException,
                     DSEInvalidRequestException,
                     DSEInternalErrorException,
                     DSESQLException
Calls the formatter (HashtableFormat parameter) format method by passing aContext as an argument. The returned object, a Hashtable instance, is then used to build and insert the journal record by calling the addRecord method with an argument of a data hashtable.

Specified by:
addRecord in interface JournalService
Specified by:
addRecord in class Journal
Parameters:
aContext - com.ibm.dse.base.Context
aHashtableFormat - com.ibm.dse.base.HashtableFormat
Returns:
int - the row number where the journal record is inserted
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

addRecord

public int addRecord(Context aContext,
                     java.lang.String aFormatName)
              throws DSEInvalidArgumentException,
                     DSEInvalidRequestException,
                     DSEInternalErrorException,
                     DSESQLException
Instantiates the journal format with the name aFormatName and calls its format method by passing aContext as an argument. The returned object, a Hashtable instance, is then used to build and insert the journal record by calling the addRecord method with an argument of a data hashtable.

Specified by:
addRecord in interface JournalService
Specified by:
addRecord in class Journal
Parameters:
aContext - com.ibm.dse.base.Context, the context where the data is
aFormatName - java.lang.String, the format name of the formatter to be used
Returns:
int - the row number where the journal record is inserted
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

addRecord

public int addRecord(Hashtable aDataHashtable)
              throws DSEInvalidRequestException,
                     DSEInvalidArgumentException,
                     DSEInternalErrorException,
                     DSESQLException
Inserts the data in aDataHashtable as a new row in the current journal table. The data hashtable has the format: key=data_field_name, value=data_field_value

Specified by:
addRecord in interface JournalService
Specified by:
addRecord in class Journal
Parameters:
aDataHashtable - Hashtable - the Hashtable with the data to be inserted in the database table
Returns:
int - the row number where the data is inserted
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

buildAddString

protected void buildAddString()
                       throws DSESQLException,
                              DSEInternalErrorException,
                              DSEInvalidRequestException,
                              DSEInvalidArgumentException,
                              DSEException
Builds an instance variable that is used when adding a record.

Specified by:
buildAddString in class JDBCService
Throws:
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSESQLException - if an SQLException is caught
DSEObjectNotFoundException - if the JDBCServicesConnectionManager cannot be found
DSEException - if an exception is thrown when calling the pool of connections manager

buildConnectionProperties

protected void buildConnectionProperties()
Builds the hashtable containing all details needed to request the database connection. It is called by the initializeFrom() method.

Overrides:
buildConnectionProperties in class JDBCService

buildUpdateString

protected void buildUpdateString()
                          throws DSESQLException,
                                 DSEInternalErrorException,
                                 DSEInvalidRequestException,
                                 DSEInvalidArgumentException,
                                 DSEException
Builds an instance variable that is used when updating all columns of a record.

Specified by:
buildUpdateString in class JDBCService
Throws:
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSESQLException - if an SQLException is caught
DSEObjectNotFoundException - if the JDBCServicesConnectionManager cannot be found
DSEException - if an exception is thrown when calling the pool of connections manager

commit

public void commit()
            throws DSESQLException
Commits all changes to the database. If the autoCommit attribute is set to true, it does nothing.

Specified by:
commit in interface JournalService
Specified by:
commit in class Journal
Throws:
DSESQLException - if commit failed

controlTableName

protected java.lang.String controlTableName()
Returns the current Control Table name. The Control Table is a specific table within the journal schema that the journal service uses internally to store information about the entities and the number of generations of the journalling system. The Control Table name can be modified by changing the CONTROL_TABLE_NAME attribute in the JournalConstants class.

Specified by:
controlTableName in class Journal
Returns:
String

currentGenerationDate

public java.lang.String currentGenerationDate()
                                       throws DSEInternalErrorException,
                                              DSESQLException
Returns the last date that the journal service was used by a specific entity. A date is assigned to the journal instance as soon as it is created. When a journal is opened, this date and the currentJournallingDate (usually today's date) are compared. If the latter is greater, this method selects to generate a new table and this generation is used for that specific entity. Note that the oldest generation is deleted if the maximum number of generations has been exceeded. If both dates are equal, the current table generation is used.

Specified by:
currentGenerationDate in class Journal
Returns:
java.lang.String - the current generation date with format yyyymmdd
Throws:
DSEInternalErrorException - if an internal Program error is detected
DSESQLException - if a SQLException occurs

currentWrapNumber

protected int currentWrapNumber()
                         throws DSEInternalErrorException,
                                DSEInvalidRequestException,
                                DSEInvalidArgumentException,
                                DSESQLException
Returns the current table generation number being used by the journal instance for the schema set in the schemaName attribute.

Returns:
int - the current wrap number
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

currentWrapNumberForSchema

protected int currentWrapNumberForSchema(java.lang.String aSchemaName)
                                  throws DSEInternalErrorException,
                                         DSEInvalidRequestException,
                                         DSEInvalidArgumentException,
                                         DSESQLException
Returns the current table generation number being used by the journal instance for the schema aSchemaName.

Parameters:
aSchemaName - java.lang.String - the journal schema name
Returns:
int - the current wrap number
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

deleteJournalContent

protected void deleteJournalContent(int aGeneration)
                             throws DSEInternalErrorException,
                                    DSESQLException
Deletes the contents of a current journal table. This is an internal method.

Parameters:
aGeneration - int
Throws:
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

deleteRecord

protected void deleteRecord(int aRecordNumber)
                     throws DSEInternalErrorException,
                            DSESQLException
Deletes a record in the current journal table. This method is an internal method.

Parameters:
aRecordNumber - int
Throws:
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

getColumnsTable

public Hashtable getColumnsTable()
Returns the columnsTable attribute value of the current journal.

Returns:
Hashtable - the Hashtable that holds the column information

getDatabaseConnection

protected java.sql.Connection getDatabaseConnection()
Returns the databaseConnection attribute value.

Overrides:
getDatabaseConnection in class JDBCService
Returns:
Connection - the connection to the database

getEntities

public Vector getEntities()
                   throws DSESQLException,
                          DSEInternalErrorException
Retrieves all entities from the Database.

Returns:
com.ibm.dse.base.Vector, the vector containing all journal entities
Throws:
DSESQLException - if an SQLException is caught
DSEInternalErrorException - if an internal program error occurs

getJDBCDriver

public java.lang.String getJDBCDriver()
Returns the JDBCDriver property value.

Specified by:
getJDBCDriver in interface JournalService
Specified by:
getJDBCDriver in class Journal
Returns:
java.lang.String

getNumberOfGenerations

public int getNumberOfGenerations()
                           throws DSESQLException,
                                  DSEInternalErrorException
Returns the number of journal generations.

Returns:
int
Throws:
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

getSchemaName

public java.lang.String getSchemaName()
Returns the schemaName attribute value.

Specified by:
getSchemaName in interface JournalService
Specified by:
getSchemaName in class Journal
Returns:
java.lang.String - the journal schema name

getTableName

public java.lang.String getTableName()
Returns the current journal tableName.

Specified by:
getTableName in interface JournalService
Specified by:
getTableName in class Journal
Returns:
java.lang.String

getWrapNumber

protected int getWrapNumber()
Returns the wrapNumber attribute value

Returns:
int - the wrap number

initializeColumnFrom

public java.lang.Object initializeColumnFrom(Tag aTag)
Used by the JDBCJournal service externalizer to create the contents of the columnsTable instance attribute. The columnsTable is a Hashtable with a key that is the column name and a value that is the data field name for the context whose value corresponds to that column in the database journal table.

Parameters:
aTag - com.ibm.dse.base.Tag
Returns:
java.lang.Object

initializeFrom

public java.lang.Object initializeFrom(Tag aTag)
                                throws java.io.IOException
Used by the services externalizer to set the JDBCJournal instance attributes as defined in the XML file.

Overrides:
initializeFrom in class Service
Parameters:
aTag - com.ibm.dse.base.Tag
Returns:
java.lang.Object
Throws:
java.io.IOException - if an I/O exception occurs.

isConnected

public boolean isConnected()
                    throws DSEInvalidRequestException,
                           DSEInternalErrorException,
                           DSESQLException,
                           DSEObjectNotFoundException,
                           DSEException
Returns true if there is a connection to the database or false if there is not.

Specified by:
isConnected in interface DatabaseConnect
Overrides:
isConnected in class JDBCService
Returns:
boolean
Throws:
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEObjectNotFoundException
DSEException

isCreateSchema

public boolean isCreateSchema()
Returns the createSchema property value. It is true if a database schema has been created for the journal schema.

Specified by:
isCreateSchema in interface JournalService
Specified by:
isCreateSchema in class Journal
Returns:
boolean

isValidEntity

public boolean isValidEntity()
                      throws DSEInternalErrorException,
                             DSESQLException
Returns true if the entity set for the current journal is valid or false if it is not. It accesses the journal control table to check if * there is a row with an ENTITY_NAME column value that matches the journal instance entity name.

Specified by:
isValidEntity in class Journal
Returns:
boolean
Throws:
DSEInternalErrorException - if an internal program error is detected
DSESQLException - if a SQLException is caught

journalTableRowInsertDefinition

protected java.lang.String journalTableRowInsertDefinition()
                                                    throws DSEInvalidArgumentException,
                                                           DSEInvalidRequestException,
                                                           DSEInternalErrorException,
                                                           DSESQLException
Returns the Journal Table Row definition for an SQL INSERT request. It builds a string with the following format: " ( " + " column_name1,"+.....+ "column_namen)" + " VALUES(?,"+ .... + ?)" Example of usage: "INSERT INTO thisTable aFormatedString" where aFormatedString = "( REC_NBR, ACC_NBR, AMOUNT, DATE, DESC) VALUES (?, ?, ?, ?, ?)"

Returns:
java.lang.String
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEInvalidRequestException - if the request is invalid

loadDriver

public void loadDriver()
                throws DSEInternalErrorException
Loads and registers the JDBC Driver given in the external definition of the service or the default JDBC Driver as set in the JournalConstants EJ_DEFAULT_JDBCDRIVER attribute.

Throws:
DSEInternalErrorException - if an internal program error occurs

loadDriver

public void loadDriver(java.lang.String aDriverName)
                throws DSEInternalErrorException
Loads and registers the JDBC Driver explicitly provided as an argument.

Parameters:
aDriverName - java.lang.String, the driver name (full path)
Throws:
DSEInternalErrorException - if an internal program error occurs

newFor

public static JDBCJournal newFor(java.lang.String anEntityName,
                                 java.lang.String aSchemaName)
                          throws DSEInvalidRequestException
Returns a new JDBCJournal instance with the entityName and schemaName attributes set to the provided values.

Parameters:
anEntityName - java.lang.String, the name of the Entity
aSchemaName - java.lang.String, the name of the Schema
Returns:
JDBCJournal - the new JDBCJournal instance
Throws:
DSEInvalidRequestException - if the request is not valid

nextWrapNumber

protected int nextWrapNumber()
                      throws DSEInternalErrorException,
                             DSEInvalidRequestException,
                             DSEInvalidArgumentException,
                             DSESQLException
Returns the next generation number to be used for the default schema.

Returns:
int - the next wrap number
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

nextWrapNumberForSchema

protected int nextWrapNumberForSchema(java.lang.String aSchemaName)
                               throws DSEInternalErrorException,
                                      DSEInvalidRequestException,
                                      DSEInvalidArgumentException,
                                      DSESQLException
Returns the next generation number available for the specified schema.

Parameters:
aSchemaName - java.lang.String - the journal schema name
Returns:
int - the generation number
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

open

public void open(java.lang.String anEntity,
                 int aGeneration)
          throws DSEInvalidRequestException,
                 DSEInternalErrorException,
                 DSESQLException
Opens the journal service with an entity and a generation number

Parameters:
anEntity - java.lang.String
aGeneration - int
Throws:
DSEInvalidRequestException - if journal service state is active
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

open

public void open(java.lang.String aSchemaName,
                 java.lang.String anEntity,
                 int aGeneration)
          throws DSEInvalidRequestException,
                 DSEInternalErrorException,
                 DSESQLException
Opens the journal service with a specific shema, an entity, and a generation number.

Parameters:
aSchemaName - java.lang.String
anEntity - java.lang.String
aGeneration - int
Throws:
DSEInvalidRequestException - if journal service state is active
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

openForEntity

public void openForEntity(java.lang.String anEntity)
                   throws DSEInternalErrorException,
                          DSEInvalidRequestException,
                          DSEInvalidArgumentException,
                          DSESQLException
Opens the current journal table for anEntity. It sets the entity property to anEntity and calls the open() method.

Parameters:
anEntity - java.lang.String, the name of the entity
Throws:
DSEInvalidRequestException - if the entity name is not valid
DSEInternalErrorException - if an internal program error occurs
DSEInvalidArgumentException - if an argument is not valid
DSESQLException - if a SQLException occurs

openForEntity

public void openForEntity(java.lang.String anEntity,
                          java.lang.String aSchemaName)
                   throws DSEInternalErrorException,
                          DSEInvalidRequestException,
                          DSEInvalidArgumentException,
                          DSESQLException
Decides which is going to be the current journal table for anEntity. It sets the entity property to anEntity, the schemaName attribute to aSchemaName, and calls the open() method.

Parameters:
anEntity - java.lang.String, the name of the entity
aSchemaName - java.lang.String, the name of the schema
Throws:
DSEInvalidRequestException - if the entity name is not valid
DSEInternalErrorException - if an internal program error occurs
DSEInvalidArgumentException - if an argument is not valid
DSESQLException - if a SQLException occurs

openForSchema

public void openForSchema(java.lang.String aSchemaName)
                   throws DSEInternalErrorException,
                          DSEInvalidRequestException,
                          DSEInvalidArgumentException,
                          DSESQLException
Decides which is going to be the current journal table. It sets the schemaName property to aSchemaName and calls the open() method.

Parameters:
aSchemaName - java.lang.String, the name of the schema
Throws:
DSEInvalidRequestException - if the entity name is not valid
DSEInternalErrorException - if an internal program error occurs
DSEInvalidArgumentException - if an argument is not valid
DSESQLException - if a SQLException occurs

openOnCurrentTable

public void openOnCurrentTable()
                        throws DSEInvalidRequestException,
                               DSEInternalErrorException,
                               DSEInvalidArgumentException,
                               DSESQLException
Selects the already selected table generation for the current schema as the current journal table. It sets the journal attributes to a value that is adequate to start working with this table.

Specified by:
openOnCurrentTable in class Journal
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

openOnCurrentTableForSchema

public void openOnCurrentTableForSchema(java.lang.String aSchemaName)
                                 throws DSEInvalidRequestException,
                                        DSEInternalErrorException,
                                        DSEInvalidArgumentException,
                                        DSESQLException
Selects the already selected table generation for the specified schema as the current journal table. It sets the journal attributes to a value that is adequate to start working with this table.

Parameters:
aSchemaName - java.lang.String, the journal schema name
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

openOnNextTable

public void openOnNextTable()
                     throws DSEInternalErrorException,
                            DSEInvalidRequestException,
                            DSEInvalidArgumentException,
                            DSESQLException
Selects the next available table generation for the current schema as the current journal table. It sets the journal attributes to a value that is adequate to start working with this table.

Specified by:
openOnNextTable in class Journal
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

openOnNextTableForSchema

public void openOnNextTableForSchema(java.lang.String aSchemaName)
                              throws DSEInternalErrorException,
                                     DSEInvalidRequestException,
                                     DSEInvalidArgumentException,
                                     DSESQLException
Selects the next available table generation for the specified schema as the current journal table. It sets the journal attributes to a value that is adequate to start working with this table.

Parameters:
aSchemaName - java.lang.String, the journal schema name
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

resetSingleTableLastRecordNumber

public void resetSingleTableLastRecordNumber()
                                      throws DSESQLException,
                                             DSEInternalErrorException
Resets the Journal last record number when different instances are accessing the same tables

Specified by:
resetSingleTableLastRecordNumber in interface JournalService
Specified by:
resetSingleTableLastRecordNumber in class Journal
Throws:
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQL Exception is caught

queryLastRecordNumber

public int queryLastRecordNumber()
                          throws DSESQLException,
                                 DSEInternalErrorException
Returns the last record number in the current journal table. The database is accessed to get this information.

Specified by:
queryLastRecordNumber in interface JournalService
Specified by:
queryLastRecordNumber in class Journal
Returns:
int
Throws:
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

recordToRow

protected Vector recordToRow(Hashtable aDataHashtable)
                      throws DSEInvalidRequestException,
                             DSEInternalErrorException,
                             DSEInvalidArgumentException,
                             DSESQLException
Returns a list of ordered data field values. Each of these values are inserted in the column with column index matching the position in the list. It uses as input the data Hashtable with key the data field name and value the data field formatted value, and the columns Hashtable set when the service is instantiated (columnsTable attribute). The columns information will be requested by calling getSchemaMetaData() method.

Parameters:
aDataHashtable - Hashtable, the data to be used to build the database record
Returns:
com.ibm.dse.base.Vector - a vector of data field values
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

retrieveLastRecord

public Hashtable retrieveLastRecord()
                             throws DSEInternalErrorException,
                                    DSEInvalidArgumentException,
                                    DSESQLException
Retrieves the last record of the current journal table.

Specified by:
retrieveLastRecord in interface JournalService
Specified by:
retrieveLastRecord in class Journal
Returns:
Hashtable - a Hashtable built from the retrieved record column values
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

retrieveLastRecord

public void retrieveLastRecord(Context aContext,
                               HashtableFormat aHashtableFormat)
                        throws DSEInvalidRequestException,
                               DSEInternalErrorException,
                               DSEInvalidArgumentException,
                               DSESQLException
Retrieves the last record of the current journal table by calling the retrieveRecord(int, Context, HashtableFormat) method with the last record number as the first parameter.

Specified by:
retrieveLastRecord in interface JournalService
Specified by:
retrieveLastRecord in class Journal
Parameters:
aContext - com.ibm.dse.base.Context
aHashtableFormat - com.ibm.dse.base.HashtableFormat
Throws:
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSEInvalidArgumentException - if an argument is not valid
DSESQLException - if an SQLException is caught

retrieveLastRecord

public void retrieveLastRecord(Context aContext,
                               java.lang.String aFormatName)
                        throws DSEInvalidRequestException,
                               DSEInternalErrorException,
                               DSEInvalidArgumentException,
                               DSESQLException
Retrieves the last record of the current journal table by calling the retrieveRecord(int, Context, String) method with the last record number as first parameter.

Specified by:
retrieveLastRecord in interface JournalService
Specified by:
retrieveLastRecord in class Journal
Parameters:
aContext - com.ibm.dse.base.Context
aFormatName - java.lang.String
Throws:
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSEInvalidArgumentException - if an argument is not valid
DSESQLException - if an SQLException is caught

retrieveLastRecords

public Vector retrieveLastRecords(int aNumber)
                           throws DSEInternalErrorException,
                                  DSEInvalidArgumentException,
                                  DSEInvalidRequestException,
                                  DSESQLException
Returns a vector with aNumber or any number between 0 and aNumber of record Hashtables.

Specified by:
retrieveLastRecords in interface JournalService
Specified by:
retrieveLastRecords in class Journal
Parameters:
aNumber - int, the number of records to retrieve
Returns:
com.ibm.dse.base.Vector
Throws:
DSEInvalidRequestException - if the request is not valid
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

retrieveLastRecords

public void retrieveLastRecords(int aNumber,
                                Context aContext,
                                HashtableIndexedCollectionFormat anOutputFormat)
                         throws DSEInternalErrorException,
                                DSEInvalidArgumentException,
                                DSEInvalidRequestException,
                                DSESQLException,
                                DSEObjectNotFoundException
Retrieves the last aNumber records from the journal table and unformats them into the aContext using the anOutputFormat formatter.

Parameters:
aNumber - int - the number of records to retrieve
aContext - com.ibm.dse.base.Context - the context to where the retrieved records will be unformatted
anOutputFormat - com.ibm.dse.base.HashtableIndexedCollectionFormat - the formatter to unformat the retrieved records
Throws:
DSEInvalidRequestException - if the request is not valid
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSESObjectNotFoundException - if an object is not found
DSEObjectNotFoundException

retrieveLastRecords

public void retrieveLastRecords(int aNumber,
                                Context aContext,
                                java.lang.String anOutputFormatName)
                         throws DSEInternalErrorException,
                                DSEInvalidArgumentException,
                                DSEInvalidRequestException,
                                DSESQLException,
                                DSEObjectNotFoundException
Retrieves the last aNumber records from the journal table and unformats them into the aContext using the named anOutputFormatName formatter.

Parameters:
aNumber - int - the number of records to retrieve
aContext - com.ibm.dse.base.Context - the context to where the retrieved records will be unformatted
anOutputFormatName - java.lang.String - the name of the formatter to unformat the retrieved records
Throws:
DSEInvalidRequestException - if the request is not valid
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSESObjectNotFoundException - if an object is not found
DSEObjectNotFoundException

retrieveRecord

public Hashtable retrieveRecord(int aRecordNumber)
                         throws DSEInternalErrorException,
                                DSEInvalidArgumentException,
                                DSESQLException
Retrieves the record with the record identification in the database equal to aRecordNumber.

Specified by:
retrieveRecord in interface JournalService
Specified by:
retrieveRecord in class Journal
Parameters:
aRecordNumber - int - the record number
Returns:
Hashtable - a Hashtable built from the retrieved record column values
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

retrieveRecord

public void retrieveRecord(int aRecordNumber,
                           Context aContext,
                           HashtableFormat aHashtableFormat)
                    throws DSEInvalidRequestException,
                           DSEInternalErrorException,
                           DSEInvalidArgumentException,
                           DSESQLException
Retrieves the record with record identification in the database equal to aRecordNumber. The retrieved record is converted into a Hashtable by calling the retrieveRecord(int aRecordNumber) method and aContext is updated with the result of unformatting that Hashtable with the aHashtableFormat formatter.

Specified by:
retrieveRecord in interface JournalService
Specified by:
retrieveRecord in class Journal
Parameters:
aRecordNumber - int
aContext - com.ibm.dse.base.Context
aHashtableFormat - com.ibm.dse.base.HashtableFormat
Throws:
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSEInvalidArgumentException - if an argument is not valid
DSESQLException - if an SQLException is caught

retrieveRecord

public void retrieveRecord(int aRecordNumber,
                           Context aContext,
                           java.lang.String aFormatName)
                    throws DSEInvalidRequestException,
                           DSEInternalErrorException,
                           DSEInvalidArgumentException,
                           DSESQLException
Retrieves the record with record identification in the database equal to aRecordNumber. The retrieved record is converted into a Hashtable by calling the retrieveRecord(int aRecordNumber) method and aContext is updated with the result of unformatting that Hashtable with the formatter defined by aFormatName.

Specified by:
retrieveRecord in interface JournalService
Specified by:
retrieveRecord in class Journal
Parameters:
aRecordNumber - int
aContext - com.ibm.dse.base.Context
aFormatName - java.lang.String
Throws:
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSEInvalidArgumentException - if an argument is not valid
DSESQLException - if an SQLException is caught

retrieveRecords

public Vector retrieveRecords(java.lang.String aSearchCondition)
                       throws DSEInternalErrorException,
                              DSEInvalidRequestException,
                              DSEInvalidArgumentException,
                              DSESQLException
Retrieves all the records within the current journal that match aSearchCondition.

Specified by:
retrieveRecords in interface JournalService
Specified by:
retrieveRecords in class Journal
Parameters:
aSearchCondition - java.lang.String - the search condition in SQL format
Returns:
com.ibm.dse.base.Vector
Throws:
DSEInvalidRequestException - if the request is not valid
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

retrieveRecords

public void retrieveRecords(java.lang.String aSearchCondition,
                            Context aContext,
                            HashtableIndexedCollectionFormat anOutputFormat)
                     throws DSEInternalErrorException,
                            DSEInvalidRequestException,
                            DSEInvalidArgumentException,
                            DSESQLException,
                            DSEObjectNotFoundException
Retrieves all the records within the current journal that match aSearchCondition. The retrieved records are then unformatted into the context aContext using anOutputFormat.

Parameters:
aSearchCondition - java.lang.String - the search condition in SQL format
aContext - com.ibm.dse.base.Context - the context to where the retrieved records will be unformatted
anOutputFormat - com.ibm.dse.base.HashtableIndexedCollectionFormat - the formatter to unformat the retrieved records
Throws:
DSEInvalidRequestException - if the request is not valid
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSESObjectNotFoundException - if an object is not found
DSEObjectNotFoundException

retrieveRecords

public void retrieveRecords(java.lang.String aSearchCondition,
                            Context aContext,
                            java.lang.String anOutputFormatName)
                     throws DSEInternalErrorException,
                            DSEInvalidRequestException,
                            DSEInvalidArgumentException,
                            DSESQLException,
                            DSEObjectNotFoundException
Retrieves all the records within the current journal that match aSearchCondition. The retrieved records are then unformatted into the context aContext using the format named anOutputFormatName.

Parameters:
aSearchCondition - java.lang.String - the search condition in SQL format
aContext - com.ibm.dse.base.Context - the context to where the retrieved records will be unformatted
anOutputFormatName - java.lang.String - the name of the formatter to unformat the retrieved records
Throws:
DSEInvalidRequestException - if the request is not valid
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSESObjectNotFoundException - if an object is not found
DSEObjectNotFoundException

retrieveRecords

public Vector retrieveRecords(java.lang.String aSearchCondition,
                              Vector aColumnsVector)
                       throws DSEInternalErrorException,
                              DSEInvalidRequestException,
                              DSEInvalidArgumentException,
                              DSESQLException
Retrieves the columns in aColumnsVector of all the records within the current journal that match aSearchCondition.

Parameters:
aSearchCondition - java.lang.String - the search condition in SQL format
aColumnsVector - com.ibm.dse.base.Vector - the vector that contains the columns to be retrieved
Returns:
com.ibm.dse.base.Vector - the vector of hash tables with the retrieved records
Throws:
DSEInvalidRequestException - if the request is not valid
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

retrieveRecords

public void retrieveRecords(java.lang.String aSearchCondition,
                            Vector aColumnsVector,
                            Context aContext,
                            HashtableIndexedCollectionFormat anOutputFormat)
                     throws DSEInternalErrorException,
                            DSEInvalidRequestException,
                            DSEInvalidArgumentException,
                            DSESQLException,
                            DSEObjectNotFoundException
Retrieves the columns in aColumnsVector of all the records within the current journal that match aSearchCondition. The retrieved records are then unformatted into the context aContext using anOutputFormat.

Parameters:
aSearchCondition - java.lang.String - the search condition in SQL format
aColumnsVector - com.ibm.dse.base.Vector - the vector that contains the columns to be retrieved
aContext - com.ibm.dse.base.Context - the context to where the retrieved records will be unformatted
anOutputFormat - com.ibm.dse.base.HashtableIndexedCollectionFormat - the formatter to unformat the retrieved records
Throws:
DSEInvalidRequestException - if the request is not valid
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEObjectNotFoundException - if an object is not found

retrieveRecords

public void retrieveRecords(java.lang.String aSearchCondition,
                            Vector aColumnsVector,
                            Context aContext,
                            java.lang.String anOutputFormatName)
                     throws DSEInternalErrorException,
                            DSEInvalidRequestException,
                            DSEInvalidArgumentException,
                            DSESQLException,
                            DSEObjectNotFoundException
Retrieves the columns in aColumnsVector of all the records within the current journal that match aSearchCondition. The retrieved records are then unformatted into the context aContext using the format named anOutputFormatName.

Parameters:
aSearchCondition - java.lang.String - the search condition in SQL format
aColumnsVector - com.ibm.dse.base.Vector - the vector that contains the columns to be retrieved
aContext - com.ibm.dse.base.Context - the context to where the retrieved records will be unformatted
anOutputFormatName - java.lang.String - the name of the formatter to unformat the retrieved records
Throws:
DSEInvalidRequestException - if the request is not valid
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEObjectNotFoundException - if an object is not found

rollback

public void rollback()
              throws DSESQLException
Rolls back all database changes.

Specified by:
rollback in interface JournalService
Specified by:
rollback in class Journal
Throws:
DSESQLException - Thrown when the rollback fails

setColumnsTable

protected void setColumnsTable(Hashtable aColumnsHashtable)
Sets the columnsTable property to aColumnsHashtable value. The columns hashtable has the following format: key=column_name, value=data_field_name

Parameters:
aColumnsHashtable - Hashtable

setCreateSchema

public void setCreateSchema(boolean newCreateSchema)
Sets the createSchema property to newCreateSchema.

Specified by:
setCreateSchema in interface JournalService
Specified by:
setCreateSchema in class Journal
Parameters:
newCreateSchema - boolean

setDatabaseConnection

protected void setDatabaseConnection(java.sql.Connection aDatabaseConnection)
Sets the database connection property to aDatabaseConnection.

Overrides:
setDatabaseConnection in class JDBCService
Parameters:
aDatabaseConnection - Connection

setEntity

public void setEntity(java.lang.String anEntityName)
Sets the entity property value to anEntityName.

Specified by:
setEntity in interface JournalService
Specified by:
setEntity in class Journal
Parameters:
anEntityName - java.lang.String

setJDBCDriver

public void setJDBCDriver(java.lang.String newJDBCDriver)
Sets the JDBCDriver property value to newJDBCDriver.

Specified by:
setJDBCDriver in interface JournalService
Specified by:
setJDBCDriver in class Journal
Parameters:
newJDBCDriver - java.lang.String

setSchemaName

public void setSchemaName(java.lang.String aSchemaName)
Sets the schemaName property to aSchemaName

Specified by:
setSchemaName in interface JournalService
Specified by:
setSchemaName in class Journal
Parameters:
aSchemaName - java.lang.String - the journal schema name

setTableName

protected void setTableName(java.lang.String aTableName)
Sets the tableName.

Specified by:
setTableName in class Journal
Parameters:
aTableName - java.lang.String

tableName

protected java.lang.String tableName(java.lang.String aSchemaName,
                                     java.lang.String anEntityName,
                                     int aGeneration)
Returns the journal table name for a specific schema name, entity name and generation.

Parameters:
aSchemaName - java.lang.String, the schema name
anEntityName - java.lang.String - the entity name
aGeneration - int - the generation number
Returns:
java.lang.String

toStrings

public Vector toStrings()
Used by the Db2Journal service externalizer.

Overrides:
toStrings in class Service
Returns:
com.ibm.dse.base.Vector

updateLastRecord

public int updateLastRecord(Context aContext,
                            HashtableFormat aHashtableFormat)
                     throws DSEInvalidRequestException,
                            DSEInternalErrorException,
                            DSEInvalidArgumentException,
                            DSESQLException
Updates the last record of the current journal table by calling the updateRecords(String, Context, HashtableFormat) method.

Specified by:
updateLastRecord in interface JournalService
Specified by:
updateLastRecord in class Journal
Parameters:
aContext - com.ibm.dse.base.Context
aHashtableFormat - com.ibm.dse.base.HashtableFormat
Returns:
int - the row count ( number of updated records)
Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

updateLastRecord

public int updateLastRecord(Context aContext,
                            HashtableFormat aHashtableFormat,
                            Vector aColumnsVector)
                     throws DSEInvalidRequestException,
                            DSEInternalErrorException,
                            DSEInvalidArgumentException,
                            DSESQLException
Updates the columns specified in aColumnsVector for the last record of the current journal table by calling the updateRecords(String, Context, HashtableFormat, Vector) method.

Parameters:
aContext - com.ibm.dse.base.Context
aHashtableFormat - com.ibm.dse.base.HashtableFormat
aColumnsVector - com.ibm.dse.base.Vector, the columns to be changed
Returns:
int - the row count ( number of updated records)
Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

updateLastRecord

public int updateLastRecord(Context aContext,
                            java.lang.String aFormatName)
                     throws DSEInvalidRequestException,
                            DSEInternalErrorException,
                            DSEInvalidArgumentException,
                            DSESQLException
Updates the last record of the current journal table by calling the updateRecords(String, Context, String) method.

Specified by:
updateLastRecord in interface JournalService
Specified by:
updateLastRecord in class Journal
Parameters:
aContext - com.ibm.dse.base.Context - the context with the data
aFormatName - java.lang.String - the journal format name to be used
Returns:
int - the row count ( number of updated records)
Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

updateLastRecord

public int updateLastRecord(Context aContext,
                            java.lang.String aFormatName,
                            Vector aColumnsVector)
                     throws DSEInvalidRequestException,
                            DSEInternalErrorException,
                            DSEInvalidArgumentException,
                            DSESQLException
Updates the columns in aColumnsVector for the last record of the current journal table by calling the updateRecords(String, Context, String, Vector) method.

Parameters:
aContext - com.ibm.dse.base.Context - the context with the data
aFormatName - java.lang.String - the journal format name to be used
aColumnsVector - com.ibm.dse.base.Vector - the columns to be changed
Returns:
int - the row count ( number of updated records)
Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

updateLastRecord

public int updateLastRecord(Hashtable aDataHashtable)
                     throws DSEInvalidRequestException,
                            DSEInternalErrorException,
                            DSEInvalidArgumentException,
                            DSESQLException
Updates the last record of the current journal table with the data in aDataHashtable. It calls the method updateRecords(String,Hashtable).

Specified by:
updateLastRecord in interface JournalService
Specified by:
updateLastRecord in class Journal
Parameters:
aDataHashtable - Hashtable - the Hashtable that contains the data
Returns:
int - the row count ( number of updated records)
Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

updateLastRecord

public int updateLastRecord(Hashtable aDataHashtable,
                            Vector aColumnsVector)
                     throws DSEInvalidRequestException,
                            DSEInternalErrorException,
                            DSEInvalidArgumentException,
                            DSESQLException
Updates the columns in aColumnsVector for the last record of the current journal table with the data in aDataHashtable. It calls the method updateRecords(String,Hashtable,Vector).

Parameters:
aDataHashtable - Hashtable - the Hashtable that contains the data
aColumnsVector - com.ibm.dse.base.Vector - the columns to be changed
Returns:
int - the row count ( number of updated records)
Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

updateRecord

public int updateRecord(int aRecordNumber,
                        Context aContext,
                        HashtableFormat aHashtableFormat)
                 throws DSEInvalidRequestException,
                        DSEInternalErrorException,
                        DSEInvalidArgumentException,
                        DSESQLException
Updates the record identified by aRecordNumber within the journal table by calling the updateRecords(String, Context, HashtableFormat) method.

Specified by:
updateRecord in interface JournalService
Specified by:
updateRecord in class Journal
Parameters:
aRecordNumber - int - the number of the record to be updated
aContext - com.ibm.dse.base.Context
aHashtableFormat - com.ibm.dse.base.HashtableFormat
Returns:
int - the row count ( number of updated records)
Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

updateRecord

public int updateRecord(int aRecordNumber,
                        Context aContext,
                        HashtableFormat aHashtableFormat,
                        Vector aColumnsVector)
                 throws DSEInvalidRequestException,
                        DSEInternalErrorException,
                        DSEInvalidArgumentException,
                        DSESQLException
Updates the columns in aColumnsVector for the record identified by aRecordNumber within the journal table by calling the updateRecords(String, Context, HashtableFormat, Vector) method.

Parameters:
aRecordNumber - int - the number of the record to be updated
aContext - com.ibm.dse.base.Context
aHashtableFormat - com.ibm.dse.base.HashtableFormat
aColumnsVector - com.ibm.dse.base.Vector - the columns to be changed
Returns:
int - the row count ( number of updated records)
Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

updateRecord

public int updateRecord(int aRecordNumber,
                        Context aContext,
                        java.lang.String aFormatName)
                 throws DSEInvalidRequestException,
                        DSEInternalErrorException,
                        DSEInvalidArgumentException,
                        DSESQLException
Updates the record identified by aRecordNumber within the journal table by calling the updateRecords(String, Context, String) method.

Specified by:
updateRecord in interface JournalService
Specified by:
updateRecord in class Journal
Parameters:
aRecordNumber - int - the number of the record to be updated
aContext - com.ibm.dse.base.Context - the context with the data
aFormatName - java.lang.String - the journal format name to be used
Returns:
int - the row count ( number of updated records)
Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

updateRecord

public int updateRecord(int aRecordNumber,
                        Context aContext,
                        java.lang.String aFormatName,
                        Vector aColumnsVector)
                 throws DSEInvalidRequestException,
                        DSEInternalErrorException,
                        DSEInvalidArgumentException,
                        DSESQLException
Updates the columns in aColumnsVector for the record identified by aRecordNumber within the journal table by calling the updateRecords(String, Context, String, Vector) method.

Parameters:
aRecordNumber - int - the number of the record to be updated
aContext - com.ibm.dse.base.Context - the context with the data
aFormatName - java.lang.String - the journal format name to be used
aColumnsVector - com.ibm.dse.base.Vector - the columns to be changed
Returns:
int - the row count ( number of updated records)
Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

updateRecord

public int updateRecord(int aRecordNumber,
                        Hashtable aDataHashtable)
                 throws DSEInvalidRequestException,
                        DSEInternalErrorException,
                        DSEInvalidArgumentException,
                        DSESQLException
Updates the record identified by aRecordNumber within the journal table with the data provided in aDataHashtable by calling the updateRecords(String, Hashtable) method.

Specified by:
updateRecord in interface JournalService
Specified by:
updateRecord in class Journal
Parameters:
aRecordNumber - int - the number of the record to be updated
aDataHashtable - Hashtable - the Hashtable containing the new data
Returns:
int - the row count ( number of updated records)
Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

updateRecord

public int updateRecord(int aRecordNumber,
                        Hashtable aDataHashtable,
                        Vector aColumnsVector)
                 throws DSEInvalidArgumentException,
                        DSEInternalErrorException,
                        DSEInvalidRequestException,
                        DSESQLException
Updates the columns specified in aColumnsVector, for the record identified by aRecordNumber within the journal table, with the data provided in aDataHashtable. The aDataHashtable should only contain the values for the columns to be updated.

Parameters:
aRecordNumber - int - the number of the record to be updated
aDataHashtable - com.ibm.dse.base.Hashtable - the Hashtable that contains the new data
aColumnsVector - com.ibm.dse.base.Vector - the columns to be changed
Returns:
int - the row count ( number of updated records)
Throws:
com.ibm.dse.base.DSEInvalidArgumentException - if the argument(s) is(are) not valid.
com.ibm.dse.base.DSEInternalErrorException - if an internal program error occurs.
com.ibm.dse.base.DSEInvalidRequestException - if the request is not valid.
DSESQLException - if an SQLException is caught.
DSEInvalidArgumentException
DSEInternalErrorException
DSEInvalidRequestException

updateRecords

public int updateRecords(java.lang.String aSearchCondition,
                         Context aContext,
                         HashtableFormat aHashtableFormat)
                  throws DSEInvalidRequestException,
                         DSEInternalErrorException,
                         DSEInvalidArgumentException,
                         DSESQLException
Updates all the current journal table records that match the search condition passed as an argument, with the data obtained by formatting aContext with the journal aHashtableFormat formatter.

Specified by:
updateRecords in interface JournalService
Specified by:
updateRecords in class Journal
Parameters:
aSearchCondition - java.lang.String
aContext - com.ibm.dse.base.Context
aHashtableFormat - com.ibm.dse.base.HashtableFormat
Returns:
int - the row count ( number of updated records)
Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

updateRecords

public int updateRecords(java.lang.String aSearchCondition,
                         Context aContext,
                         HashtableFormat aHashtableFormat,
                         Vector aColumnsVector)
                  throws DSEInvalidRequestException,
                         DSEInternalErrorException,
                         DSEInvalidArgumentException,
                         DSESQLException
Updates the columns specified in aColumnsVector for all the current journal table records that match the search condition passed as an argument, with the data obtained by formatting aContext with the journal formatter aHashtableFormat.

Parameters:
aSearchCondition - java.lang.String
aContext - com.ibm.dse.base.Context
aHashtableFormat - com.ibm.dse.base.HashtableFormat
aColumnsVector - com.ibm.dse.base.Vector - the columns to be changed
Returns:
int - the row count ( number of updated records)
Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

updateRecords

public int updateRecords(java.lang.String aSearchCondition,
                         Context aContext,
                         java.lang.String aFormatName)
                  throws DSEInvalidRequestException,
                         DSEInternalErrorException,
                         DSEInvalidArgumentException,
                         DSESQLException
Updates all the current journal table records that match the search condition passed as an argument, with the data obtained by formatting aContext with the formatter defined by aFormatName.

Specified by:
updateRecords in interface JournalService
Specified by:
updateRecords in class Journal
Parameters:
aSearchCondition - java.lang.String - the search condition
aContext - com.ibm.dse.base.Context - the context with the data
aFormatName - java.lang.String - the journal format name that defines the formatter to be used
Returns:
int - the row count ( number of updated records)
Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

updateRecords

public int updateRecords(java.lang.String aSearchCondition,
                         Context aContext,
                         java.lang.String aFormatName,
                         Vector aColumnsVector)
                  throws DSEInvalidRequestException,
                         DSEInternalErrorException,
                         DSEInvalidArgumentException,
                         DSESQLException
Updates the columns specified in aColumnsVector for all the current journal table records that match the search condition passed as an argument, with the data obtained by formatting aContext with the formatter defined by aFormatName.

Parameters:
aSearchCondition - java.lang.String - the search condition
aContext - com.ibm.dse.base.Context - the context with the data
aFormatName - java.lang.String - the journal format name that defines the formatter to be used
aColumnsVector - com.ibm.dse.base.Vector - the columns to be changed
Returns:
int - the row count ( number of updated records)
Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

updateRecords

public int updateRecords(java.lang.String aSearchCondition,
                         Hashtable aDataHashtable)
                  throws DSEInvalidRequestException,
                         DSEInternalErrorException,
                         DSEInvalidArgumentException,
                         DSESQLException
Updates all the current journal table records that match the search condition with the aDataHashtable data.

Specified by:
updateRecords in interface JournalService
Specified by:
updateRecords in class Journal
Parameters:
aSearchCondition - java.lang.String - the search condition
aDataHashtable - Hashtable - the Hashtable that contains the new data
Returns:
int - the row count ( number of updated records)
Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

updateRecords

public int updateRecords(java.lang.String aSearchCondition,
                         Hashtable aDataHashtable,
                         Vector aColumnsVector)
                  throws DSEInvalidArgumentException,
                         DSEInternalErrorException,
                         DSEInvalidRequestException,
                         DSESQLException
Updates the columns specified in aColumnsVector with the data provided in aDataHashtable for the records matching the search condition within the journal table. The aDataHashtable should only contain the values for the columns to be updated.

Parameters:
aSearchCondition - java.lang.String - the search condition
aDataHashtable - com.ibm.dse.base.Hashtable - the Hashtable that contains the new data
aColumnsVector - com.ibm.dse.base.Vector - the columns to be changed
Returns:
int - the row count ( number of updated records)
Throws:
com.ibm.dse.base.DSEInvalidArgumentException - if the argument(s) is(are) not valid.
com.ibm.dse.base.DSEInternalErrorException - if an internal program error occurs.
com.ibm.dse.base.DSEInvalidRequestException - if the request is not valid.
DSESQLException - if an SQLException is caught.
DSEInvalidArgumentException
DSEInternalErrorException
DSEInvalidRequestException

isSingleTableReset

public static boolean isSingleTableReset()
Returns the singleTableReset.

Returns:
boolean

setSingleTableReset

public static void setSingleTableReset(boolean singleTableReset)
Sets the singleTableReset.

Parameters:
singleTableReset - The singleTableReset to set

getLastRecordNumberFromTable

public int getLastRecordNumberFromTable()
                                 throws DSEInvalidRequestException
Returns the lastRecordNumber from control table. In this method, all accesses are exclusive.

Specified by:
getLastRecordNumberFromTable in interface JournalService
Specified by:
getLastRecordNumberFromTable in class Journal
Returns:
int
Throws:
DSEInvalidRequestException

setLastRecordNumberFromTable

public void setLastRecordNumberFromTable(int aLastRecordNumberFromTable)
                                  throws DSEInvalidRequestException
Sets the lastRecordNumberFromTable into control table.

Specified by:
setLastRecordNumberFromTable in interface JournalService
Specified by:
setLastRecordNumberFromTable in class Journal
Parameters:
lastRecordNumberFromTable - The lastRecordNumberFromTable to set
Throws:
DSEInvalidRequestException
DSEException

numberOfGenerations

protected int numberOfGenerations(java.lang.String aSchemaName)
                           throws DSEInvalidRequestException,
                                  DSESQLException,
                                  DSEInternalErrorException
Returns the number of journal generations for the schema aSchemaName.

Parameters:
aSchemaName - java.lang.String the journal schema name
schemaInDatabase - java.lang.String indicates whether the schema was created in the database
Returns:
int
Throws:
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

controlTableName

protected java.lang.String controlTableName(java.lang.String aSchemaName)
Returns the name of the control table for the aSchemaName schema.

Parameters:
aSchemaName - java.lang.String the name of the journal schema

existsSchema

protected boolean existsSchema(java.lang.String aSchemaName)
                        throws DSEInternalErrorException,
                               DSESQLException
Returns true if the given schema exists in the Database.

Parameters:
aSchemaName - java.lang.String the journal schema name
Returns:
boolean
Throws:
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught

getSchemaMetaData

protected DatabaseResultSetMetaData getSchemaMetaData(java.lang.String aSchemaName)
                                               throws DSEInvalidArgumentException,
                                                      DSEInvalidRequestException,
                                                      DSEInternalErrorException,
                                                      DSESQLException
Returns the DatabaseResultSetMetaData instance associated with the schema aSchemaName.

Parameters:
aSchemaName - java.lang.String the journal schema name
schemaInDatabase - java.lang.String indicates whether the schema was created in the database
Returns:
DatabaseResultSetMetaData the DatabaseResultSetMetaData (null if the key is not mapped to any value)
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQL Exception is caught

allEntitiesFromDatabase

protected Vector allEntitiesFromDatabase(java.lang.String aSchemaName)
                                  throws DSEInternalErrorException,
                                         DSESQLException,
                                         DSEInvalidRequestException
Retrieves all entities from the Database for the specified schema.

Parameters:
aSchemaName - java.lang.String, the name of the journal schema
Returns:
com.ibm.dse.base.Vector the vector containing all journal entities
Throws:
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEInvalidRequestException

getDBType

protected java.lang.String getDBType()
Return the DBType in String Format, default is DB2

Returns:
CurrentDBType

IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2009