|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.etill.framework.archive.ETillArchive
ETillArchive manages access to the Commerce Payments database using JDBC calls. All Cassette access of the database should go through ETillArchive.
Field Summary | |
---|---|
static Object |
archiveLock
Deprecated. Use ETillArchive.getArchiveLock |
static int |
DEFAULT_390_BINARY_LENGTH
|
static int |
DEFAULT_BINARY_LENGTH
Deprecated. Use the ETillArchive.getMaxBinaryLength method. |
static int |
ORACLE_BINARY_LENGTH
Deprecated. Use the ETillArchive.getMaxBinaryLength method. |
static short |
shortFalse
Use to represent boolean false value as a small integer in the Commerce Payments database. |
static short |
shortTrue
Use to represent boolean true value as a small integer in the Commerce Payments database. |
Constructor Summary | |
---|---|
ETillArchive()
|
Method Summary | |
---|---|
static void |
addBoolean(boolean booleanToSave,
PreparedStatement pstmt,
int index)
Adds a short integer representation of a boolean value to an existing JDBC prepared statement at the specified index. |
static void |
addBoolean(Boolean booleanToSave,
PreparedStatement pstmt,
int index)
Adds a short integer representation of a boolean value to an existing JDBC prepared statement at the specified index. |
static void |
addByteField(byte[] bytesToSave,
PreparedStatement pstmt,
int index)
Adds a byte array to an existing JDBC prepared statement at the specified index. |
static String |
addExternalField(Object externallySavedObject,
PreparedStatement pstmt,
int index)
Creates a uniqueKey for an object saved in another database table (typically the ETBINARYDATA table) and adds that key to an existing JDBC prepared statement at the specified index. |
static void |
addInteger(Integer integerToSave,
PreparedStatement pstmt,
int index)
Adds an integer to an existing JDBC prepared statement at the specified index. |
static void |
addString(String stringToSave,
PreparedStatement pstmt,
int index)
Adds a string to an existing JDBC prepared statement at the specified index. |
static void |
addTimestamp(Timestamp timestampToSave,
PreparedStatement pstmt,
int index)
Adds a Timestamp to an existing JDBC prepared statement at the specified index. |
static void |
addUTF8String(String stringToSave,
PreparedStatement pstmt,
int index)
Adds a UTF8 string to an existing JDBC prepared statement at the specified index. |
ResultSet |
beginQuery(String sqlQuery)
Sends an SQL QUERY command to the database manager. |
ResultSet |
beginQuery(String sqlQuery,
Integer resultSetMaxSize)
Sends an SQL QUERY command to the database manager, placing a limit on the size of the returned ResultSet. |
Connection |
beginTransaction()
Begins a new transaction with the database. |
void |
commitAndCloseTransaction(Connection conn)
Commits a transaction consisting of one or more SQL operations |
static void |
createBinaryField(byte[] binaryData,
String uniqueKey,
Connection conn)
Creates a new binary field in the ETBINARYDATA table. |
static void |
deleteBinaryField(String uniqueKey,
Connection conn)
Deletes a binary field from the ETBINARYDATA table. |
void |
endQuery()
Closes and removes objects related to the currently active SQL QUERY. |
static Object |
getArchiveLock()
|
static String |
getDatabaseProductName()
Returns the database product name for the Commerce Payments database. |
static String |
getDBDriver()
Returns the database JDBC driver name. |
static String |
geteTillDatabasejdbcURL()
Returns the Commerce Payments database's JDBC URL. |
static String |
geteTillDatabaseOwner()
Returns the userid of the Commerce Payments database owner. |
static String |
geteTillDatabasePassword()
Returns the Commerce Payments database password. |
static String |
geteTillDatabaseUserID()
Returns the Commerce Payments database userid. |
static int |
getMaxBinaryLength()
Return the size (in bytes) of the largest physical binary field that will be supported by the underlying Commerce Payments database. |
static int |
getMaxConnections()
Returns the maximum number of concurrent database connections that will be established. |
static String |
getOwner()
Deprecated. Use ETillArchive.geteTillDatabaseOwner instead |
static byte[] |
readBinaryField(String uniqueKey)
Reads the contents of a binary field from the ETBINARYDATA table. |
static Boolean |
readBoolean(ResultSet rs,
String field)
returns a Boolean from a ResultSet corresponding to the specified keyword |
static byte[] |
readByteField(ResultSet rs,
String field)
returns a byte array from a ResultSet corresponding to the specified keyword |
static Integer |
readInteger(ResultSet rs,
String field)
returns an Integer from a ResultSet corresponding to the specified keyword |
static Serializable |
readSerializedObject(byte[] serializedData)
"Re-instantiates" an object that was previously serialized by the serializeObject method. |
static String |
readString(ResultSet rs,
String field)
returns a string from a ResultSet corresponding to the specified keyword |
static Timestamp |
readTimestamp(ResultSet rs,
String field)
returns a Timestamp from a ResultSet corresponding to the specified keyword |
static String |
readUTF8String(ResultSet rs,
String field)
returns a UTF8 string from a ResultSet corresponding to the specified keyword |
void |
rollbackAndCloseTransaction(Connection conn)
Rolls back a transaction consisting of one or more SQL operations |
static byte[] |
serializeObject(Serializable serializableObject)
Serializes an object so that it can be stored in Commerce Payments database. |
static boolean |
toBoolean(short value)
Converts a short (SMALLINT) from a database table to its corresponding boolean value. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static Object archiveLock
ETillArchive.getArchiveLock
public static final short shortFalse
false
value as a small integer in the Commerce Payments database.public static final short shortTrue
true
value as a small integer in the Commerce Payments database.public static final int DEFAULT_BINARY_LENGTH
ETillArchive.getMaxBinaryLength
method.
public static final int DEFAULT_390_BINARY_LENGTH
public static final int ORACLE_BINARY_LENGTH
ETillArchive.getMaxBinaryLength
method.
Constructor Detail |
public ETillArchive()
Method Detail |
public static int getMaxBinaryLength()
ETillArchive.createBinaryField
method)
or if it will fit within a column in another table.createBinaryField(byte[], java.lang.String, java.sql.Connection)
public Connection beginTransaction() throws ETillAbortOperation
ETillAbortOperation
- if any errors occur while allocating a new
database connection.com.ibm.etill.framework.Archivable
,
com.ibm.etill.framework.Commitable
,
com.ibm.etill.framework.CommitPoint
public void commitAndCloseTransaction(Connection conn) throws ETillAbortOperation
conn
- A Connection object that was previously created through a
call to the beginTransaction
method.ETillAbortOperation
- if any errors occur while committing or
closing the transaction.public void rollbackAndCloseTransaction(Connection conn) throws ETillAbortOperation
conn
- A Connection object that was previously created through a
call to the beginTransaction
method.ETillAbortOperation
- if any errors occur while rolling back or
closing the transaction.public ResultSet beginQuery(String sqlQuery, Integer resultSetMaxSize) throws SQLException
sqlQuery
- the String containing the SQL QUERY command to be
issued.resultSetMaxSize
- the requested maximum number of records to be returned
in the result set; if specified as null, then no limit
is imposed.SQLException
- generated by JDBC if an error occursendQuery()
public ResultSet beginQuery(String sqlQuery) throws SQLException
sqlQuery
- the String containing the SQL QUERY command to be
issued.SQLException
- generated by JDBC if an error occursendQuery()
public void endQuery() throws SQLException
ResultSet
returned by
a previous beginQuery
call is complete.SQLException
- generated by JDBC if an error occursbeginQuery(java.lang.String, java.lang.Integer)
public static void createBinaryField(byte[] binaryData, String uniqueKey, Connection conn) throws ETillAbortOperation
Binary fields are particularly troublesome when multiple database engines are supported. This method inserts data into a binary field while hiding all of the idiosyncracies of different JDBC drivers and database products, including the underlying data types and length limitations.
binaryData
- the byte array containing the binary data to be written
into the new ETBINARYDATA record.uniqueKey
- a String containing a uniqueKey obtained through the
Supervisor.getUniqueKey
method. Each binary
field must be assigned a unique uniqueKey value.conn
- the Connection object representing the database transaction
under which this field will be created.ETillAbortOperation
- if Commerce Payments catches an SQLException
while creating the database records through JDBC.Supervisor.getUniqueKey()
,
deleteBinaryField(java.lang.String, java.sql.Connection)
,
readBinaryField(java.lang.String)
public static void deleteBinaryField(String uniqueKey, Connection conn) throws ETillAbortOperation
createBinaryField
method.uniqueKey
- a String containing the uniqueKey of the binary field
to be deleted.conn
- the Connection object representing the database transaction
under which this field will be deleted.ETillAbortOperation
- if Commerce Payments catches an SQLException
while deleting the database records through JDBC.createBinaryField(byte[], java.lang.String, java.sql.Connection)
,
readBinaryField(java.lang.String)
public static byte[] readBinaryField(String uniqueKey) throws ETillAbortOperation
createBinaryField
method.uniqueKey
- a String containing the uniqueKey of the binary field
to be read.ETillAbortOperation
- if Commerce Payments catches an SQLException
while reading the data through JDBC.createBinaryField(byte[], java.lang.String, java.sql.Connection)
,
deleteBinaryField(java.lang.String, java.sql.Connection)
public static byte[] serializeObject(Serializable serializableObject) throws ETillAbortOperation
serializableObject
- an object that implements the Serializable interfaceETillAbortOperation
- if the Commerce Payments catches an IOException
while serializing the objectpublic static Serializable readSerializedObject(byte[] serializedData) throws ETillAbortOperation
serializeObject
method.serializedData
- the byte array containing a serialized objectETillAbortOperation
- if the Commerce Payments catches an IOException
while instantiating the objectpublic static void addString(String stringToSave, PreparedStatement pstmt, int index) throws SQLException
stringToSave
- the String to be added to the prepared statementpstmt
- the PreparedStatement objectindex
- an int containing the index at which the string should
be addedSQLException
- if any SQL errors occurpublic static String readString(ResultSet rs, String field) throws SQLException
rs
- the ResultSet containing the results of a queryfield
- the specified fieldSQLException
- if any SQL errors occurpublic static void addUTF8String(String stringToSave, PreparedStatement pstmt, int index) throws SQLException
stringToSave
- the String to be added to the prepared statementpstmt
- the PreparedStatement objectindex
- an int containing the index at which the string should
be addedSQLException
- if any SQL errors occurpublic static String readUTF8String(ResultSet rs, String field) throws SQLException
rs
- the ResultSet containing the results of a queryfield
- the specified field mapping to the UTF8 stringSQLException
- if any SQL errors occurpublic static void addBoolean(boolean booleanToSave, PreparedStatement pstmt, int index) throws SQLException
booleanToSave
- the boolean value to be added to the prepared statementpstmt
- the PreparedStatement objectindex
- an int containing the index at which the value should
be addedSQLException
- if any SQL errors occurpublic static void addBoolean(Boolean booleanToSave, PreparedStatement pstmt, int index) throws SQLException
booleanToSave
- the boolean value to be added to the prepared statementpstmt
- the PreparedStatement objectindex
- an int containing the index at which the value should
be addedSQLException
- if any SQL errors occurpublic static Boolean readBoolean(ResultSet rs, String field) throws SQLException
rs
- the ResultSet containing the results of a queryfield
- the specified fieldSQLException
- if any SQL errors occurpublic static void addInteger(Integer integerToSave, PreparedStatement pstmt, int index) throws SQLException
integerToSave
- the Integer value to be added to the prepared statementpstmt
- the PreparedStatement objectindex
- an int containing the index at which the value should
be addedSQLException
- if any SQL errors occurpublic static Integer readInteger(ResultSet rs, String field) throws SQLException
rs
- the ResultSet containing the results of a queryfield
- the specified field mapping to the UTF8 stringSQLException
- if any SQL errors occurpublic static void addByteField(byte[] bytesToSave, PreparedStatement pstmt, int index) throws SQLException
bytesToSave
- the byte array value to be added to the prepared statementpstmt
- the PreparedStatement objectindex
- an int containing the index at which the value should
be addedSQLException
- if any SQL errors occurpublic static byte[] readByteField(ResultSet rs, String field) throws SQLException
rs
- the ResultSet containing the results of a queryfield
- the specified field mapping to the UTF8 stringSQLException
- if any SQL errors occurpublic static void addTimestamp(Timestamp timestampToSave, PreparedStatement pstmt, int index) throws SQLException
timestampToSave
- the Timestamp value to be added to the prepared statementpstmt
- the PreparedStatement objectindex
- an int containing the index at which the value should
be addedSQLException
- if any SQL errors occurpublic static Timestamp readTimestamp(ResultSet rs, String field) throws SQLException
rs
- the ResultSet containing the results of a queryfield
- the specified fieldSQLException
- if any SQL errors occurpublic static String addExternalField(Object externallySavedObject, PreparedStatement pstmt, int index) throws SQLException
externallySavedObject
- the Object that has been or will be saved elsewhere;
typically, the object is saved in the ETBINARYDATA table
using the ETillArchive.createBinaryField
method.pstmt
- the PreparedStatement objectindex
- an int containing the index at which the new key should
be addedSQLException
- if any SQL errors occurcreateBinaryField(byte[], java.lang.String, java.sql.Connection)
public static String getDatabaseProductName()
public static int getMaxConnections()
public static String getDBDriver()
public static String geteTillDatabasejdbcURL()
public static String geteTillDatabaseOwner()
public static String getOwner()
ETillArchive.geteTillDatabaseOwner
instead
public static String geteTillDatabaseUserID()
public static String geteTillDatabasePassword()
public static boolean toBoolean(short value)
value
- the short value to convert to a boolean value.public static Object getArchiveLock()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |