org.objectweb.speedo.pm.api
Interface ProxyManager

All Superinterfaces:
javax.jdo.datastore.JDOConnection, javax.jdo.PersistenceManager, javax.transaction.Synchronization
All Known Implementing Classes:
SpeedoProxyManager

public interface ProxyManager
extends javax.jdo.PersistenceManager, javax.transaction.Synchronization, javax.jdo.datastore.JDOConnection

This interfaces defined a manager of persistent instance. This concept is based on the javax.jdo.PersistenceManager interface. A ProxyManager is also a javax.transaction.Synchronization for the JTA integration. This permits to support the container transaction demarcation. On the beforeCompletion method the JDO transaction is prepared. A proxy manager used a TransactionalPersistenceManager for managing the concurrency, the loading and the caching aspects.

Author:
S.Chassande-Barrioz
See Also:
ProxyManagerFactory, ProxyManagerSwitch, TransactionalPersistenceManager

Method Summary
 void addUse()
          Signal to the persistence maneger that it is used.
 java.lang.Object getConnectionSpec()
           
 org.objectweb.perseus.concurrency.lib.Semaphore getSemaphore()
          Retrieves the semaphore object permiting the multithreading mode.
 org.objectweb.perseus.persistence.api.TransactionalPersistenceManager getTransactionalPersistenceManager()
          Retrieves the TransactionalPersistenceManager used by this ProxyManager.
 void open(java.lang.Object connectionSpec)
          Opens the persistent manager.
 java.lang.Object speedoAttachCopy(java.lang.Object detached, boolean makeTransactional, java.util.Map map)
           
 void speedoDeletePersistent(java.lang.Object o)
          Delete persistent a SpeedoProxy.
 java.lang.Object speedoDetachCopy(SpeedoProxy sp, java.util.Map map, java.util.Collection fgHints)
          Same as detachCopy(Object detached), but uses a map to avoid cycles when detaching objects referencing each other
 java.lang.Object speedoGetObjectById(java.lang.Object oid, boolean validate)
          is the same method than PersistenceManager.getObjectById(Object, boolean) but no checking is done, because this is an internal call of Speedo.
 void speedoMakePersistent(SpeedoProxy sp, boolean byAttach)
          Make persistent a SpeedoProxy.
 void speedoRefresh(SpeedoProxy sp, java.util.Map map, java.util.Collection fgHints)
           
 void speedoRetrieve(SpeedoProxy sp, java.util.Map map, java.util.Collection fgHints)
           
 
Methods inherited from interface javax.jdo.PersistenceManager
addInstanceLifecycleListener, attachCopy, attachCopyAll, attachCopyAll, checkConsistency, close, currentTransaction, deletePersistent, deletePersistentAll, deletePersistentAll, detachCopy, detachCopyAll, detachCopyAll, evict, evictAll, evictAll, evictAll, flush, getDataStoreConnection, 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, makeTransientAll, makeTransientAll, newInstance, newNamedQuery, newObjectIdInstance, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, putUserObject, refresh, refreshAll, refreshAll, refreshAll, refreshAll, removeInstanceLifecycleListener, removeUserObject, retrieve, retrieveAll, retrieveAll, retrieveAll, retrieveAll, setIgnoreCache, setMultithreaded, setUserObject
 
Methods inherited from interface javax.transaction.Synchronization
afterCompletion, beforeCompletion
 
Methods inherited from interface javax.jdo.datastore.JDOConnection
getNativeConnection
 

Method Detail

getTransactionalPersistenceManager

public org.objectweb.perseus.persistence.api.TransactionalPersistenceManager getTransactionalPersistenceManager()
Retrieves the TransactionalPersistenceManager used by this ProxyManager.


open

public void open(java.lang.Object connectionSpec)
Opens the persistent manager. This operation is the opposite of the javax.jdo.PersistenceManager.close() method. It prepares a ProxyManager to be used. During the preparation, the optimistic and multithread modes are initialized.

Parameters:
connectionSpec - is the information to access to the data store (user, password, ...)

getConnectionSpec

public java.lang.Object getConnectionSpec()
Returns:
the connection information to access the data store

addUse

public void addUse()
Signal to the persistence maneger that it is used. A persistence managed can be used by several thread. In this case each thread have done a PersistenceManagerFactory.getPersistentceManager() to obtain a proxy manager instance. The threads will do a close() operation, but only the last has to be taken in account. This method permits to knwon how many users uses the current proxy manager.


speedoGetObjectById

public java.lang.Object speedoGetObjectById(java.lang.Object oid,
                                            boolean validate)
is the same method than PersistenceManager.getObjectById(Object, boolean) but no checking is done, because this is an internal call of Speedo.

Parameters:
oid - is an object representing an persistent object.

speedoMakePersistent

public void speedoMakePersistent(SpeedoProxy sp,
                                 boolean byAttach)
Make persistent a SpeedoProxy. This method does the same thing than the PersistenceManager.makePersistent(Object) method except the call to the bind to the ProxyManager to the current thread.

Parameters:
sp - is the instance to make persistent.
byAttach - is a boolean value indicating if the instance to make persistent becomes persistent because the instance is linked/attached to a persistent object (true), or because the user calls explicitly pm.makePersistent(Obj) (false).

speedoDeletePersistent

public void speedoDeletePersistent(java.lang.Object o)
Delete persistent a SpeedoProxy. This method does the same thing than the PersistenceManager.deletePersistent(Object) method except the call to the bind to the ProxyManager to the current thread.

Parameters:
o - is the instance to make persistent.

getSemaphore

public org.objectweb.perseus.concurrency.lib.Semaphore getSemaphore()
Retrieves the semaphore object permiting the multithreading mode.


speedoDetachCopy

public java.lang.Object speedoDetachCopy(SpeedoProxy sp,
                                         java.util.Map map,
                                         java.util.Collection fgHints)
Same as detachCopy(Object detached), but uses a map to avoid cycles when detaching objects referencing each other

Parameters:
map - the map contains element of type: [SpeedoProxy, clone of SpeedoProxy]

speedoAttachCopy

public java.lang.Object speedoAttachCopy(java.lang.Object detached,
                                         boolean makeTransactional,
                                         java.util.Map map)

speedoRefresh

public void speedoRefresh(SpeedoProxy sp,
                          java.util.Map map,
                          java.util.Collection fgHints)

speedoRetrieve

public void speedoRetrieve(SpeedoProxy sp,
                           java.util.Map map,
                           java.util.Collection fgHints)