org.jpox
Interface PersistenceManager

All Superinterfaces:
javax.jdo.PersistenceManager
All Known Implementing Classes:
AbstractPersistenceManager, PersistenceManagerImpl, PersistenceManagerImpl

public interface PersistenceManager
extends javax.jdo.PersistenceManager

Extension of JDO PersistenceManager. Adds aspects particular to JPOX.

Version:
$Revision: 1.27 $

Method Summary
 void addQueryResult(QueryResult queryResult)
          Add opened query results to the pm
 void addQueryRun(java.lang.String singleStringQuery)
          Add queries already run to the pm
 void addStateManager(StateManager sm)
          Method to add the object managed by the specified StateManager to the cache.
 java.lang.Object attachCopy(java.lang.Object pc, boolean embedded)
          Method to attach a copy of the passed object (and related objects).
 void clearDirty(StateManager sm)
          Mark the specified StateManager as clean.
 java.lang.Object detachCopyInternal(java.lang.Object pc, FetchPlanState state)
          Method to detach the passed object using the provided state.
 void detachInternal(java.lang.Object pc, FetchPlanState state)
          Method to detach the passed object.
 void dump(java.lang.Object obj, java.io.PrintWriter out)
          Diagnostic method to dump the state of the PC object to the passed PrintWriter.
 void enlistInTransaction(StateManager sm)
          Method to enlist the specified StateManager in the current transaction.
 void evictFromTransaction(StateManager sm)
          Method to evict the specified StateManager from the current transaction.
 StateManager findStateManager(javax.jdo.spi.PersistenceCapable pc)
          Method to find the StateManager for the passed PersistenceCapable object when it is managed by this PM.
 ClassLoaderResolver getClassLoaderResolver()
          Accessor for the ClassLoader resolver to use in class loading issues.
 java.sql.Connection getConnection(boolean forWriting, boolean forQuery)
          Accessor for the connection to the datasource.
 java.sql.Connection getConnection(boolean forWriting, boolean forQuery, boolean useOpenedConnection)
          Accessor for the connection to the datasource.
 MetaDataManager getMetaDataManager()
          Accessor for the MetaData Manager.
 java.lang.Object getObjectByAID(java.lang.Class pcClass, FieldValues fv, boolean ignoreCache, boolean checkInheritance)
          Accessor for an object given the object id.
 java.lang.Object getObjectById(java.lang.Object id, boolean validate, boolean checkInheritance)
          Accessor for an object given the object id.
 java.lang.Object getObjectById(java.lang.Object id, FieldValues fv)
          Accessor for an object given the object id.
 java.lang.Object getObjectById(java.lang.Object id, FieldValues fv, java.lang.Class pcClass, boolean ignoreCache)
          Accessor for an object given the object id.
 PMFContext getPMFContext()
          Accessor for the context in which this PersistenceManager is running.
 PersistenceManager getPMHandle()
          Accessor for a handle to this PersistenceManager.
 StateManager getStateManagerById(java.lang.Object myID)
          Accessor for the StateManager of an object given the object id.
 StoreManager getStoreManager()
          Accessor for the Store Manager.
 boolean hasQueryRun(java.lang.String singleStringQuery)
          Whether the query was already run
 void hereIsStateManager(StateManager sm, javax.jdo.spi.PersistenceCapable pc)
          Method to add the StateManager for an object to this PersistenceManager's list.
 boolean isConnectionOpen()
          Checks whether a connection to the datasource is open.
 boolean isDelayDatastoreOperationsEnabled()
          Whether the datastore operations are delayed until commit.
 boolean isInserting(javax.jdo.spi.PersistenceCapable pc)
          Tests whether this object is being inserted.
 java.lang.Object makePersistentInternal(java.lang.Object pc, FieldValues preInsertChanges)
          Method to persist the passed object.
 void makeTransientInternal(java.lang.Object pc, FetchPlanState state)
          Method to make transient the passed object.
 void markDirty(StateManager sm)
          Mark the specified StateManager as dirty
 void notifyLifecycleListenersForEvent(java.lang.Object obj, int lifecycleEventType, java.lang.Object otherObj)
          Method to notify the listeners of an event happening
 void putObjectIntoCache(StateManager sm, boolean level1, boolean level2)
          Method to put a PersistenceCapable object associated to the StateManager into the respective cache(s).
 void releaseConnection(java.sql.Connection conn)
          Method to release the connection
 void removeObjectFromCache(javax.jdo.spi.PersistenceCapable pc, java.lang.Object id, boolean level1, boolean level2)
          Method to remove an object from the respective cache(s).
 void removeQueryResult(QueryResult queryResult)
          Remove query results from the pm
 void removeQueryRun(java.lang.String singleStringQuery)
          Remove query results from the pm
 void removeStateManager(StateManager sm)
          Method to remove the object managed by the specified StateManager from the cache.
 void replaceObjectId(javax.jdo.spi.PersistenceCapable pc, java.lang.Object oldID, java.lang.Object newID)
          Replace the previous object id for a PC object to a new
 
Methods inherited from interface javax.jdo.PersistenceManager
addInstanceLifecycleListener, checkConsistency, close, currentTransaction, deletePersistent, deletePersistentAll, deletePersistentAll, detachCopy, detachCopyAll, detachCopyAll, evict, evictAll, evictAll, evictAll, flush, getDataStoreConnection, getDetachAllOnCommit, getExtent, getExtent, getFetchPlan, getIgnoreCache, getMultithreaded, getObjectById, getObjectById, getObjectById, getObjectId, getObjectIdClass, getObjectsById, getObjectsById, getObjectsById, getObjectsById, getPersistenceManagerFactory, getSequence, getTransactionalObjectId, getUserObject, getUserObject, isClosed, makeNontransactional, makeNontransactionalAll, makeNontransactionalAll, makePersistent, makePersistentAll, makePersistentAll, makeTransactional, makeTransactionalAll, makeTransactionalAll, makeTransient, makeTransient, makeTransientAll, makeTransientAll, makeTransientAll, makeTransientAll, newInstance, newNamedQuery, newObjectIdInstance, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, putUserObject, refresh, refreshAll, refreshAll, refreshAll, refreshAll, removeInstanceLifecycleListener, removeUserObject, retrieve, retrieve, retrieveAll, retrieveAll, retrieveAll, retrieveAll, setDetachAllOnCommit, setIgnoreCache, setMultithreaded, setUserObject
 

Method Detail

getStoreManager

public StoreManager getStoreManager()
Accessor for the Store Manager.

Returns:
Store Manager

getMetaDataManager

public MetaDataManager getMetaDataManager()
Accessor for the MetaData Manager.

Returns:
The MetaData Manager

getPMFContext

public PMFContext getPMFContext()
Accessor for the context in which this PersistenceManager is running.

Returns:
Returns the pmfContext.

getPMHandle

public PersistenceManager getPMHandle()
Accessor for a handle to this PersistenceManager.

Returns:
The handle.

getClassLoaderResolver

public ClassLoaderResolver getClassLoaderResolver()
Accessor for the ClassLoader resolver to use in class loading issues.

Returns:
The ClassLoader resolver

getConnection

public java.sql.Connection getConnection(boolean forWriting,
                                         boolean forQuery)
                                  throws java.sql.SQLException
Accessor for the connection to the datasource.

Parameters:
forWriting - Whether the connection is read-only or read-write.
forQuery - Whether the connection is to be used by a query (i.e.JDOQUERY).
Returns:
The Connection
Throws:
java.sql.SQLException

getConnection

public java.sql.Connection getConnection(boolean forWriting,
                                         boolean forQuery,
                                         boolean useOpenedConnection)
                                  throws java.sql.SQLException
Accessor for the connection to the datasource.

Parameters:
forWriting - Whether the connection is read-only or read-write.
forQuery - Whether the connection is to be used by a query (i.e.JDOQUERY).
useOpenedConnection - whether to use an already opened connection, if one is opened.
Returns:
The Connection
Throws:
java.sql.SQLException

isConnectionOpen

public boolean isConnectionOpen()
Checks whether a connection to the datasource is open.

Returns:
true if the Connection is open

releaseConnection

public void releaseConnection(java.sql.Connection conn)
                       throws java.sql.SQLException
Method to release the connection

Parameters:
conn - The connection
Throws:
java.sql.SQLException - Thrown if an error occurs on release

getObjectById

public java.lang.Object getObjectById(java.lang.Object id,
                                      FieldValues fv)
Accessor for an object given the object id.

Parameters:
id - Id of the object.
fv - the FieldValues
Returns:
the Object

getObjectById

public java.lang.Object getObjectById(java.lang.Object id,
                                      boolean validate,
                                      boolean checkInheritance)
Accessor for an object given the object id.

Parameters:
id - Id of the object.
validate - Whether to validate the object state
checkInheritance - Whether look to the database to determine which class this object is. This parameter is a hint. Set false, if it's already determined the correct pcClass for this pc "object" in a certain level in the hierarchy. Set to true and it will look to the database.
Returns:
The Object

getObjectById

public java.lang.Object getObjectById(java.lang.Object id,
                                      FieldValues fv,
                                      java.lang.Class pcClass,
                                      boolean ignoreCache)
Accessor for an object given the object id.

Parameters:
id - Id of the object.
fv - the FieldValues
pcClass - the type which the object is. This type will be used to instanciat the object
ignoreCache - true if the cache is ignored
Returns:
the Object

getObjectByAID

public java.lang.Object getObjectByAID(java.lang.Class pcClass,
                                       FieldValues fv,
                                       boolean ignoreCache,
                                       boolean checkInheritance)
Accessor for an object given the object id. The object uses application identity

Parameters:
fv - the FieldValues containing at minimum the primary key fields
pcClass - the type which the object is
ignoreCache - true if the cache is ignored
checkInheritance - true if the cache is ignored
Returns:
the Object

makePersistentInternal

public java.lang.Object makePersistentInternal(java.lang.Object pc,
                                               FieldValues preInsertChanges)
Method to persist the passed object. For internal use only

Parameters:
pc - The object
preInsertChanges - Changes to be made before inserting
Returns:
The persisted object

makeTransientInternal

public void makeTransientInternal(java.lang.Object pc,
                                  FetchPlanState state)
Method to make transient the passed object. For internal use only

Parameters:
pc - The object
state - Object containing the state of the fetchplan processing

detachInternal

public void detachInternal(java.lang.Object pc,
                           FetchPlanState state)
Method to detach the passed object. For internal use only

Parameters:
pc - The object to detach
state - State for the detachment process.

attachCopy

public java.lang.Object attachCopy(java.lang.Object pc,
                                   boolean embedded)
Method to attach a copy of the passed object (and related objects).

Parameters:
pc - The object
embedded - Whether it is embedded
Returns:
The attached copy of the input object

detachCopyInternal

public java.lang.Object detachCopyInternal(java.lang.Object pc,
                                           FetchPlanState state)
Method to detach the passed object using the provided state. For internal use only

Parameters:
pc - The object
state - State for the detachment process
Returns:
The detached object

enlistInTransaction

public void enlistInTransaction(StateManager sm)
Method to enlist the specified StateManager in the current transaction.

Parameters:
sm - The StateManager

evictFromTransaction

public void evictFromTransaction(StateManager sm)
Method to evict the specified StateManager from the current transaction.

Parameters:
sm - The StateManager

findStateManager

public StateManager findStateManager(javax.jdo.spi.PersistenceCapable pc)
Method to find the StateManager for the passed PersistenceCapable object when it is managed by this PM.

Parameters:
pc - The PersistenceCapable object
Returns:
The StateManager

hereIsStateManager

public void hereIsStateManager(StateManager sm,
                               javax.jdo.spi.PersistenceCapable pc)
Method to add the StateManager for an object to this PersistenceManager's list.

Parameters:
sm - The StateManager
pc - The object managed by the StateManager

addStateManager

public void addStateManager(StateManager sm)
Method to add the object managed by the specified StateManager to the cache.

Parameters:
sm - The StateManager

removeStateManager

public void removeStateManager(StateManager sm)
Method to remove the object managed by the specified StateManager from the cache.

Parameters:
sm - The StateManager

getStateManagerById

public StateManager getStateManagerById(java.lang.Object myID)
Accessor for the StateManager of an object given the object id.

Parameters:
myID - Id of the object.
Returns:
The StateManager

markDirty

public void markDirty(StateManager sm)
Mark the specified StateManager as dirty

Parameters:
sm - The StateManager

clearDirty

public void clearDirty(StateManager sm)
Mark the specified StateManager as clean.

Parameters:
sm - The StateManager

isInserting

public boolean isInserting(javax.jdo.spi.PersistenceCapable pc)
Tests whether this object is being inserted.

Parameters:
pc - the object to verify the status
Returns:
true if this instance is inserting.

isDelayDatastoreOperationsEnabled

public boolean isDelayDatastoreOperationsEnabled()
Whether the datastore operations are delayed until commit. In optimistic transactions this is automatically enabled.

Returns:
true if datastore operations are delayed until commit

notifyLifecycleListenersForEvent

public void notifyLifecycleListenersForEvent(java.lang.Object obj,
                                             int lifecycleEventType,
                                             java.lang.Object otherObj)
Method to notify the listeners of an event happening

Parameters:
obj - The object on which the event happens
lifecycleEventType - The event type
otherObj - Other object involved in the event (if any)

addQueryResult

public void addQueryResult(QueryResult queryResult)
Add opened query results to the pm

Parameters:
queryResult - The result to add

removeQueryResult

public void removeQueryResult(QueryResult queryResult)
Remove query results from the pm

Parameters:
queryResult - The result to remove

addQueryRun

public void addQueryRun(java.lang.String singleStringQuery)
Add queries already run to the pm

Parameters:
singleStringQuery -

removeQueryRun

public void removeQueryRun(java.lang.String singleStringQuery)
Remove query results from the pm

Parameters:
singleStringQuery -

hasQueryRun

public boolean hasQueryRun(java.lang.String singleStringQuery)
Whether the query was already run

Parameters:
singleStringQuery -
Returns:
true if the query was run previously by this PersistenceManager

replaceObjectId

public void replaceObjectId(javax.jdo.spi.PersistenceCapable pc,
                            java.lang.Object oldID,
                            java.lang.Object newID)
Replace the previous object id for a PC object to a new

Parameters:
pc - The Persistence Capable object
oldID - the old id
newID - the new id

putObjectIntoCache

public void putObjectIntoCache(StateManager sm,
                               boolean level1,
                               boolean level2)
Method to put a PersistenceCapable object associated to the StateManager into the respective cache(s).

Parameters:
sm - The State Manager
level1 - Whether to put in the L1 cache
level2 - Whether to put in the L2 cache

removeObjectFromCache

public void removeObjectFromCache(javax.jdo.spi.PersistenceCapable pc,
                                  java.lang.Object id,
                                  boolean level1,
                                  boolean level2)
Method to remove an object from the respective cache(s).

Parameters:
pc - The object
id - The id of the object
level1 - Whether to remove from the L1 cache
level2 - Whether to remove from the L2 cache

dump

public void dump(java.lang.Object obj,
                 java.io.PrintWriter out)
Diagnostic method to dump the state of the PC object to the passed PrintWriter.

Parameters:
obj - The PersistenceCapable object
out - The PrintWriter


Copyright © -2007 . All Rights Reserved.