com.triactive.jdo
Class PersistenceManagerImpl

java.lang.Object
  extended bycom.triactive.jdo.PersistenceManagerImpl
All Implemented Interfaces:
PersistenceManager, javax.jdo.PersistenceManager

public class PersistenceManagerImpl
extends java.lang.Object
implements PersistenceManager

Implements the PersistenceManager interface.

Author:
Mike Martin

Constructor Summary
PersistenceManagerImpl(PersistenceManagerFactoryImpl pmf, java.lang.String userName, java.lang.String password)
           
 
Method Summary
 void close()
           
 javax.jdo.Transaction currentTransaction()
           
 int dataStoreModifyCount()
          Returns the number of data store modifications made under this persistence manager.
 void deletePersistent(java.lang.Object obj)
           
 void deletePersistentAll(java.util.Collection pcs)
           
 void deletePersistentAll(java.lang.Object[] pcs)
           
 void dump(java.lang.Object obj, java.io.PrintWriter out)
          Prints debugging info on an object to the specified output.
 void enlistInTransaction(StateManager sm)
          Called by state managers to enlist in the transaction cache.
 void evict(java.lang.Object pc)
           
 void evictAll()
           
 void evictAll(java.util.Collection pcs)
           
 void evictAll(java.lang.Object[] pcs)
           
 void evictFromTransaction(StateManager sm)
          Called by state managers to evict themselves from the transaction cache.
 void finalize()
           
 StateManager findStateManager(java.lang.Object obj)
          Returns the StateManager for a given object.
 java.util.List findStateManagers(java.util.Collection objs)
          Finds the StateManagers for a collection of objects.
 void flushDirty()
          Causes any dirty state manager to be updated in storage.
 java.sql.Connection getConnection(boolean forWriting)
          Obtains a JDBC connection to the data store.
 javax.jdo.Extent getExtent(java.lang.Class cls, boolean flag)
           
 boolean getIgnoreCache()
           
 boolean getMultithreaded()
           
 java.lang.Object getObjectById(java.lang.Object id, boolean validate)
           
 java.lang.Object getObjectById(java.lang.Object id, java.lang.Class contextClass, boolean validate)
          Locates a persistent instance in the cache of instances managed by this PersistenceManager.
 java.lang.Object getObjectById(java.lang.Object id, java.lang.Class contextClass, int[] fieldNumbers, FieldManager fm)
          Locates a persistent instance in the cache of instances managed by this PersistenceManager.
 java.lang.Object getObjectId(java.lang.Object pc)
           
 java.lang.Class getObjectIdClass(java.lang.Class cls)
           
 javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory()
           
 StoreManager getStoreManager()
          Returns the store manager used for storage by this persistence manager.
 java.lang.Object getTransactionalObjectId(java.lang.Object pc)
           
 java.lang.Object getUserObject()
           
 void hereIsStateManager(StateManager sm, java.lang.Object pc)
          Called by state managers when their getPersistenceManager() method is called.
 boolean isClosed()
           
 void makeNontransactional(java.lang.Object pc)
           
 void makeNontransactionalAll(java.util.Collection pcs)
           
 void makeNontransactionalAll(java.lang.Object[] pcs)
           
 void makePersistent(java.lang.Object obj)
           
 void makePersistentAll(java.util.Collection pcs)
           
 void makePersistentAll(java.lang.Object[] pcs)
           
 void makeTransactional(java.lang.Object pc)
           
 void makeTransactionalAll(java.util.Collection pcs)
           
 void makeTransactionalAll(java.lang.Object[] pcs)
           
 void makeTransient(java.lang.Object pc)
           
 void makeTransientAll(java.util.Collection pcs)
           
 void makeTransientAll(java.lang.Object[] pcs)
           
 void markDirty(StateManager sm)
          Marks the specified state manager as dirty.
 java.lang.Object newObjectIdInstance(java.lang.Class clazz, java.lang.String str)
           
 javax.jdo.Query newQuery()
           
 javax.jdo.Query newQuery(java.lang.Class cls)
           
 javax.jdo.Query newQuery(java.lang.Class cls, java.util.Collection cln)
           
 javax.jdo.Query newQuery(java.lang.Class cls, java.util.Collection cln, java.lang.String filter)
           
 javax.jdo.Query newQuery(java.lang.Class cls, java.lang.String filter)
           
 javax.jdo.Query newQuery(javax.jdo.Extent cln)
           
 javax.jdo.Query newQuery(javax.jdo.Extent cln, java.lang.String filter)
           
 javax.jdo.Query newQuery(java.lang.Object obj)
           
 javax.jdo.Query newQuery(java.lang.String language, java.lang.Object query)
           
 void refresh(java.lang.Object pc)
           
 void refreshAll()
           
 void refreshAll(java.util.Collection pcs)
           
 void refreshAll(java.lang.Object[] pcs)
           
 void releaseConnection(java.sql.Connection conn)
          Release a previously-obtained data store connection.
 void removeStateManager(StateManager sm)
          Called by state managers when disconnecting from the managed object.
 void retrieve(java.lang.Object pc)
           
 void retrieveAll(java.util.Collection pcs)
           
 void retrieveAll(java.util.Collection pcs, boolean DFGOnly)
           
 void retrieveAll(java.lang.Object[] pcs)
           
 void retrieveAll(java.lang.Object[] pcs, boolean DFGOnly)
           
 void setIgnoreCache(boolean flag)
           
 void setMultithreaded(boolean flag)
           
 void setUserObject(java.lang.Object userObject)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistenceManagerImpl

public PersistenceManagerImpl(PersistenceManagerFactoryImpl pmf,
                              java.lang.String userName,
                              java.lang.String password)
Method Detail

getStoreManager

public StoreManager getStoreManager()
Description copied from interface: PersistenceManager
Returns the store manager used for storage by this persistence manager.

Specified by:
getStoreManager in interface PersistenceManager

getConnection

public java.sql.Connection getConnection(boolean forWriting)
                                  throws java.sql.SQLException
Description copied from interface: PersistenceManager
Obtains a JDBC connection to the data store. If a JDO transaction is active, this is the connection on which the corresponding JDBC transaction is active. Otherwise a new connection is obtained from the underlying data source.

Specified by:
getConnection in interface PersistenceManager
Parameters:
forWriting - true if the connection will be used for updates.
Returns:
A JDBC connection.
Throws:
java.sql.SQLException

releaseConnection

public void releaseConnection(java.sql.Connection conn)
                       throws java.sql.SQLException
Description copied from interface: PersistenceManager
Release a previously-obtained data store connection. Must be called once for every connection obtained with PersistenceManager.getConnection(boolean) (use try/finally).

Specified by:
releaseConnection in interface PersistenceManager
Throws:
java.sql.SQLException

dataStoreModifyCount

public int dataStoreModifyCount()
Description copied from interface: PersistenceManager
Returns the number of data store modifications made under this persistence manager. Can be used as a version stamp on the data store. Note that it only reflects modifications made to objects from this persistence manager.

Specified by:
dataStoreModifyCount in interface PersistenceManager

enlistInTransaction

public void enlistInTransaction(StateManager sm)
Description copied from interface: PersistenceManager
Called by state managers to enlist in the transaction cache.

Specified by:
enlistInTransaction in interface PersistenceManager

evictFromTransaction

public void evictFromTransaction(StateManager sm)
Description copied from interface: PersistenceManager
Called by state managers to evict themselves from the transaction cache.

Specified by:
evictFromTransaction in interface PersistenceManager

removeStateManager

public void removeStateManager(StateManager sm)
Description copied from interface: PersistenceManager
Called by state managers when disconnecting from the managed object. Also evicts from the transaction cache.

Specified by:
removeStateManager in interface PersistenceManager

isClosed

public boolean isClosed()
Specified by:
isClosed in interface javax.jdo.PersistenceManager

close

public void close()
Specified by:
close in interface javax.jdo.PersistenceManager

finalize

public void finalize()

currentTransaction

public javax.jdo.Transaction currentTransaction()
Specified by:
currentTransaction in interface javax.jdo.PersistenceManager

evict

public void evict(java.lang.Object pc)
Specified by:
evict in interface javax.jdo.PersistenceManager

evictAll

public void evictAll(java.lang.Object[] pcs)
Specified by:
evictAll in interface javax.jdo.PersistenceManager

evictAll

public void evictAll(java.util.Collection pcs)
Specified by:
evictAll in interface javax.jdo.PersistenceManager

evictAll

public void evictAll()
Specified by:
evictAll in interface javax.jdo.PersistenceManager

refresh

public void refresh(java.lang.Object pc)
Specified by:
refresh in interface javax.jdo.PersistenceManager

refreshAll

public void refreshAll(java.lang.Object[] pcs)
Specified by:
refreshAll in interface javax.jdo.PersistenceManager

refreshAll

public void refreshAll(java.util.Collection pcs)
Specified by:
refreshAll in interface javax.jdo.PersistenceManager

refreshAll

public void refreshAll()
Specified by:
refreshAll in interface javax.jdo.PersistenceManager

retrieve

public void retrieve(java.lang.Object pc)
Specified by:
retrieve in interface javax.jdo.PersistenceManager

retrieveAll

public void retrieveAll(java.lang.Object[] pcs)
Specified by:
retrieveAll in interface javax.jdo.PersistenceManager

retrieveAll

public void retrieveAll(java.lang.Object[] pcs,
                        boolean DFGOnly)
Specified by:
retrieveAll in interface javax.jdo.PersistenceManager

retrieveAll

public void retrieveAll(java.util.Collection pcs)
Specified by:
retrieveAll in interface javax.jdo.PersistenceManager

retrieveAll

public void retrieveAll(java.util.Collection pcs,
                        boolean DFGOnly)
Specified by:
retrieveAll in interface javax.jdo.PersistenceManager

makePersistent

public void makePersistent(java.lang.Object obj)
Specified by:
makePersistent in interface javax.jdo.PersistenceManager

makePersistentAll

public void makePersistentAll(java.lang.Object[] pcs)
Specified by:
makePersistentAll in interface javax.jdo.PersistenceManager

makePersistentAll

public void makePersistentAll(java.util.Collection pcs)
Specified by:
makePersistentAll in interface javax.jdo.PersistenceManager

deletePersistent

public void deletePersistent(java.lang.Object obj)
Specified by:
deletePersistent in interface javax.jdo.PersistenceManager

deletePersistentAll

public void deletePersistentAll(java.lang.Object[] pcs)
Specified by:
deletePersistentAll in interface javax.jdo.PersistenceManager

deletePersistentAll

public void deletePersistentAll(java.util.Collection pcs)
Specified by:
deletePersistentAll in interface javax.jdo.PersistenceManager

makeTransient

public void makeTransient(java.lang.Object pc)
Specified by:
makeTransient in interface javax.jdo.PersistenceManager

makeTransientAll

public void makeTransientAll(java.lang.Object[] pcs)
Specified by:
makeTransientAll in interface javax.jdo.PersistenceManager

makeTransientAll

public void makeTransientAll(java.util.Collection pcs)
Specified by:
makeTransientAll in interface javax.jdo.PersistenceManager

makeTransactional

public void makeTransactional(java.lang.Object pc)
Specified by:
makeTransactional in interface javax.jdo.PersistenceManager

makeTransactionalAll

public void makeTransactionalAll(java.lang.Object[] pcs)
Specified by:
makeTransactionalAll in interface javax.jdo.PersistenceManager

makeTransactionalAll

public void makeTransactionalAll(java.util.Collection pcs)
Specified by:
makeTransactionalAll in interface javax.jdo.PersistenceManager

makeNontransactional

public void makeNontransactional(java.lang.Object pc)
Specified by:
makeNontransactional in interface javax.jdo.PersistenceManager

makeNontransactionalAll

public void makeNontransactionalAll(java.lang.Object[] pcs)
Specified by:
makeNontransactionalAll in interface javax.jdo.PersistenceManager

makeNontransactionalAll

public void makeNontransactionalAll(java.util.Collection pcs)
Specified by:
makeNontransactionalAll in interface javax.jdo.PersistenceManager

newObjectIdInstance

public java.lang.Object newObjectIdInstance(java.lang.Class clazz,
                                            java.lang.String str)
Specified by:
newObjectIdInstance in interface javax.jdo.PersistenceManager

newQuery

public javax.jdo.Query newQuery()
Specified by:
newQuery in interface javax.jdo.PersistenceManager

newQuery

public javax.jdo.Query newQuery(java.lang.Object obj)
Specified by:
newQuery in interface javax.jdo.PersistenceManager

newQuery

public javax.jdo.Query newQuery(java.lang.String language,
                                java.lang.Object query)
Specified by:
newQuery in interface javax.jdo.PersistenceManager

newQuery

public javax.jdo.Query newQuery(java.lang.Class cls)
Specified by:
newQuery in interface javax.jdo.PersistenceManager

newQuery

public javax.jdo.Query newQuery(javax.jdo.Extent cln)
Specified by:
newQuery in interface javax.jdo.PersistenceManager

newQuery

public javax.jdo.Query newQuery(java.lang.Class cls,
                                java.util.Collection cln)
Specified by:
newQuery in interface javax.jdo.PersistenceManager

newQuery

public javax.jdo.Query newQuery(java.lang.Class cls,
                                java.lang.String filter)
Specified by:
newQuery in interface javax.jdo.PersistenceManager

newQuery

public javax.jdo.Query newQuery(java.lang.Class cls,
                                java.util.Collection cln,
                                java.lang.String filter)
Specified by:
newQuery in interface javax.jdo.PersistenceManager

newQuery

public javax.jdo.Query newQuery(javax.jdo.Extent cln,
                                java.lang.String filter)
Specified by:
newQuery in interface javax.jdo.PersistenceManager

getExtent

public javax.jdo.Extent getExtent(java.lang.Class cls,
                                  boolean flag)
Specified by:
getExtent in interface javax.jdo.PersistenceManager

getObjectById

public java.lang.Object getObjectById(java.lang.Object id,
                                      boolean validate)
Specified by:
getObjectById in interface javax.jdo.PersistenceManager

getObjectById

public java.lang.Object getObjectById(java.lang.Object id,
                                      java.lang.Class contextClass,
                                      boolean validate)
Description copied from interface: PersistenceManager
Locates a persistent instance in the cache of instances managed by this PersistenceManager. This is a variation of getObjectById(Object, boolean) that allows a context class to be specified for class loading purposes.

Specified by:
getObjectById in interface PersistenceManager
Parameters:
id - An object ID.
contextClass - A class to use as a class-loading context, if necessary, or null to use just the default class loader(s).
validate - true if the existence of the instance is to be validated.
Returns:
The PersistenceCapable instance having the specified object ID.

getObjectById

public java.lang.Object getObjectById(java.lang.Object id,
                                      java.lang.Class contextClass,
                                      int[] fieldNumbers,
                                      FieldManager fm)
Description copied from interface: PersistenceManager
Locates a persistent instance in the cache of instances managed by this PersistenceManager. This is a variation of PersistenceManager.getObjectById(Object,Class,boolean) that allows specific initial field values to be offered to the state manager. Classes in the store package use this method to proactively offer field values in cases where they are readily available. If the instance is in a state that can benefit from newly available field values, the fields are replaced in the instance and a state change occurs as though the instance itself had read a field.

Specified by:
getObjectById in interface PersistenceManager
Parameters:
id - An object ID.
contextClass - A class to use as a class-loading context, if necessary, or null to use just the default class loader(s).
fieldNumbers - The field numbers being offered.
fm - A field manager from which to get the offered fields.
Returns:
The PersistenceCapable instance having the specified object ID.

getObjectId

public java.lang.Object getObjectId(java.lang.Object pc)
Specified by:
getObjectId in interface javax.jdo.PersistenceManager

getTransactionalObjectId

public java.lang.Object getTransactionalObjectId(java.lang.Object pc)
Specified by:
getTransactionalObjectId in interface javax.jdo.PersistenceManager

setUserObject

public void setUserObject(java.lang.Object userObject)
Specified by:
setUserObject in interface javax.jdo.PersistenceManager

getUserObject

public java.lang.Object getUserObject()
Specified by:
getUserObject in interface javax.jdo.PersistenceManager

getPersistenceManagerFactory

public javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory()
Specified by:
getPersistenceManagerFactory in interface javax.jdo.PersistenceManager

getObjectIdClass

public java.lang.Class getObjectIdClass(java.lang.Class cls)
Specified by:
getObjectIdClass in interface javax.jdo.PersistenceManager

setMultithreaded

public void setMultithreaded(boolean flag)
Specified by:
setMultithreaded in interface javax.jdo.PersistenceManager

getMultithreaded

public boolean getMultithreaded()
Specified by:
getMultithreaded in interface javax.jdo.PersistenceManager

setIgnoreCache

public void setIgnoreCache(boolean flag)
Specified by:
setIgnoreCache in interface javax.jdo.PersistenceManager

getIgnoreCache

public boolean getIgnoreCache()
Specified by:
getIgnoreCache in interface javax.jdo.PersistenceManager

findStateManager

public StateManager findStateManager(java.lang.Object obj)
Returns the StateManager for a given object.

Specified by:
findStateManager in interface PersistenceManager
Returns:
The object's state manager, or null if obj is null or has no state manager.
Throws:
javax.jdo.JDOUserException - If obj is not PersistenceCapable or is managed by a different PersistenceManager.

findStateManagers

public java.util.List findStateManagers(java.util.Collection objs)
Finds the StateManagers for a collection of objects.

Specified by:
findStateManagers in interface PersistenceManager
Returns:
A list of state managers, one for each object in objs. Each entry in the list is null if the corresponding object reference is null or the object has no state manager.
Throws:
javax.jdo.JDOUserException - If any object in objs is not PersistenceCapable or is managed by a different PersistenceManager.

hereIsStateManager

public void hereIsStateManager(StateManager sm,
                               java.lang.Object pc)
Description copied from interface: PersistenceManager
Called by state managers when their getPersistenceManager() method is called. This is used by PersistenceManager.findStateManager(java.lang.Object) to quickly locate an object's state manager.

Specified by:
hereIsStateManager in interface PersistenceManager

markDirty

public void markDirty(StateManager sm)
Description copied from interface: PersistenceManager
Marks the specified state manager as dirty.

In this case, "dirty" means having one or more fields modified that have not been updated in storage via the StoreManager. The persistence manager allows at most one state manager at a time to be considered dirty. The sole purpose of this delayed update is to coalesce multiple field changes on the same object into one SQL UPDATE.

Specified by:
markDirty in interface PersistenceManager

flushDirty

public void flushDirty()
Description copied from interface: PersistenceManager
Causes any dirty state manager to be updated in storage.

Specified by:
flushDirty in interface PersistenceManager

dump

public void dump(java.lang.Object obj,
                 java.io.PrintWriter out)
Description copied from interface: PersistenceManager
Prints debugging info on an object to the specified output.

Specified by:
dump in interface PersistenceManager


Copyright © 2001-2007 The TJDO Project All Rights Reserved.