|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface ObjectManager
Definition of an ObjectManager. Provides the basics of object persistence internally, upon which are built javax.jdo.PersistenceManager and javax.persistence.EntityManager.
| Method Summary | |
|---|---|
void |
addInternalFetchGroup(FetchGroup grp)
Method to add an internal fetch group to this ObjectManager. |
void |
addListener(java.lang.Object listener,
java.lang.Class[] classes)
Method to register a listener for instances of the specified classes. |
void |
addStateManager(StateManager sm)
Method to add the object managed by the specified StateManager to the cache. |
void |
assertClassPersistable(java.lang.Class cls)
Convenience method to assert if the passed class is not persistable. |
void |
attachObject(java.lang.Object pc,
boolean sco)
Method to attach the passed object (and related objects). |
java.lang.Object |
attachObjectCopy(java.lang.Object pc,
boolean sco)
Method to attach a copy of the passed object (and related objects). |
void |
clearDirty()
Method to mark as clean all StateManagers of dirty objects. |
void |
clearDirty(StateManager sm)
Mark the specified StateManager as clean. |
void |
close()
Method to close the ObjectManager. |
void |
deleteObject(java.lang.Object obj)
Method to delete an object from the datastore. |
void |
deleteObjectInternal(java.lang.Object pc)
Method to delete the passed object (internally). |
void |
deleteObjects(java.lang.Object[] objs)
Method to delete an array of objects from the datastore. |
void |
detachAll()
Method to detach all objects in the PM. |
void |
detachObject(java.lang.Object pc,
FetchPlanState state)
Method to detach the passed object. |
java.lang.Object |
detachObjectCopy(java.lang.Object pc,
FetchPlanState state)
Method to detach a copy of the passed object using the provided state. |
void |
disconnectLifecycleListener()
Disconnect the registered LifecycleListener |
void |
disconnectSMCache()
Disconnect SM instances, clear cache and reset settings |
void |
enlistInTransaction(StateManager sm)
Method to enlist the specified StateManager in the current transaction. |
void |
evictAllObjects()
Method to evict all L1 cache objects |
void |
evictFromTransaction(StateManager sm)
Method to evict the specified StateManager from the current transaction. |
void |
evictObject(java.lang.Object pc)
Method to evict the passed object. |
void |
evictObjects(java.lang.Class cls,
boolean subclasses)
Method to evict all objects of the specified type (and optionaly its subclasses). |
boolean |
exists(java.lang.Object obj)
Method to return if the specified object exists in the datastore. |
java.lang.Object |
findObject(java.lang.Object id,
boolean validate,
boolean checkInheritance,
java.lang.String objectClassName)
Accessor for an object given the object id. |
java.lang.Object |
findObject(java.lang.Object id,
FieldValues fv,
java.lang.Class pcClass,
boolean ignoreCache)
Accessor for an object given the object id. |
java.lang.Object[] |
findObjects(java.lang.Object[] ids,
boolean validate)
Accessor for objects with the specified identities. |
java.lang.Object |
findObjectUsingAID(java.lang.Class pcClass,
FieldValues fv,
boolean ignoreCache,
boolean checkInheritance)
Accessor for an object given the object id. |
StateManager |
findStateManager(java.lang.Object pc)
Method to find the StateManager for the passed persistable object when it is managed by this manager. |
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. |
java.lang.Object |
getAttachedObjectForId(java.lang.Object id)
Convenience method to return the attached object for the specified id if one exists. |
CallbackHandler |
getCallbackHandler()
Retrieve the callback handler for this PM |
ClassLoaderResolver |
getClassLoaderResolver()
Accessor for the ClassLoader resolver to use in class loading issues. |
boolean |
getCopyOnAttach()
Accessor for whether the ObjectManager should copy on attaching. |
java.lang.Integer |
getDatastoreReadTimeoutMillis()
Accessor for the datastore read timeout in milliseconds. |
java.lang.Integer |
getDatastoreWriteTimeoutMillis()
Accessor for the datastore write timeout in milliseconds. |
boolean |
getDetachAllOnCommit()
Accessor for whether the ObjectManager will detach all objects on commit |
boolean |
getDetachAllOnRollback()
Accessor for whether the ObjectManager will detach all objects on rollback |
ExecutionContext |
getExecutionContext()
|
Extent |
getExtent(java.lang.Class candidateClass,
boolean includeSubclasses)
Accessor for the Extent for a class (and optionally its subclasses). |
java.util.Set |
getFetchGroupsWithName(java.lang.String name)
Accessor for the fetch groups for the specified name. |
FetchPlan |
getFetchPlan()
Acessor for the current FetchPlan |
java.lang.String |
getIdentityAsString(java.lang.Object id)
Convenience method to return the identity as a String. |
boolean |
getIgnoreCache()
Accessor for whether to ignore the cache. |
FetchGroup |
getInternalFetchGroup(java.lang.Class cls,
java.lang.String name)
Accessor for an internal fetch group for the specified class. |
LockManager |
getLockManager()
Accessor for the lock manager for this ObjectManager. |
java.util.Set |
getManagedObjects()
Accessor for the currently managed objects for the current transaction. |
java.util.Set |
getManagedObjects(java.lang.Class[] classes)
Accessor for the currently managed objects for the current transaction. |
java.util.Set |
getManagedObjects(java.lang.String[] states)
Accessor for the currently managed objects for the current transaction. |
java.util.Set |
getManagedObjects(java.lang.String[] states,
java.lang.Class[] classes)
Accessor for the currently managed objects for the current transaction. |
MetaDataManager |
getMetaDataManager()
Accessor for the MetaData Manager. |
boolean |
getMultithreaded()
Accessor for whether the ObjectManager is multithreaded |
java.lang.Object |
getObjectFromCache(java.lang.Object id)
Convenience method to access an object in the cache. |
ObjectManagerFactoryImpl |
getObjectManagerFactory()
Accessor for the ObjectManagerFactory to which this manager belongs. |
OMFContext |
getOMFContext()
Accessor for the context in which this ObjectManager is running. |
java.lang.Object |
getOwner()
Method to return the owner object. |
java.lang.Object |
getReadWriteLock()
Accessor for a read-write lock object. |
boolean |
getSerializeReadForClass(java.lang.String className)
Convenience method to return the setting for serialize read for the current transaction for the specified class name. |
StateManager |
getStateManagerById(java.lang.Object myID)
Accessor for the StateManager of an object given the object id. |
StoreManager |
getStoreManager()
Accessor for the Store Manager. |
Transaction |
getTransaction()
Accessor for the current transaction for this ObjectManager. |
boolean |
hasIdentityInCache(java.lang.Object id)
Whether the specified identity is cached currently. |
boolean |
hasPersistenceInformationForClass(java.lang.Class cls)
Utility method to check if the specified class has reachable metadata or annotations. |
void |
hereIsStateManager(StateManager sm,
java.lang.Object pc)
Method to register the StateManager as being for the passed object. |
boolean |
isClosed()
Accessor for whether this ObjectManager is closed. |
boolean |
isDelayDatastoreOperationsEnabled()
Whether the datastore operations are delayed until commit. |
boolean |
isEnlistedInTransaction(java.lang.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(java.lang.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(java.lang.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(java.lang.Object pc)
Method to make the passed object nontransactional. |
void |
makeObjectTransactional(java.lang.Object pc)
Method to make the passed object transactional. |
void |
makeObjectTransient(java.lang.Object pc,
FetchPlanState state)
Method to make transient the passed object. |
void |
markDirty(StateManager sm,
boolean directUpdate)
Mark the specified StateManager as dirty |
void |
markManagedRelationDirty(StateManager sm)
Method to mark the specified StateManager as needing an update due to managed relation constraints. |
java.lang.Object |
newInstance(java.lang.Class persistenceCapable)
Method to generate an instance of an interface, abstract class, or concrete PC class. |
java.lang.Object |
newObjectId(java.lang.Class pcClass,
java.lang.Object key)
This method returns an object id instance corresponding to the pcClass and key arguments. |
java.lang.Object |
newObjectId(java.lang.String className,
java.lang.Object pc)
This method returns an object id instance corresponding to the class name, and the passed object (when using app identity). |
Query |
newQuery()
Accessor for a new Query. |
java.lang.Object |
persistObject(java.lang.Object pc)
Method to persist the passed object. |
java.lang.Object |
persistObjectInternal(java.lang.Object pc,
FieldValues preInsertChanges,
StateManager ownerSM,
int ownerFieldNum,
int objectType)
Method to persist the passed object (internally). |
java.lang.Object[] |
persistObjects(java.lang.Object[] pcs)
Method to persist the passed object(s). |
void |
postBegin()
Method called during the begin process, after the actual begin. |
void |
postClose()
Method called during the close process. |
void |
postCommit()
Method called during the commit process, after the actual datastore commit. |
void |
postRollback()
Method called during the rollback process, after the actual datastore rollback. |
void |
preCommit()
Method called during the commit process, before the actual datastore commit. |
void |
preRollback()
Method called during the rollback process, after the actual datastore rollback. |
void |
putObjectIntoCache(StateManager sm)
Method to put a Persistable object associated to the StateManager into the L1 cache. |
void |
refreshAllObjects()
Method to refresh all L1 cache objects |
void |
refreshObject(java.lang.Object pc)
Method to refresh the passed object. |
void |
removeListener(java.lang.Object listener)
Method to remove a currently registered listener. |
void |
removeObjectFromCache(java.lang.Object pc,
java.lang.Object id)
Method to remove an object from the L1 cache. |
void |
removeObjectFromLevel2Cache(java.lang.Object id)
Method to remove an object from the L2 cache. |
void |
removeStateManager(StateManager sm)
Method to remove the object managed by the specified StateManager from the cache. |
void |
replaceObjectId(java.lang.Object pc,
java.lang.Object oldID,
java.lang.Object newID)
Replace the previous object id for a PC object to a new |
void |
retrieveObject(java.lang.Object pc,
boolean fgOnly)
Method to retrieve the passed object. |
void |
setCopyOnAttach(boolean flag)
Method whether to copy on attaching. |
void |
setDatastoreReadTimeoutMillis(java.lang.Integer val)
Mutator for the datastore read timeout in milliseconds. |
void |
setDatastoreWriteTimeoutMillis(java.lang.Integer val)
Mutator for the datastore write timeout in milliseconds. |
void |
setDetachAllOnCommit(boolean flag)
Method to set DetachAllOnCommit. |
void |
setDetachAllOnRollback(boolean flag)
Method to set DetachAllOnRollback. |
void |
setDetachOnClose(boolean flag)
Method to set DetachOnClose. |
void |
setIgnoreCache(boolean ignore)
Method to set whether to ignore the L1 cache. |
void |
setMultithreaded(boolean multi)
Method to set whether the ObjectManager should operate multithreaded |
| Method Detail |
|---|
java.lang.Object getOwner()
void close()
boolean isClosed()
Transaction getTransaction()
StoreManager getStoreManager()
MetaDataManager getMetaDataManager()
OMFContext getOMFContext()
ObjectManagerFactoryImpl getObjectManagerFactory()
ApiAdapter getApiAdapter()
FetchPlan getFetchPlan()
boolean getIgnoreCache()
boolean getDetachAllOnCommit()
boolean getDetachAllOnRollback()
boolean getCopyOnAttach()
boolean getMultithreaded()
java.lang.Integer getDatastoreReadTimeoutMillis()
void setDatastoreReadTimeoutMillis(java.lang.Integer val)
val - The timeoutjava.lang.Integer getDatastoreWriteTimeoutMillis()
void setDatastoreWriteTimeoutMillis(java.lang.Integer val)
val - The timeoutvoid setDetachAllOnCommit(boolean flag)
flag - Whether to detach all objects on commit of the transaction.void setDetachAllOnRollback(boolean flag)
flag - Whether to detach all objects on rollback of the transaction.void setCopyOnAttach(boolean flag)
flag - Whether to copy on attaching.void setIgnoreCache(boolean ignore)
ignore - Whether to ignore the L1 cachevoid setMultithreaded(boolean multi)
multi - Whether to operate multithreadedvoid setDetachOnClose(boolean flag)
flag - Whether to detach all objects on close of the ObjectManager.ClassLoaderResolver getClassLoaderResolver()
CallbackHandler getCallbackHandler()
void assertClassPersistable(java.lang.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(java.lang.Class cls)
cls - The class to check
void evictObject(java.lang.Object pc)
pc - The object
void evictObjects(java.lang.Class cls,
boolean subclasses)
cls - Type of persistable objectsubclasses - Whether to include subclassesvoid evictAllObjects()
void refreshObject(java.lang.Object pc)
pc - The objectvoid refreshAllObjects()
void retrieveObject(java.lang.Object pc,
boolean fgOnly)
pc - The objectfgOnly - Just retrieve the current fetch groupjava.lang.Object persistObject(java.lang.Object pc)
pc - The object
java.lang.Object[] persistObjects(java.lang.Object[] pcs)
pcs - The objects to persist
java.lang.Object persistObjectInternal(java.lang.Object pc,
FieldValues preInsertChanges,
StateManager ownerSM,
int ownerFieldNum,
int objectType)
pc - The objectpreInsertChanges - Changes to be made before insertingownerSM - StateManager 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)
void makeObjectTransient(java.lang.Object pc,
FetchPlanState state)
pc - The objectstate - Object containing the state of the fetchplan processingvoid makeObjectTransactional(java.lang.Object pc)
pc - The objectvoid makeObjectNontransactional(java.lang.Object pc)
pc - The objectvoid deleteObject(java.lang.Object obj)
obj - The objectvoid deleteObjectInternal(java.lang.Object pc)
pc - The objectvoid deleteObjects(java.lang.Object[] objs)
objs - The objects to delete
void attachObject(java.lang.Object pc,
boolean sco)
pc - The (detached) objectsco - Whether the object has no identity (embedded or serialised)
java.lang.Object attachObjectCopy(java.lang.Object pc,
boolean sco)
pc - The objectsco - Whether it has no identity (second-class object)
void detachObject(java.lang.Object pc,
FetchPlanState state)
pc - The object to detachstate - State for the detachment process.
java.lang.Object detachObjectCopy(java.lang.Object pc,
FetchPlanState state)
pc - The objectstate - State for the detachment process
void detachAll()
boolean exists(java.lang.Object obj)
obj - The (persistable) object
java.util.Set getManagedObjects()
java.util.Set getManagedObjects(java.lang.Class[] classes)
classes - Classes that we want the objects for
java.util.Set getManagedObjects(java.lang.String[] states)
states - States that we want the objects for
java.util.Set getManagedObjects(java.lang.String[] states,
java.lang.Class[] classes)
states - States that we want the objects forclasses - Classes that we want the objects for
java.lang.Object[] findObjects(java.lang.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
java.lang.Object findObject(java.lang.Object id,
boolean validate,
boolean checkInheritance,
java.lang.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)
java.lang.Object findObject(java.lang.Object id,
FieldValues fv,
java.lang.Class pcClass,
boolean ignoreCache)
id - Id of the object.fv - the FieldValuespcClass - the type which the object is. This type will be used to instanciat the objectignoreCache - true if the cache is ignored
java.lang.Object findObjectUsingAID(java.lang.Class pcClass,
FieldValues fv,
boolean ignoreCache,
boolean checkInheritance)
fv - the FieldValues containing at minimum the primary key fieldspcClass - the type which the object isignoreCache - true if the cache is ignoredcheckInheritance - true if the cache is ignored
java.lang.Object newObjectId(java.lang.Class pcClass,
java.lang.Object key)
pcClass - Class of the PersistenceCapable to create the identity forkey - Value of the key for SingleFieldIdentity (or the toString value)
java.lang.Object newObjectId(java.lang.String className,
java.lang.Object pc)
className - Name of the class of the object.pc - The persistable object. Used for application-identity
java.lang.Object newInstance(java.lang.Class persistenceCapable)
persistenceCapable - The class of the interface or abstract class, or concrete class defined in MetaData
void enlistInTransaction(StateManager sm)
sm - The StateManagervoid evictFromTransaction(StateManager sm)
sm - The StateManagerboolean isEnlistedInTransaction(java.lang.Object id)
id - Identity for the object
StateManager findStateManager(java.lang.Object pc)
pc - The persistable object
void hereIsStateManager(StateManager sm,
java.lang.Object pc)
sm - The StateManagerpc - The object managed by the StateManagervoid addStateManager(StateManager sm)
sm - The StateManagervoid removeStateManager(StateManager sm)
sm - The StateManagerStateManager getStateManagerById(java.lang.Object myID)
myID - Id of the object.
void markDirty(StateManager sm,
boolean directUpdate)
sm - The StateManagerdirectUpdate - Whether the object has had a direct update made on it (if known)void clearDirty(StateManager sm)
sm - The StateManagervoid clearDirty()
void markManagedRelationDirty(StateManager sm)
sm - The StateManagerboolean isObjectModifiedInTransaction(java.lang.Object id)
id - The identity.
boolean isManagingRelations()
boolean isInserting(java.lang.Object pc)
pc - the object to verify the status
boolean isDelayDatastoreOperationsEnabled()
void preRollback()
void postRollback()
void postBegin()
void preCommit()
void postCommit()
void postClose()
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 isFlushing()
boolean isRunningDetachAllOnCommit()
Query newQuery()
Extent getExtent(java.lang.Class candidateClass,
boolean includeSubclasses)
candidateClass - The classincludeSubclasses - Whether to include subclasses
void replaceObjectId(java.lang.Object pc,
java.lang.Object oldID,
java.lang.Object newID)
pc - The Persistable objectoldID - the old idnewID - the new idvoid putObjectIntoCache(StateManager sm)
sm - The State Manager
void removeObjectFromCache(java.lang.Object pc,
java.lang.Object id)
pc - The objectid - The id of the objectvoid removeObjectFromLevel2Cache(java.lang.Object id)
id - The id of the objectjava.lang.Object getObjectFromCache(java.lang.Object id)
id - Id of the object
boolean hasIdentityInCache(java.lang.Object id)
id - The identity
void disconnectSMCache()
java.lang.Object getAttachedObjectForId(java.lang.Object id)
id - The id
void addListener(java.lang.Object listener,
java.lang.Class[] classes)
listener - The listener to sends events toclasses - The classes that it is interested invoid removeListener(java.lang.Object listener)
listener - The instance lifecycle listener to remove.void disconnectLifecycleListener()
FetchGroup getInternalFetchGroup(java.lang.Class cls,
java.lang.String name)
cls - The classname - Name of the group
void addInternalFetchGroup(FetchGroup grp)
grp - The internal fetch groupjava.util.Set getFetchGroupsWithName(java.lang.String name)
name - Name of the group
java.lang.String getIdentityAsString(java.lang.Object id)
id - The id
boolean getSerializeReadForClass(java.lang.String className)
className - Name of the class
ExecutionContext getExecutionContext()
LockManager getLockManager()
java.lang.Object getReadWriteLock()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||