org.objectweb.perseus.persistence.api
Interface StateManager


public interface StateManager

A StateManager is used by the PersistenceManager and the ConcurrencyManager in order to manage the life cycle of cache entries and their states. This management concerns the java life cycle of the state instance (create, destroy) and the status (dirty, new, deleted, ...). This interface is implemented by the Personality using the persistence framework of Perseus.

Author:
S.Chassande-Barrioz

Method Summary
 State createState(CacheEntry ce)
          Creates a new State.
 void destroyState(State state)
          Removes a state.
 State getReferenceState(CacheEntry ce)
           
 boolean isBound(CacheEntry ce)
           
 boolean isDirty(State state)
           
 boolean isExported(State state)
           
 boolean isFlushed(State state)
           
 boolean isToMerge(State state)
          Indicates if a State has to be merged at commit time with the reference state
 boolean isUnexported(State state)
           
 void makeBound(CacheEntry ce, java.lang.Object oid)
          A persistent object has been removed or evicted from the cache, then it must be marked as non persistent
 void makeClean(State state)
          Marks the status of the state to 'clean' (non modified).
 void makeDirty(State state)
          Marks the status of the state to 'dirty' (modified).
 void makeExported(State state)
          Marks the status of the state to 'exported' (created).
 void makeFlushed(State state)
          Marks the status of the state to 'flushed' (written on data support).
 void makeToMerge(State state, java.lang.Object thinLock)
          Marks the flag 'toMerge' on a state.
 void makeUnbound(CacheEntry ce)
          A persistent object has been removed or evicted from the cache, then it must be marked as non persistent
 void makeUnexported(State state)
          Marks the status of the state to 'unexported' (deleted).
 State merge(State oldState, State newState)
          Merges a state (newState) into a oldSate.
 void setReferenceState(CacheEntry ce, State state)
          Assignes the reference state to a cache entry
 void stateNoMoreUsed(State state)
          Indicates that this state is no more used by any working set.
 

Method Detail

createState

public State createState(CacheEntry ce)
Creates a new State.

Returns:
a State instance linked to its cache entry (ie the state.getCacheEntry() must return 'ce')

getReferenceState

public State getReferenceState(CacheEntry ce)
Parameters:
ce - is the cache entry when the reference state is asked
Returns:
the reference state of a cache entry. If no reference state exists, the 'null' value is retrieved.

setReferenceState

public void setReferenceState(CacheEntry ce,
                              State state)
Assignes the reference state to a cache entry

Parameters:
ce - is the cache entry which the reference state must be changed
state - is the new value of the reference state. If this parameter is null, that means the CacheEntry does not have a state in memory, it is hollow.

destroyState

public void destroyState(State state)
Removes a state. In general this method does nothing, but it can be used as a listener.

Parameters:
state - the state to destroy

makeUnexported

public void makeUnexported(State state)
Marks the status of the state to 'unexported' (deleted).


isUnexported

public boolean isUnexported(State state)
Returns:
true if the state has been marked as unexported, otherwise false The state is unexported if the makeUnexported method has been called.

makeExported

public void makeExported(State state)
Marks the status of the state to 'exported' (created).


isExported

public boolean isExported(State state)
Returns:
true if the state has been marked as exported, otherwise false The state is exported if the makeExported method has been called.

makeDirty

public void makeDirty(State state)
Marks the status of the state to 'dirty' (modified). The next calls to isflushed will return false.


isDirty

public boolean isDirty(State state)
Returns:
true if the state has been marked as dirty, otherwise false The state is dirty if the makeDirty or makeExported or makeUnexported method has been called.

makeClean

public void makeClean(State state)
Marks the status of the state to 'clean' (non modified). This method is used at the commit of a working set in order to reset the state status.


makeFlushed

public void makeFlushed(State state)
Marks the status of the state to 'flushed' (written on data support).

Parameters:
state -

isFlushed

public boolean isFlushed(State state)
Returns:
true if the state has been marked as flushed without call to makeDirty, otherwise false

makeUnbound

public void makeUnbound(CacheEntry ce)
A persistent object has been removed or evicted from the cache, then it must be marked as non persistent

Parameters:
ce - is the cache entry referenced the persistent object to unbind

makeBound

public void makeBound(CacheEntry ce,
                      java.lang.Object oid)
A persistent object has been removed or evicted from the cache, then it must be marked as non persistent

Parameters:
ce - is the cache entry referenced the persistent object to bind
oid - is the id of the cache entry to bind

isBound

public boolean isBound(CacheEntry ce)
Returns:
true if the persistent object referenced by the given cache entry, is persistent.

isToMerge

public boolean isToMerge(State state)
Indicates if a State has to be merged at commit time with the reference state


makeToMerge

public void makeToMerge(State state,
                        java.lang.Object thinLock)
Marks the flag 'toMerge' on a state. a true value indicates that the state has to be merged at commit time, with the reference state.

Parameters:
state -
thinLock - is a hints describing the thinlock causing the merge at commit time.

merge

public State merge(State oldState,
                   State newState)
Merges a state (newState) into a oldSate.

Parameters:
oldState - is the state wich will contains the delta of the newState
newState - contains the delta to merge to the oldState

stateNoMoreUsed

public void stateNoMoreUsed(State state)
Indicates that this state is no more used by any working set. This event permit for instance to unswizzle the references to persistent objects from the state.

Parameters:
state - is the state that is not used by any working set


Copyright © 2000-2002 France Telecom S.A., INRIA, IMAG-LSR All Rights Reserved.