|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.tivoli.twg.engine.TWGObject
com.tivoli.twg.engine.TWGPersistentObject
com.tivoli.twg.engine.TWGDatabase
TWGDatabase is the Director database class. Each instance represents one physical database. The collection of all the instances represents the logical TWG database. Each database has a name that identifies it. At this time only one instance is allowed.
Field Summary | |
---|---|
static boolean |
allowConvertingToTWGEncoding
|
static int |
CHAR
JDBC CHAR |
static int |
DATE
JDBC DATE |
static int |
DATETIME
Database type for Datetime. |
static int |
DOUBLE
JDBC DOUBLE |
static int |
INTEGER
JDBC INTEGER |
static java.lang.String |
magicCharacter
|
static int |
READONLY
Read only database connection type |
static int |
REAL
JDBC REAL |
static int |
SMALLINT
Standard JDBC data types supported by Director JDBC SMALLINT |
static int |
TRANSACTION
Transaction database connection type. |
static java.lang.String |
TWG_DB_NAME
Database name for main Director database. |
static int |
UPDATE
Update database connection type. |
static int |
VARCHAR
JDBC VARCHAR |
static java.lang.String |
VERSION
Database version |
Fields inherited from class com.tivoli.twg.engine.TWGPersistentObject |
---|
CLASS_NAME, SIZEOF_BYTE, SIZEOF_CHAR, SIZEOF_DOUBLE, SIZEOF_FLOAT, SIZEOF_INT, SIZEOF_LONG, SIZEOF_SHORT |
Constructor Summary | |
---|---|
protected |
TWGDatabase()
Default constructor: do nothing. |
protected |
TWGDatabase(java.lang.String url,
java.lang.String name,
java.lang.String user,
java.lang.String pwd)
This method is public as an implementation side effect. |
Method Summary | |
---|---|
protected TWGDbConnection |
addConnection()
This method is public as an implementation side effect. |
protected java.lang.String |
buildConditionSQL(Vect columnFilters,
Vect ops)
|
protected void |
closeConnections()
This method is protected as an implementation side effect. |
protected boolean |
compactJetDb()
This method is protected as an implementation side effect. |
protected void |
deleteManagedObject(long managedObjId)
This method is protected as an implementation side effect. |
protected void |
deleteManagedObject(long managedObjId,
StringValueSet table_classes)
This method is protected as an implementation side effect. |
protected void |
deleteRows(Vect columnFilters,
Vect ops)
This method is protected as an implementation side effect. |
java.util.Enumeration |
findTableObjects()
The class method gets all TWGDatabaseTable objects in the database. |
protected void |
flatten(TWGByteArrayOutputStream data)
Write table contents to a byte array. |
java.lang.String |
formatDatetimeValue(java.lang.String str)
Formats a datetime value formatted correctly for an SQL statement |
java.lang.String |
formatDateValue(java.lang.String str)
Formats a date value correctly for an SQL statement |
static java.lang.String |
getBundleString(java.lang.String bundleKey,
java.util.Locale loc)
Look up a value in a resource bundle |
java.lang.String |
getColumnTypeName(int colType)
Get database-specific name of column type |
java.lang.String |
GetConShadowClass()
Get name of console shadow class. |
protected static java.lang.String |
getConvertedStatement(java.lang.String theString)
This method converts the java string into the TWG encoding or a the local of the server, dependng on the value of allowConvertingToTWGEncoding. |
static TWGDatabase |
getDatabase(java.lang.String dbname)
Class method to get a reference to a TWGDatabase object. |
java.lang.String |
getDatabaseName()
Get the database name |
TWGDbMetaData |
getMetaInfo()
Gets metadata about the database. |
java.lang.String |
getProductName()
Gets database product name |
static com.tivoli.twg.engine.TWGDbQueryServiceNode |
getQueryServiceNode()
This method is public as an implementation side effect. |
byte[] |
GetShadowRecord(java.util.Locale locale)
Get buffer containing current values of the shadowed attributes to be delivered to the console shadow class. |
long |
GetShadowVersion()
Get object state version. |
TWGDatabaseTable |
getTable(java.lang.String tableName)
Instance method to get the table for the supplied table name |
static com.tivoli.twg.engine.TWGDbUpdateServiceNode |
getUpdateServiceNode()
This method is public as an implementation side effect. |
protected java.lang.String |
getURL()
Get the URL for the database |
protected void |
incrementDirtyLevel()
This method is protected as an implementation side effect. |
protected void |
initConnections()
This method is protected as an implementation side effect. |
protected void |
initDatabaseDriver()
Initializes the database driver. |
protected void |
initDB(java.lang.String url,
java.lang.String user,
java.lang.String pwd)
This method is protected as an implementation side effect. |
protected void |
initDBMetaData(TWGDbConnection con)
Instance method to initialize the database related metadata variables. |
static boolean |
isActive()
Class method to determine if the databases are active. |
static boolean |
isDbChanged()
Check if Director switches to a different database system. |
static boolean |
isEnabled()
Class method to determine if the databases are enabled. |
protected void |
registerTable(java.lang.String key,
TWGDatabaseTable tableObject)
This method is protected as an implementation side effect. |
protected void |
reInitConnections()
This method is protected as an implementation side effect. |
protected void |
removeTable(java.lang.String key)
This method is protected as an implementation side effect. |
protected void |
replaceManagedObject(long managedObjId,
java.util.Vector rows)
This method is protected as an implementation side effect. |
protected void |
resetReadWriteMutex()
This method is protected as an implementation side effect. |
protected void |
restoreData(TWGPersistentObjectDictionary dict,
boolean do_resolve)
Restore method for database table object |
void |
returnConnection(TWGDbConnection conn)
This method is public as an implementation side effect. |
protected void |
saveData(TWGPersistentObjectDictionary dict)
Method for saving persistent object data. |
protected void |
setDatabaseState(int newState)
Class method to set database state. |
protected void |
storeRows(java.util.Vector rows,
int connType,
TWGDbReply dbReply)
This method is protected as an implementation side effect. |
java.lang.String |
toString()
Convert Database to String for debug |
void |
UpdateShadowVersion()
Update object state version. |
protected static boolean |
usingDatabase(java.lang.String db_product_name)
Class method to determine if any of the databases uses the specified database product. |
protected void |
waitForIdle()
This method is protected as an implementation side effect. |
Methods inherited from class com.tivoli.twg.engine.TWGPersistentObject |
---|
Destroy, enableAsyncWrites, fromPersistID, initialize, isNewPersistentStore, isSaveRequired, PersistID, restore, restoreAll, save, save, setSaveRequired, terminate, toPersistID |
Methods inherited from class com.tivoli.twg.engine.TWGObject |
---|
AllObjects, AllObjects, Delete, DumpTWGObjects, FindObject, isDeleted, isNewObject, isPersistent, isPersistent, isValid, isValid, ObjectID, setDistinctObjectID, SetObjectID |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String TWG_DB_NAME
public static final java.lang.String VERSION
public static final int READONLY
public static final int UPDATE
public static final int TRANSACTION
public static final int SMALLINT
public static final int INTEGER
public static final int REAL
public static final int DOUBLE
public static final int CHAR
public static final int VARCHAR
public static final int DATE
public static final int DATETIME
public static boolean allowConvertingToTWGEncoding
public static java.lang.String magicCharacter
Constructor Detail |
protected TWGDatabase()
protected TWGDatabase(java.lang.String url, java.lang.String name, java.lang.String user, java.lang.String pwd) throws TWGDbException
Constructor for TWGDatabase
url
- - URL for the databasename
- - title for the database (used for database object identification)user
- - user id to be used when establishing connections to the databasepwd
- - password for user id for connecting to the databaseMethod Detail |
protected void initDB(java.lang.String url, java.lang.String user, java.lang.String pwd) throws TWGDatabaseInitException
Initializes non-persistent data for the database object.
url
- - URL for the database
TWGDatabaseInitException
protected void initDatabaseDriver() throws TWGDatabaseInitException
Initializes the database driver. Registers the class for the database driver and calls DriverManager.getDriver. This method is to help work around the occasional "No Suitable Driver" error.
TWGDatabaseInitException
protected void initConnections() throws TWGDbException
Establish the connections to the database
TWGDbException
protected void reInitConnections() throws TWGDbException
Reestablish connections to a database object that already exists.
TWGDbException
protected void setDatabaseState(int newState)
public static boolean isActive()
public static boolean isEnabled()
protected void closeConnections() throws TWGDbException
Close all the connections to a database.
TWGDbException
public static TWGDatabase getDatabase(java.lang.String dbname) throws TWGDbException
dbname
- - name of the database (used for database object identification)
TWGDbException
protected boolean compactJetDb()
protected void resetReadWriteMutex()
protected static boolean usingDatabase(java.lang.String db_product_name)
db_product_name
- - the database product name. Examples:
protected void waitForIdle()
Wait until database is idle -- no one is using any connections
public static com.tivoli.twg.engine.TWGDbQueryServiceNode getQueryServiceNode()
Class method to get a reference to the query service node.
public static com.tivoli.twg.engine.TWGDbUpdateServiceNode getUpdateServiceNode()
Class method to get a reference to the update service node.
protected TWGDbConnection addConnection() throws TWGDbException
Instance method to open a TWGDbConnection to this database and add the connection to the pool of available connections for this database
TWGDbException
TWGDbConnection
public void returnConnection(TWGDbConnection conn) throws TWGDbException
conn
- - a TWGDbConnection object reference
TWGDbException
TWGDbConnection
,
TWGDbException
protected void storeRows(java.util.Vector rows, int connType, TWGDbReply dbReply) throws TWGDbException
rows
- - A vector of TWGDbStoreRow objects containing the updatesconnType
- - Type of connection:
TWGDatabase.UPDATE
TWGDatabase.TRANSACTION
TWGDbException
TWGDbStoreRow
protected void deleteRows(Vect columnFilters, Vect ops) throws TWGDbException
ops
- - Vect containing a set of logical operators.
TWGDbException
TWGDbColumnFilter
protected void deleteManagedObject(long managedObjId) throws TWGDbException
managedObjId
- - the managed object id
TWGDbException
protected void deleteManagedObject(long managedObjId, StringValueSet table_classes) throws TWGDbException
Instance method to delete all rows for a managed object from a specified list of table classes.
managedObjId
- - the managed object idtable_classes
- - a StringValueSet containing the table class names
TWGDbException
protected void replaceManagedObject(long managedObjId, java.util.Vector rows) throws TWGDbException
For the specified managed object and the specified tables, all rows for the managed object are deleted from these tables and the new rows supplied are inserted into the tables. This command does not support replacing more than one managed object per request at this time.
managedObjId
- - managed object id to delete rows for.rows
- - a list of TWGDbStoreRow objects containing the table names and rows to
insert.
TWGDbException
TWGDbStoreRow
protected void incrementDirtyLevel()
Instance method to increment the dirty indicator for the database. It should be used when changes have occurred to the database (such as creating a new table) that would require connections to the database to be closed and new ones obtained in order to see the changes to the database.
TWGDbConnection
protected void initDBMetaData(TWGDbConnection con) throws TWGDbException
TWGDbException
TWGDbConnection
,
TWGDbException
public java.lang.String formatDatetimeValue(java.lang.String str)
public java.lang.String formatDateValue(java.lang.String str)
public TWGDbMetaData getMetaInfo()
TWGDbMetaData
public java.lang.String getProductName()
TWGDbMetaData
protected java.lang.String getURL()
public java.lang.String getDatabaseName()
public java.lang.String getColumnTypeName(int colType) throws TWGDbException
colType
-
TWGDbException
public java.util.Enumeration findTableObjects()
public TWGDatabaseTable getTable(java.lang.String tableName) throws TWGDbException
tableName
- - name of the table
TWGDbException
protected void registerTable(java.lang.String key, TWGDatabaseTable tableObject)
Register a table into the list of tables for this database
protected void removeTable(java.lang.String key)
Remove a table from the the list of all known tables for this database
public static java.lang.String getBundleString(java.lang.String bundleKey, java.util.Locale loc)
loc
- - locale for the bundle
public static boolean isDbChanged()
protected void flatten(TWGByteArrayOutputStream data)
data
- - the TWGByteArrayOutputStreamprotected void saveData(TWGPersistentObjectDictionary dict) throws TWGPersistentObjectSaveException
saveData
in class TWGPersistentObject
dict
- - dictionary used to accumulate data
TWGPersistentObjectSaveException
- thrown to
abort save procedure.protected void restoreData(TWGPersistentObjectDictionary dict, boolean do_resolve) throws TWGPersistentObjectRestoreException
restoreData
in class TWGPersistentObject
dict
- - dictionary containing data to be restoreddo_resolve
- - true if second pass of restore (do resolve)
TWGPersistentObjectRestoreException
- if restore abortedpublic java.lang.String toString()
protected static java.lang.String getConvertedStatement(java.lang.String theString)
-
- SQLExceptionStatement
public void UpdateShadowVersion()
UpdateShadowVersion
in interface TWGBaseShadowedObject
TWGShadowedObject
public long GetShadowVersion()
GetShadowVersion
in interface TWGBaseShadowedObject
TWGShadowedObject
public java.lang.String GetConShadowClass()
GetConShadowClass
in interface TWGBaseShadowedObject
TWGShadowedObject
public byte[] GetShadowRecord(java.util.Locale locale)
GetShadowRecord
in interface TWGBaseShadowedObject
locale
- - Locale requested (for any locale-specific content)
TWGShadowedObject
protected java.lang.String buildConditionSQL(Vect columnFilters, Vect ops) throws TWGDbException
TWGDbException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |