net.ontopia.persistence.proxy
Class AbstractTransaction

java.lang.Object
  extended by net.ontopia.persistence.proxy.AbstractTransaction
All Implemented Interfaces:
TransactionIF
Direct Known Subclasses:
ROTransaction, RWTransaction

public abstract class AbstractTransaction
extends java.lang.Object
implements TransactionIF

INTERNAL: The default proxy transaction implementation.


Field Summary
protected  StorageAccessIF access
           
protected  boolean debug
           
protected  java.lang.String id
           
protected  LookupIndexIF identity_map
           
protected  boolean isactive
           
protected  boolean isclosed
           
protected  java.util.Map lru
           
protected  int lrusize
           
protected  ObjectRelationalMappingIF mapping
           
protected  ObjectAccessIF oaccess
           
protected  java.util.Map querymap
           
protected  AccessRegistrarIF registrar
           
protected  long timestamp
           
protected  StorageCacheIF txncache
           
 
Method Summary
 PersistentIF _getObject(IdentityIF identity)
          EXPERIMENTAL: ...
 void abort()
          INTERNAL: Aborts the changes performed in the transaction.
 void begin()
          INTERNAL: Begins a new transaction.
 void close()
          INTERNAL: Releases all resources used by the transaction.
 void commit()
          INTERNAL: Commits the changes performed in the transaction.
protected  PersistentIF createInstance(IdentityIF identity)
           
 QueryIF createQuery(JDOQuery jdoquery, boolean resolve_identities)
          INTERNAL: Build a QueryIF from the specified JDO query instance.
 java.lang.Object executeQuery(java.lang.String name, java.lang.Object[] params)
          INTERNAL: Executes the named query.
protected  java.util.Collection extractFieldValues(java.lang.Object type, int field, java.util.Collection identities)
           
protected  java.util.Collection extractNonDirty(java.util.Collection identities)
           
abstract  void flush()
          INTERNAL: Stores all pending changes in the data repository.
 AccessRegistrarIF getAccessRegistrar()
          INTERNAL: Gets the access registrar used by the transaction.
 java.lang.String getId()
          INTERNAL: Gets the transaction id.
 PersistentIF getObject(IdentityIF identity)
          INTERNAL: Gets the object instance with the given identity.
 PersistentIF getObject(IdentityIF identity, boolean acceptDeleted)
          INTERNAL: Gets the object instance with the given identity.
 ObjectAccessIF getObjectAccess()
          INTERNAL: Gets the object access used by the transaction.
protected  QueryIF getQuery(java.lang.String name)
           
 StorageAccessIF getStorageAccess()
          INTERNAL: Gets the storage access used by the transaction.
 boolean isActive()
          INTERNAL: Returns true the transaction is active.
 boolean isFieldLoaded(IdentityIF identity, int field)
          EXPERIMENTAL:
 boolean isObjectLoaded(IdentityIF identity)
          EXPERIMENTAL:
 java.lang.Object loadField(IdentityIF identity, int field)
          INTERNAL: Called by PersistentIFs when the value of the specified field is requested.
 void prefetch(java.lang.Object type, int[] fields, boolean[] traverse, java.util.Collection identities)
           
 void prefetch(java.lang.Object type, int field, boolean traverse, java.util.Collection identities)
           
protected  void registerQuery(java.lang.String name, QueryIF query)
           
 java.lang.String toString()
           
protected abstract  void transactionPostAbort()
           
protected abstract  void transactionPostCommit()
           
protected abstract  void transactionPreAbort()
           
protected abstract  void transactionPreCommit()
           
 boolean validate()
          INTERNAL: Returns true if the transaction is valid.
 void writeIdentityMap(java.io.Writer out, boolean dump)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.ontopia.persistence.proxy.TransactionIF
assignIdentity, create, delete, isClean, isObjectClean, isReadOnly, objectCreated, objectDeleted, objectDirty, objectRead
 

Field Detail

debug

protected boolean debug

isactive

protected boolean isactive

isclosed

protected boolean isclosed

id

protected java.lang.String id

access

protected StorageAccessIF access

txncache

protected StorageCacheIF txncache

registrar

protected AccessRegistrarIF registrar

oaccess

protected ObjectAccessIF oaccess

mapping

protected ObjectRelationalMappingIF mapping

identity_map

protected LookupIndexIF identity_map

lru

protected java.util.Map lru

lrusize

protected int lrusize

querymap

protected java.util.Map querymap

timestamp

protected long timestamp
Method Detail

getId

public java.lang.String getId()
Description copied from interface: TransactionIF
INTERNAL: Gets the transaction id. This id is unique for a given StorageIF instance.

Specified by:
getId in interface TransactionIF

getStorageAccess

public StorageAccessIF getStorageAccess()
Description copied from interface: TransactionIF
INTERNAL: Gets the storage access used by the transaction.

Specified by:
getStorageAccess in interface TransactionIF

isActive

public boolean isActive()
Description copied from interface: TransactionIF
INTERNAL: Returns true the transaction is active.

Specified by:
isActive in interface TransactionIF

validate

public boolean validate()
Description copied from interface: TransactionIF
INTERNAL: Returns true if the transaction is valid.

Specified by:
validate in interface TransactionIF

begin

public void begin()
Description copied from interface: TransactionIF
INTERNAL: Begins a new transaction.

Specified by:
begin in interface TransactionIF

commit

public void commit()
Description copied from interface: TransactionIF
INTERNAL: Commits the changes performed in the transaction.

Specified by:
commit in interface TransactionIF

abort

public void abort()
Description copied from interface: TransactionIF
INTERNAL: Aborts the changes performed in the transaction.

Specified by:
abort in interface TransactionIF

close

public void close()
Description copied from interface: TransactionIF
INTERNAL: Releases all resources used by the transaction.

Specified by:
close in interface TransactionIF

flush

public abstract void flush()
Description copied from interface: TransactionIF
INTERNAL: Stores all pending changes in the data repository. Note that the transaction is not commited.

Specified by:
flush in interface TransactionIF

transactionPreCommit

protected abstract void transactionPreCommit()

transactionPostCommit

protected abstract void transactionPostCommit()

transactionPreAbort

protected abstract void transactionPreAbort()

transactionPostAbort

protected abstract void transactionPostAbort()

getObjectAccess

public ObjectAccessIF getObjectAccess()
Description copied from interface: TransactionIF
INTERNAL: Gets the object access used by the transaction.

Specified by:
getObjectAccess in interface TransactionIF

getAccessRegistrar

public AccessRegistrarIF getAccessRegistrar()
Description copied from interface: TransactionIF
INTERNAL: Gets the access registrar used by the transaction.

Specified by:
getAccessRegistrar in interface TransactionIF

isObjectLoaded

public boolean isObjectLoaded(IdentityIF identity)
Description copied from interface: TransactionIF
EXPERIMENTAL:

Specified by:
isObjectLoaded in interface TransactionIF

isFieldLoaded

public boolean isFieldLoaded(IdentityIF identity,
                             int field)
Description copied from interface: TransactionIF
EXPERIMENTAL:

Specified by:
isFieldLoaded in interface TransactionIF

loadField

public java.lang.Object loadField(IdentityIF identity,
                                  int field)
Description copied from interface: TransactionIF
INTERNAL: Called by PersistentIFs when the value of the specified field is requested. Note that the persistent object will be notified through the _p_setValue method, so there is usually no need to use the return value to set the instance member.

Specified by:
loadField in interface TransactionIF
Returns:
the field value that was loaded.

getObject

public PersistentIF getObject(IdentityIF identity)
Description copied from interface: TransactionIF
INTERNAL: Gets the object instance with the given identity. If the identity is known not to exist in the data repository an exception will be thrown. Deleted objects will not be returned from this method.

Specified by:
getObject in interface TransactionIF

getObject

public PersistentIF getObject(IdentityIF identity,
                              boolean acceptDeleted)
Description copied from interface: TransactionIF
INTERNAL: Gets the object instance with the given identity. If the identity is known not to exist in the data repository an exception will be thrown. Known and still existing object instances of deleted objects will be returned from this method if the acceptDeleted flag is true.

Specified by:
getObject in interface TransactionIF

_getObject

public PersistentIF _getObject(IdentityIF identity)
Description copied from interface: TransactionIF
EXPERIMENTAL: ...

Specified by:
_getObject in interface TransactionIF

createInstance

protected PersistentIF createInstance(IdentityIF identity)

prefetch

public void prefetch(java.lang.Object type,
                     int field,
                     boolean traverse,
                     java.util.Collection identities)
Specified by:
prefetch in interface TransactionIF

prefetch

public void prefetch(java.lang.Object type,
                     int[] fields,
                     boolean[] traverse,
                     java.util.Collection identities)
Specified by:
prefetch in interface TransactionIF

extractNonDirty

protected java.util.Collection extractNonDirty(java.util.Collection identities)

extractFieldValues

protected java.util.Collection extractFieldValues(java.lang.Object type,
                                                  int field,
                                                  java.util.Collection identities)

executeQuery

public java.lang.Object executeQuery(java.lang.String name,
                                     java.lang.Object[] params)
Description copied from interface: TransactionIF
INTERNAL: Executes the named query. The parameters given in the params parameter are used during the execution of the query.

Specified by:
executeQuery in interface TransactionIF

createQuery

public QueryIF createQuery(JDOQuery jdoquery,
                           boolean resolve_identities)
Description copied from interface: TransactionIF
INTERNAL: Build a QueryIF from the specified JDO query instance.

Specified by:
createQuery in interface TransactionIF

getQuery

protected QueryIF getQuery(java.lang.String name)

registerQuery

protected void registerQuery(java.lang.String name,
                             QueryIF query)

writeIdentityMap

public void writeIdentityMap(java.io.Writer out,
                             boolean dump)
                      throws java.io.IOException
Throws:
java.io.IOException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2000-2012 Ontopia.