org.exolab.castor.jdo.engine

Class GlobalDatabaseImpl

Implemented Interfaces:
Synchronization, Database

public class GlobalDatabaseImpl
extends AbstractDatabaseImpl
implements Synchronization

An implementation of the JDO database supporting explicit transaction demarcation.
Version:
$Revision: 7127 $ $Date: 2006-04-10 16:39:24 -0600 (Mon, 10 Apr 2006) $
Author:
Werner Guttmann

Field Summary

Fields inherited from class org.exolab.castor.jdo.engine.AbstractDatabaseImpl

_autoStore, _callback, _classLoader, _ctx, _dbName, _instanceFactory, _lockTimeout, _scope

Fields inherited from interface org.exolab.castor.jdo.Database

DBLOCKED, DbLocked, EXCLUSIVE, Exclusive, READONLY, ReadOnly, SHARED, Shared

Constructor Summary

GlobalDatabaseImpl(String dbName, int lockTimeout, CallbackInterceptor callback, InstanceFactory instanceFactory, Transaction transaction, ClassLoader classLoader, boolean autoStore, boolean isPoolInUseForGlobalTransactions)
Creates an instance of this class.

Method Summary

void
afterCompletion(int status)
void
beforeCompletion()
void
begin()
void
close()
void
commit()
protected void
finalize()
Overrides Object.finalize().
Connection
getJdbcConnection()
void
rollback()
(package private) void
setTxMap(TxDatabaseMap txMap)

Methods inherited from class org.exolab.castor.jdo.engine.AbstractDatabaseImpl

begin, close, commit, create, getCacheManager, getClassLoader, getCurrentTransaction, getDatabaseName, getIdentity, getJdbcConnection, getLockEngine, getNamedQuery, getOQLQuery, getOQLQuery, getQuery, getScope, getTransaction, isActive, isAutoStore, isClosed, isLocked, isPersistent, load, load, load, loadSynchronizables, lock, registerSynchronizables, remove, rollback, setAutoStore, toString, unregisterSynchronizables, update

Constructor Details

GlobalDatabaseImpl

public GlobalDatabaseImpl(String dbName,
                          int lockTimeout,
                          CallbackInterceptor callback,
                          InstanceFactory instanceFactory,
                          Transaction transaction,
                          ClassLoader classLoader,
                          boolean autoStore,
                          boolean isPoolInUseForGlobalTransactions)
            throws DatabaseNotFoundException
Creates an instance of this class.
Parameters:
dbName - Database name.
lockTimeout - Lock timeout.
callback - Callback interceptors.
instanceFactory - Instance factory to use.
transaction - Current XA transaction.
classLoader - Current class loader.
autoStore - True if auto-storing is enabled.
isPoolInUseForGlobalTransactions - True if Database instanced should be cached.
Throws:
DatabaseNotFoundException - If the specified database cannot be found.

Method Details

afterCompletion

public void afterCompletion(int status)
See Also:
javax.transaction.Synchronization.afterCompletion(int)

beforeCompletion

public void beforeCompletion()

begin

public void begin()
            throws PersistenceException
Specified by:
begin in interface Database
Overrides:
begin in interface AbstractDatabaseImpl

close

public void close()
            throws PersistenceException
Specified by:
close in interface Database
Overrides:
close in interface AbstractDatabaseImpl

commit

public void commit()
            throws TransactionNotInProgressException,
                   TransactionAbortedException
Specified by:
commit in interface Database
Overrides:
commit in interface AbstractDatabaseImpl

finalize

protected void finalize()
            throws Throwable
Overrides Object.finalize(). Outputs a warning message to the logs if the current DatabaseImpl instance still has valid scope. In this condition - a condition that ideally should not occur at all - we close the instance as well to free up resources.
See Also:
java.lang.Object.finalize()

getJdbcConnection

public Connection getJdbcConnection()
            throws PersistenceException
Specified by:
getJdbcConnection in interface Database
Overrides:
getJdbcConnection in interface AbstractDatabaseImpl

rollback

public void rollback()
            throws TransactionNotInProgressException
Specified by:
rollback in interface Database
Overrides:
rollback in interface AbstractDatabaseImpl

setTxMap

(package private)  void setTxMap(TxDatabaseMap txMap)

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