org.objectweb.speedo.mim.api
Interface SpeedoProxy

All Known Subinterfaces:
SpeedoGenClassProxy
All Known Implementing Classes:
ArrayListImpl, GenClass, HashMapImpl, HashSetImpl, HashtableImpl, LinkedListImpl, PropertiesImpl, TreeMapImpl, VectorImpl

public interface SpeedoProxy

This interface what is a Proxy in Speedo. A proxy a PersistentCapable instance because it is the user object. It is the jorm PBinding because it is unique. There are several fields:

Author:
S.Chassande-Barrioz

Method Summary
 void copyAccessor(SpeedoAccessor src, SpeedoAccessor dest)
          Copies persistent fields from an accessor to another.
 SpeedoAccessor createAccessor()
           
 java.util.Collection fgGetFieldsToLoad(java.lang.String fgName)
           
 java.util.Collection fgGetFieldsToLoad(java.lang.String fgName, boolean onlyDirectRef)
          Same as fgGetFieldsToLoad(String fgName) but if onlyDirectRef is set to true, all the fields of type a.b.c or a#element or a/fg are removed from the returned collection.
 java.util.Collection fgGetNestedFetchGroups(java.lang.String fgName)
           
 boolean fgIsDefined(java.lang.String fgName)
           
 boolean fgIsPostload(java.lang.String fgName)
           
 java.lang.Object getEncodedPName()
           
 SpeedoAccessor getReferenceAccessor()
           
 SpeedoAccessor getSpeedoAccessor()
          It retrieves the SpeedoAccessor instance used in the current context.
 void jdoAttachCopy(ProxyManager pm, java.util.Map map, java.lang.Object clone, SpeedoAccessor sa, boolean makeTransactional)
          Attach the detached clone to the datastore.
 void jdoDeletePersistent(ProxyManager pm, SpeedoAccessor sa)
           
 SpeedoProxy jdoDetachCopy(ProxyManager pm, java.util.Map map, java.lang.Object clone, java.util.Collection fgHints)
           
 java.lang.String jdoGetJdoFileName()
           
 java.lang.Object jdoGetPNameHints()
          Retrieves the hints needed to build the PName of the persistent object during the export action.
 java.lang.String jdoGetProjectName()
           
 ProxyManagerFactory jdoGetProxyManagerFactory()
           
 TransactionalPersistenceManager jdoGetTransactionalPersistenceManager()
           
 byte jdoGetVersioningStrategy()
          The versioning strategy.
 boolean jdoIsActive()
          Tests whether the Proxy infrastructure has already been set.
 void jdoIsActive(boolean newvalue)
          Sets the new value of the proxy flags
 boolean jdoIsDetachable()
           
 void jdoMakePersistent(ProxyManager pm, SpeedoAccessor sa)
           
 void jdoRefresh(ProxyManager pm, java.util.Map map, java.util.Collection fgHints)
          Refresh the fields to be fetched according to the active fetch groups
 void jdoSetProxyManagerFactory(ProxyManagerFactory pmf)
          It assignes a ProxyManagerFactory
 void jdoSetTransactionalPersistenceManager(TransactionalPersistenceManager tpm)
          It assignes a TransactionalPersistenceManager
 void setEncodedPName(java.lang.Object encodedPName)
          Set the encoded PName of the detach copy to allow serialization.
 void setReferenceAccessor(SpeedoAccessor refAcc)
          Assignes the reference accessor to the SpeedoProxy The Reference accessor is used for non persistent instance, as cache value and for pessimistic policy.
 void speedoAdd(java.lang.Object elem, int gcFieldNumber)
          Adds an element in the gen class field whose number is given.
 

Method Detail

jdoIsActive

public boolean jdoIsActive()
Tests whether the Proxy infrastructure has already been set. A proxy has a correct PClassMapping linked to a PBinder, a PName obtained thanks to this PClassMapping.

Returns:
true if this object is a Proxy.

jdoIsActive

public void jdoIsActive(boolean newvalue)
Sets the new value of the proxy flags

Parameters:
newvalue - the new value of the proxy flag
See Also:
jdoIsActive()

jdoGetVersioningStrategy

public byte jdoGetVersioningStrategy()
The versioning strategy.

See Also:
SpeeedoVersion.TIMESTAMP, STATE_COMPARISON, VERSION_NUMBER, NO_VERSION

getSpeedoAccessor

public SpeedoAccessor getSpeedoAccessor()
It retrieves the SpeedoAccessor instance used in the current context. If the proxy is not active then the reference state is returned. otherwise a $classNameFields is returned


getReferenceAccessor

public SpeedoAccessor getReferenceAccessor()
Returns:
the reference accessor of the SpeedoProxy instance. It can be * null. The Reference accessor is used for non persistent instance, as cache value and for pessimistic policy.

setReferenceAccessor

public void setReferenceAccessor(SpeedoAccessor refAcc)
Assignes the reference accessor to the SpeedoProxy The Reference accessor is used for non persistent instance, as cache value and for pessimistic policy.

Parameters:
refAcc - the new reference accessor

createAccessor

public SpeedoAccessor createAccessor()
Returns:
a new SpeedoAccessor instance.

copyAccessor

public void copyAccessor(SpeedoAccessor src,
                         SpeedoAccessor dest)
Copies persistent fields from an accessor to another.

Parameters:
src - is the accessor containing peristent fields to copy
dest - is the accessor where persistent fields have to be copied

setEncodedPName

public void setEncodedPName(java.lang.Object encodedPName)
Set the encoded PName of the detach copy to allow serialization.

Parameters:
encodedPName - : the encoded PName of the persistent object

getEncodedPName

public java.lang.Object getEncodedPName()
Returns:
the encoded PName of the detached copy

jdoGetProxyManagerFactory

public ProxyManagerFactory jdoGetProxyManagerFactory()
Returns:
the ProxyManagerFactory which represents the data support inside which the proxy is persistent.

jdoSetProxyManagerFactory

public void jdoSetProxyManagerFactory(ProxyManagerFactory pmf)
It assignes a ProxyManagerFactory

Parameters:
pmf - is the ProxyManagerFactory which represents the data support inside which the proxy is persistent.

jdoGetTransactionalPersistenceManager

public TransactionalPersistenceManager jdoGetTransactionalPersistenceManager()
Returns:
the TransactionalPersistenceManager which manage the concurrency, loading, ... of the proxy.

jdoSetTransactionalPersistenceManager

public void jdoSetTransactionalPersistenceManager(TransactionalPersistenceManager tpm)
It assignes a TransactionalPersistenceManager

Parameters:
tpm - is the TransactionalPersistenceManager which manage the concurrency, loading, ... of the proxy.

jdoMakePersistent

public void jdoMakePersistent(ProxyManager pm,
                              SpeedoAccessor sa)

jdoDeletePersistent

public void jdoDeletePersistent(ProxyManager pm,
                                SpeedoAccessor sa)

jdoDetachCopy

public SpeedoProxy jdoDetachCopy(ProxyManager pm,
                                 java.util.Map map,
                                 java.lang.Object clone,
                                 java.util.Collection fgHints)
Returns:
the detached copy of this SpeedoProxy.

jdoAttachCopy

public void jdoAttachCopy(ProxyManager pm,
                          java.util.Map map,
                          java.lang.Object clone,
                          SpeedoAccessor sa,
                          boolean makeTransactional)
Attach the detached clone to the datastore.


jdoRefresh

public void jdoRefresh(ProxyManager pm,
                       java.util.Map map,
                       java.util.Collection fgHints)
Refresh the fields to be fetched according to the active fetch groups


jdoGetProjectName

public java.lang.String jdoGetProjectName()
Returns:
return the mapper name by which the instance is persistent.

jdoIsDetachable

public boolean jdoIsDetachable()
Returns:
return if the class has been declared detachable in the jdo file

jdoGetJdoFileName

public java.lang.String jdoGetJdoFileName()
Returns:
The file name of the jdo descriptor. This file must be availlable in the class at runtime.

jdoGetPNameHints

public java.lang.Object jdoGetPNameHints()
Retrieves the hints needed to build the PName of the persistent object during the export action.


speedoAdd

public void speedoAdd(java.lang.Object elem,
                      int gcFieldNumber)
Adds an element in the gen class field whose number is given. This method must call the speedoAdd method of the SpeedoGenClassCoherence interface, or the Collection.add method (if the field contains a collection that does implement the previous interface). If the field is null, a new (speedo) collection must be created first.


fgIsPostload

public boolean fgIsPostload(java.lang.String fgName)
Parameters:
fgName - The name of the fetchgroup
Returns:
true if fetchgroup identified by the name fgName has the postload attribute to true, else false

fgGetFieldsToLoad

public java.util.Collection fgGetFieldsToLoad(java.lang.String fgName)
Parameters:
fgName - The name of the fetchgroup
Returns:
the collection of fields to load when using the fetchgroup identified by the name fgName

fgGetFieldsToLoad

public java.util.Collection fgGetFieldsToLoad(java.lang.String fgName,
                                              boolean onlyDirectRef)
Same as fgGetFieldsToLoad(String fgName) but if onlyDirectRef is set to true, all the fields of type a.b.c or a#element or a/fg are removed from the returned collection.

Parameters:
fgName -
onlyDirectRef -
Returns:

fgGetNestedFetchGroups

public java.util.Collection fgGetNestedFetchGroups(java.lang.String fgName)
Parameters:
fgName - The name of the fetchgroup
Returns:
the collection of the nested fetchgroups when using the fetchgroup identified by the name fgName

fgIsDefined

public boolean fgIsDefined(java.lang.String fgName)
Parameters:
fgName - The name of the fetchgroup
Returns:
true if this fetchgroup has been defined in the jdo file of this class.