org.objectweb.speedo.mim.lib
Class SpeedoMemoryInstanceManager

java.lang.Object
  extended byorg.objectweb.speedo.mim.lib.SpeedoMemoryInstanceManager
All Implemented Interfaces:
AttributeController, BindingController, CacheEntryFactory, CacheEventListener, MemoryInstanceManager, MemoryInstanceManagerAttribute, StateManager

public class SpeedoMemoryInstanceManager
extends java.lang.Object
implements MemoryInstanceManager, MemoryInstanceManagerAttribute, StateManager, CacheEntryFactory, BindingController

This class is an implementation of the MemoryInstanceManager provided by the persistence framwork availlable in perseus. This implementation depends on the identifier used, and the way to instanciate user objects. This implementation supports only the jorm object identifier: PName. This implementation supports also the instanciation of the Jorm generic class. To do this it is needed to specify for each jorm generic class used the name of the class which must be instanciated. This configuration is done via the GenClassNames attribute. This implementation does not used a pool, then the instance are created at each newInstance call.

Author:
S.Chassande-Barrioz

Field Summary
protected  JormFactory jf
           
static java.lang.String JORM_FACTORY_BINDING
           
protected  Logger logger
           
protected  ProxyManagerFactory pmf
           
static java.lang.String PMS_BINDING
           
 
Constructor Summary
SpeedoMemoryInstanceManager()
           
 
Method Summary
 void bindFc(java.lang.String s, java.lang.Object o)
           
 FixableCacheEntry create(java.lang.Object id, java.lang.Object obj)
          binds the SpeedoProxy to its identifier (PName) if it does not have already one.
 State createState(CacheEntry ce)
           
 State createState(State s)
           
 void destroyState(State state)
           
 void entryBound(CacheEvent event)
           
 void entryUnbound(CacheEvent event)
           
 java.lang.String getGenClassNames()
           
 State getReferenceState(CacheEntry ce)
           
 boolean isBound(CacheEntry ce)
           
 boolean isDirty(State state)
           
 boolean isExported(State state)
           
 boolean isFlushed(State state)
           
 boolean isToMerge(State state)
           
 boolean isUnexported(State state)
           
 java.lang.String[] listFc()
           
 java.lang.Object lookupFc(java.lang.String s)
           
 void makeBound(CacheEntry ce, java.lang.Object oid)
           
 void makeClean(State state)
           
 void makeDirty(State state)
           
 void makeExported(State state)
           
 void makeFlushed(State state)
           
 void makeToMerge(State state, java.lang.Object thinLock)
           
 void makeUnbound(CacheEntry ce)
           
 void makeUnexported(State state)
           
 State merge(State oldState, State newState)
           
 java.lang.Object newInstance(java.lang.Object oid, ConnectionHolder context)
          It creates an instance since an identifier
 void setGenClassNames(java.lang.String gcname)
          It assignes a description of the gen class names.
 void setReferenceState(CacheEntry ce, State state)
           
 void stateNoMoreUsed(State state)
           
 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

JORM_FACTORY_BINDING

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

PMS_BINDING

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

jf

protected JormFactory jf

pmf

protected ProxyManagerFactory pmf

logger

protected Logger logger
Constructor Detail

SpeedoMemoryInstanceManager

public SpeedoMemoryInstanceManager()
Method Detail

listFc

public java.lang.String[] listFc()
Specified by:
listFc in interface BindingController

lookupFc

public java.lang.Object lookupFc(java.lang.String s)
Specified by:
lookupFc in interface BindingController

bindFc

public void bindFc(java.lang.String s,
                   java.lang.Object o)
Specified by:
bindFc in interface BindingController

unbindFc

public void unbindFc(java.lang.String s)
Specified by:
unbindFc in interface BindingController

getGenClassNames

public java.lang.String getGenClassNames()
Specified by:
getGenClassNames in interface MemoryInstanceManagerAttribute
Returns:
a String describing the genclass names with the following format: "(jorm_name,java_name),(jorm_name,java_name),(jorm_name,java_name)}"

setGenClassNames

public void setGenClassNames(java.lang.String gcname)
It assignes a description of the gen class names.

Specified by:
setGenClassNames in interface MemoryInstanceManagerAttribute
Parameters:
gcname - is the desciption which must follow this format: "(jorm_name,java_name),(jorm_name,java_name),(jorm_name,java_name)}"

newInstance

public java.lang.Object newInstance(java.lang.Object oid,
                                    ConnectionHolder context)
                             throws PersistenceException
It creates an instance since an identifier

Specified by:
newInstance in interface MemoryInstanceManager
Parameters:
oid - is the identifier of the futur object
Returns:
a memory instance
Throws:
PersistenceException

createState

public State createState(CacheEntry ce)
Specified by:
createState in interface StateManager

createState

public State createState(State s)
Specified by:
createState in interface StateManager

getReferenceState

public State getReferenceState(CacheEntry ce)
Specified by:
getReferenceState in interface StateManager

destroyState

public void destroyState(State state)
Specified by:
destroyState in interface StateManager

makeUnexported

public void makeUnexported(State state)
Specified by:
makeUnexported in interface StateManager

isUnexported

public boolean isUnexported(State state)
Specified by:
isUnexported in interface StateManager

makeExported

public void makeExported(State state)
Specified by:
makeExported in interface StateManager

isExported

public boolean isExported(State state)
Specified by:
isExported in interface StateManager

makeDirty

public void makeDirty(State state)
Specified by:
makeDirty in interface StateManager

isDirty

public boolean isDirty(State state)
Specified by:
isDirty in interface StateManager

setReferenceState

public void setReferenceState(CacheEntry ce,
                              State state)
Specified by:
setReferenceState in interface StateManager

makeClean

public void makeClean(State state)
Specified by:
makeClean in interface StateManager

makeFlushed

public void makeFlushed(State state)
Specified by:
makeFlushed in interface StateManager

isFlushed

public boolean isFlushed(State state)
Specified by:
isFlushed in interface StateManager

makeUnbound

public void makeUnbound(CacheEntry ce)
Specified by:
makeUnbound in interface StateManager

makeBound

public void makeBound(CacheEntry ce,
                      java.lang.Object oid)
Specified by:
makeBound in interface StateManager

isBound

public boolean isBound(CacheEntry ce)
Specified by:
isBound in interface StateManager

isToMerge

public boolean isToMerge(State state)
Specified by:
isToMerge in interface StateManager

makeToMerge

public void makeToMerge(State state,
                        java.lang.Object thinLock)
Specified by:
makeToMerge in interface StateManager

merge

public State merge(State oldState,
                   State newState)
Specified by:
merge in interface StateManager

stateNoMoreUsed

public void stateNoMoreUsed(State state)
Specified by:
stateNoMoreUsed in interface StateManager

entryBound

public void entryBound(CacheEvent event)
Specified by:
entryBound in interface CacheEventListener
Parameters:
event -

entryUnbound

public void entryUnbound(CacheEvent event)
Specified by:
entryUnbound in interface CacheEventListener
Parameters:
event -

create

public FixableCacheEntry create(java.lang.Object id,
                                java.lang.Object obj)
binds the SpeedoProxy to its identifier (PName) if it does not have already one.

Specified by:
create in interface CacheEntryFactory
Parameters:
id - is the PName of the SpeedoProxy
obj - is the SpeedoProxy instance added into the cache
Returns:
the SpeedoProxy instance