org.objectweb.speedo.mim.lib
Class SpeedoMemoryInstanceManager

java.lang.Object
  extended byorg.objectweb.speedo.mim.lib.SpeedoMemoryInstanceManager
All Implemented Interfaces:
org.objectweb.fractal.api.control.AttributeController, org.objectweb.fractal.api.control.BindingController, org.objectweb.perseus.cache.api.CacheEntryFactory, org.objectweb.perseus.cache.api.CacheEventListener, org.objectweb.perseus.persistence.api.MemoryInstanceManager, MemoryInstanceManagerAttribute, org.objectweb.perseus.persistence.api.StateManager

public class SpeedoMemoryInstanceManager
extends java.lang.Object
implements org.objectweb.perseus.persistence.api.MemoryInstanceManager, MemoryInstanceManagerAttribute, org.objectweb.perseus.persistence.api.StateManager, org.objectweb.perseus.cache.api.CacheEntryFactory, org.objectweb.fractal.api.control.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  org.objectweb.util.monolog.api.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)
           
 org.objectweb.perseus.cache.api.FixableCacheEntry create(java.lang.Object id, java.lang.Object obj)
          binds the SpeedoProxy to its identifier (PName) if it does not have already one.
 org.objectweb.perseus.persistence.api.State createState(org.objectweb.perseus.cache.api.CacheEntry ce)
           
 org.objectweb.perseus.persistence.api.State createState(org.objectweb.perseus.persistence.api.State s)
           
 void destroyState(org.objectweb.perseus.persistence.api.State state)
           
 void entryBound(org.objectweb.perseus.cache.api.CacheEvent event)
           
 void entryUnbound(org.objectweb.perseus.cache.api.CacheEvent event)
           
 java.lang.String getGenClassNames()
           
 org.objectweb.perseus.persistence.api.State getReferenceState(org.objectweb.perseus.cache.api.CacheEntry ce)
           
 boolean isBound(org.objectweb.perseus.cache.api.CacheEntry ce)
           
 boolean isDirty(org.objectweb.perseus.persistence.api.State state)
           
 boolean isExported(org.objectweb.perseus.persistence.api.State state)
           
 boolean isFlushed(org.objectweb.perseus.persistence.api.State state)
           
 boolean isToMerge(org.objectweb.perseus.persistence.api.State state)
           
 boolean isUnexported(org.objectweb.perseus.persistence.api.State state)
           
 java.lang.String[] listFc()
           
 java.lang.Object lookupFc(java.lang.String s)
           
 void makeBound(org.objectweb.perseus.cache.api.CacheEntry ce, java.lang.Object oid)
           
 void makeClean(org.objectweb.perseus.persistence.api.State state)
           
 void makeDirty(org.objectweb.perseus.persistence.api.State state)
           
 void makeExported(org.objectweb.perseus.persistence.api.State state)
           
 void makeFlushed(org.objectweb.perseus.persistence.api.State state)
           
 void makeToMerge(org.objectweb.perseus.persistence.api.State state, java.lang.Object thinLock)
           
 void makeUnbound(org.objectweb.perseus.cache.api.CacheEntry ce)
           
 void makeUnexported(org.objectweb.perseus.persistence.api.State state)
           
 org.objectweb.perseus.persistence.api.State merge(org.objectweb.perseus.persistence.api.State oldState, org.objectweb.perseus.persistence.api.State newState)
           
 java.lang.Object newInstance(java.lang.Object oid, org.objectweb.perseus.persistence.api.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(org.objectweb.perseus.cache.api.CacheEntry ce, org.objectweb.perseus.persistence.api.State state)
           
 void stateNoMoreUsed(org.objectweb.perseus.persistence.api.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 org.objectweb.util.monolog.api.Logger logger
Constructor Detail

SpeedoMemoryInstanceManager

public SpeedoMemoryInstanceManager()
Method Detail

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

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,
                                    org.objectweb.perseus.persistence.api.ConnectionHolder context)
                             throws org.objectweb.perseus.persistence.api.PersistenceException
It creates an instance since an identifier

Specified by:
newInstance in interface org.objectweb.perseus.persistence.api.MemoryInstanceManager
Parameters:
oid - is the identifier of the futur object
Returns:
a memory instance
Throws:
org.objectweb.perseus.persistence.api.PersistenceException

createState

public org.objectweb.perseus.persistence.api.State createState(org.objectweb.perseus.cache.api.CacheEntry ce)
Specified by:
createState in interface org.objectweb.perseus.persistence.api.StateManager

createState

public org.objectweb.perseus.persistence.api.State createState(org.objectweb.perseus.persistence.api.State s)
Specified by:
createState in interface org.objectweb.perseus.persistence.api.StateManager

getReferenceState

public org.objectweb.perseus.persistence.api.State getReferenceState(org.objectweb.perseus.cache.api.CacheEntry ce)
Specified by:
getReferenceState in interface org.objectweb.perseus.persistence.api.StateManager

destroyState

public void destroyState(org.objectweb.perseus.persistence.api.State state)
Specified by:
destroyState in interface org.objectweb.perseus.persistence.api.StateManager

makeUnexported

public void makeUnexported(org.objectweb.perseus.persistence.api.State state)
Specified by:
makeUnexported in interface org.objectweb.perseus.persistence.api.StateManager

isUnexported

public boolean isUnexported(org.objectweb.perseus.persistence.api.State state)
Specified by:
isUnexported in interface org.objectweb.perseus.persistence.api.StateManager

makeExported

public void makeExported(org.objectweb.perseus.persistence.api.State state)
Specified by:
makeExported in interface org.objectweb.perseus.persistence.api.StateManager

isExported

public boolean isExported(org.objectweb.perseus.persistence.api.State state)
Specified by:
isExported in interface org.objectweb.perseus.persistence.api.StateManager

makeDirty

public void makeDirty(org.objectweb.perseus.persistence.api.State state)
Specified by:
makeDirty in interface org.objectweb.perseus.persistence.api.StateManager

isDirty

public boolean isDirty(org.objectweb.perseus.persistence.api.State state)
Specified by:
isDirty in interface org.objectweb.perseus.persistence.api.StateManager

setReferenceState

public void setReferenceState(org.objectweb.perseus.cache.api.CacheEntry ce,
                              org.objectweb.perseus.persistence.api.State state)
Specified by:
setReferenceState in interface org.objectweb.perseus.persistence.api.StateManager

makeClean

public void makeClean(org.objectweb.perseus.persistence.api.State state)
Specified by:
makeClean in interface org.objectweb.perseus.persistence.api.StateManager

makeFlushed

public void makeFlushed(org.objectweb.perseus.persistence.api.State state)
Specified by:
makeFlushed in interface org.objectweb.perseus.persistence.api.StateManager

isFlushed

public boolean isFlushed(org.objectweb.perseus.persistence.api.State state)
Specified by:
isFlushed in interface org.objectweb.perseus.persistence.api.StateManager

makeUnbound

public void makeUnbound(org.objectweb.perseus.cache.api.CacheEntry ce)
Specified by:
makeUnbound in interface org.objectweb.perseus.persistence.api.StateManager

makeBound

public void makeBound(org.objectweb.perseus.cache.api.CacheEntry ce,
                      java.lang.Object oid)
Specified by:
makeBound in interface org.objectweb.perseus.persistence.api.StateManager

isBound

public boolean isBound(org.objectweb.perseus.cache.api.CacheEntry ce)
Specified by:
isBound in interface org.objectweb.perseus.persistence.api.StateManager

isToMerge

public boolean isToMerge(org.objectweb.perseus.persistence.api.State state)
Specified by:
isToMerge in interface org.objectweb.perseus.persistence.api.StateManager

makeToMerge

public void makeToMerge(org.objectweb.perseus.persistence.api.State state,
                        java.lang.Object thinLock)
Specified by:
makeToMerge in interface org.objectweb.perseus.persistence.api.StateManager

merge

public org.objectweb.perseus.persistence.api.State merge(org.objectweb.perseus.persistence.api.State oldState,
                                                         org.objectweb.perseus.persistence.api.State newState)
Specified by:
merge in interface org.objectweb.perseus.persistence.api.StateManager

stateNoMoreUsed

public void stateNoMoreUsed(org.objectweb.perseus.persistence.api.State state)
Specified by:
stateNoMoreUsed in interface org.objectweb.perseus.persistence.api.StateManager

entryBound

public void entryBound(org.objectweb.perseus.cache.api.CacheEvent event)
Specified by:
entryBound in interface org.objectweb.perseus.cache.api.CacheEventListener
Parameters:
event -

entryUnbound

public void entryUnbound(org.objectweb.perseus.cache.api.CacheEvent event)
Specified by:
entryUnbound in interface org.objectweb.perseus.cache.api.CacheEventListener
Parameters:
event -

create

public org.objectweb.perseus.cache.api.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 org.objectweb.perseus.cache.api.CacheEntryFactory
Parameters:
id - is the PName of the SpeedoProxy
obj - is the SpeedoProxy instance added into the cache
Returns:
the SpeedoProxy instance