org.objectweb.speedo.pm.lib
Class SpeedoProxyManager

java.lang.Object
  extended byorg.objectweb.speedo.pm.lib.SpeedoProxyManager
All Implemented Interfaces:
org.objectweb.fractal.api.control.BindingController, javax.jdo.datastore.JDOConnection, javax.jdo.PersistenceManager, ProxyManager, javax.transaction.Synchronization

public class SpeedoProxyManager
extends java.lang.Object
implements javax.jdo.PersistenceManager, ProxyManager, org.objectweb.fractal.api.control.BindingController

Is a fractal component exporting the ProxyManager interface. This implementation delegates most of the JDO methods (javax.jdo.PersistenceManager) to the underlying TransactionPersistenceManager, the perseus component managing the concurrency, the caching and the loading aspect. In order to represents a working set (transtional or not) this PM is linked forever to an org.objectweb.speedo.workingset.api.Transaction instance. The status of this Transaction instance changes when this PM is allocated or closed, or when transaction demarcations are done through the javax.jdo.Transaction interface. This implementation uses a QueryManager for allocating CompiledQuery instance. Concerning the javax.jdo.Query implementation, this PM uses org.objectweb.speedo.query.lib.SpeedoQuery which are created each time (No pooling mechanism). The last dependencies is the JormFactory and a P

Author:
S.Chassande-Barrioz
See Also:
PersistenceManager, TransactionalPersistenceManager, JormFactory, ProxyManagerFactory, QueryManager, CompiledQuery, Transaction

Field Summary
static java.lang.String COMPONENT_BINDING
           
static java.lang.String JORM_FACTORY_BINDING
           
static java.lang.String LOGGER_NAME
           
static java.lang.String PNAME_CODER_BINDING
           
static java.lang.String PROXY_MANAGER_FACTORY_BINDING
           
static java.lang.String QUERY_MANAGER_BINDING
           
static java.lang.String TRANSACTION_BINDING
           
static java.lang.String TRANSACTIONAL_PERSISTENCE_MANAGER_BINDING
           
 
Constructor Summary
SpeedoProxyManager()
           
 
Method Summary
 void addInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener l, java.lang.Class[] classes)
           
 void addUse()
          Signal to the persistence maneger that it is used.
 void afterCompletion(int i)
           
 java.lang.Object attachCopy(java.lang.Object detached, boolean makeTransactional)
          Apply the changes contained in the detached object to the corresponding persistent instance in the cache.
 java.util.Collection attachCopyAll(java.util.Collection detached, boolean makeTransactional)
           
 java.lang.Object[] attachCopyAll(java.lang.Object[] detached, boolean makeTransactional)
           
 void beforeCompletion()
           
 void bindFc(java.lang.String s, java.lang.Object o)
           
 void checkConsistency()
           
 void close()
          This method closes the PersistenceManager.
 javax.jdo.Query createQuery(java.lang.Object o)
           
 javax.jdo.Transaction currentTransaction()
          Return the Transaction instance associated with a PersistenceManager.
 void deletePersistent(java.lang.Object o)
          Delete the persistent instance from the data store.
 void deletePersistentAll(java.util.Collection pcs)
          Delete a Set of instances from the data store.
 void deletePersistentAll(java.lang.Object[] pcs)
          Delete an array of instances from the data store.
 java.lang.Object detachCopy(java.lang.Object o)
          Make a detached copy of the persitent object o and return it.
 java.util.Collection detachCopyAll(java.util.Collection collection)
          Create a detached copy for each element of collection (assuming each element is persistent).
 java.lang.Object[] detachCopyAll(java.lang.Object[] objects)
           
 void evict(java.lang.Object o)
          Mark an instance as no longer needed in the cache.
 void evictAll()
          Mark all persistent-nontransactional instances as no longer needed in the cache.
 void evictAll(java.util.Collection pcs)
          Mark a Set of instances as no longer needed in the cache.
 void evictAll(java.lang.Object[] pcs)
          Mark an array of instances as no longer needed in the cache.
 void flush()
           
 java.lang.Object getConnectionSpec()
           
 javax.jdo.datastore.JDOConnection getDataStoreConnection()
           
 javax.jdo.Extent getExtent(java.lang.Class arg0)
           
 javax.jdo.Extent getExtent(java.lang.Class persistenceCapableClass, boolean subclasses)
          Not implemented.
 javax.jdo.FetchPlan getFetchPlan()
           
 boolean getIgnoreCache()
          Get the ignoreCache setting for queries.
 boolean getMultithreaded()
          Get the current Multithreaded flag for this PersistenceManager.
 java.lang.Object getNativeConnection()
           
 java.lang.Object getObjectById(java.lang.Class arg0, java.lang.Object oid)
           
 java.lang.Object getObjectById(java.lang.Object oid)
           
 java.lang.Object getObjectById(java.lang.Object oid, boolean validate)
          This method locates a persistent instance in the cache of instances managed by this PersistenceManager.
 java.lang.Object getObjectId(java.lang.Object pc)
          The ObjectId returned by this method represents the JDO identity of the instance.
 java.lang.Class getObjectIdClass(java.lang.Class cls)
          Fetches the Null PName associated to the PBinder of the persistent class
 java.util.Collection getObjectsById(java.util.Collection arg0)
           
 java.util.Collection getObjectsById(java.util.Collection arg0, boolean validate)
           
 java.lang.Object[] getObjectsById(java.lang.Object[] arg0)
           
 java.lang.Object[] getObjectsById(java.lang.Object[] arg0, boolean arg1)
           
 javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory()
           
 org.objectweb.perseus.concurrency.lib.Semaphore getSemaphore()
          Retrieves the semaphore object permiting the multithreading mode.
 javax.jdo.datastore.Sequence getSequence(java.lang.String name)
           
 java.lang.Object getTransactionalObjectId(java.lang.Object o)
          Not implemented.
 org.objectweb.perseus.persistence.api.TransactionalPersistenceManager getTransactionalPersistenceManager()
          Retrieves the TransactionalPersistenceManager used by this ProxyManager.
 java.lang.Object getUserObject()
          The application can manage the PersistenceManager instances more easily by having an application object associated with each PersistenceManager instance.
 java.lang.Object getUserObject(java.lang.Object arg0)
           
 boolean isClosed()
          A PersistenceManager instance can be used until it is closed.
 java.lang.String[] listFc()
           
 java.lang.Object lookupFc(java.lang.String s)
           
 void makeNontransactional(java.lang.Object o)
           
 void makeNontransactionalAll(java.util.Collection pcs)
           
 void makeNontransactionalAll(java.lang.Object[] pcs)
           
 void makePersistent(java.lang.Object o)
          Make the transient instance persistent in this PersistenceManager.
 void makePersistentAll(java.util.Collection pcs)
          Make a Set of instances persistent.
 void makePersistentAll(java.lang.Object[] pcs)
          Make an array of instances persistent.
 void makeTransactional(java.lang.Object o)
          Make an instance subject to transactional boundaries.
 void makeTransactionalAll(java.util.Collection pcs)
          Make a Set of instances subject to transactional boundaries.
 void makeTransactionalAll(java.lang.Object[] pcs)
          Make an array of instances subject to transactional boundaries.
 void makeTransient(java.lang.Object o)
          Make an instance transient, removing it from management by this PersistenceManager.
 void makeTransientAll(java.util.Collection pcs)
          Make a Set of instances transient, removing them from management by this PersistenceManager.
 void makeTransientAll(java.lang.Object[] pcs)
          Make an array of instances transient, removing them from management by this PersistenceManager.
 java.lang.Object newInstance(java.lang.Class arg0)
           
 javax.jdo.Query newNamedQuery(java.lang.Class klass, java.lang.String name)
           
 java.lang.Object newObjectIdInstance(java.lang.Class aClass, java.lang.Object s)
           
 javax.jdo.Query newQuery()
          Create a new Query with no elements.
 javax.jdo.Query newQuery(java.lang.Class cls)
          Create a new Query specifying the Class of the candidate instances.
 javax.jdo.Query newQuery(java.lang.Class cls, java.util.Collection cln)
          Create a new Query with the Class of the candidate instances and candidate Set.
 javax.jdo.Query newQuery(java.lang.Class cls, java.util.Collection cln, java.lang.String filter)
          Create a new Query with the Class of the candidate instances, candidate Set, and filter.
 javax.jdo.Query newQuery(java.lang.Class cls, java.lang.String filter)
          Create a new Query with the Class of the candidate instances and filter.
 javax.jdo.Query newQuery(javax.jdo.Extent extent)
           
 javax.jdo.Query newQuery(javax.jdo.Extent extent, java.lang.String filter)
           
 javax.jdo.Query newQuery(java.lang.Object compiled)
          Create a new Query using elements from another Query.
 javax.jdo.Query newQuery(java.lang.String query)
           
 javax.jdo.Query newQuery(java.lang.String language, java.lang.Object query)
          Create a new Query using the specified language.
 void open(java.lang.Object connectionspec)
          Opens the persistent manager.
 java.lang.Object putUserObject(java.lang.Object arg0, java.lang.Object arg1)
           
 void refresh(java.lang.Object o)
          Refresh the state of the instance from the data store.
 void refreshAll()
          Refresh the state of all applicable instances from the data store.
 void refreshAll(java.util.Collection pcs)
          Refresh the state of a Set of instances from the data store.
 void refreshAll(javax.jdo.JDOException arg0)
           
 void refreshAll(java.lang.Object[] pcs)
          Refresh the state of an array of instances from the data store.
 void removeInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener classes)
           
 java.lang.Object removeUserObject(java.lang.Object arg0)
           
 void retrieve(java.lang.Object o)
           
 void retrieveAll(java.util.Collection pcs)
           
 void retrieveAll(java.util.Collection collection, boolean b)
           
 void retrieveAll(java.lang.Object[] pcs)
           
 void retrieveAll(java.lang.Object[] objects, boolean b)
           
 void setIgnoreCache(boolean flag)
          Set the ignoreCache parameter for queries.
 void setMultithreaded(boolean flag)
          Set the Multithreaded flag for this PersistenceManager.
 void setUserObject(java.lang.Object o)
           
 java.lang.Object speedoAttachCopy(java.lang.Object detached, boolean makeTransactional, java.util.Map map)
          Apply the changes contained in the detached object to the corresponding persistent instance in the cache.
 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)
           
 void unbindFc(java.lang.String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROXY_MANAGER_FACTORY_BINDING

public static final java.lang.String PROXY_MANAGER_FACTORY_BINDING
See Also:
Constant Field Values

TRANSACTIONAL_PERSISTENCE_MANAGER_BINDING

public static final java.lang.String TRANSACTIONAL_PERSISTENCE_MANAGER_BINDING
See Also:
Constant Field Values

QUERY_MANAGER_BINDING

public static final java.lang.String QUERY_MANAGER_BINDING
See Also:
Constant Field Values

TRANSACTION_BINDING

public static final java.lang.String TRANSACTION_BINDING
See Also:
Constant Field Values

JORM_FACTORY_BINDING

public static final java.lang.String JORM_FACTORY_BINDING
See Also:
Constant Field Values

PNAME_CODER_BINDING

public static final java.lang.String PNAME_CODER_BINDING
See Also:
Constant Field Values

COMPONENT_BINDING

public static final java.lang.String COMPONENT_BINDING
See Also:
Constant Field Values

LOGGER_NAME

public static final java.lang.String LOGGER_NAME
See Also:
Constant Field Values
Constructor Detail

SpeedoProxyManager

public SpeedoProxyManager()
Method Detail

createQuery

public javax.jdo.Query createQuery(java.lang.Object o)

listFc

public java.lang.String[] listFc()
Specified by:
listFc in interface org.objectweb.fractal.api.control.BindingController

lookupFc

public java.lang.Object lookupFc(java.lang.String s)
Specified by:
lookupFc in interface org.objectweb.fractal.api.control.BindingController

bindFc

public void bindFc(java.lang.String s,
                   java.lang.Object o)
Specified by:
bindFc in interface org.objectweb.fractal.api.control.BindingController

unbindFc

public void unbindFc(java.lang.String s)
Specified by:
unbindFc in interface org.objectweb.fractal.api.control.BindingController

getNativeConnection

public java.lang.Object getNativeConnection()
Specified by:
getNativeConnection in interface javax.jdo.datastore.JDOConnection

addInstanceLifecycleListener

public void addInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener l,
                                         java.lang.Class[] classes)
Specified by:
addInstanceLifecycleListener in interface javax.jdo.PersistenceManager

removeInstanceLifecycleListener

public void removeInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener classes)
Specified by:
removeInstanceLifecycleListener in interface javax.jdo.PersistenceManager

flush

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

getDataStoreConnection

public javax.jdo.datastore.JDOConnection getDataStoreConnection()
Specified by:
getDataStoreConnection in interface javax.jdo.PersistenceManager

getFetchPlan

public javax.jdo.FetchPlan getFetchPlan()
Specified by:
getFetchPlan in interface javax.jdo.PersistenceManager

getObjectIdClass

public java.lang.Class getObjectIdClass(java.lang.Class cls)
Fetches the Null PName associated to the PBinder of the persistent class

Specified by:
getObjectIdClass in interface javax.jdo.PersistenceManager

isClosed

public boolean isClosed()
A PersistenceManager instance can be used until it is closed.

Specified by:
isClosed in interface javax.jdo.PersistenceManager
Returns:
true if this PersistenceManager has been closed
See Also:
close()

close

public void close()
This method closes the PersistenceManager.

Specified by:
close in interface javax.jdo.PersistenceManager
Throws:
javax.jdo.JDOUserException - if the transaction associated to the persistence manager is active.
javax.jdo.JDOFatalDataStoreException - if there is a problem while releasing the persistence manager.

currentTransaction

public javax.jdo.Transaction currentTransaction()
Return the Transaction instance associated with a PersistenceManager.

Specified by:
currentTransaction in interface javax.jdo.PersistenceManager
Returns:
the Transaction associated with this PersistenceManager.

evict

public void evict(java.lang.Object o)
Mark an instance as no longer needed in the cache.

Specified by:
evict in interface javax.jdo.PersistenceManager
Parameters:
o - the instance to evict from the cache.

evictAll

public void evictAll(java.lang.Object[] pcs)
Mark an array of instances as no longer needed in the cache.

Specified by:
evictAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - the array of instances to evict from the cache.
Throws:
javax.jdo.JDOUserException - if some instances cannot be removed.
See Also:
evict(java.lang.Object pc)

evictAll

public void evictAll(java.util.Collection pcs)
Mark a Set of instances as no longer needed in the cache.

Specified by:
evictAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - the Set of instance to evict from the cache.
See Also:
evict(java.lang.Object pc)

evictAll

public void evictAll()
Mark all persistent-nontransactional instances as no longer needed in the cache. It transitions all persistent-nontransactional instances to hollow. Transactional instances are subject to eviction based on the RetainValues setting.

Specified by:
evictAll in interface javax.jdo.PersistenceManager
See Also:
evict(java.lang.Object pc)

refresh

public void refresh(java.lang.Object o)
Refresh the state of the instance from the data store.

In an optimistic transaction, the state of instances in the cache might not match the state in the data store. This method is used to reload the state of the instance from the data store so that a subsequent commit is more likely to succeed.

Outside a transaction, this method will refresh nontransactional state.

Specified by:
refresh in interface javax.jdo.PersistenceManager
Parameters:
o - the instance to refresh.

speedoRefresh

public void speedoRefresh(SpeedoProxy sp,
                          java.util.Map map,
                          java.util.Collection fgHints)
Specified by:
speedoRefresh in interface ProxyManager

refreshAll

public void refreshAll(java.lang.Object[] pcs)
Refresh the state of an array of instances from the data store.

Specified by:
refreshAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - the array of instances to refresh. object.
See Also:
refresh(java.lang.Object pc)

refreshAll

public void refreshAll(java.util.Collection pcs)
Refresh the state of a Set of instances from the data store.

Specified by:
refreshAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - the Set of instances to refresh.
See Also:
refresh(java.lang.Object pc)

refreshAll

public void refreshAll()
Refresh the state of all applicable instances from the data store.

If called with an active transaction, all transactional instances will be refreshed. If called outside an active transaction, all nontransactional instances will be refreshed.

Specified by:
refreshAll in interface javax.jdo.PersistenceManager
See Also:
refresh(java.lang.Object pc)

refreshAll

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

newQuery

public javax.jdo.Query newQuery()
Create a new Query with no elements.

Specified by:
newQuery in interface javax.jdo.PersistenceManager
Returns:
the new Query.

newQuery

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

newNamedQuery

public javax.jdo.Query newNamedQuery(java.lang.Class klass,
                                     java.lang.String name)
Specified by:
newNamedQuery in interface javax.jdo.PersistenceManager

newQuery

public javax.jdo.Query newQuery(java.lang.Object compiled)
Create a new Query using elements from another Query. The other Query must have been created by the same JDO implementation. It might be active in a different PersistenceManager or might have been serialized and restored.

All of the settings of the other Query are copied to this Query, except for the candidate Set or Extent.

Specified by:
newQuery in interface javax.jdo.PersistenceManager
Parameters:
compiled - another Query from the same JDO implementation
Returns:
the new Query

newQuery

public javax.jdo.Query newQuery(java.lang.String language,
                                java.lang.Object query)
Create a new Query using the specified language.

Specified by:
newQuery in interface javax.jdo.PersistenceManager
Parameters:
language - the language of the query parameter
query - the query, which is of a form determined by the language
Returns:
the new Query

newQuery

public javax.jdo.Query newQuery(java.lang.Class cls)
Create a new Query specifying the Class of the candidate instances.

Specified by:
newQuery in interface javax.jdo.PersistenceManager
Parameters:
cls - the Class of the candidate instances
Returns:
the new Query

newQuery

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

newQuery

public javax.jdo.Query newQuery(javax.jdo.Extent extent,
                                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)
Create a new Query with the Class of the candidate instances and candidate Set.

Specified by:
newQuery in interface javax.jdo.PersistenceManager
Parameters:
cls - the Class of results
cln - the Set of candidate instances
Returns:
the new Query

newQuery

public javax.jdo.Query newQuery(java.lang.Class cls,
                                java.lang.String filter)
Create a new Query with the Class of the candidate instances and filter.

Specified by:
newQuery in interface javax.jdo.PersistenceManager
Parameters:
cls - the Class of results
filter - the filter for candidate instances
Returns:
the new Query

newQuery

public javax.jdo.Query newQuery(java.lang.Class cls,
                                java.util.Collection cln,
                                java.lang.String filter)
Create a new Query with the Class of the candidate instances, candidate Set, and filter.

Specified by:
newQuery in interface javax.jdo.PersistenceManager
Parameters:
cls - the Class of candidate instances
cln - the Set of candidate instances
filter - the filter for candidate instances
Returns:
the new Query

getExtent

public javax.jdo.Extent getExtent(java.lang.Class persistenceCapableClass,
                                  boolean subclasses)
Not implemented. The PersistenceManager manages a collection of instances in the data store based on the class of the instances. This method returns a Extent of instances in the data store that might be iterated or given to a Query. The Extent itself might not reference any instances, but only hold the class name and an indicator whether subclasses are included in the Extent.

Specified by:
getExtent in interface javax.jdo.PersistenceManager
Parameters:
persistenceCapableClass - Class of instances
subclasses - whether to include instances of subclasses
Returns:
an Extent of the specified Class

getExtent

public javax.jdo.Extent getExtent(java.lang.Class arg0)
Specified by:
getExtent in interface javax.jdo.PersistenceManager

getObjectById

public java.lang.Object getObjectById(java.lang.Object oid,
                                      boolean validate)
This method locates a persistent instance in the cache of instances managed by this PersistenceManager. The getObjectById method attempts to find an instance in the cache with the specified JDO identity. The oid parameter object might have been returned by an earlier call to getObjectId or getTransactionalObjectId, or might have been constructed by the application.

Specified by:
getObjectById in interface javax.jdo.PersistenceManager
Parameters:
oid - an ObjectId
validate - if the existence of the instance is to be validated. The flag is ignored in this implementation.
Returns:
the PersistenceCapable instance with the specified ObjectId
See Also:
getObjectId(java.lang.Object pc), getTransactionalObjectId(java.lang.Object pc)

getObjectById

public java.lang.Object getObjectById(java.lang.Class arg0,
                                      java.lang.Object oid)
Specified by:
getObjectById in interface javax.jdo.PersistenceManager

getObjectById

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

getObjectsById

public java.util.Collection getObjectsById(java.util.Collection arg0,
                                           boolean validate)
Specified by:
getObjectsById in interface javax.jdo.PersistenceManager

getObjectsById

public java.util.Collection getObjectsById(java.util.Collection arg0)
Specified by:
getObjectsById in interface javax.jdo.PersistenceManager

getObjectsById

public java.lang.Object[] getObjectsById(java.lang.Object[] arg0,
                                         boolean arg1)
Specified by:
getObjectsById in interface javax.jdo.PersistenceManager

getObjectsById

public java.lang.Object[] getObjectsById(java.lang.Object[] arg0)
Specified by:
getObjectsById in interface javax.jdo.PersistenceManager

speedoGetObjectById

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

Specified by:
speedoGetObjectById in interface ProxyManager
Parameters:
oid - is an object representing an persistent object.

getObjectId

public java.lang.Object getObjectId(java.lang.Object pc)
The ObjectId returned by this method represents the JDO identity of the instance. The ObjectId is a copy (clone) of the internal state of the instance, and changing it does not affect the JDO identity of the instance.

Specified by:
getObjectId in interface javax.jdo.PersistenceManager
Parameters:
pc - the PersistenceCapable instance
Returns:
the ObjectId of the instance
See Also:
getTransactionalObjectId(java.lang.Object pc), getObjectById(java.lang.Object oid, boolean validate)

getTransactionalObjectId

public java.lang.Object getTransactionalObjectId(java.lang.Object o)
Not implemented. The ObjectId returned by this method represents the JDO identity of the instance. The ObjectId is a copy (clone) of the internal state of the instance, and changing it does not affect the JDO identity of the instance.

If the object identity is being changed in the transaction, by the application modifying one or more of the application key fields, then this method returns the current identity in the transaction.

If there is no transaction in progress, or if none of the key fields is being modified, then this method will return the same value as getObjectId.

Specified by:
getTransactionalObjectId in interface javax.jdo.PersistenceManager
Parameters:
o - a PersistenceCapable instance
Returns:
the ObjectId of the instance
See Also:
getObjectId(java.lang.Object pc), getObjectById(java.lang.Object oid, boolean validate)

makePersistent

public void makePersistent(java.lang.Object o)
Make the transient instance persistent in this PersistenceManager. This method must be called in an active transaction. The PersistenceManager assigns an ObjectId to the instance and transitions it to persistent-new. The instance will be managed in the Extent associated with its Class. The instance will be put into the data store at commit. The closure of instances of PersistenceCapable classes reachable from persistent fields will be made persistent at commit. [This is known as persistence by reachability.]

Specified by:
makePersistent in interface javax.jdo.PersistenceManager
Parameters:
o - a transient instance of a Class that implements PersistenceCapable

speedoMakePersistent

public void speedoMakePersistent(SpeedoProxy sp,
                                 boolean byAttach)
Description copied from interface: ProxyManager
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.

Specified by:
speedoMakePersistent in interface ProxyManager
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).

makePersistentAll

public void makePersistentAll(java.lang.Object[] pcs)
Make an array of instances persistent.

Specified by:
makePersistentAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - an array of transient instances
Throws:
javax.jdo.JDOUserException - if an object cannot be made persistent.
See Also:
makePersistent(java.lang.Object pc)

makePersistentAll

public void makePersistentAll(java.util.Collection pcs)
Make a Set of instances persistent.

Specified by:
makePersistentAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - a Set of transient instances
See Also:
makePersistent(java.lang.Object pc)

deletePersistent

public void deletePersistent(java.lang.Object o)
Delete the persistent instance from the data store. This method must be called in an active transaction. The data store object will be removed at commit. Unlike makePersistent, which makes the closure of the instance persistent, the closure of the instance is not deleted from the data store. This method has no effect if the instance is already deleted in the current transaction.

Specified by:
deletePersistent in interface javax.jdo.PersistenceManager
Parameters:
o - a persistent instance
Throws:
javax.jdo.JDOUserException - if the instance is transient or managed by another PersistenceManager.

speedoDeletePersistent

public void speedoDeletePersistent(java.lang.Object o)
Description copied from interface: ProxyManager
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.

Specified by:
speedoDeletePersistent in interface ProxyManager
Parameters:
o - is the instance to make persistent.

deletePersistentAll

public void deletePersistentAll(java.lang.Object[] pcs)
Delete an array of instances from the data store.

Specified by:
deletePersistentAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - a Set of persistent instances
See Also:
deletePersistent(java.lang.Object pc)

deletePersistentAll

public void deletePersistentAll(java.util.Collection pcs)
Delete a Set of instances from the data store.

Specified by:
deletePersistentAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - a Set of persistent instances
See Also:
deletePersistent(java.lang.Object pc)

makeTransient

public void makeTransient(java.lang.Object o)
Make an instance transient, removing it from management by this PersistenceManager.

The instance loses its JDO identity and it is no longer associated with any PersistenceManager. The state of fields is preserved unchanged.

Specified by:
makeTransient in interface javax.jdo.PersistenceManager
Parameters:
o - the instance to make transient.
Throws:
javax.jdo.JDOUserException - if the instance is dirty.

makeTransientAll

public void makeTransientAll(java.lang.Object[] pcs)
Make an array of instances transient, removing them from management by this PersistenceManager.

Specified by:
makeTransientAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - the instances to make transient.
See Also:
makeTransient(java.lang.Object pc)

makeTransientAll

public void makeTransientAll(java.util.Collection pcs)
Make a Set of instances transient, removing them from management by this PersistenceManager.

The instances lose their JDO identity and they are no longer associated with any PersistenceManager. The state of fields is preserved unchanged.

Specified by:
makeTransientAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - the instances to make transient.

makeTransactional

public void makeTransactional(java.lang.Object o)
Make an instance subject to transactional boundaries.

Specified by:
makeTransactional in interface javax.jdo.PersistenceManager
Parameters:
o - the instance to make transactional.
See Also:
PersistenceManager.makeTransactional(java.lang.Object)

makeTransactionalAll

public void makeTransactionalAll(java.lang.Object[] pcs)
Make an array of instances subject to transactional boundaries.

Specified by:
makeTransactionalAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - the array of instances to make transactional.
See Also:
makeTransactional(java.lang.Object pc)

makeTransactionalAll

public void makeTransactionalAll(java.util.Collection pcs)
Make a Set of instances subject to transactional boundaries.

Specified by:
makeTransactionalAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - the Set of instances to make transactional.
See Also:
makeTransactional(java.lang.Object pc)

makeNontransactional

public void makeNontransactional(java.lang.Object o)
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

setUserObject

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

getUserObject

public java.lang.Object getUserObject()
The application can manage the PersistenceManager instances more easily by having an application object associated with each PersistenceManager instance.

Specified by:
getUserObject in interface javax.jdo.PersistenceManager
Returns:
the user object associated with this PersistenceManager
See Also:
setUserObject(java.lang.Object)

getPersistenceManagerFactory

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

setMultithreaded

public void setMultithreaded(boolean flag)
Set the Multithreaded flag for this PersistenceManager. Applications that use multiple threads to invoke methods or access fields from instances managed by this PersistenceManager must set this flag to true. Instances managed by this PersistenceManager include persistent or transactional instances of PersistenceCapable classes, as well as helper instances such as Query, Transaction, or Extent.

Specified by:
setMultithreaded in interface javax.jdo.PersistenceManager
Parameters:
flag - the Multithreaded setting.

getMultithreaded

public boolean getMultithreaded()
Get the current Multithreaded flag for this PersistenceManager. This option is ignored by the implementation.

Specified by:
getMultithreaded in interface javax.jdo.PersistenceManager
Returns:
the Multithreaded setting.
See Also:
setMultithreaded(boolean)

setIgnoreCache

public void setIgnoreCache(boolean flag)
Set the ignoreCache parameter for queries.

Specified by:
setIgnoreCache in interface javax.jdo.PersistenceManager
Parameters:
flag - the ignoreCache setting.

getIgnoreCache

public boolean getIgnoreCache()
Get the ignoreCache setting for queries.

Specified by:
getIgnoreCache in interface javax.jdo.PersistenceManager
Returns:
the ignoreCache setting.
See Also:
setIgnoreCache(boolean)

newObjectIdInstance

public java.lang.Object newObjectIdInstance(java.lang.Class aClass,
                                            java.lang.Object s)
Specified by:
newObjectIdInstance in interface javax.jdo.PersistenceManager

retrieve

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

speedoRetrieve

public void speedoRetrieve(SpeedoProxy sp,
                           java.util.Map map,
                           java.util.Collection fgHints)
Specified by:
speedoRetrieve in interface ProxyManager

retrieveAll

public void retrieveAll(java.util.Collection pcs)
Specified by:
retrieveAll 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.util.Collection collection,
                        boolean b)
Specified by:
retrieveAll in interface javax.jdo.PersistenceManager

retrieveAll

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

detachCopy

public java.lang.Object detachCopy(java.lang.Object o)
Make a detached copy of the persitent object o and return it. Only the fields belonging to the fetch group are reachable.

Specified by:
detachCopy in interface javax.jdo.PersistenceManager
Parameters:
o -
Returns:
the detached copy of the persistent object

speedoDetachCopy

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

Specified by:
speedoDetachCopy in interface ProxyManager
Parameters:
map - the map contains element of type: [SpeedoProxy, clone of SpeedoProxy]

detachCopyAll

public java.util.Collection detachCopyAll(java.util.Collection collection)
Create a detached copy for each element of collection (assuming each element is persistent). If there are duplicates in collection, the corresponding detached copy is used for each such duplicate.

Specified by:
detachCopyAll in interface javax.jdo.PersistenceManager
Parameters:
collection -
Returns:
the collection of the detached copies in the same order than the parameter

detachCopyAll

public java.lang.Object[] detachCopyAll(java.lang.Object[] objects)
Specified by:
detachCopyAll in interface javax.jdo.PersistenceManager

attachCopy

public java.lang.Object attachCopy(java.lang.Object detached,
                                   boolean makeTransactional)
Apply the changes contained in the detached object to the corresponding persistent instance in the cache.

Specified by:
attachCopy in interface javax.jdo.PersistenceManager
Parameters:
detached -
makeTransactional -
Returns:
the peristent object containg attached values

speedoAttachCopy

public java.lang.Object speedoAttachCopy(java.lang.Object detached,
                                         boolean makeTransactional,
                                         java.util.Map map)
Apply the changes contained in the detached object to the corresponding persistent instance in the cache.

Specified by:
speedoAttachCopy in interface ProxyManager
Parameters:
detached -
makeTransactional -
map - is the attachement context
Returns:
the peristent object containg attached values

attachCopyAll

public java.util.Collection attachCopyAll(java.util.Collection detached,
                                          boolean makeTransactional)
Specified by:
attachCopyAll in interface javax.jdo.PersistenceManager

attachCopyAll

public java.lang.Object[] attachCopyAll(java.lang.Object[] detached,
                                        boolean makeTransactional)
Specified by:
attachCopyAll in interface javax.jdo.PersistenceManager

getUserObject

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

putUserObject

public java.lang.Object putUserObject(java.lang.Object arg0,
                                      java.lang.Object arg1)
Specified by:
putUserObject in interface javax.jdo.PersistenceManager

removeUserObject

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

checkConsistency

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

getSequence

public javax.jdo.datastore.Sequence getSequence(java.lang.String name)
Specified by:
getSequence in interface javax.jdo.PersistenceManager

newInstance

public java.lang.Object newInstance(java.lang.Class arg0)
Specified by:
newInstance in interface javax.jdo.PersistenceManager

getTransactionalPersistenceManager

public org.objectweb.perseus.persistence.api.TransactionalPersistenceManager getTransactionalPersistenceManager()
Description copied from interface: ProxyManager
Retrieves the TransactionalPersistenceManager used by this ProxyManager.

Specified by:
getTransactionalPersistenceManager in interface ProxyManager

open

public void open(java.lang.Object connectionspec)
Description copied from interface: ProxyManager
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.

Specified by:
open in interface ProxyManager
Parameters:
connectionspec - is the information to access to the data store (user, password, ...)

getConnectionSpec

public java.lang.Object getConnectionSpec()
Specified by:
getConnectionSpec in interface ProxyManager
Returns:
the connection information to access the data store

addUse

public void addUse()
Description copied from interface: ProxyManager
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.

Specified by:
addUse in interface ProxyManager

beforeCompletion

public void beforeCompletion()
Specified by:
beforeCompletion in interface javax.transaction.Synchronization

afterCompletion

public void afterCompletion(int i)
Specified by:
afterCompletion in interface javax.transaction.Synchronization

getSemaphore

public org.objectweb.perseus.concurrency.lib.Semaphore getSemaphore()
Description copied from interface: ProxyManager
Retrieves the semaphore object permiting the multithreading mode.

Specified by:
getSemaphore in interface ProxyManager