IBM Branch Transformation Toolkit Javadoc

com.ibm.btt.services.jdbcjournalservice
Interface JournalService

All Superinterfaces:
DatabaseConnect
All Known Implementing Classes:
JDBCJournal, JDBCJournalImpl

public interface JournalService
extends DatabaseConnect

The JournalService interface provides the public abstract methods that are used when working with any journal service. Each class that includes the JournalService interface must implement all of these methods.


Method Summary
 int addRecord(Hashtable aDataHashtable)
          Adds a record into the journal table with the data in aDataHashtable.
 void close()
          Closes the journal, which means that no database operation can be done with this journal instance.
 void commit()
          Commits all changes to the database.
 int getLastRecordNumberFromTable()
          Returns the lastRecordNumber from control table.
 void open()
          Decides which table is going to be the current journal table and prepares the journal instance to start working with it.
 void open(java.lang.String anEntity, int aGeneration)
          Opens the journal service with an entity and a generation number.
 void open(java.lang.String aSchemaName, java.lang.String anEntity, int aGeneration)
          Opens the journal service with an specific shema, an entity, and a generation number.
 void openForEntity(java.lang.String anEntity)
          Decides which table is going to be the current journal table for anEntity.
 void openForEntity(java.lang.String anEntity, java.lang.String aSchemaName)
          Decides which table is going to be the current journal table for entity anEntity.
 void openForSchema(java.lang.String aSchemaName)
          Decides which table is going to be the current journal table in the schema aSchemaName and prepares the journal instance to start working with it.
 int queryLastRecordNumber()
          Gets the last record number from the journal table.
 Hashtable retrieveLastRecord()
          Retrieves the last record from the journal table.
 Vector retrieveLastRecords(int aNumber)
          Returns the last aNumber records from the journal table.
 Hashtable retrieveRecord(int aRecordNumber)
          Retrieves the record from the journal table that is identified by aRecordNumber.
 Vector retrieveRecords(java.lang.String aSearchCondition)
          Retrieves all of the records from the journal table that match the search condition.
 Vector retrieveRecords(java.lang.String aSearchCondition, Vector aColumnsVector)
          Retrieves the columns in aColumnsVector of all the records within the journal table that match the search condition.
 void rollback()
          Rolls back all database changes.
 void setEntity(java.lang.String anEntityName)
           
 int updateLastRecord(Hashtable aDataHashtable)
          Updates the last record of the journal table with the data in aDataHashtable.
 int updateLastRecord(Hashtable aDataHashtable, Vector aColumnsVector)
          Updates the columns in aColumnsVector for the last record of the current journal table with the data in aDataHashtable.
 int updateRecord(int aRecordNumber, Hashtable aDataHashtable)
          Updates the record identified by aRecordNumber within the journal table with the data contained in aDataHashtable.
 int updateRecord(int aRecordNumber, Hashtable aDataHashtable, Vector aColumnsVector)
          Updates the columns specified in aColumnsVector with the data provided in aDataHashtable for the aRecordNumber record within the journal table.
 int updateRecords(java.lang.String aSearchCondition, Hashtable aDataHashtable)
          Updates all of the journal table records that match the search condition with the data contained in aDataHashtable.
 int updateRecords(java.lang.String aSearchCondition, Hashtable aDataHashtable, Vector aColumnsVector)
          Updates the columns specified in aColumnsVector with the data provided in aDataHashtable for the records matching the search condition within the journal table.
 
Methods inherited from interface com.ibm.btt.services.jdbcservicesinfra.DatabaseConnect
connect, disconnect, getDataSourceName, isConnected, isWaitRetry, setDataSourceName, setWaitRetry
 

Method Detail

addRecord

public int addRecord(Hashtable aDataHashtable)
              throws DSEInvalidRequestException,
                     DSEInvalidArgumentException,
                     DSEInternalErrorException,
                     DSESQLException
Adds a record into the journal table with the data in aDataHashtable.

Parameters:
aDataHashtable - com.ibm.dse.base.Hashtable
Returns:
int - the row number where the journal record is inserted
Throws:
DSEInvalidArgumentException - if the arguments are not valid
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQL Exception is caught

close

public void close()
           throws DSESQLException,
                  DSEInternalErrorException
Closes the journal, which means that no database operation can be done with this journal instance.

Throws:
DSESQLException - if close failed
DSEInternalErrorException

commit

public void commit()
            throws DSESQLException,
                   DSEInternalErrorException
Commits all changes to the database.

Throws:
DSESQLException - if commit failed
DSEInternalErrorException

open

public void open()
          throws DSEInternalErrorException,
                 DSEInvalidRequestException,
                 DSEInvalidArgumentException,
                 DSESQLException
Decides which table is going to be the current journal table and prepares the journal instance to start working with it.

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 SQL Exception occurs

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 SQL Exception 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 an 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 SQL Exception is caught

openForEntity

public void openForEntity(java.lang.String anEntity)
                   throws DSEInternalErrorException,
                          DSEInvalidRequestException,
                          DSEInvalidArgumentException,
                          DSESQLException
Decides which table is going to be the current journal table for anEntity. It sets the entity attribute 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 SQL Exception occurs

openForEntity

public void openForEntity(java.lang.String anEntity,
                          java.lang.String aSchemaName)
                   throws DSEInternalErrorException,
                          DSEInvalidRequestException,
                          DSEInvalidArgumentException,
                          DSESQLException
Decides which table is going to be the current journal table for entity anEntity. It sets the entity attribute 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 SQL Exception occurs

openForSchema

public void openForSchema(java.lang.String aSchemaName)
                   throws DSEInternalErrorException,
                          DSEInvalidRequestException,
                          DSEInvalidArgumentException,
                          DSESQLException
Decides which table is going to be the current journal table in the schema aSchemaName and prepares the journal instance to start working with it.

Parameters:
aSchemaName - java.lang.String - the name of the journal 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 SQL Exception occurs

queryLastRecordNumber

public int queryLastRecordNumber()
                          throws DSESQLException,
                                 DSEInternalErrorException
Gets the last record number from the journal table.

Returns:
int - the number of the retrieved record
Throws:
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQL Exception is caught

retrieveLastRecord

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

Returns:
com.ibm.dse.base.Hashtable the retrieved record as a hash table.
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQL Exception is caught

retrieveLastRecords

public Vector retrieveLastRecords(int aNumber)
                           throws DSEInternalErrorException,
                                  DSEInvalidArgumentException,
                                  DSEInvalidRequestException,
                                  DSESQLException
Returns the last aNumber records from the journal table.

Parameters:
aNumber - int - the number of records to be retrieved
Returns:
com.ibm.dse.base.Vector - a vector with all retrieved records as hash tables
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 SQL Exception is caught

retrieveRecord

public Hashtable retrieveRecord(int aRecordNumber)
                         throws DSEInternalErrorException,
                                DSEInvalidArgumentException,
                                DSESQLException
Retrieves the record from the journal table that is identified by aRecordNumber.

Parameters:
aRecordNumber - int
Returns:
com.ibm.dse.base.Hashtable - the retrieved record as a hash table
Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQL Exception is caught

retrieveRecords

public Vector retrieveRecords(java.lang.String aSearchCondition)
                       throws DSEInternalErrorException,
                              DSEInvalidRequestException,
                              DSEInvalidArgumentException,
                              DSESQLException
Retrieves all of the records from the journal table that match the search condition.

Parameters:
aSearchCondition - java.lang.String
Returns:
Vector - a vector with all retrieved records as hash tables
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 SQL Exception is caught

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 journal table that match the search condition. The format used to put the retrieved data into the operation context must only unformat the returned column values.

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 SQL Exception is caught

rollback

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

Throws:
DSESQLException - Thrown when the rollback fails
DSEInternalErrorException

updateLastRecord

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

Parameters:
aDataHashtable - com.ibm.dse.base.Hashtable
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 SQL Exception 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.

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 SQL Exception 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 contained in aDataHashtable.

Parameters:
aRecordNumber - int
aDataHashtable - com.ibm.dse.base.Hashtable
Returns:
int - the row count ( number of updated records)
Throws:
DSEInvalidArgumentException - is an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - is an SQL Exception is caught

updateRecord

public int updateRecord(int aRecordNumber,
                        Hashtable aDataHashtable,
                        Vector aColumnsVector)
                 throws DSEInvalidArgumentException,
                        DSEInternalErrorException,
                        DSEInvalidRequestException,
                        DSESQLException
Updates the columns specified in aColumnsVector with the data provided in aDataHashtable for the aRecordNumber record within the journal table. 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:
DSEInvalidArgumentException - if the argument(s) is(are) not valid.
DSEInternalErrorException - if an internal program error occurs.
DSEInvalidRequestException - if the request is not valid.
com.ibm.dse.services.jdbc.DSESQLException - if an SQL Exception is caught.
DSEInvalidArgumentException
DSEInternalErrorException
DSEInvalidRequestException
DSESQLException

updateRecords

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

Parameters:
aSearchCondition - java.lang.String
aDataHashtable - com.ibm.dse.base.Hashtable
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 SQL Exception 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:
DSEInvalidArgumentException - if the argument(s) is(are) not valid.
DSEInternalErrorException - if an internal program error occurs.
DSEInvalidRequestException - if the request is not valid.
com.ibm.dse.services.jdbc.DSESQLException - if an SQL Exception is caught.
DSEInvalidArgumentException
DSEInternalErrorException
DSEInvalidRequestException
DSESQLException

setEntity

public void setEntity(java.lang.String anEntityName)
               throws DSEInternalErrorException
Throws:
DSEInternalErrorException

getLastRecordNumberFromTable

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

Returns:
int
Throws:
DSEInvalidRequestException

IBM Branch Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2005