Package net.ontopia.persistence.proxy
Class AbstractTransaction
- java.lang.Object
-
- net.ontopia.persistence.proxy.AbstractTransaction
-
- All Implemented Interfaces:
TransactionIF
- Direct Known Subclasses:
ROTransaction,RWTransaction
public abstract class AbstractTransaction extends Object implements TransactionIF
INTERNAL: The default proxy transaction implementation.
-
-
Field Summary
Fields Modifier and Type Field Description protected StorageAccessIFaccessprotected booleandebugprotected Stringidprotected Map<IdentityIF,PersistentIF>identity_mapprotected booleanisabortedprotected booleanisactiveprotected booleanisclosedprotected Map<IdentityIF,PersistentIF>lruprotected intlrusizeprotected ObjectRelationalMappingIFmappingprotected ObjectAccessIFoaccessprotected Map<String,QueryIF>querymapprotected AccessRegistrarIFregistrarprotected longtimestampprotected StorageCacheIFtxncache
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description PersistentIF_getObject(IdentityIF identity)EXPERIMENTAL: ...voidabort()INTERNAL: Aborts the changes performed in the transaction.voidbegin()INTERNAL: Begins a new transaction.protected PersistentIFcheckIdentityMap(IdentityIF identity)protected PersistentIFcheckIdentityMapAndCreateInstance(IdentityIF identity)protected PersistentIFcheckIdentityMapNoLRU(IdentityIF identity)voidclose()INTERNAL: Releases all resources used by the transaction.voidcommit()INTERNAL: Commits the changes performed in the transaction.protected PersistentIFcreateInstance(IdentityIF identity)QueryIFcreateQuery(JDOQuery jdoquery, boolean resolve_identities)INTERNAL: Build a QueryIF from the specified JDO query instance.ObjectexecuteQuery(String name, Object[] params)INTERNAL: Executes the named query.protected CollectionextractFieldValues(Object type, int field, Collection<IdentityIF> identities)protected Collection<IdentityIF>extractNonDirty(Collection<IdentityIF> identities)abstract voidflush()INTERNAL: Stores all pending changes in the data repository.AccessRegistrarIFgetAccessRegistrar()INTERNAL: Gets the access registrar used by the transaction.StringgetId()INTERNAL: Gets the transaction id.PersistentIFgetObject(IdentityIF identity)INTERNAL: Gets the object instance with the given identity.PersistentIFgetObject(IdentityIF identity, boolean acceptDeleted)INTERNAL: Gets the object instance with the given identity.ObjectAccessIFgetObjectAccess()INTERNAL: Gets the object access used by the transaction.protected QueryIFgetQuery(String name)StorageAccessIFgetStorageAccess()INTERNAL: Gets the storage access used by the transaction.booleanisActive()INTERNAL: Returns true the transaction is active.booleanisFieldLoaded(IdentityIF identity, int field)EXPERIMENTAL:booleanisObjectLoaded(IdentityIF identity)EXPERIMENTAL:<F> FloadField(IdentityIF identity, int field)INTERNAL: Called by PersistentIFs when the value of the specified field is requested.voidobjectMerged(IdentityIF source, IdentityIF target)INTERNAL: Called by other transactions to notify this transaction of committed merges.voidprefetch(Class<?> type, int[] fields, boolean[] traverse, Collection<IdentityIF> identities)voidprefetch(Class<?> type, int field, boolean traverse, Collection<IdentityIF> identities)protected voidregisterQuery(String name, QueryIF query)protected PersistentIFremoveIdentityMapNoLRU(IdentityIF identity)StringtoString()protected abstract voidtransactionPostAbort()protected abstract voidtransactionPostCommit()protected abstract voidtransactionPreAbort()protected abstract voidtransactionPreCommit()booleanvalidate()INTERNAL: Returns true if the transaction is valid.voidwriteIdentityMap(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
-
isaborted
protected boolean isaborted
-
id
protected 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 final Map<IdentityIF,PersistentIF> identity_map
-
lru
protected Map<IdentityIF,PersistentIF> lru
-
lrusize
protected int lrusize
-
timestamp
protected long timestamp
-
-
Method Detail
-
getId
public String getId()
Description copied from interface:TransactionIFINTERNAL: Gets the transaction id. This id is unique for a given StorageIF instance.- Specified by:
getIdin interfaceTransactionIF
-
getStorageAccess
public StorageAccessIF getStorageAccess()
Description copied from interface:TransactionIFINTERNAL: Gets the storage access used by the transaction.- Specified by:
getStorageAccessin interfaceTransactionIF
-
isActive
public boolean isActive()
Description copied from interface:TransactionIFINTERNAL: Returns true the transaction is active.- Specified by:
isActivein interfaceTransactionIF
-
validate
public boolean validate()
Description copied from interface:TransactionIFINTERNAL: Returns true if the transaction is valid.- Specified by:
validatein interfaceTransactionIF
-
begin
public void begin()
Description copied from interface:TransactionIFINTERNAL: Begins a new transaction.- Specified by:
beginin interfaceTransactionIF
-
commit
public void commit()
Description copied from interface:TransactionIFINTERNAL: Commits the changes performed in the transaction.- Specified by:
commitin interfaceTransactionIF
-
abort
public void abort()
Description copied from interface:TransactionIFINTERNAL: Aborts the changes performed in the transaction.- Specified by:
abortin interfaceTransactionIF
-
close
public void close()
Description copied from interface:TransactionIFINTERNAL: Releases all resources used by the transaction.- Specified by:
closein interfaceTransactionIF
-
flush
public abstract void flush()
Description copied from interface:TransactionIFINTERNAL: Stores all pending changes in the data repository. Note that the transaction is not commited.- Specified by:
flushin interfaceTransactionIF
-
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:TransactionIFINTERNAL: Gets the object access used by the transaction.- Specified by:
getObjectAccessin interfaceTransactionIF
-
getAccessRegistrar
public AccessRegistrarIF getAccessRegistrar()
Description copied from interface:TransactionIFINTERNAL: Gets the access registrar used by the transaction.- Specified by:
getAccessRegistrarin interfaceTransactionIF
-
isObjectLoaded
public boolean isObjectLoaded(IdentityIF identity)
Description copied from interface:TransactionIFEXPERIMENTAL:- Specified by:
isObjectLoadedin interfaceTransactionIF
-
isFieldLoaded
public boolean isFieldLoaded(IdentityIF identity, int field)
Description copied from interface:TransactionIFEXPERIMENTAL:- Specified by:
isFieldLoadedin interfaceTransactionIF
-
loadField
public <F> F loadField(IdentityIF identity, int field)
Description copied from interface:TransactionIFINTERNAL: 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:
loadFieldin interfaceTransactionIF- Returns:
- the field value that was loaded.
-
objectMerged
public void objectMerged(IdentityIF source, IdentityIF target)
INTERNAL: Called by other transactions to notify this transaction of committed merges. Default implementation is empty.- Parameters:
source- The identity of the object merged into targettarget- The identity of the target object that was merged- Since:
- 5.4.0
-
getObject
public PersistentIF getObject(IdentityIF identity)
Description copied from interface:TransactionIFINTERNAL: 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:
getObjectin interfaceTransactionIF
-
getObject
public PersistentIF getObject(IdentityIF identity, boolean acceptDeleted)
Description copied from interface:TransactionIFINTERNAL: 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:
getObjectin interfaceTransactionIF
-
_getObject
public PersistentIF _getObject(IdentityIF identity)
Description copied from interface:TransactionIFEXPERIMENTAL: ...- Specified by:
_getObjectin interfaceTransactionIF
-
checkIdentityMapAndCreateInstance
protected PersistentIF checkIdentityMapAndCreateInstance(IdentityIF identity)
-
checkIdentityMapNoLRU
protected PersistentIF checkIdentityMapNoLRU(IdentityIF identity)
-
removeIdentityMapNoLRU
protected PersistentIF removeIdentityMapNoLRU(IdentityIF identity)
-
checkIdentityMap
protected PersistentIF checkIdentityMap(IdentityIF identity)
-
createInstance
protected PersistentIF createInstance(IdentityIF identity)
-
prefetch
public void prefetch(Class<?> type, int field, boolean traverse, Collection<IdentityIF> identities)
- Specified by:
prefetchin interfaceTransactionIF
-
prefetch
public void prefetch(Class<?> type, int[] fields, boolean[] traverse, Collection<IdentityIF> identities)
- Specified by:
prefetchin interfaceTransactionIF
-
extractNonDirty
protected Collection<IdentityIF> extractNonDirty(Collection<IdentityIF> identities)
-
extractFieldValues
protected Collection extractFieldValues(Object type, int field, Collection<IdentityIF> identities)
-
executeQuery
public Object executeQuery(String name, Object[] params)
Description copied from interface:TransactionIFINTERNAL: Executes the named query. The parameters given in the params parameter are used during the execution of the query.- Specified by:
executeQueryin interfaceTransactionIF
-
createQuery
public QueryIF createQuery(JDOQuery jdoquery, boolean resolve_identities)
Description copied from interface:TransactionIFINTERNAL: Build a QueryIF from the specified JDO query instance.- Specified by:
createQueryin interfaceTransactionIF
-
writeIdentityMap
public void writeIdentityMap(Writer out, boolean dump) throws IOException
- Throws:
IOException
-
-