SolarMetric Kodo JDO Enterprise Edition 2.3.1 generated on August 20 2002

com.solarmetric.kodo.runtime
Class PersistenceManagerImpl

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

public class PersistenceManagerImpl
extends Object
implements PersistenceManager, Transaction

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.

Author:
Abe White

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()
          Default constructor.
 
Method Summary
 void begin()
           
 void checkActiveTransaction()
           
 void checkClosed()
           
 void checkNontransactionalRead()
           
protected  StateManagerImpl checkValid(Object pc)
           
 void close()
           
protected  void closeQueries()
          Close all open queries.
 void commit()
           
 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.
protected  void endTransaction(boolean rollback)
           
 void evict(Object pc)
           
 void evictAll()
           
 void evictAll(Collection pcs)
           
 void evictAll(Object[] pcs)
           
protected  void evictFilter(Object pc)
          Evict the given instance.
protected  void flush()
           
 Object getCachedObjectById(Object oid)
          API extension.
 ClassLoader getClassLoader()
          Return the class loader of the constructing thread.
 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.
 Extent getExtent(Class type, boolean subclasses)
           
 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 getRestoreValues()
           
 boolean getRetainValues()
           
 StateManagerImpl getState(Object oid)
          API extension.
protected  StateManagerImpl getState(Object oid, boolean getNewObjects)
          API extension.
 StoreManager getStoreManager()
          API extension.
 Synchronization getSynchronization()
           
 Object getTransactionalObjectId(Object pc)
           
 Collection getTransactionalObjects()
          API Extension.
 Object getUserObject()
           
 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  void markTransactionalObjectDirty(StateManagerImpl sm)
           
 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)
           
 void refresh(Object pc)
           
 void refreshAll()
           
 void refreshAll(Collection pcs)
           
 void refreshAll(Object[] pcs)
           
protected  void refreshFilter(Object pc)
          Refresh the given instance.
 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 setIgnoreCache(boolean val)
           
 void setMultithreaded(boolean multiThreaded)
           
 void setNontransactionalRead(boolean val)
           
 void setNontransactionalWrite(boolean val)
           
 void setOptimistic(boolean val)
           
 void setRestoreValues(boolean val)
           
 void setRetainValues(boolean val)
           
 void setSynchronization(Synchronization synch)
           
 void setUserObject(Object o)
           
protected  void unlock()
          Releases the internal lock.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, 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()
Default constructor.
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
store - 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

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

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

flush

protected void flush()

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.

getClassLoader

public ClassLoader getClassLoader()
Return the class loader of the constructing thread.

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

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

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

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 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 void unlock()
Releases the internal lock.

getStoreManager

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

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.

markTransactionalObjectDirty

protected void markTransactionalObjectDirty(StateManagerImpl sm)

checkClosed

public void checkClosed()

checkActiveTransaction

public void checkActiveTransaction()

checkNontransactionalRead

public void checkNontransactionalRead()

checkValid

protected StateManagerImpl checkValid(Object pc)

SolarMetric Kodo JDO Enterprise Edition 2.3.1 generated on August 20 2002

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