|
SolarMetric Kodo JDO 2.5.8 generated on January 11 2004 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.solarmetric.kodo.runtime.PersistenceManagerImpl
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 |
|
| Field Detail |
protected StoreManager store
DataCacheStoreManager around the native store manager.| Constructor Detail |
public PersistenceManagerImpl()
| Method Detail |
public void initialize(PersistenceManagerFactoryImpl factory,
StoreManager sm,
String user,
String pass)
factory - the PersistenceManagerFactory used to create
this PersistenceManagersm - a concrete StoreManager implementation to
handle interaction with the data storeuser - 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 PersistenceManagerpass - the password for the above userprotected Map newManagedObjectCache()
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.public PersistenceManager getPersistenceManager()
getPersistenceManager in interface Transactionpublic boolean getNontransactionalRead()
getNontransactionalRead in interface Transactionpublic void setNontransactionalRead(boolean val)
setNontransactionalRead in interface Transactionpublic boolean getNontransactionalWrite()
getNontransactionalWrite in interface Transactionpublic void setNontransactionalWrite(boolean val)
setNontransactionalWrite in interface Transactionpublic boolean getOptimistic()
getOptimistic in interface Transactionpublic void setOptimistic(boolean val)
setOptimistic in interface Transactionpublic boolean getRetainValues()
getRetainValues in interface Transactionpublic void setRetainValues(boolean val)
setRetainValues in interface Transactionpublic boolean getRestoreValues()
getRestoreValues in interface Transactionpublic void setRestoreValues(boolean val)
setRestoreValues in interface Transactionpublic boolean getIgnoreCache()
getIgnoreCache in interface PersistenceManagerpublic void setIgnoreCache(boolean val)
setIgnoreCache in interface PersistenceManagerpublic void begin()
begin in interface Transactionpublic void commitAndResume()
KodoTransactionpm.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.
commitAndResume in interface KodoTransactioncom.solarmetric.kodo.runtime.KodoTransactionTransaction.commit(),
Transaction.begin()public void rollbackAndResume()
KodoTransactionpm.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.
rollbackAndResume in interface KodoTransactioncom.solarmetric.kodo.runtime.KodoTransactionTransaction.rollback(),
Transaction.begin()public void commit()
commit in interface Transactionpublic void rollback()
rollback in interface Transactionpublic Synchronization getSynchronization()
getSynchronization in interface Transactionpublic void setSynchronization(Synchronization synch)
setSynchronization in interface Transactionpublic boolean isActive()
isActive in interface Transactionprotected void preCommitCallbacks()
InstanceCallbacks#preStore or InstanceCallbacks#preDelete on each modified or new object.protected void preFlushCallbacks()
InstanceCallbacks#preFlush on each touched object.public void flush()
flush in interface KodoTransactionprotected 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.
protected void endTransaction(boolean rollback)
public PersistenceManagerFactory getPersistenceManagerFactory()
getPersistenceManagerFactory in interface PersistenceManagerpublic Configuration getConfiguration()
public String getConnectionUserName()
public String getConnectionPassword()
public Object getUserObject()
getUserObject in interface PersistenceManagerpublic void setUserObject(Object o)
setUserObject in interface PersistenceManagerpublic boolean getMultithreaded()
getMultithreaded in interface PersistenceManagerpublic void setMultithreaded(boolean multiThreaded)
setMultithreaded in interface PersistenceManagerpublic boolean isClosed()
isClosed in interface PersistenceManager
protected void finalize()
throws Throwable
finalize in class Objectpublic void close()
close in interface PersistenceManagerprotected void closeQueries()
public Transaction currentTransaction()
currentTransaction in interface PersistenceManagerpublic KodoTransaction currentKodoTransaction()
public Object getObjectId(Object pc)
getObjectId in interface PersistenceManagerpublic Object getTransactionalObjectId(Object pc)
getTransactionalObjectId in interface PersistenceManagerpublic Class getObjectIdClass(Class cls)
getObjectIdClass in interface PersistenceManager
public Object newObjectIdInstance(Class cls,
String str)
newObjectIdInstance in interface PersistenceManager
public Object getObjectById(Object oid,
boolean validate)
getObjectById in interface PersistenceManager
public Object getObjectById(Object oid,
Object connection)
protected Object getObjectByIdFilter(Object oid,
Object connection,
boolean validate,
boolean copyOid,
boolean getNewObjects)
public Object getCachedObjectById(Object oid)
oid - the object's id, or a persistence-capable instance with
the same id (possibly from another persistence manager)public void makePersistentAll(Collection pcs)
makePersistentAll in interface PersistenceManagerpublic void makePersistentAll(Object[] pcs)
makePersistentAll in interface PersistenceManagerpublic void makePersistent(Object pc)
makePersistent in interface PersistenceManagerprotected void makePersistentFilter(Object pc)
public void deletePersistentAll(Collection pcs)
deletePersistentAll in interface PersistenceManagerpublic void deletePersistentAll(Object[] pcs)
deletePersistentAll in interface PersistenceManagerpublic void deletePersistent(Object pc)
deletePersistent in interface PersistenceManagerprotected void deletePersistentFilter(Object pc)
public void makeNontransactionalAll(Collection pcs)
makeNontransactionalAll in interface PersistenceManagerpublic void makeNontransactionalAll(Object[] pcs)
makeNontransactionalAll in interface PersistenceManagerpublic void makeNontransactional(Object pc)
makeNontransactional in interface PersistenceManagerprotected void makeNontransactionalFilter(Object pc)
public void makeTransactionalAll(Collection pcs)
makeTransactionalAll in interface PersistenceManagerpublic void makeTransactionalAll(Object[] pcs)
makeTransactionalAll in interface PersistenceManagerpublic void makeTransactional(Object pc)
makeTransactional in interface PersistenceManagerprotected void makeTransactionalFilter(Object pc)
public void makeTransientAll(Collection pcs)
makeTransientAll in interface PersistenceManagerpublic void makeTransientAll(Object[] pcs)
makeTransientAll in interface PersistenceManagerpublic void makeTransient(Object pc)
makeTransient in interface PersistenceManagerprotected void makeTransientFilter(Object pc)
public void refreshAll()
refreshAll in interface PersistenceManagerpublic void refreshAll(Collection pcs)
refreshAll in interface PersistenceManagerpublic void refreshAll(Object[] pcs)
refreshAll in interface PersistenceManagerpublic void refresh(Object pc)
refresh in interface PersistenceManagerprotected void refreshFilter(Object pc)
public void retrieveAll(Collection pcs)
retrieveAll in interface PersistenceManagerpublic void retrieveAll(Object[] pcs)
retrieveAll in interface PersistenceManagerpublic void retrieve(Object pc)
retrieve in interface PersistenceManagerprotected void retrieveFilter(Object pc)
public void evictAll()
evictAll in interface PersistenceManagerpublic void evictAll(Collection pcs)
evictAll in interface PersistenceManagerpublic void evictAll(Object[] pcs)
evictAll in interface PersistenceManagerpublic void evict(Object pc)
evict in interface PersistenceManagerpublic void evictAll(Class cls)
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.
JDOUserException - if cls is null or does
not implement PersistenceCapablepublic void evictAll(Extent extent)
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.
JDOUserException - if extent is null or does
not implement PersistenceCapableprotected void evictFilter(Object pc)
public Extent getExtent(Class type,
boolean subclasses)
getExtent in interface PersistenceManagerpublic Query newQuery()
newQuery in interface PersistenceManagerpublic Query newQuery(Class cls)
newQuery in interface PersistenceManager
public Query newQuery(Class cls,
Collection cln)
newQuery in interface PersistenceManagerpublic Query newQuery(Extent ext)
newQuery in interface PersistenceManager
public Query newQuery(Class cls,
Collection cln,
String filter)
newQuery in interface PersistenceManager
public Query newQuery(Extent ext,
String filter)
newQuery in interface PersistenceManager
public Query newQuery(Class cls,
String filter)
newQuery in interface PersistenceManagerpublic Query newQuery(Object compiled)
newQuery in interface PersistenceManager
public Query newQuery(String language,
Object compiled)
newQuery in interface PersistenceManagerprotected final void lock()
Multithreaded flag is set to true. Make sure to call
unlock() in a finally clause of the same method.protected final void unlock()
public StoreManager getStoreManager()
getStoreManager(false).public StoreManager getStoreManager(boolean decorators)
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().)public StateManagerImpl getState(Object oid)
protected StateManagerImpl getState(Object oid,
boolean getNewObjects)
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.public Collection getManagedObjects()
public Collection getTransactionalObjects()
public Collection getTransactionalObjectsOfType(Class ofType,
boolean subclasses)
void setState(StateManagerImpl sm)
sm - the new StateManager for the instancevoid dropState(Object oid)
oid - the non-null oid of the instance to drop
void addToTransaction(StateManagerImpl sm,
boolean dirtied)
void removeFromTransaction(StateManagerImpl sm)
void freezeOid(StateManagerImpl sm)
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.public void touchClass(Class type)
type as a class that has been
touched in the current transaction.public Set getTouchedClasses()
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.
public boolean getQueryCacheEnabled()
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.public void setFlushBeforeQueries(int flush)
Configuration#setFlushBeforeQueries(),
KodoQuery.FLUSH_ALWAYS_MODE,
KodoQuery.FLUSH_NEVER_MODE,
KodoQuery.FLUSH_WITH_CONNECTION_MODEpublic int getFlushBeforeQueries()
Configuration.getFlushBeforeQueries(),
KodoQuery.FLUSH_ALWAYS_MODE,
KodoQuery.FLUSH_NEVER_MODE,
KodoQuery.FLUSH_WITH_CONNECTION_MODEpublic void checkClosed()
public void checkActiveTransaction()
public void checkNontransactionalRead()
protected StateManagerImpl checkValid(Object pc)
public ClassLoader getContextClassLoader()
public JDOClassResolver getClassResolver(StateManagerImpl sm)
JDOClassResolver appropriate for use with
sm.public JDOClassResolver getClassResolver(Class cls)
JDOClassResolver appropriate for use with
cls.public JDOClassResolver getClassResolver(ClassLoader l)
JDOClassResolver appropriate for use with
l.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.
public boolean addFetchGroup(String group)
Adds group to the list of fetch group names to
use when loading data.
true if group was added;
false if group was already
in the fetch group list.public boolean addFetchGroups(String[] groups)
groups to the list of fetch group names to
use when loading data.true if the set of fetch group names to
load was updated as a result of this operation.public boolean removeFetchGroup(String group)
group from the list of fetch group names
to use when loading data.true if group was removed;
false if group was not in
the fetch group list.public boolean removeFetchGroups(String[] groups)
groups from the list of fetch group names
to use when loading data.true if the set of fetch group names to
load was updated as a result of this operation.public void clearFetchGroups()
protected final boolean hasCustomFetchGroupCapability()
true if this persistence manager is
licensed to use custom fetch groups; otherwise, returns
false.final void setCustomFetchGroupCapability(boolean fetch)
protected void checkCustomFetchGroupCapability()
public void registerTransactionListener(TransactionListener listener)
EventManagerregisterTransactionListener in interface EventManagerpublic void removeTransactionListener(TransactionListener listener)
EventManagerTransactionListener associated with this
manager. Does nothing if listener was not already
associated with the manager.removeTransactionListener in interface EventManager
|
SolarMetric Kodo JDO 2.5.8 generated on January 11 2004 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||