|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface ExecutionContext
Context of execution for persistence operations. In the traditional Java persistence role this will be an ObjectManager.
| Nested Class Summary | |
|---|---|
static interface |
ExecutionContext.LifecycleListener
|
| Method Summary | |
|---|---|
void |
addInternalFetchGroup(FetchGroup grp)
Method to add an internal fetch group to this ObjectManager. |
void |
addListener(Object listener,
Class[] classes)
Method to register a listener for instances of the specified classes. |
void |
addObjectProvider(ObjectProvider op)
Method to add the object managed by the specified ObjectProvider to the cache. |
void |
assertClassPersistable(Class cls)
Convenience method to assert if the passed class is not persistable. |
void |
attachObject(ObjectProvider op,
Object pc,
boolean sco)
Method to attach the passed object (and related objects). |
Object |
attachObjectCopy(ObjectProvider op,
Object pc,
boolean sco)
Method to attach a copy of the passed object (and related objects). |
void |
clearDirty()
Method to mark as clean all ObjectProviders of dirty objects. |
void |
clearDirty(ObjectProvider op)
Mark the specified ObjectProvider as clean. |
void |
close()
Method to close the execution context. |
void |
deleteObject(Object obj)
Method to delete an object from the datastore. |
void |
deleteObjectInternal(Object pc)
Method to delete the passed object (internally). |
void |
deleteObjects(Object[] objs)
Method to delete an array of objects from the datastore. |
void |
detachAll()
Method to detach all managed objects. |
void |
detachObject(Object pc,
FetchPlanState state)
Method to detach the passed object. |
Object |
detachObjectCopy(Object pc,
FetchPlanState state)
Method to detach a copy of the passed object using the provided state. |
void |
disconnectLifecycleListener()
Disconnect the registered LifecycleListener |
void |
enlistInTransaction(ObjectProvider op)
Method to enlist the specified ObjectProvider in the current transaction. |
void |
evictAllObjects()
Method to evict all L1 cache objects |
void |
evictFromTransaction(ObjectProvider op)
Method to evict the specified ObjectProvider from the current transaction. |
void |
evictObject(Object pc)
Method to evict the passed object. |
void |
evictObjects(Class cls,
boolean subclasses)
Method to evict all objects of the specified type (and optionaly its subclasses). |
boolean |
exists(Object obj)
Method to return if the specified object exists in the datastore. |
Object |
findObject(Object id,
boolean validate,
boolean checkInheritance,
String objectClassName)
Accessor for an object given the object id. |
Object |
findObject(Object id,
FieldValues fv,
Class pcClass,
boolean ignoreCache,
boolean checkInheritance)
Accessor for an object given the object id. |
ObjectProvider |
findObjectProvider(Object pc)
Method to find the ObjectProvider for the passed persistable object when it is managed by this manager. |
ObjectProvider |
findObjectProvider(Object pc,
boolean persist)
Method to find the ObjectProvider for the passed persistable object when it is managed by this manager, and if not yet persistent to persist it. |
ObjectProvider |
findObjectProviderForEmbedded(Object value,
ObjectProvider owner,
AbstractMemberMetaData mmd)
Method to find the ObjectProvider for the passed embedded persistable object. |
Object[] |
findObjects(Object[] ids,
boolean validate)
Accessor for objects with the specified identities. |
void |
flush()
Method callable from external APIs for user-management of flushing. |
void |
flushInternal(boolean flushToDatastore)
Method to flushes all dirty, new, and deleted instances to the datastore. |
ApiAdapter |
getApiAdapter()
Accessor for the API adapter. |
Object |
getAttachedObjectForId(Object id)
Convenience method to return the attached object for the specified id if one exists. |
Boolean |
getBooleanProperty(String name)
Accessor for a boolean property value. |
CallbackHandler |
getCallbackHandler()
Retrieve the callback handler for this PM |
ClassLoaderResolver |
getClassLoaderResolver()
Accessor for the ClassLoader resolver to use in class loading issues. |
Integer |
getDatastoreReadTimeoutMillis()
Accessor for the datastore read timeout in milliseconds. |
Integer |
getDatastoreWriteTimeoutMillis()
Accessor for the datastore write timeout in milliseconds. |
Extent |
getExtent(Class candidateClass,
boolean includeSubclasses)
Accessor for the Extent for a class (and optionally its subclasses). |
Set |
getFetchGroupsWithName(String name)
Accessor for the fetch groups for the specified name. |
FetchPlan |
getFetchPlan()
Acessor for the current FetchPlan |
boolean |
getIgnoreCache()
Accessor for whether to ignore the cache. |
FetchGroup |
getInternalFetchGroup(Class cls,
String name)
Accessor for an internal fetch group for the specified class. |
Integer |
getIntProperty(String name)
Accessor for an int property value. |
Lock |
getLock()
Accessor for the lock object for this ObjectManager. |
LockManager |
getLockManager()
Accessor for the lock manager for this execution context. |
Set |
getManagedObjects()
Accessor for the currently managed objects for the current transaction. |
Set |
getManagedObjects(Class[] classes)
Accessor for the currently managed objects for the current transaction. |
Set |
getManagedObjects(String[] states)
Accessor for the currently managed objects for the current transaction. |
Set |
getManagedObjects(String[] states,
Class[] classes)
Accessor for the currently managed objects for the current transaction. |
boolean |
getManageRelations()
Whether managed relations are supported by this execution context. |
MetaDataManager |
getMetaDataManager()
Accessor for the MetaData Manager. |
boolean |
getMultithreaded()
Accessor for whether this context is multithreaded. |
NucleusContext |
getNucleusContext()
Accessor for the context in which this execution context is running. |
Object |
getObjectFromCache(Object id)
Convenience method to access an object in the cache. |
List<ObjectProvider> |
getObjectsToBeFlushed()
Convenience method to inspect the list of objects with outstanding changes to flush. |
Object |
getOwner()
Method to return the owner object. |
Map<String,Object> |
getProperties()
Accessor for the defined properties. |
Object |
getProperty(String name)
Accessor for a property. |
RelationshipManager |
getRelationshipManager(ObjectProvider op)
Accessor for the RelationshipManager for the provided ObjectProvider. |
boolean |
getSerializeReadForClass(String className)
Convenience method to return the setting for serialize read for the current transaction for the specified class name. |
ManagerStatistics |
getStatistics()
Accessor for any statistics-gathering object. |
StoreManager |
getStoreManager()
Accessor for the Store Manager. |
Set<String> |
getSupportedProperties()
Accessor for the supported property names. |
Transaction |
getTransaction()
Accessor for the current transaction for this execution context. |
TypeManager |
getTypeManager()
TODO should we keep this here? this is api/language dependent |
boolean |
hasIdentityInCache(Object id)
Whether an object with the specified identity exists in the cache(s). |
boolean |
hasPersistenceInformationForClass(Class cls)
Utility method to check if the specified class has reachable metadata or annotations. |
void |
hereIsObjectProvider(ObjectProvider op,
Object pc)
Method to register the ObjectProvider as being for the passed object. |
boolean |
isClosed()
Accessor for whether this execution context is closed. |
boolean |
isDelayDatastoreOperationsEnabled()
Whether the datastore operations are delayed until commit. |
boolean |
isEnlistedInTransaction(Object id)
Method to return if an object is enlisted in the current transaction. |
boolean |
isFlushing()
Accessor for whether the ObjectManager is flushing changes to the datastore. |
boolean |
isInserting(Object pc)
Tests whether this persistable object is being inserted. |
boolean |
isManagingRelations()
Returns whether this ObjectManager is currently performing the manage relationships task. |
boolean |
isObjectModifiedInTransaction(Object id)
Accessor for whether the object with this identity is modified in the current transaction. |
boolean |
isRunningDetachAllOnCommit()
Accessor for whether this ObjectManager is currently running detachAllOnCommit. |
void |
makeObjectNontransactional(Object pc)
Method to make the passed object nontransactional. |
void |
makeObjectTransactional(Object pc)
Method to make the passed object transactional. |
void |
makeObjectTransient(Object pc,
FetchPlanState state)
Method to make transient the passed object. |
void |
markDirty(ObjectProvider op,
boolean directUpdate)
Mark the specified ObjectProvider as dirty |
Object |
newInstance(Class cls)
Method to generate an instance of an interface, abstract class, or concrete PC class. |
Object |
newObjectId(Class pcClass,
Object key)
This method returns an object id instance corresponding to the pcClass and key arguments. |
Object |
newObjectId(String className,
Object pc)
This method returns an object id instance corresponding to the class name, and the passed object (when using app identity). |
ObjectProvider |
newObjectProviderForDetached(Object pc,
Object id,
Object version)
Constructor for creating ObjectProvider instances to manage persistable objects in detached state. |
ObjectProvider |
newObjectProviderForEmbedded(AbstractClassMetaData cmd,
ObjectProvider ownerOP,
int ownerFieldNumber)
Constructs an ObjectProvider for an object of the specified type, creating the PC object to hold the values where this object will be EMBEDDED/SERIALISED into another persistable object. |
ObjectProvider |
newObjectProviderForEmbedded(Object pc,
boolean copyPc,
ObjectProvider ownerOP,
int ownerFieldNumber)
Constructs an ObjectProvider to manage a persistable instance that will be EMBEDDED/SERIALISED into another persistable object. |
ObjectProvider |
newObjectProviderForHollow(Class pcClass,
Object id)
Constructs an ObjectProvider to manage a hollow instance having the given object ID. |
ObjectProvider |
newObjectProviderForHollowPopulated(Class pcClass,
Object id,
FieldValues fv)
Constructs an ObjectProvider to manage a recently populated hollow instance having the given object ID and the given field values. |
ObjectProvider |
newObjectProviderForHollowPopulatedAppId(Class pcClass,
FieldValues fv)
Deprecated. Use newForHollowPopulated instead |
ObjectProvider |
newObjectProviderForHollowPreConstructed(Object id,
Object pc)
Constructs an ObjectProvider to manage a hollow instance having the given object ID. |
ObjectProvider |
newObjectProviderForPersistentClean(Object id,
Object pc)
Constructs an ObjectProvider to manage the specified persistent instance having the given object ID. |
ObjectProvider |
newObjectProviderForPersistentNew(Object pc,
FieldValues fv)
Constructs an ObjectProvider to manage a transient instance that is becoming newly persistent. |
ObjectProvider |
newObjectProviderForPNewToBeDeleted(Object pc)
Constructor for creating ObjectProvider instances to manage persistable objects that are not persistent yet are about to be deleted. |
ObjectProvider |
newObjectProviderForTransactionalTransient(Object pc)
Constructs an ObjectProvider to manage a Transactional Transient instance. |
Query |
newQuery()
Accessor for a new Query. |
Object |
persistObject(Object pc,
boolean merging)
Method to persist the passed object. |
Object |
persistObjectInternal(Object pc,
FieldValues preInsertChanges,
int objectType)
Method to persist the passed object (internally). |
Object |
persistObjectInternal(Object pc,
FieldValues preInsertChanges,
ObjectProvider ownerOP,
int ownerFieldNum,
int objectType)
Method to persist the passed object (internally). |
Object |
persistObjectInternal(Object pc,
ObjectProvider ownerOP,
int ownerFieldNum,
int objectType)
Method to persist the passed object (internally). |
Object[] |
persistObjects(Object[] pcs)
Method to persist the passed object(s). |
void |
processNontransactionalUpdate()
Method to process any outstanding non-transactional updates that are queued. |
void |
putObjectIntoLevel1Cache(ObjectProvider op)
Method to put a Persistable object associated to the ObjectProvider into the L1 cache. |
void |
refreshAllObjects()
Method to refresh all L1 cache objects |
void |
refreshObject(Object pc)
Method to refresh the passed object. |
void |
removeListener(Object listener)
Method to remove a currently registered listener. |
void |
removeObjectFromLevel1Cache(Object id)
Method to remove an object from the L1 cache. |
void |
removeObjectFromLevel2Cache(Object id)
Method to remove an object from the L2 cache. |
void |
removeObjectProvider(ObjectProvider op)
Method to remove the object managed by the specified ObjectProvider from the cache. |
void |
replaceObjectId(Object pc,
Object oldID,
Object newID)
Replace the previous object id for a PC object to a new |
void |
retrieveObject(Object pc,
boolean fgOnly)
Method to retrieve the passed object. |
void |
setProperties(Map props)
Method to set properties on the execution context. |
void |
setProperty(String name,
Object value)
Method to set a property on the execution context |
| Method Detail |
|---|
Object getOwner()
Transaction getTransaction()
StoreManager getStoreManager()
MetaDataManager getMetaDataManager()
NucleusContext getNucleusContext()
ApiAdapter getApiAdapter()
FetchPlan getFetchPlan()
ClassLoaderResolver getClassLoaderResolver()
LockManager getLockManager()
ManagerStatistics getStatistics()
void setProperties(Map props)
props - The properties
void setProperty(String name,
Object value)
name - Name of the propertyvalue - Value to setObject getProperty(String name)
name - Name of the property
Boolean getBooleanProperty(String name)
name - Name of the property
Integer getIntProperty(String name)
name - Name of the property
Map<String,Object> getProperties()
Set<String> getSupportedProperties()
TypeManager getTypeManager()
void close()
boolean isClosed()
boolean getIgnoreCache()
Integer getDatastoreReadTimeoutMillis()
Integer getDatastoreWriteTimeoutMillis()
ObjectProvider findObjectProvider(Object pc)
pc - The persistable object
ObjectProvider findObjectProvider(Object pc,
boolean persist)
pc - The persistable objectpersist - Whether to persist if not yet persistent
ObjectProvider findObjectProviderForEmbedded(Object value,
ObjectProvider owner,
AbstractMemberMetaData mmd)
value - The embedded objectowner - The owner ObjectProvider (if known).mmd - Metadata for the field of the owner
void hereIsObjectProvider(ObjectProvider op,
Object pc)
op - The ObjectProviderpc - The object managed by the ObjectProvider
ObjectProvider newObjectProviderForHollow(Class pcClass,
Object id)
pcClass - the class of the new instance to be created.id - the JDO identity of the object.
ObjectProvider newObjectProviderForHollowPreConstructed(Object id,
Object pc)
id - the JDO identity of the object.pc - The object that is hollow that we are going to manage
ObjectProvider newObjectProviderForHollowPopulated(Class pcClass,
Object id,
FieldValues fv)
pcClass - the class of the new instance to be created.id - the JDO identity of the object.fv - the initial field values of the object.
ObjectProvider newObjectProviderForPersistentClean(Object id,
Object pc)
id - the JDO identity of the object.pc - The object that is persistent that we are going to manage
ObjectProvider newObjectProviderForHollowPopulatedAppId(Class pcClass,
FieldValues fv)
pcClass - the class of the new instance to be created.fv - the initial field values of the object.
ObjectProvider newObjectProviderForEmbedded(Object pc,
boolean copyPc,
ObjectProvider ownerOP,
int ownerFieldNumber)
pc - The persistable to manage (see copyPc also)copyPc - Whether the SM should manage a copy of the passed PC or that oneownerOP - Owner ObjectProviderownerFieldNumber - Field number in owner object where this is stored
ObjectProvider newObjectProviderForEmbedded(AbstractClassMetaData cmd,
ObjectProvider ownerOP,
int ownerFieldNumber)
cmd - Meta-data for the class that this is an instance of.ownerOP - Owner ObjectProviderownerFieldNumber - Field number in owner object where this is stored
ObjectProvider newObjectProviderForPersistentNew(Object pc,
FieldValues fv)
pc - the instance being make persistent.fv - Any changes to make before insertingObjectProvider newObjectProviderForTransactionalTransient(Object pc)
pc - the instance being make persistent.
ObjectProvider newObjectProviderForDetached(Object pc,
Object id,
Object version)
pc - the detached objectid - the JDO identity of the object.version - the detached versionObjectProvider newObjectProviderForPNewToBeDeleted(Object pc)
pc - the object being deleted from persistencevoid addObjectProvider(ObjectProvider op)
op - The ObjectProvidervoid removeObjectProvider(ObjectProvider op)
op - The ObjectProvidervoid evictObject(Object pc)
pc - The object
void evictObjects(Class cls,
boolean subclasses)
cls - Type of persistable objectsubclasses - Whether to include subclassesvoid evictAllObjects()
void retrieveObject(Object pc,
boolean fgOnly)
pc - The objectfgOnly - Just retrieve the current fetch group
Object persistObject(Object pc,
boolean merging)
pc - The objectmerging - Whether this object (and dependents) is being merged
Object[] persistObjects(Object[] pcs)
pcs - The objects to persist
Object persistObjectInternal(Object pc,
FieldValues preInsertChanges,
ObjectProvider ownerOP,
int ownerFieldNum,
int objectType)
pc - The objectpreInsertChanges - Changes to be made before insertingownerOP - ObjectProvider of the owner when embeddedownerFieldNum - Field number in the owner where this is embedded (or -1 if not embedded)objectType - Type of object (see org.datanucleus.store.ObjectProvider, e.g ObjectProvider.PC)
Object persistObjectInternal(Object pc,
ObjectProvider ownerOP,
int ownerFieldNum,
int objectType)
pc - The objectownerOP - ObjectProvider of the owner when embeddedownerFieldNum - Field number in the owner where this is embedded (or -1 if not embedded)objectType - Type of object (see org.datanucleus.StateManager, e.g StateManager.PC)
Object persistObjectInternal(Object pc,
FieldValues preInsertChanges,
int objectType)
pc - The objectpreInsertChanges - Changes to be made before insertingobjectType - Type of object (see org.datanucleus.StateManager, e.g StateManager.PC)
void makeObjectTransient(Object pc,
FetchPlanState state)
pc - The objectstate - Object containing the state of the fetchplan processingvoid makeObjectTransactional(Object pc)
pc - The objectvoid makeObjectNontransactional(Object pc)
pc - The objectboolean exists(Object obj)
obj - The (persistable) object
Set getManagedObjects()
Set getManagedObjects(Class[] classes)
classes - Classes that we want the objects for
Set getManagedObjects(String[] states)
states - States that we want the objects for
Set getManagedObjects(String[] states,
Class[] classes)
states - States that we want the objects forclasses - Classes that we want the objects for
void deleteObject(Object obj)
obj - The objectvoid deleteObjects(Object[] objs)
objs - The objects to deletevoid deleteObjectInternal(Object pc)
pc - The object
void detachObject(Object pc,
FetchPlanState state)
pc - The object to detachstate - State for the detachment process.
Object detachObjectCopy(Object pc,
FetchPlanState state)
pc - The objectstate - State for the detachment process
void detachAll()
void attachObject(ObjectProvider op,
Object pc,
boolean sco)
op - ObjectProvider of the owning object that has this in a field causing its attachpc - The (detached) objectsco - Whether the object has no identity (embedded or serialised)
Object attachObjectCopy(ObjectProvider op,
Object pc,
boolean sco)
op - ObjectProvider of the owning object that has this in a field causing its attachpc - The objectsco - Whether it has no identity (second-class object)
Object getAttachedObjectForId(Object id)
id - The id
void refreshObject(Object pc)
pc - The objectvoid refreshAllObjects()
void enlistInTransaction(ObjectProvider op)
op - The ObjectProviderboolean isEnlistedInTransaction(Object id)
id - Identity for the object
void evictFromTransaction(ObjectProvider op)
op - The ObjectProvider
void markDirty(ObjectProvider op,
boolean directUpdate)
op - ObjectProviderdirectUpdate - Whether the object has had a direct update made on it (if known)void clearDirty(ObjectProvider op)
op - The ObjectProvidervoid clearDirty()
boolean isDelayDatastoreOperationsEnabled()
void processNontransactionalUpdate()
Object findObject(Object id,
boolean validate,
boolean checkInheritance,
String objectClassName)
id - Id of the object.validate - Whether to validate the object statecheckInheritance - Whether look to the database to determine which
class this object is. This parameter is a hint. Set false, if it's
already determined the correct pcClass for this pc "object" in a certain
level in the hierarchy. Set to true and it will look to the database.objectClassName - Class name for the object with this id (if known, optional)
Object findObject(Object id,
FieldValues fv,
Class pcClass,
boolean ignoreCache,
boolean checkInheritance)
id - Id of the object.fv - FieldValues to apply to the object (optional)pcClass - the type which the object is. This type will be used to instantiate the objectignoreCache - true if the cache is ignoredcheckInheritance - Whether to check the inheritance of this object
Object[] findObjects(Object[] ids,
boolean validate)
ids - Ids of the object(s).validate - Whether to validate the object state
NucleusObjectNotFoundException - if an object doesn't exist in the datastore
Extent getExtent(Class candidateClass,
boolean includeSubclasses)
candidateClass - The classincludeSubclasses - Whether to include subclasses
Query newQuery()
void putObjectIntoLevel1Cache(ObjectProvider op)
op - The ObjectProviderObject getObjectFromCache(Object id)
id - Id of the object
void removeObjectFromLevel1Cache(Object id)
id - The id of the objectvoid removeObjectFromLevel2Cache(Object id)
id - The id of the objectboolean hasIdentityInCache(Object id)
id - The identity
Object newObjectId(Class pcClass,
Object key)
pcClass - Class of the PersistenceCapable to create the identity forkey - Value of the key for SingleFieldIdentity (or the toString value)
Object newObjectId(String className,
Object pc)
className - Name of the class of the object.pc - The persistable object. Used for application-identity
boolean getSerializeReadForClass(String className)
className - Name of the class
void assertClassPersistable(Class cls)
cls - The class of which we want to persist objects
ClassNotPersistableException - When the class is not persistable
NoPersistenceInformationException - When the class has no available persistence informationboolean hasPersistenceInformationForClass(Class cls)
cls - The class to check
boolean isInserting(Object pc)
pc - the object to verify the status
boolean isFlushing()
boolean isRunningDetachAllOnCommit()
void flush()
void flushInternal(boolean flushToDatastore)
flushToDatastore - Whether to ensure any changes reach the datastore
Otherwise they will be flushed to the datastore manager and leave it to
decide the opportune moment to actually flush them to teh datastore
NucleusOptimisticException - when optimistic locking error(s) occurboolean getMultithreaded()
boolean getManageRelations()
RelationshipManager getRelationshipManager(ObjectProvider op)
op - ObjectProvider
boolean isManagingRelations()
List<ObjectProvider> getObjectsToBeFlushed()
CallbackHandler getCallbackHandler()
void addListener(Object listener,
Class[] classes)
listener - The listener to sends events toclasses - The classes that it is interested invoid removeListener(Object listener)
listener - The instance lifecycle listener to remove.void disconnectLifecycleListener()
FetchGroup getInternalFetchGroup(Class cls,
String name)
cls - The classname - Name of the group
void addInternalFetchGroup(FetchGroup grp)
grp - The internal fetch groupSet getFetchGroupsWithName(String name)
name - Name of the group
Lock getLock()
Object newInstance(Class cls)
cls - The class of the interface or abstract class, or concrete class defined in MetaData
boolean isObjectModifiedInTransaction(Object id)
id - The identity.
void replaceObjectId(Object pc,
Object oldID,
Object newID)
pc - The Persistable objectoldID - the old idnewID - the new id
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||