org.exolab.castor.jdo.engine

Class AbstractDatabaseImpl

public abstract class AbstractDatabaseImpl extends Object implements Database

An implementation of the JDO database supporting explicit transaction demarcation.

Version: $Revision: 6230 $ $Date: 2006-04-22 11:05:30 -0600 (Sat, 22 Apr 2006) $

Author: Assaf Arkin Bruce Snyder

Field Summary
protected boolean_autoStore
True if user prefer all reachable object to be stored automatically.
protected CallbackInterceptor_callback
The default callback interceptor for transaction
protected ClassLoader_classLoader
The class loader for application classes (may be null).
protected TransactionContext_ctx
The transaction context is this database was accessed with an javax.transaction.xa.XAResource.
protected String_dbName
The name of this database.
protected InstanceFactory_instanceFactory
The instance factory to that creates new instances of data object
protected int_lockTimeout
The lock timeout for this database.
protected PersistenceInfoGroup_scope
The database engine used to access the underlying SQL database.
Constructor Summary
AbstractDatabaseImpl(String dbName, int lockTimeout, CallbackInterceptor callback, InstanceFactory instanceFactory, ClassLoader classLoader, boolean autoStore)
Creates an instance of this class
Method Summary
abstract voidbegin()
abstract voidclose()
abstract voidcommit()
voidcreate(Object object)
CacheManagergetCacheManager()
ClassLoadergetClassLoader()
Gets the current application ClassLoader's instance.
TransactionContextgetCurrentTransaction()
Gets the current Castor transaction in use.
StringgetDatabaseName()
Return the name of the database
IdentitygetIdentity(Object object)
abstract ConnectiongetJdbcConnection()
LockEnginegetLockEngine()
Returns the LockEngine in use by this database instance.
OQLQuerygetNamedQuery(String name)
OQLQuerygetOQLQuery()
OQLQuerygetOQLQuery(String oql)
QuerygetQuery()
PersistenceInfoGroupgetScope()
protected TransactionContextgetTransaction()
Returns the currently active transaction, if any.
booleanisActive()
booleanisAutoStore()
Return if the current transaction is set to autoStore, it there is transaction active.
booleanisClosed()
booleanisLocked(Class cls, Object identity)
booleanisPersistent(Object object)
Objectload(Class type, Object identity)
Objectload(Class type, Object identity, Object object)
Objectload(Class type, Object identity, AccessMode mode)
protected voidloadSynchronizables()
Load the TxSynchronizable implementations from the properties file, if not loaded before.
voidlock(Object object)
protected voidregisterSynchronizables()
Register the TxSynchronizable implementations at the TransactionContect at end of begin().
voidremove(Object object)
abstract voidrollback()
voidsetAutoStore(boolean autoStore)
Indicates whether user prefer all reachable object to be stored automatically; false if user wants dependent object only to be stored.
StringtoString()
protected voidunregisterSynchronizables()
Unregister the TxSynchronizable implementations at the TransactionContect after commit() or rollback().
voidupdate(Object object)

Field Detail

_autoStore

protected boolean _autoStore
True if user prefer all reachable object to be stored automatically. False if user want only dependent object to be stored.

_callback

protected CallbackInterceptor _callback
The default callback interceptor for transaction

_classLoader

protected ClassLoader _classLoader
The class loader for application classes (may be null).

_ctx

protected TransactionContext _ctx
The transaction context is this database was accessed with an javax.transaction.xa.XAResource.

_dbName

protected String _dbName
The name of this database.

_instanceFactory

protected InstanceFactory _instanceFactory
The instance factory to that creates new instances of data object

_lockTimeout

protected int _lockTimeout
The lock timeout for this database. Zero for immediate timeout, an infinite value for no timeout. The timeout is specified in seconds.

_scope

protected PersistenceInfoGroup _scope
The database engine used to access the underlying SQL database.

Constructor Detail

AbstractDatabaseImpl

public AbstractDatabaseImpl(String dbName, int lockTimeout, CallbackInterceptor callback, InstanceFactory instanceFactory, ClassLoader classLoader, boolean autoStore)
Creates an instance of this class

Parameters: dbName Name of the database. lockTimeout Lock timeout to use callback Callback interceptors instanceFactory Instance factory classLoader Current class loader. autoStore True if auto storing is enabled.

Throws: DatabaseNotFoundException If there's no database configuration for the given name.

Method Detail

begin

public abstract void begin()

See Also: begin

UNKNOWN:

close

public abstract void close()

See Also: close

UNKNOWN:

commit

public abstract void commit()

See Also: commit

UNKNOWN:

create

public void create(Object object)

See Also: Database

UNKNOWN:

getCacheManager

public CacheManager getCacheManager()

See Also: getCacheManager

UNKNOWN:

getClassLoader

public ClassLoader getClassLoader()
Gets the current application ClassLoader's instance.

Returns: the current ClassLoader's instance, or null if not provided

getCurrentTransaction

public TransactionContext getCurrentTransaction()
Gets the current Castor transaction in use.

Returns: the current Castor

Throws: TransactionNotInProgressException If there's no transaction in progress.

getDatabaseName

public String getDatabaseName()
Return the name of the database

Returns: Name of the database.

getIdentity

public Identity getIdentity(Object object)

See Also: Database

UNKNOWN:

getJdbcConnection

public abstract Connection getJdbcConnection()

See Also: getJdbcConnection

UNKNOWN:

getLockEngine

LockEngine getLockEngine()
Returns the LockEngine in use by this database instance.

Returns: the LockEngine in use by this database instance.

getNamedQuery

public OQLQuery getNamedQuery(String name)

See Also: Database

UNKNOWN:

getOQLQuery

public OQLQuery getOQLQuery()

See Also: getOQLQuery

UNKNOWN:

getOQLQuery

public OQLQuery getOQLQuery(String oql)

See Also: Database

UNKNOWN:

getQuery

public Query getQuery()

See Also: getQuery

UNKNOWN:

getScope

public PersistenceInfoGroup getScope()

See Also: getScope

UNKNOWN:

getTransaction

protected TransactionContext getTransaction()
Returns the currently active transaction, if any.

Returns: The current active transaction.

Throws: TransactionNotInProgressException If there's no active transaction.

isActive

public boolean isActive()

See Also: isActive

UNKNOWN:

isAutoStore

public boolean isAutoStore()
Return if the current transaction is set to autoStore, it there is transaction active. If there is no active transaction, return if the next transaction will be set to autoStore.

Returns: True if 'auto-store' mode is in use.

isClosed

public boolean isClosed()

See Also: isClosed

UNKNOWN:

isLocked

public boolean isLocked(Class cls, Object identity)

See Also: Database

UNKNOWN:

isPersistent

public boolean isPersistent(Object object)

See Also: Database

UNKNOWN:

load

public Object load(Class type, Object identity)

See Also: {@inheritDoc }

load

public Object load(Class type, Object identity, Object object)

See Also: {@inheritDoc }

load

public Object load(Class type, Object identity, AccessMode mode)

See Also: {@inheritDoc }

loadSynchronizables

protected void loadSynchronizables()
Load the TxSynchronizable implementations from the properties file, if not loaded before.

lock

public void lock(Object object)

See Also: Database

UNKNOWN:

registerSynchronizables

protected void registerSynchronizables()
Register the TxSynchronizable implementations at the TransactionContect at end of begin().

remove

public void remove(Object object)

See Also: Database

UNKNOWN:

rollback

public abstract void rollback()

See Also: rollback

UNKNOWN:

setAutoStore

public void setAutoStore(boolean autoStore)
Indicates whether user prefer all reachable object to be stored automatically; false if user wants dependent object only to be stored.

Parameters: autoStore True to indicate that 'autoStore' mode should be used.

toString

public String toString()

See Also: java.lang.Object#toString()

UNKNOWN:

unregisterSynchronizables

protected void unregisterSynchronizables()
Unregister the TxSynchronizable implementations at the TransactionContect after commit() or rollback().

update

public void update(Object object)

See Also: Database

UNKNOWN:

Intalio Inc. (C) 1999-2006. All rights reserved http://www.intalio.com