|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface StoreContext
Represents a set of managed objects and their environment.
Field Summary | |
---|---|
static BitSet |
EXCLUDE_ALL
Marker bitset to indicate that all field loads should be excluded in the find methods of this interface. |
static int |
OID_ALLOW_NEW
|
static int |
OID_COPY
|
static int |
OID_NODELETED
|
static int |
OID_NOVALIDATE
|
Method Summary | |
---|---|
void |
beginStore()
Begin a data store transaction. |
OpenJPAStateManager |
embed(Object obj,
Object id,
OpenJPAStateManager owner,
ValueMetaData ownerMeta)
Make the given instance embedded. |
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. |
Broker |
getBroker()
Return the broker for this context, if possible. |
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. |
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. |
FetchConfiguration |
getFetchConfiguration()
Return the (mutable) fetch configuration for loading objects from this context. |
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. |
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 |
getOrderDirtyObjects()
Whether to maintain the order in which objects are dirtied for 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. |
OpenJPAStateManager |
getStateManager(Object obj)
Return the state manager for the given instance. |
DelegatingStoreManager |
getStoreManager()
Return the store manager in use. |
Collection |
getTransactionalObjects()
Return a list of current transaction instances. |
Collection |
getUpdatedTypes()
Return the set of classes for objects that have been modified in the current transaction. |
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. |
boolean |
isActive()
Whether a logical transaction is active. |
boolean |
isDeleted(Object obj)
Return whether the given object is deleted. |
boolean |
isDirty(Object obj)
Return whether the given object is dirty. |
boolean |
isLargeTransaction()
Whether memory usage is reduced during this transaction at the expense of possibly more aggressive data cache evictions. |
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 |
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. |
Object |
newObjectId(Class cls,
Object val)
Create a new object id instance from the given value. |
void |
nontransactional(Object pc,
OpCallbacks call)
Make the given object nontransactional. |
void |
nontransactionalAll(Collection objs,
OpCallbacks call)
Make the given objects nontransactional. |
void |
retrieve(Object pc,
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 |
setDetachState(int mode)
Detach mode constant to determine which fields are part of the detached graph. |
void |
setLargeTransaction(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. |
void |
setOrderDirtyObjects(boolean order)
Whether to maintain the order in which objects are dirtied for getDirtyObjects() . |
void |
setPopulateDataCache(boolean cache)
Whether to populate the store cache with objects used by this transaction. |
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. |
void |
unlock()
Releases the internal lock. |
Field Detail |
---|
static final BitSet EXCLUDE_ALL
find
methods of this interface.
static final int OID_NOVALIDATE
static final int OID_NODELETED
static final int OID_COPY
static final int OID_ALLOW_NEW
Method Detail |
---|
Broker getBroker()
OpenJPAConfiguration getConfiguration()
FetchConfiguration getFetchConfiguration()
ClassLoader getClassLoader()
LockManager getLockManager()
DelegatingStoreManager getStoreManager()
DelegatingStoreManager.getInnermostDelegate()
.
String getConnectionUserName()
String getConnectionPassword()
Object findCached(Object oid, FindCallbacks call)
oid
- the object's id
Object find(Object oid, boolean validate, FindCallbacks call)
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.
validate
- if true, validate that the instance exists in the
store and load fetch group fields, otherwise return
any cached or hollow instanceObject[] findAll(Collection oids, boolean validate, FindCallbacks call)
oids
- the oids of the objects to return
#find(Object,boolean)
Object find(Object oid, FetchConfiguration fetch, BitSet exclude, Object edata, int flags)
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.
Object[] findAll(Collection oids, FetchConfiguration fetch, BitSet exclude, Object edata, int flags)
find(Object,FetchConfiguration,BitSet,Object,int)
Iterator extentIterator(Class cls, boolean subs, FetchConfiguration fetch, boolean ignoreChanges)
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)
.
void retrieve(Object pc, boolean fgOnly, OpCallbacks call)
fgOnly
- indicator as to whether to retrieve only fields
in the current fetch groups, or all fieldsretrieve(java.lang.Object, boolean, org.apache.openjpa.kernel.OpCallbacks)
void retrieveAll(Collection objs, boolean fgOnly, OpCallbacks call)
fgOnly
- indicator as to whether to retrieve only fieldsretrieve(java.lang.Object, boolean, org.apache.openjpa.kernel.OpCallbacks)
OpenJPAStateManager embed(Object obj, Object id, OpenJPAStateManager owner, ValueMetaData ownerMeta)
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
Class getObjectIdType(Class cls)
Object newObjectId(Class cls, Object val)
cls
- the persitent class that uses this identity valueval
- an object id instance, stringified object id, or primary
key valueCollection getPersistedTypes()
Collection getDeletedTypes()
Collection getUpdatedTypes()
Collection getManagedObjects()
Collection getTransactionalObjects()
Collection getPendingTransactionalObjects()
Collection getDirtyObjects()
boolean getOrderDirtyObjects()
getDirtyObjects()
. Default is the store manager's decision.
void setOrderDirtyObjects(boolean order)
getDirtyObjects()
. Default is the store manager's decision.
OpenJPAStateManager getStateManager(Object obj)
obj
is not
a managed type or is managed by another context, throw an exception.
int getLockLevel(Object obj)
Object getVersion(Object obj)
o
.
boolean isDirty(Object obj)
boolean isTransactional(Object obj)
void transactional(Object pc, boolean updateVersion, OpCallbacks call)
pc
- instance to make transactionalupdateVersion
- if true, the instance's version will be
incremented at the next flushvoid transactionalAll(Collection objs, boolean updateVersion, OpCallbacks call)
objs
- instances to make transactionalupdateVersion
- if true, the instance's version will be
incremented at the next flushvoid nontransactional(Object pc, OpCallbacks call)
void nontransactionalAll(Collection objs, OpCallbacks call)
boolean isPersistent(Object obj)
boolean isNew(Object obj)
broker
.
boolean isDeleted(Object obj)
Object getObjectId(Object obj)
int getDetachState()
DetachState.DETACH_LOADED
.
void setDetachState(int mode)
DetachState.DETACH_LOADED
.
boolean getPopulateDataCache()
void setPopulateDataCache(boolean cache)
boolean isLargeTransaction()
void setLargeTransaction(boolean largeTransaction)
RemoteCommitEvent
s. Defaults to false.
boolean isManaged()
boolean isActive()
boolean isStoreActive()
void beginStore()
boolean hasConnection()
Object getConnection()
void lock()
Multithreaded
flag is set to true. Make sure to call
unlock()
in a finally clause of the same method.
void unlock()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |