org.exolab.castor.jdo.engine

Class LocalDatabaseImpl

Implemented Interfaces:
Database

public class LocalDatabaseImpl
extends AbstractDatabaseImpl

An implementation of the JDO Database interface supporting explicit local transaction demarcation.
Version:
$Revision: 6230 $ $Date: 2006-04-10 16:39:24 -0600 (Mon, 10 Apr 2006) $
Authors:
Assaf Arkin
Bruce Snyder
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, Exclusive, ReadOnly, Shared

Constructor Summary

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

Method Summary

void
begin()
void
close()
void
commit()
protected void
finalize()
Overrides Object.finalize().
Connection
getJdbcConnection()
void
rollback()

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

LocalDatabaseImpl

public LocalDatabaseImpl(String dbName,
                         int lockTimeout,
                         CallbackInterceptor callback,
                         InstanceFactory instanceFactory,
                         ClassLoader classLoader,
                         boolean autoStore)
            throws DatabaseNotFoundException
Creates an instance of this class.
Parameters:
dbName - database name
lockTimeout - Lock timeout
callback - Callback interceptor
instanceFactory - Instance factory.
classLoader - Current class loader
autoStore - Indicates whetehr to use 'auto-storing'
Throws:
DatabaseNotFoundException - If the specified database configuration cannot be found.

Method Details

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

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