org.exolab.castor.jdo.engine

Class DatabaseImpl

Implemented Interfaces:
Database, Synchronization

public class DatabaseImpl
extends java.lang.Object
implements Database, Synchronization

An implementation of the JDO database supporting explicit transaction demaracation.

Version:
$Revision: 1.1.1.1 $ $Date: 2003/03/03 07:08:16 $

Author:
Assaf Arkin

Field Summary

protected TransactionContext
_ctx
The transaction context is this database was accessed with an javax.transaction.xa.XAResource.
protected PersistenceInfoGroup
_scope
The database engine used to access the underlying SQL database.

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

DbLocked, Exclusive, ReadOnly, Shared

Constructor Summary

DatabaseImpl(String dbName, int lockTimeout, LogInterceptor logInterceptor, CallbackInterceptor callback, InstanceFactory instanceFactory, Transaction transaction, ClassLoader classLoader, boolean autoStore)

Method Summary

void
afterCompletion(int status)
void
beforeCompletion()
void
begin()
void
checkpoint()
Deprecated. Use commit() and rollback() instead
void
close()
void
commit()
void
create(Object object)
void
deletePersistent(Object object)
Deprecated.
protected void
finalize()
ClassLoader
getClassLoader()
Gets the current application ClassLoader's instance.
Object
getConnection()
Get the underlying JDBC Connection.
String
getDatabaseName()
} Return the name of the database
Object
getIdentity(Object object)
(package private) LockEngine
getLockEngine()
OQLQuery
getOQLQuery()
OQLQuery
getOQLQuery(String oql)
Query
getQuery()
PersistenceInfoGroup
getScope()
protected TransactionContext
getTransaction()
boolean
isActive()
boolean
isAutoStore()
boolean
isClosed()
boolean
isPersistent(Object object)
Object
load(Class type, Object identity)
Object
load(Class type, Object identity, Object object)
Object
load(Class type, Object identity, short accessMode)
Object
load(Class type, Complex identity)
Object
load(Class type, Complex identity, short accessMode)
void
lock(Object object)
void
makePersistent(Object object)
Deprecated.
void
remove(Object object)
void
rollback()
void
setAutoStore(boolean autoStore)
(package private) void
setTxMap(TxDatabaseMap txMap)
String
toString()
void
update(Object object)

Field Details

_ctx

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


_scope

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

Constructor Details

DatabaseImpl

public DatabaseImpl(String dbName,
                    int lockTimeout,
                    LogInterceptor logInterceptor,
                    CallbackInterceptor callback,
                    InstanceFactory instanceFactory,
                    Transaction transaction,
                    ClassLoader classLoader,
                    boolean autoStore)
            throws DatabaseNotFoundException

Method Details

afterCompletion

public void afterCompletion(int status)


beforeCompletion

public void beforeCompletion()


begin

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


checkpoint

public void checkpoint()
            throws TransactionNotInProgressException,
                   TransactionAbortedException

Deprecated. Use commit() and rollback() instead

Specified by:
checkpoint in interface Database


close

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


commit

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


create

public void create(Object object)
            throws ClassNotPersistenceCapableException,
                   DuplicateIdentityException,
                   TransactionNotInProgressException,
                   PersistenceException
Specified by:
create in interface Database


deletePersistent

public void deletePersistent(Object object)
            throws ObjectNotPersistentException,
                   LockNotGrantedException,
                   PersistenceException

Deprecated.

Specified by:
deletePersistent in interface Database


finalize

protected void finalize()
            throws Throwable


getClassLoader

public ClassLoader getClassLoader()
Gets the current application ClassLoader's instance. For use in OQLQueryImpl and TransactionContext.
Specified by:
getClassLoader in interface Database

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


getConnection

public Object getConnection()
            throws PersistenceException
Get the underlying JDBC Connection. Only for internal / advanced use ! Never try to close it (is done by castor).


getDatabaseName

public String getDatabaseName()
} Return the name of the database
Specified by:
getDatabaseName in interface Database


getIdentity

public Object getIdentity(Object object)
Specified by:
getIdentity in interface Database


getLockEngine

(package private)  LockEngine getLockEngine()


getOQLQuery

public OQLQuery getOQLQuery()
Specified by:
getOQLQuery in interface Database


getOQLQuery

public OQLQuery getOQLQuery(String oql)
            throws QueryException
Specified by:
getOQLQuery in interface Database


getQuery

public Query getQuery()
Specified by:
getQuery in interface Database


getScope

public PersistenceInfoGroup getScope()
Specified by:
getScope in interface Database


getTransaction

protected TransactionContext getTransaction()
            throws TransactionNotInProgressException


isActive

public boolean isActive()
Specified by:
isActive in interface Database


isAutoStore

public boolean isAutoStore()
Specified by:
isAutoStore in interface Database


isClosed

public boolean isClosed()
Specified by:
isClosed in interface Database


isPersistent

public boolean isPersistent(Object object)
Specified by:
isPersistent in interface Database


load

public Object load(Class type,
                   Object identity)
            throws ObjectNotFoundException,
                   LockNotGrantedException,
                   TransactionNotInProgressException,
                   PersistenceException
Specified by:
load in interface Database


load

public Object load(Class type,
                   Object identity,
                   Object object)
            throws TransactionNotInProgressException,
                   ObjectNotFoundException,
                   LockNotGrantedException,
                   PersistenceException
Specified by:
load in interface Database


load

public Object load(Class type,
                   Object identity,
                   short accessMode)
            throws ObjectNotFoundException,
                   LockNotGrantedException,
                   TransactionNotInProgressException,
                   PersistenceException
Specified by:
load in interface Database


load

public Object load(Class type,
                   Complex identity)
            throws TransactionNotInProgressException,
                   ObjectNotFoundException,
                   LockNotGrantedException,
                   PersistenceException
Specified by:
load in interface Database


load

public Object load(Class type,
                   Complex identity,
                   short accessMode)
            throws TransactionNotInProgressException,
                   ObjectNotFoundException,
                   LockNotGrantedException,
                   PersistenceException
Specified by:
load in interface Database


lock

public void lock(Object object)
            throws LockNotGrantedException,
                   ObjectNotPersistentException,
                   TransactionNotInProgressException,
                   PersistenceException
Specified by:
lock in interface Database


makePersistent

public void makePersistent(Object object)
            throws ClassNotPersistenceCapableException,
                   DuplicateIdentityException,
                   TransactionNotInProgressException,
                   PersistenceException

Deprecated.

Specified by:
makePersistent in interface Database


remove

public void remove(Object object)
            throws ObjectNotPersistentException,
                   LockNotGrantedException,
                   TransactionNotInProgressException,
                   PersistenceException
Specified by:
remove in interface Database


rollback

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


setAutoStore

public void setAutoStore(boolean autoStore)
Specified by:
setAutoStore in interface Database


setTxMap

(package private)  void setTxMap(TxDatabaseMap txMap)


toString

public String toString()


update

public void update(Object object)
            throws ClassNotPersistenceCapableException,
                   ObjectModifiedException,
                   TransactionNotInProgressException,
                   PersistenceException
Specified by:
update in interface Database


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