|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--dtw.webmail.util.CastorDatabase
Abstract class that encapsulates a Database from the Castor lib, to enhance performance by adding the reuse of queries (which is perfectly possible).
Field Summary | |
protected org.exolab.castor.jdo.Database |
m_Database
|
protected java.util.HashMap |
m_Queries
|
Constructor Summary | |
CastorDatabase()
Simple and empty constructor, to create a lightweight instance that serves only as factory object for "real" instances. |
Method Summary | |
void |
begin()
Delegates beginning a new transaction to the encapsulated Database. |
void |
close()
Closes the database. |
void |
commit()
Delegates the commit method to the encapsulated Database instance. |
void |
create(java.lang.Object object)
Delegates creation of a new object in persistent storage to the encapsulated Database. |
abstract CastorDatabase |
createCastorDatabase()
|
org.exolab.castor.jdo.Database |
getDatabase()
Returns the encapsulated Database instance. |
java.lang.Object |
getIdentity(java.lang.Object object)
Delegates checking an object's identity to the encapsulated Database. |
org.exolab.castor.jdo.OQLQuery |
getOQLQuery()
Delegates creation of an OQL query with no statement. |
org.exolab.castor.jdo.OQLQuery |
getOQLQuery(java.lang.String oql)
Delegates creation of an OQL query from the supplied statement. |
org.exolab.castor.jdo.OQLQuery |
getQuery(java.lang.String identifier)
|
boolean |
isActive()
Tests if a transaction is currently active. |
boolean |
isAutoStore()
Delegates testing of the current transaction autoStore flag state to the encapsulated Database. |
boolean |
isClosed()
Tests if a database has been closed. |
boolean |
isPersistent(java.lang.Object object)
Delegates testing of a given object's persistency state. |
java.lang.Object |
load(java.lang.Class type,
java.lang.Object identity)
Delegates loading of an object of the specified type and given identity to the encapsulated Database. |
void |
putQuery(java.lang.String identifier,
org.exolab.castor.jdo.OQLQuery query)
|
void |
remove(java.lang.Object object)
Delegates removal of the object from persistent storage. |
void |
rollback()
Delegates the rollback method to the encapsulated Database instance. |
void |
setAutoStore(boolean autoStore)
Delegates setting of the autoStore flag state to the encapsulated Database. |
void |
update(java.lang.Object object)
Delegates updating a data object which is queried/loaded/created in another transaction to the encapsulated Database. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected org.exolab.castor.jdo.Database m_Database
protected java.util.HashMap m_Queries
Constructor Detail |
public CastorDatabase()
Method Detail |
public org.exolab.castor.jdo.OQLQuery getOQLQuery()
OQLQuery.create(java.lang.String)
must be called before the
query can be executed.
public org.exolab.castor.jdo.OQLQuery getOQLQuery(java.lang.String oql) throws org.exolab.castor.jdo.QueryException
org.exolab.castor.jdo.QueryException
- The query syntax is invalidpublic java.lang.Object load(java.lang.Class type, java.lang.Object identity) throws org.exolab.castor.jdo.TransactionNotInProgressException, org.exolab.castor.jdo.ObjectNotFoundException, org.exolab.castor.jdo.LockNotGrantedException, org.exolab.castor.jdo.PersistenceException
type
- The object's typeidentity
- The object's identity
org.exolab.castor.jdo.ObjectNotFoundException
- No object of the given type and
identity was found in persistent storage.
org.exolab.castor.jdo.LockNotGrantedException
- Timeout or deadlock occured
attempting to acquire a lock on the object.
org.exolab.castor.jdo.TransactionNotInProgressException
- Method called while
transaction is not in progress.
org.exolab.castor.jdo.PersistenceException
- An error reported by the
persistence engine.public void create(java.lang.Object object) throws org.exolab.castor.jdo.ClassNotPersistenceCapableException, org.exolab.castor.jdo.DuplicateIdentityException, org.exolab.castor.jdo.TransactionNotInProgressException, org.exolab.castor.jdo.PersistenceException
object
- The object to create
org.exolab.castor.jdo.TransactionNotInProgressException
- Method called while
transaction is not in progress.
org.exolab.castor.jdo.DuplicateIdentityException
- An object with this identity
already exists in persistent storage
org.exolab.castor.jdo.ClassNotPersistenceCapableException
- The class is not
persistent capable.
org.exolab.castor.jdo.PersistenceException
- An error reported by the
persistence engine.public void remove(java.lang.Object object) throws org.exolab.castor.jdo.ObjectNotPersistentException, org.exolab.castor.jdo.LockNotGrantedException, org.exolab.castor.jdo.TransactionNotInProgressException, org.exolab.castor.jdo.PersistenceException
object
- The object to remove
org.exolab.castor.jdo.TransactionNotInProgressException
- Method called while
transaction is not in progress.
org.exolab.castor.jdo.ObjectNotPersistentException
- The object has not been
queried or created in this transaction.
org.exolab.castor.jdo.LockNotGrantedException
- Timeout or deadlock occured
attempting to acquire a lock on the object.
org.exolab.castor.jdo.PersistenceException
- An error reported by the
persistence engine.public void update(java.lang.Object object) throws org.exolab.castor.jdo.ClassNotPersistenceCapableException, org.exolab.castor.jdo.TransactionNotInProgressException, org.exolab.castor.jdo.PersistenceException
object
- The object to create
org.exolab.castor.jdo.TransactionNotInProgressException
- Method called while
transaction is not in progress.
org.exolab.castor.jdo.ClassNotPersistenceCapableException
- The class is not
persistent capable.
org.exolab.castor.jdo.PersistenceException
- An error reported by the
persistence engine.public boolean isAutoStore()
public void setAutoStore(boolean autoStore)
autoStore
- true if on, false otherwise.public void begin() throws org.exolab.castor.jdo.PersistenceException
org.exolab.castor.jdo.PersistenceException
- A transaction is already open on
this database, or an error reported by the persistence enginepublic void rollback() throws org.exolab.castor.jdo.TransactionNotInProgressException
org.exolab.castor.jdo.TransactionNotInProgressException
public void commit() throws org.exolab.castor.jdo.TransactionNotInProgressException, org.exolab.castor.jdo.TransactionAbortedException
org.exolab.castor.jdo.TransactionNotInProgressException
- Method called while
transaction is not in progress.
org.exolab.castor.jdo.TransactionAbortedException
- The transaction cannot
commit and has been rolled back.public boolean isActive()
public boolean isClosed()
public void close() throws org.exolab.castor.jdo.PersistenceException
org.exolab.castor.jdo.PersistenceException
- An error occured while
attempting to close the databasepublic boolean isPersistent(java.lang.Object object)
object
- the object to be tested.
public java.lang.Object getIdentity(java.lang.Object object)
object
- the object to be checked.
public org.exolab.castor.jdo.Database getDatabase()
public org.exolab.castor.jdo.OQLQuery getQuery(java.lang.String identifier)
public void putQuery(java.lang.String identifier, org.exolab.castor.jdo.OQLQuery query)
public abstract CastorDatabase createCastorDatabase() throws JwmaException
JwmaException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |