SolarMetric Kodo JDO 2.5.8 generated on January 11 2004

com.solarmetric.kodo.runtime
Class PersistenceManagerImpl

java.lang.Object
  |
  +--com.solarmetric.kodo.runtime.PersistenceManagerImpl
All Implemented Interfaces:
EventManager, KodoTransaction, PersistenceManager, Transaction
Direct Known Subclasses:
EEPersistenceManager

public class PersistenceManagerImpl
extends Object
implements PersistenceManager, KodoTransaction, EventManager

Concrete PersistenceManager for use with this common runtime. The PersistenceManager handles JDO-specific behavior, but leaves all interaction with the data store to a StoreManager that must be supplied at initialization.

All options defined in the JDO 1.0 specification are supported, with the exception of non durable identity and changing primary keys.


Inner classes inherited from class com.solarmetric.kodo.runtime.event.EventManager
EventManager.EventManagerHelper
 
Field Summary
protected  StoreManager store
          The store manager in use; this may be a decorator such as a DataCacheStoreManager around the native store manager.
 
Constructor Summary
PersistenceManagerImpl()
           
 
Method Summary
 boolean addFetchGroup(String group)
          Adds group to the list of fetch group names to use when loading data.
 boolean addFetchGroups(String[] groups)
          Adds groups to the list of fetch group names to use when loading data.
(package private)  void addToTransaction(StateManagerImpl sm, boolean dirtied)
          Notify the PersistenceManager that the given StateManager should be added to the set of instances involved in the current transaction.
 void begin()
           
 void checkActiveTransaction()
           
 void checkClosed()
           
protected  void checkCustomFetchGroupCapability()
          Throws an exception if this persistence manager is not licensed to use custom fetch groups.
 void checkNontransactionalRead()
           
protected  StateManagerImpl checkValid(Object pc)
           
 void clearFetchGroups()
          Clears the list of fetch group names to use wen loading data.
 void close()
           
protected  void closeQueries()
          Close all open queries.
 void commit()
           
 void commitAndResume()
          Issue a commit and then start a new transaction.
 KodoTransaction currentKodoTransaction()
          Obtain the KodoPersistenceManager's current transaction.
 Transaction currentTransaction()
          Obtain the PersistenceManager's current transaction.
 void deletePersistent(Object pc)
           
 void deletePersistentAll(Collection pcs)
           
 void deletePersistentAll(Object[] pcs)
           
protected  void deletePersistentFilter(Object pc)
          Delete the given persistent instance.
(package private)  void dropState(Object oid)
          Stop managing the specified id.
protected  void endTransaction(boolean rollback)
           
 void evict(Object pc)
           
 void evictAll()
           
 void evictAll(Class cls)
          API extension.
 void evictAll(Collection pcs)
           
 void evictAll(Extent extent)
          API extension.
 void evictAll(Object[] pcs)
           
protected  void evictFilter(Object pc)
          Evict the given instance.
protected  void finalize()
           
 void flush()
          API Extension.
protected  void flushInternal(boolean fromCommit)
          Helper method that allows us to differentiate betwenn flushes that originate from commit() and those that are originated by client code directly.
(package private)  void freezeOid(StateManagerImpl sm)
          Ensure that sm is in the regular cache, not the new cache.
 Object getCachedObjectById(Object oid)
          API extension.
 JDOClassResolver getClassResolver(Class cls)
          Returns a JDOClassResolver appropriate for use with cls.
 JDOClassResolver getClassResolver(ClassLoader l)
          Returns a JDOClassResolver appropriate for use with l.
 JDOClassResolver getClassResolver(StateManagerImpl sm)
          Returns a JDOClassResolver appropriate for use with sm.
 Configuration getConfiguration()
          Return the JDO configuration for the persistence manager.
 String getConnectionPassword()
          Return the password given on construction.
 String getConnectionUserName()
          Return the user name given on construction.
 ClassLoader getContextClassLoader()
           
 Extent getExtent(Class type, boolean subclasses)
           
 String[] getFetchGroups()
          Returns the names of the fetch groups that this persistence manager will use when performing database queries.
 int getFlushBeforeQueries()
          API Extension.
 boolean getIgnoreCache()
           
 Collection getManagedObjects()
          API Extension.
 boolean getMultithreaded()
           
 boolean getNontransactionalRead()
           
 boolean getNontransactionalWrite()
           
 Object getObjectById(Object oid, boolean validate)
           
 Object getObjectById(Object oid, Object connection)
          API extension.
protected  Object getObjectByIdFilter(Object oid, Object connection, boolean validate, boolean copyOid, boolean getNewObjects)
           
 Object getObjectId(Object pc)
           
 Class getObjectIdClass(Class cls)
           
 boolean getOptimistic()
           
 PersistenceManager getPersistenceManager()
           
 PersistenceManagerFactory getPersistenceManagerFactory()
           
 boolean getQueryCacheEnabled()
          API Extension.
 boolean getRestoreValues()
           
 boolean getRetainValues()
           
 StateManagerImpl getState(Object oid)
          API extension.
protected  StateManagerImpl getState(Object oid, boolean getNewObjects)
          API extension.
 StoreManager getStoreManager()
          API extension.
 StoreManager getStoreManager(boolean decorators)
          API extension.
 Synchronization getSynchronization()
           
 Set getTouchedClasses()
          API Extension.
 Object getTransactionalObjectId(Object pc)
           
 Collection getTransactionalObjects()
          API Extension.
 Collection getTransactionalObjectsOfType(Class ofType, boolean subclasses)
          Returns all the transactional objects that extend from the given type.
 Object getUserObject()
           
protected  boolean hasCustomFetchGroupCapability()
          Returns true if this persistence manager is licensed to use custom fetch groups; otherwise, returns false.
 void initialize(PersistenceManagerFactoryImpl factory, StoreManager sm, String user, String pass)
          Initialize the persistence manager.
 boolean isActive()
           
 boolean isClosed()
           
protected  void lock()
          Synchronizes on an internal lock if the Multithreaded flag is set to true.
 void makeNontransactional(Object pc)
           
 void makeNontransactionalAll(Collection pcs)
           
 void makeNontransactionalAll(Object[] pcs)
           
protected  void makeNontransactionalFilter(Object pc)
          Make the given instance non-transactional.
 void makePersistent(Object pc)
           
 void makePersistentAll(Collection pcs)
           
 void makePersistentAll(Object[] pcs)
           
protected  void makePersistentFilter(Object pc)
          Make the given instance persistent.
 void makeTransactional(Object pc)
           
 void makeTransactionalAll(Collection pcs)
           
 void makeTransactionalAll(Object[] pcs)
           
protected  void makeTransactionalFilter(Object pc)
          Make the given instance transactional.
 void makeTransient(Object pc)
           
 void makeTransientAll(Collection pcs)
           
 void makeTransientAll(Object[] pcs)
           
protected  void makeTransientFilter(Object pc)
          Make the given instance transient.
protected  Map newManagedObjectCache()
          Create a new Map to be used for the managed object cache.
 Object newObjectIdInstance(Class cls, String str)
           
 Query newQuery()
           
 Query newQuery(Class cls)
           
 Query newQuery(Class cls, Collection cln)
           
 Query newQuery(Class cls, Collection cln, String filter)
           
 Query newQuery(Class cls, String filter)
           
 Query newQuery(Extent ext)
           
 Query newQuery(Extent ext, String filter)
           
 Query newQuery(Object compiled)
           
 Query newQuery(String language, Object compiled)
           
protected  void preCommitCallbacks()
          Invoke InstanceCallbacks#preStore or InstanceCallbacks#preDelete on each modified or new object.
protected  void preFlushCallbacks()
          Invoke InstanceCallbacks#preFlush on each touched object.
 void refresh(Object pc)
           
 void refreshAll()
           
 void refreshAll(Collection pcs)
           
 void refreshAll(Object[] pcs)
           
protected  void refreshFilter(Object pc)
          Refresh the given instance.
 void registerTransactionListener(TransactionListener listener)
          Register a listener to be notified of transaction events.
 boolean removeFetchGroup(String group)
          Removes group from the list of fetch group names to use when loading data.
 boolean removeFetchGroups(String[] groups)
          Removes groups from the list of fetch group names to use when loading data.
(package private)  void removeFromTransaction(StateManagerImpl sm)
          Notify the PersistenceManager that the given StateManager should be removed from the set of instances involved in the current transaction.
 void removeTransactionListener(TransactionListener listener)
          Remove a TransactionListener associated with this manager.
 void retrieve(Object pc)
           
 void retrieveAll(Collection pcs)
           
 void retrieveAll(Object[] pcs)
           
protected  void retrieveFilter(Object pc)
          Retrieve the persistent state of the given instance.
 void rollback()
           
 void rollbackAndResume()
          Issue a rollback and then start a new transaction.
(package private)  void setCustomFetchGroupCapability(boolean fetch)
          Configures whether or not this persistence manager is licensed to use custom fetch groups.
 void setFlushBeforeQueries(int flush)
          API Extension.
 void setIgnoreCache(boolean val)
           
 void setMultithreaded(boolean multiThreaded)
           
 void setNontransactionalRead(boolean val)
           
 void setNontransactionalWrite(boolean val)
           
 void setOptimistic(boolean val)
           
 void setQueryCacheEnabled(boolean enabled)
          API Extension.
 void setRestoreValues(boolean val)
           
 void setRetainValues(boolean val)
           
(package private)  void setState(StateManagerImpl sm)
          Set the cached StateManager for the given instance.
 void setSynchronization(Synchronization synch)
           
 void setUserObject(Object o)
           
 void touchClass(Class type)
          API Extension.
protected  void unlock()
          Releases the internal lock.
 
Methods inherited from class java.lang.Object
, clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

store

protected StoreManager store
The store manager in use; this may be a decorator such as a DataCacheStoreManager around the native store manager.
Constructor Detail

PersistenceManagerImpl

public PersistenceManagerImpl()
Method Detail

initialize

public void initialize(PersistenceManagerFactoryImpl factory,
                       StoreManager sm,
                       String user,
                       String pass)
Initialize the persistence manager. This method is called automatically by the factory before use.
Parameters:
factory - the PersistenceManagerFactory used to create this PersistenceManager
sm - a concrete StoreManager implementation to handle interaction with the data store
user - the username this PersistenceManager represents; used when pooling managers to make sure that a request to the PersistenceManagerFactory for a connection with an explicit user is delegated to a suitable PersistenceManager
pass - the password for the above user

newManagedObjectCache

protected Map newManagedObjectCache()
Create a new Map to be used for the managed object cache. By default, this creates a CacheMap if the factory's configuration's cache reference size is greater than or equal to 0, or a HashMap with an initial capacity of 1000 if the cache reference size is less than 0.

getPersistenceManager

public PersistenceManager getPersistenceManager()
Specified by:
getPersistenceManager in interface Transaction

getNontransactionalRead

public boolean getNontransactionalRead()
Specified by:
getNontransactionalRead in interface Transaction

setNontransactionalRead

public void setNontransactionalRead(boolean val)
Specified by:
setNontransactionalRead in interface Transaction

getNontransactionalWrite

public boolean getNontransactionalWrite()
Specified by:
getNontransactionalWrite in interface Transaction

setNontransactionalWrite

public void setNontransactionalWrite(boolean val)
Specified by:
setNontransactionalWrite in interface Transaction

getOptimistic

public boolean getOptimistic()
Specified by:
getOptimistic in interface Transaction

setOptimistic

public void setOptimistic(boolean val)
Specified by:
setOptimistic in interface Transaction

getRetainValues

public boolean getRetainValues()
Specified by:
getRetainValues in interface Transaction

setRetainValues

public void setRetainValues(boolean val)
Specified by:
setRetainValues in interface Transaction

getRestoreValues

public boolean getRestoreValues()
Specified by:
getRestoreValues in interface Transaction

setRestoreValues

public void setRestoreValues(boolean val)
Specified by:
setRestoreValues in interface Transaction

getIgnoreCache

public boolean getIgnoreCache()
Specified by:
getIgnoreCache in interface PersistenceManager

setIgnoreCache

public void setIgnoreCache(boolean val)
Specified by:
setIgnoreCache in interface PersistenceManager

begin

public void begin()
Specified by:
begin in interface Transaction

commitAndResume

public void commitAndResume()
Description copied from interface: KodoTransaction
Issue a commit and then start a new transaction. This is identical to:
	pm.currentTransaction ().commit ();
	pm.currentTransaction ().begin ();
	
except that the PersistenceManager's internal atomic lock is utilized, so this method can be safely executed from multiple threads.
Specified by:
commitAndResume in interface KodoTransaction
Following copied from interface: com.solarmetric.kodo.runtime.KodoTransaction
See Also:
Transaction.commit(), Transaction.begin()

rollbackAndResume

public void rollbackAndResume()
Description copied from interface: KodoTransaction
Issue a rollback and then start a new transaction. This is identical to:
	pm.currentTransaction ().rollback ();
	pm.currentTransaction ().begin ();
	
except that the PersistenceManager's internal atomic lock is utilized, so this method can be safely executed from multiple threads.
Specified by:
rollbackAndResume in interface KodoTransaction
Following copied from interface: com.solarmetric.kodo.runtime.KodoTransaction
See Also:
Transaction.rollback(), Transaction.begin()

commit

public void commit()
Specified by:
commit in interface Transaction

rollback

public void rollback()
Specified by:
rollback in interface Transaction

getSynchronization

public Synchronization getSynchronization()
Specified by:
getSynchronization in interface Transaction

setSynchronization

public void setSynchronization(Synchronization synch)
Specified by:
setSynchronization in interface Transaction

isActive

public boolean isActive()
Specified by:
isActive in interface Transaction

preCommitCallbacks

protected void preCommitCallbacks()
Invoke InstanceCallbacks#preStore or InstanceCallbacks#preDelete on each modified or new object.

preFlushCallbacks

protected void preFlushCallbacks()
Invoke InstanceCallbacks#preFlush on each touched object.

flush

public void flush()
API Extension. Flush all transactional instances to the datastore.
Specified by:
flush in interface KodoTransaction
Since:
2.5.0

flushInternal

protected void flushInternal(boolean fromCommit)

Helper method that allows us to differentiate betwenn flushes that originate from commit() and those that are originated by client code directly. Subclasses that override the behavior of commit should use this method.

This method assumes that the PersistenceManager has already been locked, is not closed, and is involved in an active transaction.

Since:
2.5.0

endTransaction

protected void endTransaction(boolean rollback)

getPersistenceManagerFactory

public PersistenceManagerFactory getPersistenceManagerFactory()
Specified by:
getPersistenceManagerFactory in interface PersistenceManager

getConfiguration

public Configuration getConfiguration()
Return the JDO configuration for the persistence manager.

getConnectionUserName

public String getConnectionUserName()
Return the user name given on construction.

getConnectionPassword

public String getConnectionPassword()
Return the password given on construction.

getUserObject

public Object getUserObject()
Specified by:
getUserObject in interface PersistenceManager

setUserObject

public void setUserObject(Object o)
Specified by:
setUserObject in interface PersistenceManager

getMultithreaded

public boolean getMultithreaded()
Specified by:
getMultithreaded in interface PersistenceManager

setMultithreaded

public void setMultithreaded(boolean multiThreaded)
Specified by:
setMultithreaded in interface PersistenceManager

isClosed

public boolean isClosed()
Specified by:
isClosed in interface PersistenceManager

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object

close

public void close()
Specified by:
close in interface PersistenceManager

closeQueries

protected void closeQueries()
Close all open queries.

currentTransaction

public Transaction currentTransaction()
Obtain the PersistenceManager's current transaction.
Specified by:
currentTransaction in interface PersistenceManager

currentKodoTransaction

public KodoTransaction currentKodoTransaction()
Obtain the KodoPersistenceManager's current transaction.

getObjectId

public Object getObjectId(Object pc)
Specified by:
getObjectId in interface PersistenceManager

getTransactionalObjectId

public Object getTransactionalObjectId(Object pc)
Specified by:
getTransactionalObjectId in interface PersistenceManager

getObjectIdClass

public Class getObjectIdClass(Class cls)
Specified by:
getObjectIdClass in interface PersistenceManager

newObjectIdInstance

public Object newObjectIdInstance(Class cls,
                                  String str)
Specified by:
newObjectIdInstance in interface PersistenceManager

getObjectById

public Object getObjectById(Object oid,
                            boolean validate)
Specified by:
getObjectById in interface PersistenceManager

getObjectById

public Object getObjectById(Object oid,
                            Object connection)
API extension. Return the object with the given oid. If present, the cached instance will be returned. Otherwise, the instance will be initialized through the store as usual; however, in this case the store will be passed the given connection information. This method is provided as an optimization opportunity to concrete jdo implementations built on this common runtime. It is not for use by client code.

getObjectByIdFilter

protected Object getObjectByIdFilter(Object oid,
                                     Object connection,
                                     boolean validate,
                                     boolean copyOid,
                                     boolean getNewObjects)

getCachedObjectById

public Object getCachedObjectById(Object oid)
API extension. Return the cached instance for the given oid/object, or null if not cached.
Parameters:
oid - the object's id, or a persistence-capable instance with the same id (possibly from another persistence manager)
Returns:
the cached object, or null if not cached

makePersistentAll

public void makePersistentAll(Collection pcs)
Specified by:
makePersistentAll in interface PersistenceManager

makePersistentAll

public void makePersistentAll(Object[] pcs)
Specified by:
makePersistentAll in interface PersistenceManager

makePersistent

public void makePersistent(Object pc)
Specified by:
makePersistent in interface PersistenceManager

makePersistentFilter

protected void makePersistentFilter(Object pc)
Make the given instance persistent. This method has no effect if the instance is null or already persistent. The instance cannot be managed by another persistence manager. This method should be called only after checking that the persistence manager is not closed and that there is a transaction in progress.

deletePersistentAll

public void deletePersistentAll(Collection pcs)
Specified by:
deletePersistentAll in interface PersistenceManager

deletePersistentAll

public void deletePersistentAll(Object[] pcs)
Specified by:
deletePersistentAll in interface PersistenceManager

deletePersistent

public void deletePersistent(Object pc)
Specified by:
deletePersistent in interface PersistenceManager

deletePersistentFilter

protected void deletePersistentFilter(Object pc)
Delete the given persistent instance. After this method call, all manipulation of the instance will throw an exception. This method has no effect if the instance is null. The instance must be managed by this persistence manager. This method should be called only after checking that the persistence manager is not closed and that there is a transaction in progress.

makeNontransactionalAll

public void makeNontransactionalAll(Collection pcs)
Specified by:
makeNontransactionalAll in interface PersistenceManager

makeNontransactionalAll

public void makeNontransactionalAll(Object[] pcs)
Specified by:
makeNontransactionalAll in interface PersistenceManager

makeNontransactional

public void makeNontransactional(Object pc)
Specified by:
makeNontransactional in interface PersistenceManager

makeNontransactionalFilter

protected void makeNontransactionalFilter(Object pc)
Make the given instance non-transactional. The instance must not be dirty. This method has no effect if the instance is null. The instance must be managed by this persistence manager. This method should be called only after checking that the persistence manager is not closed and that there is a transaction in progress.

makeTransactionalAll

public void makeTransactionalAll(Collection pcs)
Specified by:
makeTransactionalAll in interface PersistenceManager

makeTransactionalAll

public void makeTransactionalAll(Object[] pcs)
Specified by:
makeTransactionalAll in interface PersistenceManager

makeTransactional

public void makeTransactional(Object pc)
Specified by:
makeTransactional in interface PersistenceManager

makeTransactionalFilter

protected void makeTransactionalFilter(Object pc)
Make the given instance transactional. Persistent instances will be brought into the current transaction, and transient instances will be assigned a StateManager to track changes and rollback instance state on transaction rollback. This method has no effect if the instance is null. The instance cannot be managed by another persistence manager. This method should only be called after checking that the persistence manager is not closed and that there is a transaction in progress.

makeTransientAll

public void makeTransientAll(Collection pcs)
Specified by:
makeTransientAll in interface PersistenceManager

makeTransientAll

public void makeTransientAll(Object[] pcs)
Specified by:
makeTransientAll in interface PersistenceManager

makeTransient

public void makeTransient(Object pc)
Specified by:
makeTransient in interface PersistenceManager

makeTransientFilter

protected void makeTransientFilter(Object pc)
Make the given instance transient. The instance will lose its association with this PersistenceManager, and will no longer participate in transactions. Any unloaded state of persistent instances will remain unloaded. This method has no effect if the instance is null. The instance must be managed by this persistence manager. This method should only be called after checking that the persistence manager is not closed.

refreshAll

public void refreshAll()
Specified by:
refreshAll in interface PersistenceManager

refreshAll

public void refreshAll(Collection pcs)
Specified by:
refreshAll in interface PersistenceManager

refreshAll

public void refreshAll(Object[] pcs)
Specified by:
refreshAll in interface PersistenceManager

refresh

public void refresh(Object pc)
Specified by:
refresh in interface PersistenceManager

refreshFilter

protected void refreshFilter(Object pc)
Refresh the given instance. The state of the instance will be re-read from the database, and it will transition to persistent-clean if a datastore transaction is in progress, or persistent-nontrans if an optimistic transaction is in progress. This method has no effect if the instance is null. The instance must be managed by this persistence manager. This method should only be called after checking that the persistence manager is not closed and that there is a transaction in progress or non-trans reads are permitted.

retrieveAll

public void retrieveAll(Collection pcs)
Specified by:
retrieveAll in interface PersistenceManager

retrieveAll

public void retrieveAll(Object[] pcs)
Specified by:
retrieveAll in interface PersistenceManager

retrieve

public void retrieve(Object pc)
Specified by:
retrieve in interface PersistenceManager

retrieveFilter

protected void retrieveFilter(Object pc)
Retrieve the persistent state of the given instance. The unloaded state of the instance will be read from the database. State transitions will occur as if the fields were read. The instance must be persistent and must be managed by this PersistentManager, and there must be a transaction in progress. This method has no effect if the instance is null.

evictAll

public void evictAll()
Specified by:
evictAll in interface PersistenceManager

evictAll

public void evictAll(Collection pcs)
Specified by:
evictAll in interface PersistenceManager

evictAll

public void evictAll(Object[] pcs)
Specified by:
evictAll in interface PersistenceManager

evict

public void evict(Object pc)
Specified by:
evict in interface PersistenceManager

evictAll

public void evictAll(Class cls)
API extension.

Evict all persistent-clean and persistent-nontransactional instances of the given class. The state of any cached instances will be cleared, and they will transition to hollow. Any strong references to the instances will be cleared.

This method should only be called after checking that the persistence manager is not closed.

Throws:
JDOUserException - if cls is null or does not implement PersistenceCapable

evictAll

public void evictAll(Extent extent)
API extension.

Evict all persistent-clean and persistent-nontransactional instances in the given Extent. The state of any cached instances will be cleared, and they will transition to hollow. Any strong references to the instances will be cleared.

This method should only be called after checking that the persistence manager is not closed.

Throws:
JDOUserException - if extent is null or does not implement PersistenceCapable

evictFilter

protected void evictFilter(Object pc)
Evict the given instance. If persistent, the state of the instance will be cleared, and it will transition to hollow. Any strong references to the instance will be cleared. This method has no effect if the instance is null or transient. The instance must be managed by this persistence manager. This method should only be called after checking that the persistence manager is not closed.

getExtent

public Extent getExtent(Class type,
                        boolean subclasses)
Specified by:
getExtent in interface PersistenceManager

newQuery

public Query newQuery()
Specified by:
newQuery in interface PersistenceManager

newQuery

public Query newQuery(Class cls)
Specified by:
newQuery in interface PersistenceManager

newQuery

public Query newQuery(Class cls,
                      Collection cln)
Specified by:
newQuery in interface PersistenceManager

newQuery

public Query newQuery(Extent ext)
Specified by:
newQuery in interface PersistenceManager

newQuery

public Query newQuery(Class cls,
                      Collection cln,
                      String filter)
Specified by:
newQuery in interface PersistenceManager

newQuery

public Query newQuery(Extent ext,
                      String filter)
Specified by:
newQuery in interface PersistenceManager

newQuery

public Query newQuery(Class cls,
                      String filter)
Specified by:
newQuery in interface PersistenceManager

newQuery

public Query newQuery(Object compiled)
Specified by:
newQuery in interface PersistenceManager

newQuery

public Query newQuery(String language,
                      Object compiled)
Specified by:
newQuery in interface PersistenceManager

lock

protected final void lock()
Synchronizes on an internal lock if the Multithreaded flag is set to true. Make sure to call unlock() in a finally clause of the same method.

unlock

protected final void unlock()
Releases the internal lock.

getStoreManager

public StoreManager getStoreManager()
API extension. Return the native store being used to interact with the data store. Equivalent to getStoreManager(false).

getStoreManager

public StoreManager getStoreManager(boolean decorators)
API extension. Return the store being used to interact with the data store. If decorators is true, return the store manager as used by this PM. If it is false, then strip away any decorators and return the native store manager (equivalent to etStoreManager().)

getState

public StateManagerImpl getState(Object oid)
API extension. Return the StateManager for the given instance / the instance with the given oid. If there are any PNEW objects in the transaction, an undetermined one of these objects will be returned. Otherwise, if there is an object in the managed object cache that correspond to this oid, it will be returned.

getState

protected StateManagerImpl getState(Object oid,
                                    boolean getNewObjects)
API extension. Return the StateManager for the given instance / the instance with the given oid. If there are any PNEW objects in the transaction, an undetermined one of these objects will be returned. Otherwise, if there is an object in the managed object cache that correspond to this oid, it will be returned.
Parameters:
getNewObjects - If true, consider PNEW objects. Otherwise, only examine non-new objects. When loading data from the data store, we never want to look up new objects -- we can never get a new object id from the data store.

getManagedObjects

public Collection getManagedObjects()
API Extension. Return a list of all managed instances.

getTransactionalObjects

public Collection getTransactionalObjects()
API Extension. Return a list of current transaction instances.

getTransactionalObjectsOfType

public Collection getTransactionalObjectsOfType(Class ofType,
                                                boolean subclasses)
Returns all the transactional objects that extend from the given type.

setState

void setState(StateManagerImpl sm)
Set the cached StateManager for the given instance.
Parameters:
sm - the new StateManager for the instance

dropState

void dropState(Object oid)
Stop managing the specified id.
Parameters:
oid - the non-null oid of the instance to drop

addToTransaction

void addToTransaction(StateManagerImpl sm,
                      boolean dirtied)
Notify the PersistenceManager that the given StateManager should be added to the set of instances involved in the current transaction.

removeFromTransaction

void removeFromTransaction(StateManagerImpl sm)
Notify the PersistenceManager that the given StateManager should be removed from the set of instances involved in the current transaction.

freezeOid

void freezeOid(StateManagerImpl sm)
Ensure that sm is in the regular cache, not the new cache. This is invoked by StateManagerImpl once it has been notified that some of the data in sm has been flushed. Once any data has been flushed, the object id is no longer mutable, so we should move this object from the set of specially-handled new objects to the regular cache.

touchClass

public void touchClass(Class type)
API Extension. Mark type as a class that has been touched in the current transaction.

getTouchedClasses

public Set getTouchedClasses()
API Extension. Retrieve an unmodifiable set of all classes that have been touched in this transaction.

setQueryCacheEnabled

public void setQueryCacheEnabled(boolean enabled)

API Extension. Control whether or not query caching is enabled for this PersistenceManager. This has no effect if the datacache plugin is not installed, or if the query cache size is set to zero.

Queries created by this PersistenceManager will be configured with the setting of this flag at the time of query creation.

Since:
2.5

getQueryCacheEnabled

public boolean getQueryCacheEnabled()
API Extension. Return whether or not query caching is enabled for this PersistenceManager. If this returns true but the datacache plugin is not installed, caching will not be enabled. If this returns false, query caching will not be used even if the datacache plugin is installed.
Since:
2.5

setFlushBeforeQueries

public void setFlushBeforeQueries(int flush)
API Extension. Returns this PersistenceManager's automatic query flush configuration.
Since:
2.5.0
See Also:
Configuration#setFlushBeforeQueries(), KodoQuery.FLUSH_ALWAYS_MODE, KodoQuery.FLUSH_NEVER_MODE, KodoQuery.FLUSH_WITH_CONNECTION_MODE

getFlushBeforeQueries

public int getFlushBeforeQueries()
API Extension. Returns this PersistenceManager's automatic query flush configuration.
Since:
2.5.0
See Also:
Configuration.getFlushBeforeQueries(), KodoQuery.FLUSH_ALWAYS_MODE, KodoQuery.FLUSH_NEVER_MODE, KodoQuery.FLUSH_WITH_CONNECTION_MODE

checkClosed

public void checkClosed()

checkActiveTransaction

public void checkActiveTransaction()

checkNontransactionalRead

public void checkNontransactionalRead()

checkValid

protected StateManagerImpl checkValid(Object pc)

getContextClassLoader

public ClassLoader getContextClassLoader()
Returns:
the value of Thread.currentThread().getContextClassLoader() when this PersistenceManager was created.

getClassResolver

public JDOClassResolver getClassResolver(StateManagerImpl sm)
Returns a JDOClassResolver appropriate for use with sm.

getClassResolver

public JDOClassResolver getClassResolver(Class cls)
Returns a JDOClassResolver appropriate for use with cls.

getClassResolver

public JDOClassResolver getClassResolver(ClassLoader l)
Returns a JDOClassResolver appropriate for use with l.

getFetchGroups

public String[] getFetchGroups()

Returns the names of the fetch groups that this persistence manager will use when performing database queries. When loading data from the underlying data store, the StoreManager will be instructed to load all fields in a fetch group named in this array. The order of this array is undefined.

Returns a zero-length array if custom fetch groups are not enabled.

Since:
2.5.0

addFetchGroup

public boolean addFetchGroup(String group)

Adds group to the list of fetch group names to use when loading data.

Returns:
true if group was added; false if group was already in the fetch group list.
Since:
2.5.0

addFetchGroups

public boolean addFetchGroups(String[] groups)
Adds groups to the list of fetch group names to use when loading data.
Returns:
true if the set of fetch group names to load was updated as a result of this operation.
Since:
2.5.0

removeFetchGroup

public boolean removeFetchGroup(String group)
Removes group from the list of fetch group names to use when loading data.
Returns:
true if group was removed; false if group was not in the fetch group list.
Since:
2.5.0

removeFetchGroups

public boolean removeFetchGroups(String[] groups)
Removes groups from the list of fetch group names to use when loading data.
Returns:
true if the set of fetch group names to load was updated as a result of this operation.
Since:
2.5.0

clearFetchGroups

public void clearFetchGroups()
Clears the list of fetch group names to use wen loading data. After this operation is invoked, only those fields in the default fetch group (and any requested field) will be loaded when loading an object.
Since:
2.5.0

hasCustomFetchGroupCapability

protected final boolean hasCustomFetchGroupCapability()
Returns true if this persistence manager is licensed to use custom fetch groups; otherwise, returns false.
Since:
2.5.0

setCustomFetchGroupCapability

final void setCustomFetchGroupCapability(boolean fetch)
Configures whether or not this persistence manager is licensed to use custom fetch groups.
Since:
2.5.3

checkCustomFetchGroupCapability

protected void checkCustomFetchGroupCapability()
Throws an exception if this persistence manager is not licensed to use custom fetch groups.
Since:
2.5.0

registerTransactionListener

public void registerTransactionListener(TransactionListener listener)
Description copied from interface: EventManager
Register a listener to be notified of transaction events.
Specified by:
registerTransactionListener in interface EventManager

removeTransactionListener

public void removeTransactionListener(TransactionListener listener)
Description copied from interface: EventManager
Remove a TransactionListener associated with this manager. Does nothing if listener was not already associated with the manager.
Specified by:
removeTransactionListener in interface EventManager

SolarMetric Kodo JDO 2.5.8 generated on January 11 2004

Copyright 2001,2002,2003 SolarMetric, Inc. All Rights Reserved.