|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.openjpa.kernel.DelegatingBroker
public class DelegatingBroker
Delegating broker that can also perform exception translation for use in facades.
Field Summary |
---|
Fields inherited from interface org.apache.openjpa.kernel.StoreContext |
---|
EXCLUDE_ALL, OID_ALLOW_NEW, OID_COPY, OID_NODELETED, OID_NOVALIDATE |
Fields inherited from interface org.apache.openjpa.kernel.ConnectionRetainModes |
---|
CONN_RETAIN_ALWAYS, CONN_RETAIN_DEMAND, CONN_RETAIN_TRANS |
Fields inherited from interface org.apache.openjpa.kernel.DetachState |
---|
DETACH_ALL, DETACH_FETCH_GROUPS, DETACH_FGS, DETACH_LOADED |
Fields inherited from interface org.apache.openjpa.kernel.LockLevels |
---|
LOCK_NONE, LOCK_READ, LOCK_WRITE |
Fields inherited from interface org.apache.openjpa.kernel.RestoreState |
---|
RESTORE_ALL, RESTORE_IMMUTABLE, RESTORE_NONE |
Fields inherited from interface org.apache.openjpa.kernel.AutoClear |
---|
CLEAR_ALL, CLEAR_DATASTORE |
Fields inherited from interface org.apache.openjpa.kernel.AutoDetach |
---|
DETACH_CLOSE, DETACH_COMMIT, DETACH_NONTXREAD, DETACH_ROLLBACK |
Fields inherited from interface org.apache.openjpa.event.CallbackModes |
---|
CALLBACK_FAIL_FAST, CALLBACK_IGNORE, CALLBACK_LOG, CALLBACK_RETHROW, CALLBACK_ROLLBACK |
Constructor Summary | |
---|---|
DelegatingBroker(Broker broker)
Constructor; supply delegate. |
|
DelegatingBroker(Broker broker,
RuntimeExceptionTranslator trans)
Constructor; supply delegate and exception translator. |
Method Summary | |
---|---|
void |
addLifecycleListener(Object listener,
Class[] classes)
Register a listener for lifecycle-related events on the specified classes. |
void |
addTransactionListener(Object listener)
Register a listener for transaction-related events. |
void |
afterCompletion(int status)
|
void |
assertActiveTransaction()
Throw an exception if there is no active transaction. |
void |
assertNontransactionalRead()
Throw an exception if there is no transaction active and nontransactional reading is not enabled. |
void |
assertOpen()
Throw an exception if this broker has been closed. |
void |
assertWriteOperation()
Throw an exception if a write operation is not permitted (there is no active transaction and nontransactional writing is not enabled). |
Object |
attach(Object obj,
boolean copyNew,
OpCallbacks call)
Import the specified detached object into the broker. |
Object[] |
attachAll(Collection objs,
boolean copyNew,
OpCallbacks call)
Import the specified objects into the broker. |
void |
beforeCompletion()
|
void |
begin()
Begin a transaction. |
boolean |
beginOperation(boolean read)
Begin a logical operation. |
void |
beginStore()
Begin a data store transaction. |
boolean |
cancelAll()
Cancel all pending data store statements. |
void |
close()
Close the broker. |
void |
commit()
Commit the current transaction. |
void |
commitAndResume()
Issue a commit and then start a new transaction. |
void |
delete(Object obj,
OpCallbacks call)
Delete the given object. |
void |
deleteAll(Collection objs,
OpCallbacks call)
Delete the given objects. |
Object |
detach(Object obj,
OpCallbacks call)
Detach the specified object from the broker. |
Object[] |
detachAll(Collection objs,
OpCallbacks call)
Detach the specified objects from the broker. |
void |
detachAll(OpCallbacks call)
Detach all objects in place. |
void |
detachAll(OpCallbacks call,
boolean flush)
Detach all objects in place, with the option of performing a flush before doing the detachment. |
void |
dirtyType(Class cls)
Mark the given class as dirty within the current transaction. |
OpenJPAStateManager |
embed(Object obj,
Object id,
OpenJPAStateManager owner,
ValueMetaData ownerMeta)
Make the given instance embedded. |
boolean |
endOperation()
End a logical operation. |
boolean |
equals(Object other)
|
void |
evict(Object obj,
OpCallbacks call)
Evict the given object. |
void |
evictAll(Collection objs,
OpCallbacks call)
Evict the given objects. |
void |
evictAll(Extent extent,
OpCallbacks call)
Evict all persistent-clean and persistent-nontransactional instances in the given Extent . |
void |
evictAll(OpCallbacks call)
Evict all clean objects. |
Iterator |
extentIterator(Class cls,
boolean subs,
FetchConfiguration fetch,
boolean ignoreChanges)
Return an iterator over all instances of the given type. |
Object |
find(Object oid,
boolean validate,
FindCallbacks call)
Find the persistence object with the given oid. |
Object |
find(Object oid,
FetchConfiguration fetch,
BitSet exclude,
Object edata,
int flags)
Return the object with the given oid. |
Object[] |
findAll(Collection oids,
boolean validate,
FindCallbacks call)
Return the objects with the given oids. |
Object[] |
findAll(Collection oids,
FetchConfiguration fetch,
BitSet exclude,
Object edata,
int flags)
Return the objects with the given oids. |
Object |
findCached(Object oid,
FindCallbacks call)
Return the cached instance for the given oid/object, or null if not cached. |
void |
flush()
Flush all transactional instances to the data store. |
int |
getAutoClear()
Whether objects clear when entering transactions. |
int |
getAutoDetach()
Bit flags marked in AutoDetach which indicate when persistent
managed objects should be automatically detached in-place. |
Broker |
getBroker()
Return the broker for this context, if possible. |
BrokerFactory |
getBrokerFactory()
Return the factory that produced this broker. |
ClassLoader |
getClassLoader()
Return the current thread's class loader at the time this context was obtained. |
OpenJPAConfiguration |
getConfiguration()
Return the configuration associated with this context. |
Object |
getConnection()
Return the connection in use by the context, or a new connection if none. |
String |
getConnectionPassword()
Return the connection password. |
int |
getConnectionRetainMode()
Return the connection retain mode for this broker. |
String |
getConnectionUserName()
Return the connection user name. |
Broker |
getDelegate()
Return the direct delegate. |
Collection |
getDeletedTypes()
Return the set of classes that have been deleted in the current transaction. |
int |
getDetachState()
Detach mode constant to determine which fields are part of the detached graph. |
Collection |
getDirtyObjects()
Return a list of current dirty instances. |
boolean |
getEvictFromDataCache()
Whether to also evict an object from the store cache when it is evicted through this broker. |
FetchConfiguration |
getFetchConfiguration()
Return the (mutable) fetch configuration for loading objects from this context. |
Seq |
getIdentitySequence(ClassMetaData meta)
Returns a Seq for the datastore identity values of the
specified persistent class, or null if the class' identity cannot be
represented as a sequence. |
boolean |
getIgnoreChanges()
Whether to take into account changes in the transaction when executing a query or iterating an extent. |
Broker |
getInnermostDelegate()
Return the native delegate. |
InverseManager |
getInverseManager()
Return the inverse manager in use. |
LifecycleEventManager |
getLifecycleEventManager()
Return the lifecycle event manager associated with the broker. |
int |
getLifecycleListenerCallbackMode()
The callback mode for handling exceptions from lifecycle event listeners. |
int |
getLockLevel(Object obj)
Return the lock level of the specified object. |
LockManager |
getLockManager()
Return the lock manager in use. |
Collection |
getManagedObjects()
Return a list of all managed instances. |
ManagedRuntime |
getManagedRuntime()
Return the managed runtime in use. |
boolean |
getMultithreaded()
Whether the broker or its managed instances are used in a multithreaded environment. |
boolean |
getNontransactionalRead()
Whether to allow nontransactional access to persistent state. |
boolean |
getNontransactionalWrite()
Whether to allow nontransactional changes to persistent state. |
Object |
getObjectId(Object obj)
Return the oid of the given instance. |
Class |
getObjectIdType(Class cls)
Return the application or datastore identity class the given persistent class uses for object ids. |
boolean |
getOptimistic()
Whether to use optimistic transactional semantics. |
boolean |
getOrderDirtyObjects()
Whether to maintain the order in which objects are dirtied for StoreContext.getDirtyObjects() . |
Collection |
getPendingTransactionalObjects()
Return a list of instances which will become transactional upon the next transaction. |
Collection |
getPersistedTypes()
Return the set of classes that have been made persistent in the current transaction. |
boolean |
getPopulateDataCache()
Whether objects accessed during this transaction will be added to the store cache. |
int |
getRestoreState()
Whether to restore an object's original state on rollback. |
boolean |
getRetainState()
Whether objects retain their persistent state on transaction commit. |
Throwable |
getRollbackCause()
Returns the Throwable that caused the transaction to be marked for rollback. |
boolean |
getRollbackOnly()
Return whether the current transaction has been marked for rollback. |
OpenJPAStateManager |
getStateManager(Object obj)
Return the state manager for the given instance. |
DelegatingStoreManager |
getStoreManager()
Return the store manager in use. |
boolean |
getSyncWithManagedTransactions()
Whether to check for a global transaction upon every managed, non-transactional operation. |
Collection |
getTransactionalObjects()
Return a list of current transaction instances. |
int |
getTransactionListenerCallbackMode()
The callback mode for handling exceptions from transaction event listeners. |
Collection |
getUpdatedTypes()
Return the set of classes for objects that have been modified in the current transaction. |
Object |
getUserObject(Object key)
Get the value for the specified key from the map of user objects. |
Seq |
getValueSequence(FieldMetaData fmd)
Returns a Seq for the generated values of the specified
field, or null if the field is not generated. |
Object |
getVersion(Object obj)
Returns the current version indicator for o . |
boolean |
hasConnection()
Whether the broker has a dedicated connection based on the configured connection retain mode and transaction status. |
int |
hashCode()
|
boolean |
isActive()
Whether a logical transaction is active. |
boolean |
isClosed()
Whether the broker is closed. |
boolean |
isCloseInvoked()
Whether Broker.close() has been invoked, though the broker might
remain open until the current managed transaction completes. |
boolean |
isDeleted(Object obj)
Return whether the given object is deleted. |
boolean |
isDetached(Object obj)
Returns true if obj is a detached object
(one that can be reattached to a Broker via a call to
Broker.attach(java.lang.Object, boolean, org.apache.openjpa.kernel.OpCallbacks) ); otherwise returns false . |
boolean |
isDetachedNew()
Whether to treat relations to detached instances during persist operations as new or as pseudo-hollow instances. |
boolean |
isDirty(Object obj)
Return whether the given object is dirty. |
boolean |
isManaged()
Whether this context is using managed transactions. |
boolean |
isNew(Object obj)
Return whether the given object is a newly-created instance registered with broker . |
boolean |
isPersistent(Object obj)
Return whether the given object is persistent. |
boolean |
isStoreActive()
Whether a data store transaction is active. |
boolean |
isTrackChangesByType()
Whether memory usage is reduced during this transaction at the expense of tracking changes at the type level instead of the instance level, resulting in more aggressive cache invalidation. |
boolean |
isTransactional(Object obj)
Return whether the given object is transactional. |
void |
lock()
Synchronizes on an internal lock if the Multithreaded flag is set to true. |
void |
lock(Object obj,
int level,
int timeout,
OpCallbacks call)
Ensure that the given instance is locked at the given lock level. |
void |
lock(Object obj,
OpCallbacks call)
Ensure that the given instance is locked at the current lock level, as set in the FetchConfiguration for the broker. |
void |
lockAll(Collection objs,
int level,
int timeout,
OpCallbacks call)
Ensure that the given instances are locked at the given lock level. |
void |
lockAll(Collection objs,
OpCallbacks call)
Ensure that the given instances are locked at the current lock level, as set in the FetchConfiguration for the broker. |
Extent |
newExtent(Class cls,
boolean subs)
Return an extent of the given class, optionally including subclasses. |
Object |
newInstance(Class cls)
Create a new instance of type cls . |
Object |
newObjectId(Class cls,
Object val)
Create a new object id instance from the given value. |
Query |
newQuery(String language,
Class cls,
Object query)
Create a new query from the given data, with the given candidate class and language. |
Query |
newQuery(String language,
Object query)
Create a new query in the given language. |
void |
nontransactional(Object pc,
OpCallbacks call)
Make the given object nontransactional. |
void |
nontransactionalAll(Collection objs,
OpCallbacks call)
Make the given objects nontransactional. |
OpenJPAStateManager |
persist(Object obj,
Object id,
OpCallbacks call)
Make the given instance persistent. |
void |
persist(Object obj,
OpCallbacks call)
Persist the given object. |
void |
persistAll(Collection objs,
OpCallbacks call)
Persist the given objects. |
void |
preFlush()
Run pre-flush actions on transactional objects, including persistence-by-reachability, inverse relationship management, deletion of dependent instances, and instance callbacks. |
Object |
putUserObject(Object key,
Object val)
Put the specified key-value pair into the map of user objects. |
void |
refresh(Object obj,
OpCallbacks call)
Refresh the state of the given object. |
void |
refreshAll(Collection objs,
OpCallbacks call)
Refresh the state of the given objects. |
void |
release(Object obj,
OpCallbacks call)
Release the given object from management. |
void |
releaseAll(Collection objs,
OpCallbacks call)
Release the given objects from management. |
void |
releaseSavepoint()
Release the last set savepoint and any resources associated with it. |
void |
releaseSavepoint(String name)
Release the savepoint and any resources associated with it. |
void |
removeLifecycleListener(Object listener)
Remove a listener for lifecycle-related events. |
void |
removeTransactionListener(Object listener)
Remove a listener for transaction-related events. |
void |
retrieve(Object obj,
boolean fgOnly,
OpCallbacks call)
Immediately load the given object's persistent fields. |
void |
retrieveAll(Collection objs,
boolean fgOnly,
OpCallbacks call)
Retrieve the given objects' persistent state. |
void |
rollback()
Rollback the current transaction. |
void |
rollbackAndResume()
Issue a rollback and then start a new transaction. |
void |
rollbackToSavepoint()
Rollback the current transaction to the last savepoint. |
void |
rollbackToSavepoint(String name)
Rollback the current transaction to the given savepoint name. |
void |
setAutoClear(int clear)
Whether objects clear when entering transactions. |
void |
setAutoDetach(int flags)
Bit flags marked in AutoDetach which indicate when persistent
managed objects should be automatically detached in-place. |
void |
setAutoDetach(int flag,
boolean on)
Bit flags marked in AutoDetach which indicate when persistent
managed objects should be automatically detached in-place. |
void |
setDetachedNew(boolean isNew)
Whether to treat relations to detached instances as new. |
void |
setDetachState(int mode)
Detach mode constant to determine which fields are part of the detached graph. |
void |
setEvictFromDataCache(boolean evict)
Whether to also evict an object from the store cache when it is evicted through this broker. |
void |
setIgnoreChanges(boolean ignore)
Whether to take into account changes in the transaction when executing a query or iterating an extent. |
void |
setImplicitBehavior(OpCallbacks call,
RuntimeExceptionTranslator ex)
Set the broker's behavior for implicit actions such as flushing, automatic detachment, and exceptions thrown by managed instances outside a broker operation. |
void |
setLifecycleListenerCallbackMode(int mode)
The callback mode for handling exceptions from lifecycle event listeners. |
void |
setMultithreaded(boolean multi)
Whether the broker or its managed instances are used in a multithreaded environment. |
void |
setNontransactionalRead(boolean read)
Whether to allow nontransactional access to persistent state. |
void |
setNontransactionalWrite(boolean write)
Whether to allow nontransactional changes to persistent state. |
void |
setOptimistic(boolean opt)
Whether to use optimistic transactional semantics. |
void |
setOrderDirtyObjects(boolean order)
Whether to maintain the order in which objects are dirtied for StoreContext.getDirtyObjects() . |
void |
setPopulateDataCache(boolean cache)
Whether to populate the store cache with objects used by this transaction. |
void |
setRestoreState(int restore)
Whether to restore an object's original state on rollback. |
void |
setRetainState(boolean retain)
Whether objects retain their persistent state on transaction commit. |
void |
setRollbackOnly()
Mark the current transaction for rollback. |
void |
setRollbackOnly(Throwable cause)
Mark the current transaction for rollback with the specified cause of the rollback. |
void |
setSavepoint(String name)
Set a transactional savepoint where operations after this savepoint will be rolled back. |
void |
setSyncWithManagedTransactions(boolean sync)
Whether to check for a global transaction upon every managed, non-transactional operation. |
void |
setTrackChangesByType(boolean largeTransaction)
If a large number of objects will be created, modified, or deleted during this transaction setting this option to true will reduce memory usage if you perform periodic flushes by tracking changes at the type level instead of the instance level, resulting in more aggressive cache invalidation. |
void |
setTransactionListenerCallbackMode(int mode)
The callback mode for handling exceptions from transaction event listeners. |
boolean |
syncWithManagedTransaction()
Attempt to synchronize with a current managed transaction, returning true if successful, false if no managed transaction is active. |
void |
transactional(Object pc,
boolean updateVersion,
OpCallbacks call)
Make the given object transactional. |
void |
transactionalAll(Collection objs,
boolean updateVersion,
OpCallbacks call)
Make the given objects transactional. |
protected RuntimeException |
translate(RuntimeException re)
Translate the OpenJPA exception. |
void |
unlock()
Releases the internal lock. |
void |
validateChanges()
Validate the changes made in this transaction, reporting any optimistic violations, constraint violations, etc. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DelegatingBroker(Broker broker)
public DelegatingBroker(Broker broker, RuntimeExceptionTranslator trans)
Method Detail |
---|
public Broker getDelegate()
public Broker getInnermostDelegate()
public int hashCode()
hashCode
in class Object
public boolean equals(Object other)
equals
in class Object
protected RuntimeException translate(RuntimeException re)
public Broker getBroker()
StoreContext
getBroker
in interface StoreContext
public OpenJPAConfiguration getConfiguration()
StoreContext
getConfiguration
in interface StoreContext
public FetchConfiguration getFetchConfiguration()
StoreContext
getFetchConfiguration
in interface StoreContext
public ClassLoader getClassLoader()
StoreContext
getClassLoader
in interface StoreContext
public LockManager getLockManager()
StoreContext
getLockManager
in interface StoreContext
public DelegatingStoreManager getStoreManager()
StoreContext
DelegatingStoreManager.getInnermostDelegate()
.
getStoreManager
in interface StoreContext
public String getConnectionUserName()
StoreContext
getConnectionUserName
in interface StoreContext
public String getConnectionPassword()
StoreContext
getConnectionPassword
in interface StoreContext
public Object find(Object oid, boolean validate, FindCallbacks call)
StoreContext
validate
is true, the broker will check the store
for the object, and return null if it does not exist. If
validate
is false, this method never returns null. The
broker will either return its cached instance, attempt to create a
hollow instance, or throw an ObjectNotFoundException
if
unable to return a hollow instance.
find
in interface StoreContext
validate
- if true, validate that the instance exists in the
store and load fetch group fields, otherwise return
any cached or hollow instancepublic Object[] findAll(Collection oids, boolean validate, FindCallbacks call)
StoreContext
findAll
in interface StoreContext
oids
- the oids of the objects to return
StoreContext.find(Object,boolean,FindCallbacks)
public Object findCached(Object oid, FindCallbacks call)
StoreContext
findCached
in interface StoreContext
oid
- the object's id
public Object find(Object oid, FetchConfiguration fetch, BitSet exclude, Object edata, int flags)
StoreContext
exclude
mask. By default this method does not find new
unflushed instances, validates, and does not throw an exception
if a cached instance has been deleted concurrently. These options
are controllable through the given OID_XXX
flags.
find
in interface StoreContext
public Object[] findAll(Collection oids, FetchConfiguration fetch, BitSet exclude, Object edata, int flags)
StoreContext
findAll
in interface StoreContext
StoreContext.find(Object,FetchConfiguration,BitSet,Object,int)
public Iterator extentIterator(Class cls, boolean subs, FetchConfiguration fetch, boolean ignoreChanges)
StoreContext
ImplHelper.close(java.lang.Object)
when no longer needed. This method delegates to
StoreManager.executeExtent(org.apache.openjpa.meta.ClassMetaData, boolean, org.apache.openjpa.kernel.FetchConfiguration)
.
extentIterator
in interface StoreContext
public void retrieve(Object obj, boolean fgOnly, OpCallbacks call)
StoreContext
retrieve
in interface StoreContext
fgOnly
- indicator as to whether to retrieve only fields
in the current fetch groups, or all fieldsStoreContext.retrieve(java.lang.Object, boolean, org.apache.openjpa.kernel.OpCallbacks)
public void retrieveAll(Collection objs, boolean fgOnly, OpCallbacks call)
StoreContext
retrieveAll
in interface StoreContext
fgOnly
- indicator as to whether to retrieve only fieldsStoreContext.retrieve(java.lang.Object, boolean, org.apache.openjpa.kernel.OpCallbacks)
public OpenJPAStateManager embed(Object obj, Object id, OpenJPAStateManager owner, ValueMetaData ownerMeta)
StoreContext
embed
in interface StoreContext
obj
- the instance to embed; may be null to create a new instanceid
- the id to give the embedded state manager; may be
null for defaultowner
- the owning state managerownerMeta
- the value in which the object is embedded
public Class getObjectIdType(Class cls)
StoreContext
getObjectIdType
in interface StoreContext
public Object newObjectId(Class cls, Object val)
StoreContext
newObjectId
in interface StoreContext
cls
- the persitent class that uses this identity valueval
- an object id instance, stringified object id, or primary
key valuepublic Collection getManagedObjects()
StoreContext
getManagedObjects
in interface StoreContext
public Collection getTransactionalObjects()
StoreContext
getTransactionalObjects
in interface StoreContext
public Collection getPendingTransactionalObjects()
StoreContext
getPendingTransactionalObjects
in interface StoreContext
public Collection getDirtyObjects()
StoreContext
getDirtyObjects
in interface StoreContext
public boolean getOrderDirtyObjects()
StoreContext
StoreContext.getDirtyObjects()
. Default is the store manager's decision.
getOrderDirtyObjects
in interface StoreContext
public void setOrderDirtyObjects(boolean order)
StoreContext
StoreContext.getDirtyObjects()
. Default is the store manager's decision.
setOrderDirtyObjects
in interface StoreContext
public Collection getPersistedTypes()
StoreContext
getPersistedTypes
in interface StoreContext
public Collection getUpdatedTypes()
StoreContext
getUpdatedTypes
in interface StoreContext
public Collection getDeletedTypes()
StoreContext
getDeletedTypes
in interface StoreContext
public OpenJPAStateManager getStateManager(Object obj)
StoreContext
obj
is not
a managed type or is managed by another context, throw an exception.
getStateManager
in interface StoreContext
public int getLockLevel(Object obj)
StoreContext
getLockLevel
in interface StoreContext
public Object getVersion(Object obj)
StoreContext
o
.
getVersion
in interface StoreContext
public boolean isDirty(Object obj)
StoreContext
isDirty
in interface StoreContext
public boolean isTransactional(Object obj)
StoreContext
isTransactional
in interface StoreContext
public boolean isPersistent(Object obj)
StoreContext
isPersistent
in interface StoreContext
public boolean isNew(Object obj)
StoreContext
broker
.
isNew
in interface StoreContext
public boolean isDeleted(Object obj)
StoreContext
isDeleted
in interface StoreContext
public Object getObjectId(Object obj)
StoreContext
getObjectId
in interface StoreContext
public boolean isManaged()
StoreContext
isManaged
in interface StoreContext
public boolean isActive()
StoreContext
isActive
in interface StoreContext
public boolean isStoreActive()
StoreContext
isStoreActive
in interface StoreContext
public boolean hasConnection()
StoreContext
hasConnection
in interface StoreContext
public Object getConnection()
StoreContext
getConnection
in interface StoreContext
public void lock()
StoreContext
Multithreaded
flag is set to true. Make sure to call
StoreContext.unlock()
in a finally clause of the same method.
lock
in interface StoreContext
public void unlock()
StoreContext
unlock
in interface StoreContext
public boolean beginOperation(boolean read)
Broker
Broker.endOperation()
is called.
beginOperation
in interface Broker
read
- whether instances may be loaded/modified during
this operation requiring a re-check of global tx
public boolean endOperation()
Broker
endOperation
in interface Broker
public void setImplicitBehavior(OpCallbacks call, RuntimeExceptionTranslator ex)
Broker
setImplicitBehavior
in interface Broker
public BrokerFactory getBrokerFactory()
Broker
getBrokerFactory
in interface Broker
public int getConnectionRetainMode()
Broker
getConnectionRetainMode
in interface Broker
public ManagedRuntime getManagedRuntime()
Broker
getManagedRuntime
in interface Broker
public InverseManager getInverseManager()
Broker
getInverseManager
in interface Broker
public boolean getMultithreaded()
Broker
getMultithreaded
in interface Broker
public void setMultithreaded(boolean multi)
Broker
setMultithreaded
in interface Broker
public boolean getIgnoreChanges()
Broker
getIgnoreChanges
in interface Broker
public void setIgnoreChanges(boolean ignore)
Broker
setIgnoreChanges
in interface Broker
public boolean getNontransactionalRead()
Broker
getNontransactionalRead
in interface Broker
public void setNontransactionalRead(boolean read)
Broker
setNontransactionalRead
in interface Broker
public boolean getNontransactionalWrite()
Broker
getNontransactionalWrite
in interface Broker
public void setNontransactionalWrite(boolean write)
Broker
setNontransactionalWrite
in interface Broker
public int getRestoreState()
Broker
getRestoreState
in interface Broker
public void setRestoreState(int restore)
Broker
setRestoreState
in interface Broker
public boolean getOptimistic()
Broker
getOptimistic
in interface Broker
public void setOptimistic(boolean opt)
Broker
setOptimistic
in interface Broker
public boolean getRetainState()
Broker
getRetainState
in interface Broker
public void setRetainState(boolean retain)
Broker
setRetainState
in interface Broker
public int getAutoClear()
Broker
getAutoClear
in interface Broker
public void setAutoClear(int clear)
Broker
setAutoClear
in interface Broker
public int getAutoDetach()
Broker
AutoDetach
which indicate when persistent
managed objects should be automatically detached in-place.
getAutoDetach
in interface Broker
public void setAutoDetach(int flags)
Broker
AutoDetach
which indicate when persistent
managed objects should be automatically detached in-place.
setAutoDetach
in interface Broker
public void setAutoDetach(int flag, boolean on)
Broker
AutoDetach
which indicate when persistent
managed objects should be automatically detached in-place.
setAutoDetach
in interface Broker
public int getDetachState()
StoreContext
DetachState.DETACH_LOADED
.
getDetachState
in interface StoreContext
public void setDetachState(int mode)
StoreContext
DetachState.DETACH_LOADED
.
setDetachState
in interface StoreContext
public boolean isDetachedNew()
Broker
isDetachedNew
in interface Broker
public void setDetachedNew(boolean isNew)
Broker
setDetachedNew
in interface Broker
public boolean getSyncWithManagedTransactions()
Broker
getSyncWithManagedTransactions
in interface Broker
public void setSyncWithManagedTransactions(boolean sync)
Broker
setSyncWithManagedTransactions
in interface Broker
public boolean getEvictFromDataCache()
Broker
getEvictFromDataCache
in interface Broker
public void setEvictFromDataCache(boolean evict)
Broker
setEvictFromDataCache
in interface Broker
public boolean getPopulateDataCache()
StoreContext
getPopulateDataCache
in interface StoreContext
public void setPopulateDataCache(boolean cache)
StoreContext
setPopulateDataCache
in interface StoreContext
public boolean isTrackChangesByType()
StoreContext
isTrackChangesByType
in interface StoreContext
public void setTrackChangesByType(boolean largeTransaction)
StoreContext
RemoteCommitEvent
s. Defaults to false.
setTrackChangesByType
in interface StoreContext
public Object putUserObject(Object key, Object val)
Broker
putUserObject
in interface Broker
public Object getUserObject(Object key)
Broker
getUserObject
in interface Broker
public void addTransactionListener(Object listener)
Broker
addTransactionListener
in interface Broker
public void removeTransactionListener(Object listener)
Broker
removeTransactionListener
in interface Broker
public int getTransactionListenerCallbackMode()
Broker
getTransactionListenerCallbackMode
in interface Broker
public void setTransactionListenerCallbackMode(int mode)
Broker
setTransactionListenerCallbackMode
in interface Broker
public void addLifecycleListener(Object listener, Class[] classes)
Broker
addLifecycleListener
in interface Broker
public void removeLifecycleListener(Object listener)
Broker
removeLifecycleListener
in interface Broker
public int getLifecycleListenerCallbackMode()
Broker
getLifecycleListenerCallbackMode
in interface Broker
public void setLifecycleListenerCallbackMode(int mode)
Broker
setLifecycleListenerCallbackMode
in interface Broker
public LifecycleEventManager getLifecycleEventManager()
Broker
getLifecycleEventManager
in interface Broker
public void begin()
Broker
begin
in interface Broker
public void commit()
Broker
commit
in interface Broker
public void rollback()
Broker
rollback
in interface Broker
public boolean syncWithManagedTransaction()
Broker
syncWithManagedTransaction
in interface Broker
public void commitAndResume()
Broker
broker.commit (); broker.begin ();except that the broker's internal atomic lock is utilized, so this method can be safely executed from multiple threads.
commitAndResume
in interface Broker
Broker.commit()
,
Broker.begin()
public void rollbackAndResume()
Broker
broker.rollback (); broker.begin ();except that the broker's internal atomic lock is utilized, so this method can be safely executed from multiple threads.
rollbackAndResume
in interface Broker
Broker.rollback()
,
Broker.begin()
public void setRollbackOnly()
Broker
setRollbackOnly
in interface Broker
public void setRollbackOnly(Throwable cause)
Broker
setRollbackOnly
in interface Broker
public Throwable getRollbackCause()
Broker
getRollbackCause
in interface Broker
public boolean getRollbackOnly()
Broker
getRollbackOnly
in interface Broker
public void setSavepoint(String name)
Broker
setSavepoint
in interface Broker
public void rollbackToSavepoint()
Broker
rollbackToSavepoint
in interface Broker
public void rollbackToSavepoint(String name)
Broker
rollbackToSavepoint
in interface Broker
public void releaseSavepoint()
Broker
releaseSavepoint
in interface Broker
public void releaseSavepoint(String name)
Broker
releaseSavepoint
in interface Broker
public void flush()
Broker
flush
in interface Broker
public void preFlush()
Broker
preFlush
in interface Broker
public void validateChanges()
Broker
Broker.flush()
. In an optimistic transaction that has not yet begun a
datastore-level transaction, however, it will only report exceptions
that would occur on flush, without retaining any datastore resources.
validateChanges
in interface Broker
public void beginStore()
StoreContext
beginStore
in interface StoreContext
public void persist(Object obj, OpCallbacks call)
Broker
persist
in interface Broker
public void persistAll(Collection objs, OpCallbacks call)
Broker
persistAll
in interface Broker
public OpenJPAStateManager persist(Object obj, Object id, OpCallbacks call)
Broker
ValueMetaData.CASCADE_IMMEDIATE
.
persist
in interface Broker
obj
- the instance to persistid
- the id to give the state manager; may be null for default
public void delete(Object obj, OpCallbacks call)
Broker
delete
in interface Broker
public void deleteAll(Collection objs, OpCallbacks call)
Broker
deleteAll
in interface Broker
public void release(Object obj, OpCallbacks call)
Broker
release
in interface Broker
public void releaseAll(Collection objs, OpCallbacks call)
Broker
releaseAll
in interface Broker
public void refresh(Object obj, OpCallbacks call)
Broker
refresh
in interface Broker
public void refreshAll(Collection objs, OpCallbacks call)
Broker
refreshAll
in interface Broker
public void evict(Object obj, OpCallbacks call)
Broker
evict
in interface Broker
public void evictAll(Collection objs, OpCallbacks call)
Broker
evictAll
in interface Broker
public void evictAll(OpCallbacks call)
Broker
evictAll
in interface Broker
public void evictAll(Extent extent, OpCallbacks call)
Broker
Extent
.
evictAll
in interface Broker
public Object detach(Object obj, OpCallbacks call)
Broker
detach
in interface Broker
obj
- the instance to detach
public Object[] detachAll(Collection objs, OpCallbacks call)
Broker
Broker.attachAll(java.util.Collection, boolean, org.apache.openjpa.kernel.OpCallbacks)
. The
detached instances will be unmanaged copies of the specified parameters,
and are suitable for serialization and manipulation outside
of a OpenJPA environment. When detaching instances, only fields
in the current FetchConfiguration
will be traversed. Thus,
to detach a graph of objects, relations to other persistent
instances must either be in the default-fetch-group
,
or in the current custom FetchConfiguration
.
detachAll
in interface Broker
objs
- the instances to detach
public void detachAll(OpCallbacks call)
Broker
detachAll
in interface Broker
public void detachAll(OpCallbacks call, boolean flush)
Broker
detachAll
in interface Broker
call
- Persistence operation callbacksflush
- boolean value to indicate whether to perform a
flush before detaching the entities (true, do the flush;
false, don't do the flush)public Object attach(Object obj, boolean copyNew, OpCallbacks call)
Broker
attach
in interface Broker
obj
- instance to importcopyNew
- whether to copy new instances
public Object[] attachAll(Collection objs, boolean copyNew, OpCallbacks call)
Broker
attachAll
in interface Broker
objs
- array of instances to importcopyNew
- whether to copy new instances
public void transactional(Object pc, boolean updateVersion, OpCallbacks call)
StoreContext
transactional
in interface StoreContext
pc
- instance to make transactionalupdateVersion
- if true, the instance's version will be
incremented at the next flushpublic void transactionalAll(Collection objs, boolean updateVersion, OpCallbacks call)
StoreContext
transactionalAll
in interface StoreContext
objs
- instances to make transactionalupdateVersion
- if true, the instance's version will be
incremented at the next flushpublic void nontransactional(Object pc, OpCallbacks call)
StoreContext
nontransactional
in interface StoreContext
public void nontransactionalAll(Collection objs, OpCallbacks call)
StoreContext
nontransactionalAll
in interface StoreContext
public Extent newExtent(Class cls, boolean subs)
Broker
newExtent
in interface Broker
public Query newQuery(String language, Class cls, Object query)
Broker
newQuery
in interface Broker
public Query newQuery(String language, Object query)
Broker
newQuery
in interface Broker
public Seq getIdentitySequence(ClassMetaData meta)
Broker
Seq
for the datastore identity values of the
specified persistent class, or null if the class' identity cannot be
represented as a sequence.
getIdentitySequence
in interface Broker
public Seq getValueSequence(FieldMetaData fmd)
Broker
Seq
for the generated values of the specified
field, or null if the field is not generated.
getValueSequence
in interface Broker
public void lock(Object obj, int level, int timeout, OpCallbacks call)
Broker
lock
in interface Broker
obj
- the object to locklevel
- the lock level to usetimeout
- the number of milliseconds to wait for the lock before
giving up, or -1 for no limitpublic void lock(Object obj, OpCallbacks call)
Broker
FetchConfiguration
for the broker.
lock
in interface Broker
public void lockAll(Collection objs, int level, int timeout, OpCallbacks call)
Broker
lockAll
in interface Broker
objs
- the objects to locklevel
- the lock level to usetimeout
- the number of milliseconds to wait for the lock before
giving up, or -1 for no limitpublic void lockAll(Collection objs, OpCallbacks call)
Broker
FetchConfiguration
for the broker.
lockAll
in interface Broker
public boolean cancelAll()
Broker
cancelAll
in interface Broker
public void dirtyType(Class cls)
Broker
dirtyType
in interface Broker
public void close()
Broker
close
in interface Broker
close
in interface Closeable
public boolean isClosed()
Broker
isClosed
in interface Broker
public boolean isCloseInvoked()
Broker
Broker.close()
has been invoked, though the broker might
remain open until the current managed transaction completes.
isCloseInvoked
in interface Broker
public void assertOpen()
Broker
assertOpen
in interface Broker
public void assertActiveTransaction()
Broker
assertActiveTransaction
in interface Broker
public void assertNontransactionalRead()
Broker
assertNontransactionalRead
in interface Broker
public void assertWriteOperation()
Broker
assertWriteOperation
in interface Broker
public void beforeCompletion()
public void afterCompletion(int status)
public Object newInstance(Class cls)
Broker
cls
. If cls
is
an interface or an abstract class whose abstract methods follow the
JavaBeans convention, this method will create a concrete implementation
according to the metadata that defines the class.
Otherwise, this will return an instance of the specified class.
newInstance
in interface Broker
public boolean isDetached(Object obj)
Broker
true
if obj
is a detached object
(one that can be reattached to a Broker
via a call to
Broker.attach(java.lang.Object, boolean, org.apache.openjpa.kernel.OpCallbacks)
); otherwise returns false
.
isDetached
in interface Broker
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |