org.objectweb.speedo.pm.api
Interface ProxyManager

All Known Implementing Classes:
SpeedoProxyManager

public interface ProxyManager

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 attachCopy(java.lang.Object detached, boolean makeTransactional)
          attach/detach temporary included in this interface: to be removed and included in the jdo2.0.jar
 java.util.Collection attachCopyAll(java.util.Collection detached, boolean makeTransactional)
           
 java.lang.Object[] attachCopyAll(java.lang.Object[] detached, boolean makeTransactional)
           
 java.lang.Object detachCopy(java.lang.Object o)
           
 java.util.Collection detachCopyAll(java.util.Collection collection)
           
 java.lang.Object[] detachCopyAll(java.lang.Object[] objects)
           
 java.lang.Object getConnectionSpec()
          Retrieves the connection information to access the data store
 java.util.Collection getFetchGroupHints(SpeedoProxy sp)
          Compute the list of unsual fields to load using the active fetchgroups in the persistence manager and the fetchgroups defined for the proxy sp.
 java.util.Collection getFetchGroupHints(SpeedoProxy sp, java.lang.Object filter)
          Same as getFetchGroupHints except that the filter parameter enables to define a filter for the collection to be returned.
 java.util.Collection getFetchGroupHints(java.lang.String className)
           
 java.util.Collection getFetchGroupHints(java.lang.String className, java.lang.Object filter)
           
 java.util.Collection getFieldsToLoad(SpeedoProxy sp, boolean onlyDirectRef)
          Compute the list of fields to load using the active fetchgroups in the persistence manager and the fetchgroups defined for the proxy sp.
 java.util.Collection getFieldsToLoad(java.lang.String className, boolean onlyDirectRef)
           
 Semaphore getSemaphore()
          Retrieves the semaphore object permiting the multithreading mode.
 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)
           
 

Method Detail

getTransactionalPersistenceManager

public 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()
Retrieves 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 Semaphore getSemaphore()
Retrieves the semaphore object permiting the multithreading mode.


getFieldsToLoad

public java.util.Collection getFieldsToLoad(SpeedoProxy sp,
                                            boolean onlyDirectRef)
Compute the list of fields to load using the active fetchgroups in the persistence manager and the fetchgroups defined for the proxy sp.

Parameters:
onlyDirectRef - : if set to true, all the fields of type a.b.c or a#element or a/fg are removed from the returned collection
Returns:

getFieldsToLoad

public java.util.Collection getFieldsToLoad(java.lang.String className,
                                            boolean onlyDirectRef)

getFetchGroupHints

public java.util.Collection getFetchGroupHints(SpeedoProxy sp)
Compute the list of unsual fields to load using the active fetchgroups in the persistence manager and the fetchgroups defined for the proxy sp. This means that only fields defined as "a.b.c" or "a#key.name", etc... are returned.

Returns:

getFetchGroupHints

public java.util.Collection getFetchGroupHints(java.lang.String className)

getFetchGroupHints

public java.util.Collection getFetchGroupHints(SpeedoProxy sp,
                                               java.lang.Object filter)
Same as getFetchGroupHints except that the filter parameter enables to define a filter for the collection to be returned.


getFetchGroupHints

public java.util.Collection getFetchGroupHints(java.lang.String className,
                                               java.lang.Object filter)

attachCopy

public java.lang.Object attachCopy(java.lang.Object detached,
                                   boolean makeTransactional)
attach/detach temporary included in this interface: to be removed and included in the jdo2.0.jar


attachCopyAll

public java.util.Collection attachCopyAll(java.util.Collection detached,
                                          boolean makeTransactional)

attachCopyAll

public java.lang.Object[] attachCopyAll(java.lang.Object[] detached,
                                        boolean makeTransactional)

detachCopy

public java.lang.Object detachCopy(java.lang.Object o)

detachCopyAll

public java.util.Collection detachCopyAll(java.util.Collection collection)

detachCopyAll

public java.lang.Object[] detachCopyAll(java.lang.Object[] objects)

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


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)