| java.lang.Object dtw.webmail.util.CastorDatabase
All known Subclasses: dtw.webmail.plugin.std.JwmaDatabase,
CastorDatabase | abstract public class CastorDatabase (Code) | | Abstract class that encapsulates a Database
from the Castor lib, to enhance performance by adding
the reuse of queries (which is perfectly possible).
author: Dieter Wimberger version: 0.9.7 07/02/2003 |
Constructor Summary | |
public | CastorDatabase() Simple and empty constructor, to create a lightweight
instance that serves only as factory object for "real"
instances. |
Method Summary | |
public void | begin() Delegates beginning a new transaction to the encapsulated
Database. | public void | close() Closes the database. | public void | commit() Delegates the commit method to the encapsulated
Database instance. | public void | create(Object object) Delegates creation of a new object in persistent storage to the
encapsulated Database. | abstract public CastorDatabase | createCastorDatabase() | public Database | getDatabase() Returns the encapsulated Database instance. | public Object | getIdentity(Object object) Delegates checking an object's identity to the encapsulated
Database.
Parameters: object - the object to be checked. | public OQLQuery | getOQLQuery() Delegates creation of an OQL query with no statement. | public OQLQuery | getOQLQuery(String oql) Delegates creation of an OQL query from the
supplied statement. | public OQLQuery | getQuery(String identifier) | public boolean | isActive() Tests if a transaction is currently active. | public boolean | isAutoStore() Delegates testing of the current transaction autoStore flag state
to the encapsulated Database. | public boolean | isClosed() Tests if a database has been closed. | public boolean | isPersistent(Object object) Delegates testing of a given object's persistency state.
An object is persistent if it was created or queried
in this transaction. | public Object | load(Class type, Object identity) Delegates loading of an object of the specified type and
given identity to the encapsulated Database. | public void | putQuery(String identifier, OQLQuery query) | public void | remove(Object object) Delegates removal of the object from persistent storage. | public void | rollback() Delegates the rollback method to the encapsulated
Database instance. | public void | setAutoStore(boolean autoStore) Delegates setting of the autoStore flag state
to the encapsulated Database. | public void | update(Object object) Delegates updating a data object which is queried/loaded/created
in another transaction to the encapsulated Database. |
m_Database | protected Database m_Database(Code) | | |
CastorDatabase | public CastorDatabase()(Code) | | Simple and empty constructor, to create a lightweight
instance that serves only as factory object for "real"
instances.
|
begin | public void begin() throws PersistenceException(Code) | | Delegates beginning a new transaction to the encapsulated
Database. A transaction must be open in order
to query and persist objects.
throws: PersistenceException - A transaction is already open onthis database, or an error reported by the persistence engine |
close | public void close() throws PersistenceException(Code) | | Closes the database. If a client transaction is in progress the
transaction will be rolled back and an exception thrown.
If an app-server transaction is in progress, the transaction
will commit/rollback when triggered by the application server.
throws: PersistenceException - An error occured whileattempting to close the database |
commit | public void commit() throws TransactionNotInProgressException, TransactionAbortedException(Code) | | Delegates the commit method to the encapsulated
Database instance.
throws: TransactionNotInProgressException - Method called whiletransaction is not in progress. throws: TransactionAbortedException - The transaction cannotcommit and has been rolled back. |
create | public void create(Object object) throws ClassNotPersistenceCapableException, DuplicateIdentityException, TransactionNotInProgressException, PersistenceException(Code) | | Delegates creation of a new object in persistent storage to the
encapsulated Database. The object will only be persisted
if the transaction commits.
Parameters: object - The object to create throws: TransactionNotInProgressException - Method called whiletransaction is not in progress. throws: DuplicateIdentityException - An object with this identityalready exists in persistent storage throws: ClassNotPersistenceCapableException - The class is notpersistent capable. throws: PersistenceException - An error reported by thepersistence engine. |
getDatabase | public Database getDatabase()(Code) | | Returns the encapsulated Database instance.
the encapsulated database instance. |
getIdentity | public Object getIdentity(Object object)(Code) | | Delegates checking an object's identity to the encapsulated
Database.
Parameters: object - the object to be checked. the object's identity, or null if nonexistant. |
getOQLQuery | public OQLQuery getOQLQuery()(Code) | | Delegates creation of an OQL query with no statement.
OQLQuery.create must be called before the
query can be executed.
a new nonprepared OQL query. |
getOQLQuery | public OQLQuery getOQLQuery(String oql) throws QueryException(Code) | | Delegates creation of an OQL query from the
supplied statement.
Parameters: query - An OQL query statement An OQL query throws: QueryException - The query syntax is invalid |
isActive | public boolean isActive()(Code) | | Tests if a transaction is currently active.
true if a transaction is active, false otherwise. |
isAutoStore | public boolean isAutoStore()(Code) | | Delegates testing of the current transaction autoStore flag state
to the encapsulated Database.
true if autostoring is on, false otherwise. |
isClosed | public boolean isClosed()(Code) | | Tests if a database has been closed.
true if the database has been closed, false otherwise. |
isPersistent | public boolean isPersistent(Object object)(Code) | | Delegates testing of a given object's persistency state.
An object is persistent if it was created or queried
in this transaction. If the object was created or queried
in another transaction, or there is no open transaction,
this method returns null(??).
Parameters: object - the object to be tested. True if persistent in this transaction |
load | public Object load(Class type, Object identity) throws TransactionNotInProgressException, ObjectNotFoundException, LockNotGrantedException, PersistenceException(Code) | | Delegates loading of an object of the specified type and
given identity to the encapsulated Database.
Parameters: type - The object's type Parameters: identity - The object's identity throws: ObjectNotFoundException - No object of the given type andidentity was found in persistent storage. throws: LockNotGrantedException - Timeout or deadlock occuredattempting to acquire a lock on the object. throws: TransactionNotInProgressException - Method called whiletransaction is not in progress. throws: PersistenceException - An error reported by thepersistence engine. |
putQuery | public void putQuery(String identifier, OQLQuery query)(Code) | | |
remove | public void remove(Object object) throws ObjectNotPersistentException, LockNotGrantedException, TransactionNotInProgressException, PersistenceException(Code) | | Delegates removal of the object from persistent storage.
The deletion will take effect only if the transaction is committed,
but the object is no longer visible to queries in the current
transaction and locks for access from other transactions will
block until this transaction completes.
Parameters: object - The object to remove throws: TransactionNotInProgressException - Method called whiletransaction is not in progress. throws: ObjectNotPersistentException - The object has not beenqueried or created in this transaction. throws: LockNotGrantedException - Timeout or deadlock occuredattempting to acquire a lock on the object. throws: PersistenceException - An error reported by thepersistence engine. |
rollback | public void rollback() throws TransactionNotInProgressException(Code) | | Delegates the rollback method to the encapsulated
Database instance.
|
setAutoStore | public void setAutoStore(boolean autoStore)(Code) | | Delegates setting of the autoStore flag state
to the encapsulated Database.
Parameters: autoStore - true if on, false otherwise. |
update | public void update(Object object) throws ClassNotPersistenceCapableException, TransactionNotInProgressException, PersistenceException(Code) | | Delegates updating a data object which is queried/loaded/created
in another transaction to the encapsulated Database.
This method is used only for long transaction support.
Calling this method for data object queried/loaded/created
in the same transaction results in Exception.
Parameters: object - The object to create throws: TransactionNotInProgressException - Method called whiletransaction is not in progress. throws: ClassNotPersistenceCapableException - The class is notpersistent capable. throws: PersistenceException - An error reported by thepersistence engine. |
|
|