|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.openjpa.kernel.BrokerImpl
public class BrokerImpl
Concrete Broker. The broker handles object-level behavior,
but leaves all interaction with the data store to a StoreManager
that must be supplied at initialization.
| Nested Class Summary | |
|---|---|
static class |
BrokerImpl.StateManagerId
Unique id for state managers of new datastore instances without assigned object ids. |
(package private) static class |
BrokerImpl.TransactionalCache
Transactional cache that holds soft refs to clean instances. |
| Field Summary | |
|---|---|
protected static int |
FLUSH_COMMIT
Flush in preparation of commit. |
protected static int |
FLUSH_INC
Incremental flush. |
protected static int |
FLUSH_LOGICAL
Run persistence-by-reachability and other flush-time operations without accessing the database. |
protected static int |
FLUSH_ROLLBACK
Flush to check consistency of cache, then immediately rollback changes. |
(package private) static int |
STATUS_COMMIT_NEW
|
(package private) static int |
STATUS_INIT
|
(package private) static int |
STATUS_OID_ASSIGN
|
(package private) static int |
STATUS_TRANSIENT
|
| 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_NONE, DETACH_NONTXREAD, DETACH_ROLLBACK, names, values |
| Fields inherited from interface org.apache.openjpa.event.CallbackModes |
|---|
CALLBACK_FAIL_FAST, CALLBACK_IGNORE, CALLBACK_LOG, CALLBACK_RETHROW, CALLBACK_ROLLBACK |
| Constructor Summary | |
|---|---|
BrokerImpl()
|
|
| Method Summary | |
|---|---|
(package private) void |
addDereferencedDependent(StateManagerImpl sm)
Add a dereferenced dependent object to the persistence manager's cache. |
void |
addLifecycleListener(Object listener,
Class[] classes)
Register a listener for lifecycle-related events on the specified classes. |
(package private) void |
addToPendingTransaction(StateManagerImpl sm)
Notify the broker that the given state manager should be added to the set of instances that will become transactional on the next transaction |
(package private) void |
addToTransaction(StateManagerImpl sm)
Notify the broker that the given state manager should be added to the set of instances involved in the current transaction. |
void |
addTransactionListener(Object tl)
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 the context is closed. |
protected PersistenceCapable |
assertPersistenceCapable(Object obj)
Return the given instance as a PersistenceCapable. |
void |
assertWriteOperation()
Throw an exception if a write operation is not permitted (there is no active transaction and nontransactional writing is not enabled). |
protected void |
assignObjectId(Object cache,
Object id,
StateManagerImpl sm)
Assign the object id to the cache. |
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 syncTrans)
Begin a logical operation. |
void |
beginStore()
Begin a data store transaction. |
boolean |
cancelAll()
Cancel all pending data store statements. |
protected void |
checkForDuplicateId(Object id,
Object obj,
ClassMetaData meta)
This method makes sure we don't already have the instance cached |
Object |
clone()
|
void |
close()
Close the broker. |
void |
commit()
Commit the current transaction. |
void |
commitAndResume()
Issue a commit and then start a new transaction. |
(package private) OpenJPAStateManager |
copy(OpenJPAStateManager copy,
PCState state)
If not already cached, create an empty copy of the given state manager in the given state. |
void |
delete(Object obj,
OpCallbacks call)
Delete the given object. |
(package private) void |
delete(Object obj,
StateManagerImpl sm,
OpCallbacks call)
Internal delete. |
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()
Mark the operation over. |
protected void |
endTransaction(int status)
End the current transaction, making appropriate state transitions. |
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 type,
boolean subclasses,
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. |
protected Object |
find(Object oid,
FetchConfiguration fetch,
BitSet exclude,
Object edata,
int flags,
FindCallbacks call)
Internal finder. |
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. |
protected Object[] |
findAll(Collection oids,
FetchConfiguration fetch,
BitSet exclude,
Object edata,
int flags,
FindCallbacks call)
Internal finder. |
Object |
findCached(Object oid,
FindCallbacks call)
Return the instance for the given oid/object , or null if not found in the L1 cache. |
(package private) boolean |
fireLifecycleEvent(Object src,
Object related,
ClassMetaData meta,
int eventType)
Fire given lifecycle event, handling any exceptions appropriately. |
void |
flush()
Flush all transactional instances to the data store. |
protected void |
flush(int reason)
Flush the transactional state to the data store. |
protected void |
free()
Free the resources used by this persistence manager. |
(package private) void |
gatherCascadeRefresh(Object obj,
OpCallbacks call)
Gathers all objects reachable through cascade-refresh relations into the operating set. |
boolean |
getAllowReferenceToSiblingContext()
Affirms if this context will allow its managed instances to refer instances that are managed by other contexts. |
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. |
boolean |
getCacheFinderQuery()
|
boolean |
getCachePreparedQuery()
Affirms if this receiver is caching prepared queries. |
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. |
Object |
getConnectionFactory()
Return the 'JTA' ConnectionFactory, looking it up from JNDI if needed. |
Object |
getConnectionFactory2()
Return the 'NonJTA' ConnectionFactory, looking it up from JNDI if needed. |
String |
getConnectionFactory2Name()
Return the 'NonJTA' ConnectionFactoryName. |
String |
getConnectionFactoryName()
Return the 'JTA' connectionFactoryName |
String |
getConnectionPassword()
Return the connection password. |
int |
getConnectionRetainMode()
Return the connection retain mode for this broker. |
String |
getConnectionUserName()
Return the connection user name. |
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. |
protected Collection |
getDirtyStates()
Return a copy of all dirty state managers. |
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. |
(package private) RuntimeExceptionTranslator |
getInstanceExceptionTranslator()
|
InverseManager |
getInverseManager()
Return the inverse manager in use. |
LifecycleEventManager |
getLifecycleEventManager()
Give state managers access to the lifecycle event manager. |
int |
getLifecycleListenerCallbackMode()
The callback mode for handling exceptions from lifecycle event listeners. |
int |
getLockLevel(Object o)
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. |
protected Collection |
getManagedStates()
Return a copy of all managed state managers. |
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. |
protected Set<Object> |
getOperatingSet()
Gets the unmodifiable set of instances being operated. |
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. |
protected Collection |
getPendingTransactionalStates()
Return a copy of all state managers 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. |
boolean |
getPostLoadOnMerge()
Force sending a @PostLoad lifecycle event while merging. |
boolean |
getPrintParameters()
|
Map<String,Object> |
getProperties()
Get current configuration property values used by this instance. |
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. |
protected StateManagerImpl |
getStateManagerImpl(Object obj,
boolean assertThisContext)
Return the state manager for the given instance, or null. |
protected StateManagerImpl |
getStateManagerImplById(Object oid,
boolean allowNew)
Return the state manager for the given oid. |
DelegatingStoreManager |
getStoreManager()
Return the store manager in use. |
Set<String> |
getSupportedProperties()
Gets the property names that can be used to corresponding setter methods of this receiver to set its value. |
boolean |
getSuppressBatchOLELogging()
Return whether this Broker will generate verbose optimistic lock exceptions when batching operations. |
Synchronization |
getSynchronization()
|
boolean |
getSyncWithManagedTransactions()
Whether to check for a global transaction upon every managed, non-transactional operation. |
Collection |
getTransactionalObjects()
Return a list of current transaction instances. |
protected Collection<StateManagerImpl> |
getTransactionalStates()
Return a copy of all transactional state managers. |
int |
getTransactionListenerCallbackMode()
The callback mode for handling exceptions from transaction event listeners. |
Collection<Object> |
getTransactionListeners()
Gets an umodifiable collection of currently registered lsteners. |
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. |
void |
initialize(AbstractBrokerFactory factory,
DelegatingStoreManager sm,
boolean managed,
int connMode,
boolean fromDeserialization)
Initialize the persistence manager. |
void |
initialize(AbstractBrokerFactory factory,
DelegatingStoreManager sm,
boolean managed,
int connMode,
boolean fromDeserialization,
boolean fromWriteBehindCallback)
|
protected StateManagerImpl |
initialize(StateManagerImpl sm,
boolean load,
FetchConfiguration fetch,
Object edata)
Initialize a newly-constructed state manager. |
boolean |
isActive()
Whether a logical transaction is active. |
boolean |
isCached(List<Object> oids)
Indicate whether the oid can be found in the StoreContext's L1 cache or in the StoreManager cache. |
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 |
isDetached(Object obj,
boolean find)
This method makes a best effort to determine if the provided object is detached. |
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. |
protected boolean |
isFlushing()
|
boolean |
isFromWriteBehindCallback()
|
boolean |
isLoading(Object o)
|
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. |
(package private) boolean |
isSerializing()
Whether or not this broker is in the midst of being serialized. |
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. |
(package private) boolean |
isTransactionEnding()
Return whether the current transaction is ending, i.e. |
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 type,
boolean subclasses)
Return an extent of the given class, optionally including subclasses. |
Object |
newInstance(Class cls)
Create a new instance of type cls. |
protected Map<?,?> |
newManagedObjectCache()
Create a Map to be used for the primary managed object cache. |
Object |
newObjectId(Class<?> cls,
Object val)
Create a new object id instance from the given value. |
Query |
newQuery(String lang,
Class cls,
Object query)
Create a new query from the given data, with the given candidate class and language. |
Query |
newQuery(String lang,
Object query)
Create a new query in the given language. |
protected QueryImpl |
newQueryImpl(String lang,
StoreQuery sq)
Create a new query. |
protected StateManagerImpl |
newStateManagerImpl(Object oid,
ClassMetaData meta)
Create a state manager for the given oid and metadata. |
void |
nontransactional(Object obj,
OpCallbacks call)
Make the given object non-transactional. |
void |
nontransactionalAll(Collection objs,
OpCallbacks call)
Make the given objects nontransactional. |
void |
persist(Object obj,
boolean explicit,
OpCallbacks call)
Persist the given object. |
OpenJPAStateManager |
persist(Object obj,
Object id,
boolean explicit,
OpCallbacks call)
Persist the given object. |
OpenJPAStateManager |
persist(Object obj,
Object id,
boolean explicit,
OpCallbacks call,
boolean fireEvent)
Persist the given object. |
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,
boolean explicit,
OpCallbacks call)
Persist the given objects. |
void |
persistAll(Collection objs,
OpCallbacks call)
Persist the given objects. |
void |
popFetchConfiguration()
Pops the fetch configuration from the top of the stack, making the next one down the active one. |
void |
preFlush()
Run pre-flush actions on transactional objects, including persistence-by-reachability, inverse relationship management, deletion of dependent instances, and instance callbacks. |
Object |
processArgument(Object oid)
Process find argument. |
Object |
processReturn(Object oid,
OpenJPAStateManager sm)
Process operation return value. |
FetchConfiguration |
pushFetchConfiguration()
Pushes a new fetch configuration that inherits from the current fetch configuration onto a stack, and makes the new configuration the active one. |
FetchConfiguration |
pushFetchConfiguration(FetchConfiguration fc)
Pushes the fetch configuration argument onto a stack, and makes the new configuration the active one. |
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. |
protected void |
refreshInternal(Collection objs,
OpCallbacks call)
This method is called with the full set of objects reachable via cascade-refresh relations from the user-given instances. |
protected void |
refreshInternal(Object obj,
OpCallbacks call)
Optimization for single-object refresh. |
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 savepoint)
Release the savepoint and any resources associated with it. |
(package private) void |
removeDereferencedDependent(StateManagerImpl sm)
Remove the given previously dereferenced dependent object from the cache. |
(package private) void |
removeFromPendingTransaction(StateManagerImpl sm)
Notify the persistence manager that the given state manager should be removed from the set of instances involved in the next transaction. |
(package private) void |
removeFromTransaction(StateManagerImpl sm)
Notify the persistence manager that the given state manager should be removed from the set of instances involved in the current transaction. |
void |
removeLifecycleListener(Object listener)
Remove a listener for lifecycle-related events. |
void |
removeTransactionListener(Object tl)
Remove a listener for transaction-related events. |
void |
retrieve(Object obj,
boolean dfgOnly,
OpCallbacks call)
Immediately load the given object's persistent fields. |
void |
retrieveAll(Collection objs,
boolean dfgOnly,
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 savepoint)
Rollback the current transaction to the given savepoint name. |
void |
setAllowReferenceToSiblingContext(boolean allow)
Affirms if this context will allow its managed instances to refer instances that are managed by other contexts. |
void |
setAuthentication(String user,
String pass)
Set the persistence manager's authentication. |
void |
setAutoClear(int val)
Whether objects clear when entering transactions. |
void |
setAutoDetach(int detachFlags)
Sets automatic detachment option. |
void |
setAutoDetach(int detachFlag,
boolean on)
Bit flags marked in AutoDetach which indicate when persistent
managed objects should be automatically detached in-place. |
void |
setCacheFinderQuery(boolean flag)
|
void |
setCachePreparedQuery(boolean flag)
Sets whether this receiver will cache prepared queries during its lifetime. |
void |
setConnectionFactory2Name(String connectionFactory2Name)
Set the 'NonJTA' ConnectionFactoryName. |
void |
setConnectionFactoryName(String connectionFactoryName)
Set the 'JTA' ConnectionFactoryName. |
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. |
(package private) void |
setDirty(StateManagerImpl sm,
boolean firstDirty)
Notification that the given instance has been dirtied. |
void |
setEvictFromDataCache(boolean evict)
Whether to also evict an object from the store cache when it is evicted through this broker. |
void |
setIgnoreChanges(boolean val)
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 multithreaded)
Whether the broker or its managed instances are used in a multithreaded environment. |
void |
setNontransactionalRead(boolean val)
Whether to allow nontransactional access to persistent state. |
void |
setNontransactionalWrite(boolean val)
Whether to allow nontransactional changes to persistent state. |
void |
setOptimistic(boolean val)
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 |
setPostLoadOnMerge(boolean allow)
Set to true if the merge operation should trigger
a @PostLoad lifecycle event. |
void |
setRestoreState(int val)
Whether to restore an object's original state on rollback. |
void |
setRetainState(boolean val)
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. |
protected void |
setStateManager(Object id,
StateManagerImpl sm,
int status)
Set the cached StateManager for the instance that had the given oid. |
void |
setSuppressBatchOLELogging(boolean b)
Set whether this Broker will generate verbose optimistic lock exceptions when batching operations. |
void |
setSynchronization(Synchronization sync)
|
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 obj,
boolean updateVersion,
OpCallbacks call)
Make the given instances transactional. |
void |
transactionalAll(Collection objs,
boolean updateVersion,
OpCallbacks call)
Make the given instances transactional. |
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 |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final int FLUSH_INC
protected static final int FLUSH_COMMIT
protected static final int FLUSH_ROLLBACK
protected static final int FLUSH_LOGICAL
static final int STATUS_INIT
static final int STATUS_TRANSIENT
static final int STATUS_OID_ASSIGN
static final int STATUS_COMMIT_NEW
| Constructor Detail |
|---|
public BrokerImpl()
| Method Detail |
|---|
public void setAuthentication(String user,
String pass)
user - the username this broker represents; used when pooling
brokers to make sure that a request to the factory for
a connection with an explicit user is delegated to a suitable brokerpass - the password for the above user
public void initialize(AbstractBrokerFactory factory,
DelegatingStoreManager sm,
boolean managed,
int connMode,
boolean fromDeserialization)
factory - the factory used to create this brokersm - a concrete StoreManager implementation to
handle interaction with the data storemanaged - the transaction modeconnMode - the connection retain modefromDeserialization - whether this call happened because of a
deserialization or creation of a new BrokerImpl.
public void initialize(AbstractBrokerFactory factory,
DelegatingStoreManager sm,
boolean managed,
int connMode,
boolean fromDeserialization,
boolean fromWriteBehindCallback)
protected Set<Object> getOperatingSet()
public Object clone()
throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedExceptionprotected Map<?,?> newManagedObjectCache()
Map to be used for the primary managed object cache.
Maps oids to state managers. By default, this creates a
ReferenceMap with soft values.
public Broker getBroker()
StoreContext
getBroker in interface StoreContext
public void setImplicitBehavior(OpCallbacks call,
RuntimeExceptionTranslator ex)
Broker
setImplicitBehavior in interface BrokerRuntimeExceptionTranslator getInstanceExceptionTranslator()
public BrokerFactory getBrokerFactory()
Broker
getBrokerFactory in interface Brokerpublic OpenJPAConfiguration getConfiguration()
StoreContext
getConfiguration in interface StoreContextpublic FetchConfiguration getFetchConfiguration()
StoreContext
getFetchConfiguration in interface StoreContextpublic FetchConfiguration pushFetchConfiguration()
StoreContext
pushFetchConfiguration in interface StoreContextpublic FetchConfiguration pushFetchConfiguration(FetchConfiguration fc)
StoreContext
pushFetchConfiguration in interface StoreContextpublic void popFetchConfiguration()
StoreContext
popFetchConfiguration in interface StoreContextpublic int getConnectionRetainMode()
Broker
getConnectionRetainMode in interface Brokerpublic boolean isManaged()
StoreContext
isManaged in interface StoreContextpublic ManagedRuntime getManagedRuntime()
Broker
getManagedRuntime in interface Brokerpublic ClassLoader getClassLoader()
StoreContext
getClassLoader in interface StoreContextpublic DelegatingStoreManager getStoreManager()
StoreContextDelegatingStoreManager.getInnermostDelegate().
getStoreManager in interface StoreContextpublic LockManager getLockManager()
StoreContext
getLockManager in interface StoreContextpublic InverseManager getInverseManager()
Broker
getInverseManager in interface Brokerpublic String getConnectionUserName()
StoreContext
getConnectionUserName in interface StoreContextpublic String getConnectionPassword()
StoreContext
getConnectionPassword in interface StoreContextpublic boolean getMultithreaded()
Broker
getMultithreaded in interface Brokerpublic void setMultithreaded(boolean multithreaded)
Broker
setMultithreaded in interface Brokerpublic boolean getIgnoreChanges()
Broker
getIgnoreChanges in interface Brokerpublic void setIgnoreChanges(boolean val)
Broker
setIgnoreChanges in interface Brokerpublic boolean getNontransactionalRead()
Broker
getNontransactionalRead in interface Brokerpublic void setNontransactionalRead(boolean val)
Broker
setNontransactionalRead in interface Brokerpublic boolean getNontransactionalWrite()
Broker
getNontransactionalWrite in interface Brokerpublic void setNontransactionalWrite(boolean val)
Broker
setNontransactionalWrite in interface Brokerpublic boolean getOptimistic()
Broker
getOptimistic in interface Brokerpublic void setOptimistic(boolean val)
Broker
setOptimistic in interface Brokerpublic int getRestoreState()
Broker
getRestoreState in interface Brokerpublic void setRestoreState(int val)
Broker
setRestoreState in interface Brokerpublic boolean getRetainState()
Broker
getRetainState in interface Brokerpublic void setRetainState(boolean val)
Broker
setRetainState in interface Brokerpublic int getAutoClear()
Broker
getAutoClear in interface Brokerpublic void setAutoClear(int val)
Broker
setAutoClear in interface Brokerpublic int getAutoDetach()
BrokerAutoDetach which indicate when persistent
managed objects should be automatically detached in-place.
getAutoDetach in interface Brokerpublic void setAutoDetach(int detachFlags)
AutoDetach.DETACH_NONE option,
then no other option can be specified.
setAutoDetach in interface Broker
public void setAutoDetach(int detachFlag,
boolean on)
BrokerAutoDetach which indicate when persistent
managed objects should be automatically detached in-place.
setAutoDetach in interface Brokerpublic int getDetachState()
StoreContextDetachState.DETACH_LOADED.
getDetachState in interface StoreContextpublic void setDetachState(int mode)
StoreContextDetachState.DETACH_LOADED.
setDetachState in interface StoreContextpublic boolean isDetachedNew()
Broker
isDetachedNew in interface Brokerpublic void setDetachedNew(boolean isNew)
Broker
setDetachedNew in interface Brokerpublic boolean getSyncWithManagedTransactions()
Broker
getSyncWithManagedTransactions in interface Brokerpublic void setSyncWithManagedTransactions(boolean sync)
Broker
setSyncWithManagedTransactions in interface Brokerpublic boolean getEvictFromDataCache()
Broker
getEvictFromDataCache in interface Brokerpublic void setEvictFromDataCache(boolean evict)
Broker
setEvictFromDataCache in interface Brokerpublic boolean getPopulateDataCache()
StoreContext
getPopulateDataCache in interface StoreContextpublic void setPopulateDataCache(boolean cache)
StoreContext
setPopulateDataCache in interface StoreContextpublic boolean isTrackChangesByType()
StoreContext
isTrackChangesByType in interface StoreContextpublic void setTrackChangesByType(boolean largeTransaction)
StoreContextRemoteCommitEvents. Defaults to false.
setTrackChangesByType in interface StoreContextpublic Object getUserObject(Object key)
Broker
getUserObject in interface Broker
public Object putUserObject(Object key,
Object val)
Broker
putUserObject in interface Brokerpublic Map<String,Object> getProperties()
getProperties in interface Brokerpublic Set<String> getSupportedProperties()
getSupportedProperties in interface Broker
public void addLifecycleListener(Object listener,
Class[] classes)
Broker
addLifecycleListener in interface Brokerpublic void removeLifecycleListener(Object listener)
Broker
removeLifecycleListener in interface Brokerpublic int getLifecycleListenerCallbackMode()
Broker
getLifecycleListenerCallbackMode in interface Brokerpublic void setLifecycleListenerCallbackMode(int mode)
Broker
setLifecycleListenerCallbackMode in interface Brokerpublic LifecycleEventManager getLifecycleEventManager()
getLifecycleEventManager in interface Broker
boolean fireLifecycleEvent(Object src,
Object related,
ClassMetaData meta,
int eventType)
public void addTransactionListener(Object tl)
Broker
addTransactionListener in interface Brokerpublic void removeTransactionListener(Object tl)
Broker
removeTransactionListener in interface Brokerpublic Collection<Object> getTransactionListeners()
Broker
getTransactionListeners in interface Brokerpublic int getTransactionListenerCallbackMode()
Broker
getTransactionListenerCallbackMode in interface Brokerpublic void setTransactionListenerCallbackMode(int mode)
Broker
setTransactionListenerCallbackMode in interface Brokerpublic void setSuppressBatchOLELogging(boolean b)
b - public boolean getSuppressBatchOLELogging()
public Object find(Object oid,
boolean validate,
FindCallbacks call)
StoreContextvalidate 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 StoreContextvalidate - if true, validate that the instance exists in the
store and load fetch group fields, otherwise return
any cached or hollow instance
public Object find(Object oid,
FetchConfiguration fetch,
BitSet exclude,
Object edata,
int flags)
StoreContextexclude 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
protected Object find(Object oid,
FetchConfiguration fetch,
BitSet exclude,
Object edata,
int flags,
FindCallbacks call)
protected StateManagerImpl initialize(StateManagerImpl sm,
boolean load,
FetchConfiguration fetch,
Object edata)
public Object[] findAll(Collection oids,
boolean validate,
FindCallbacks call)
StoreContext
findAll in interface StoreContextoids - the oids of the objects to return
StoreContext.find(Object,boolean,FindCallbacks)
public Object[] findAll(Collection oids,
FetchConfiguration fetch,
BitSet exclude,
Object edata,
int flags)
StoreContext
findAll in interface StoreContextStoreContext.find(Object,FetchConfiguration,BitSet,Object,int)
protected Object[] findAll(Collection oids,
FetchConfiguration fetch,
BitSet exclude,
Object edata,
int flags,
FindCallbacks call)
public boolean isLoading(Object o)
public Object findCached(Object oid,
FindCallbacks call)
StoreContext
findCached in interface StoreContextoid - the object's id
public Class<?> getObjectIdType(Class<?> cls)
StoreContext
getObjectIdType in interface StoreContext
public Object newObjectId(Class<?> cls,
Object val)
StoreContext
newObjectId in interface StoreContextcls - the persistent class that uses this identity valueval - an object id instance, stringified object id, or primary
key value
protected StateManagerImpl newStateManagerImpl(Object oid,
ClassMetaData meta)
public void begin()
Broker
begin in interface Brokerpublic void beginStore()
StoreContext
beginStore in interface StoreContextpublic void commit()
Broker
commit in interface Brokerpublic void rollback()
Broker
rollback in interface Brokerpublic boolean syncWithManagedTransaction()
Broker
syncWithManagedTransaction in interface Brokerpublic void commitAndResume()
Brokerbroker.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 BrokerBroker.commit(),
Broker.begin()public void rollbackAndResume()
Brokerbroker.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 BrokerBroker.rollback(),
Broker.begin()public boolean getRollbackOnly()
Broker
getRollbackOnly in interface Brokerpublic Throwable getRollbackCause()
Broker
getRollbackCause in interface Brokerpublic void setRollbackOnly()
Broker
setRollbackOnly in interface Brokerpublic void setRollbackOnly(Throwable cause)
Broker
setRollbackOnly in interface Brokerpublic void setSavepoint(String name)
Broker
setSavepoint in interface Brokerpublic void releaseSavepoint()
Broker
releaseSavepoint in interface Brokerpublic void releaseSavepoint(String savepoint)
Broker
releaseSavepoint in interface Brokerpublic void rollbackToSavepoint()
Broker
rollbackToSavepoint in interface Brokerpublic void rollbackToSavepoint(String savepoint)
Broker
rollbackToSavepoint in interface Brokerpublic void flush()
Broker
flush in interface Brokerpublic void preFlush()
Broker
preFlush in interface Brokerpublic void validateChanges()
BrokerBroker.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 Brokerpublic boolean isActive()
StoreContext
isActive in interface StoreContextpublic boolean isStoreActive()
StoreContext
isStoreActive in interface StoreContextboolean isTransactionEnding()
public boolean beginOperation(boolean syncTrans)
BrokerBroker.endOperation() is called.
beginOperation in interface BrokersyncTrans - whether instances may be loaded/modified during
this operation requiring a re-check of global tx
public boolean endOperation()
endOperation in interface Brokerpublic Synchronization getSynchronization()
public void setSynchronization(Synchronization sync)
public void beforeCompletion()
beforeCompletion in interface Synchronizationpublic void afterCompletion(int status)
afterCompletion in interface Synchronizationprotected void flush(int reason)
reason - one of FLUSH_INC, FLUSH_COMMIT,
FLUSH_ROLLBACK, or FLUSH_LOGICALprotected void endTransaction(int status)
public void persist(Object obj,
OpCallbacks call)
Broker
persist in interface Broker
public OpenJPAStateManager persist(Object obj,
Object id,
OpCallbacks call)
BrokerValueMetaData.CASCADE_IMMEDIATE.
persist in interface Brokerobj - the instance to persistid - the id to give the state manager; may be null for default
public void persistAll(Collection objs,
OpCallbacks call)
Broker
persistAll in interface Broker
public void persistAll(Collection objs,
boolean explicit,
OpCallbacks call)
public void persist(Object obj,
boolean explicit,
OpCallbacks call)
public OpenJPAStateManager persist(Object obj,
Object id,
boolean explicit,
OpCallbacks call)
Broker for details on this method.
public OpenJPAStateManager persist(Object obj,
Object id,
boolean explicit,
OpCallbacks call,
boolean fireEvent)
Broker for details on this method.
public void deleteAll(Collection objs,
OpCallbacks call)
Broker
deleteAll in interface Broker
public void delete(Object obj,
OpCallbacks call)
Broker
delete in interface Broker
void delete(Object obj,
StateManagerImpl sm,
OpCallbacks call)
public void releaseAll(Collection objs,
OpCallbacks call)
Broker
releaseAll in interface Broker
public void release(Object obj,
OpCallbacks call)
Broker
release in interface Broker
public OpenJPAStateManager embed(Object obj,
Object id,
OpenJPAStateManager owner,
ValueMetaData ownerMeta)
StoreContext
embed in interface StoreContextobj - 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
OpenJPAStateManager copy(OpenJPAStateManager copy,
PCState state)
public void refreshAll(Collection objs,
OpCallbacks call)
Broker
refreshAll in interface Broker
public void refresh(Object obj,
OpCallbacks call)
Broker
refresh in interface Broker
void gatherCascadeRefresh(Object obj,
OpCallbacks call)
protected void refreshInternal(Collection objs,
OpCallbacks call)
protected void refreshInternal(Object obj,
OpCallbacks call)
public void retrieveAll(Collection objs,
boolean dfgOnly,
OpCallbacks call)
StoreContext
retrieveAll in interface StoreContextdfgOnly - indicator as to whether to retrieve only fieldsStoreContext.retrieve(java.lang.Object, boolean, org.apache.openjpa.kernel.OpCallbacks)
public void retrieve(Object obj,
boolean dfgOnly,
OpCallbacks call)
StoreContext
retrieve in interface StoreContextdfgOnly - 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 evictAll(OpCallbacks call)
Broker
evictAll in interface Broker
public void evictAll(Collection objs,
OpCallbacks call)
Broker
evictAll in interface Broker
public void evictAll(Extent extent,
OpCallbacks call)
BrokerExtent.
evictAll in interface Broker
public void evict(Object obj,
OpCallbacks call)
Broker
evict in interface Broker
public Object detach(Object obj,
OpCallbacks call)
Broker
detach in interface Brokerobj - the instance to detach
public Object[] detachAll(Collection objs,
OpCallbacks call)
BrokerBroker.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 Brokerobjs - 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 Brokercall - 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 Brokerobj - instance to importcopyNew - whether to copy new instances
public Object[] attachAll(Collection objs,
boolean copyNew,
OpCallbacks call)
Broker
attachAll in interface Brokerobjs - array of instances to importcopyNew - whether to copy new instances
public void nontransactionalAll(Collection objs,
OpCallbacks call)
StoreContext
nontransactionalAll in interface StoreContext
public void nontransactional(Object obj,
OpCallbacks call)
StoreContext
nontransactional in interface StoreContext
public void transactionalAll(Collection objs,
boolean updateVersion,
OpCallbacks call)
transactionalAll in interface StoreContextobjs - instances to make transactionalupdateVersion - if true, the instance's version will be
incremented at the next flush
public void transactional(Object obj,
boolean updateVersion,
OpCallbacks call)
transactional in interface StoreContextobj - instance to make transactionalupdateVersion - if true, the instance's version will be
incremented at the next flush
public Extent newExtent(Class type,
boolean subclasses)
Broker
newExtent in interface Broker
public Iterator extentIterator(Class type,
boolean subclasses,
FetchConfiguration fetch,
boolean ignoreChanges)
StoreContextImplHelper.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 Query newQuery(String lang,
Class cls,
Object query)
Broker
newQuery in interface Broker
public Query newQuery(String lang,
Object query)
Broker
newQuery in interface Broker
protected QueryImpl newQueryImpl(String lang,
StoreQuery sq)
public Seq getIdentitySequence(ClassMetaData meta)
BrokerSeq 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 Brokerpublic Seq getValueSequence(FieldMetaData fmd)
BrokerSeq 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,
OpCallbacks call)
BrokerFetchConfiguration for the broker.
lock in interface Broker
public void lock(Object obj,
int level,
int timeout,
OpCallbacks call)
Broker
lock in interface Brokerobj - 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 limit
public void lockAll(Collection objs,
OpCallbacks call)
BrokerFetchConfiguration for the broker.
lockAll in interface Broker
public void lockAll(Collection objs,
int level,
int timeout,
OpCallbacks call)
Broker
lockAll in interface Brokerobjs - 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 boolean cancelAll()
Broker
cancelAll in interface Brokerpublic Object getConnection()
StoreContext
getConnection in interface StoreContextpublic boolean hasConnection()
StoreContext
hasConnection in interface StoreContextpublic Collection getManagedObjects()
StoreContext
getManagedObjects in interface StoreContextpublic Collection getTransactionalObjects()
StoreContext
getTransactionalObjects in interface StoreContextpublic Collection getPendingTransactionalObjects()
StoreContext
getPendingTransactionalObjects in interface StoreContextpublic Collection getDirtyObjects()
StoreContext
getDirtyObjects in interface StoreContextpublic boolean getOrderDirtyObjects()
StoreContextStoreContext.getDirtyObjects(). Default is the store manager's decision.
getOrderDirtyObjects in interface StoreContextpublic void setOrderDirtyObjects(boolean order)
StoreContextStoreContext.getDirtyObjects(). Default is the store manager's decision.
setOrderDirtyObjects in interface StoreContextprotected Collection getManagedStates()
protected Collection<StateManagerImpl> getTransactionalStates()
protected Collection getDirtyStates()
protected Collection getPendingTransactionalStates()
protected void setStateManager(Object id,
StateManagerImpl sm,
int status)
id - the id previously used by the instancesm - the state manager for the instance; if the state
manager is transient, we'll stop managing the instance;
if it has updated its oid, we'll re-cache under the new oidstatus - one of our STATUS constants describing why we're
setting the state managervoid addToTransaction(StateManagerImpl sm)
void removeFromTransaction(StateManagerImpl sm)
void setDirty(StateManagerImpl sm,
boolean firstDirty)
void addToPendingTransaction(StateManagerImpl sm)
void removeFromPendingTransaction(StateManagerImpl sm)
void addDereferencedDependent(StateManagerImpl sm)
void removeDereferencedDependent(StateManagerImpl sm)
public void dirtyType(Class cls)
Broker
dirtyType in interface Brokerpublic Collection getPersistedTypes()
StoreContext
getPersistedTypes in interface StoreContextpublic Collection getUpdatedTypes()
StoreContext
getUpdatedTypes in interface StoreContextpublic Collection getDeletedTypes()
StoreContext
getDeletedTypes in interface StoreContextpublic boolean isClosed()
Broker
isClosed in interface Brokerpublic boolean isCloseInvoked()
BrokerBroker.close() has been invoked, though the broker might
remain open until the current managed transaction completes.
isCloseInvoked in interface Brokerpublic void close()
Broker
close in interface Brokerclose in interface Closeableprotected void free()
public void lock()
StoreContextMultithreaded flag is set to true. Make sure to call
StoreContext.unlock() in a finally clause of the same method.
lock in interface StoreContextpublic void unlock()
StoreContext
unlock in interface StoreContextpublic Object newInstance(Class cls)
Brokercls. 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, if cls is a managed type, this will return an
instance of the specified class.
newInstance in interface Brokerpublic Object getObjectId(Object obj)
StoreContext
getObjectId in interface StoreContextpublic int getLockLevel(Object o)
StoreContext
getLockLevel in interface StoreContextpublic Object getVersion(Object obj)
StoreContexto.
getVersion in interface StoreContextpublic boolean isDirty(Object obj)
StoreContext
isDirty in interface StoreContextpublic boolean isTransactional(Object obj)
StoreContext
isTransactional in interface StoreContextpublic boolean isPersistent(Object obj)
StoreContext
isPersistent in interface StoreContextpublic boolean isNew(Object obj)
StoreContextbroker.
isNew in interface StoreContextpublic boolean isDeleted(Object obj)
StoreContext
isDeleted in interface StoreContextpublic boolean isDetached(Object obj)
Brokertrue 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
public boolean isDetached(Object obj,
boolean find)
obj - find - - If true, as a last resort this method will check whether or not the provided object exists in the
DB. If it is in the DB, the provided object is detached.
public OpenJPAStateManager getStateManager(Object obj)
StoreContextobj is not
a managed type or is managed by another context, throw an exception.
getStateManager in interface StoreContext
protected StateManagerImpl getStateManagerImpl(Object obj,
boolean assertThisContext)
assertThisContext - if true, thow an exception if the given
object is managed by another broker
protected StateManagerImpl getStateManagerImplById(Object oid,
boolean allowNew)
allowNew - if true, objects made persistent in the current
transaction will be included in the search; if
multiple new objects match the given oid, it is
undefined which will be returnedprotected PersistenceCapable assertPersistenceCapable(Object obj)
PersistenceCapable.
If the instance is not manageable throw the proper exception.
public void assertOpen()
assertOpen in interface Brokerpublic void assertActiveTransaction()
Broker
assertActiveTransaction in interface Brokerpublic void assertNontransactionalRead()
Broker
assertNontransactionalRead in interface Brokerpublic void assertWriteOperation()
Broker
assertWriteOperation in interface Brokerpublic Object processArgument(Object oid)
FindCallbacksOpenJPAException for illegal value.
processArgument in interface FindCallbacks
public Object processReturn(Object oid,
OpenJPAStateManager sm)
FindCallbacks
processReturn in interface FindCallbacksboolean isSerializing()
public boolean getPrintParameters()
protected void assignObjectId(Object cache,
Object id,
StateManagerImpl sm)
protected void checkForDuplicateId(Object id,
Object obj,
ClassMetaData meta)
public boolean getCachePreparedQuery()
Broker
getCachePreparedQuery in interface Brokerpublic void setCachePreparedQuery(boolean flag)
Broker
setCachePreparedQuery in interface Brokerpublic boolean getCacheFinderQuery()
public void setCacheFinderQuery(boolean flag)
public boolean isFromWriteBehindCallback()
public String getConnectionFactoryName()
getConnectionFactoryName in interface StoreContextpublic void setConnectionFactoryName(String connectionFactoryName)
setConnectionFactoryName in interface StoreContextpublic String getConnectionFactory2Name()
getConnectionFactory2Name in interface StoreContextpublic void setConnectionFactory2Name(String connectionFactory2Name)
setConnectionFactory2Name in interface StoreContextpublic Object getConnectionFactory()
getConnectionFactory in interface StoreContextpublic Object getConnectionFactory2()
getConnectionFactory2 in interface StoreContextpublic boolean isCached(List<Object> oids)
StoreContext
isCached in interface StoreContextoids - List of ObjectIds for PersistenceCapables which may be found in memory.
public boolean getAllowReferenceToSiblingContext()
StoreContext
getAllowReferenceToSiblingContext in interface StoreContextpublic void setAllowReferenceToSiblingContext(boolean allow)
StoreContext
setAllowReferenceToSiblingContext in interface StoreContextprotected boolean isFlushing()
public boolean getPostLoadOnMerge()
StoreContext
getPostLoadOnMerge in interface StoreContextfalse by defaultpublic void setPostLoadOnMerge(boolean allow)
StoreContexttrue if the merge operation should trigger
a @PostLoad lifecycle event.
setPostLoadOnMerge in interface StoreContextallow - PostLoad lifecycle events to be triggered on a merge operation
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||