org.objectweb.perseus.persistence.api

Interface StateManager

All Superinterfaces:
CacheEventListener

public interface StateManager
extends CacheEventListener

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.
State
createState(State s)
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
isUnexported(State state)
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
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).
void
setReferenceState(CacheEntry ce, State state)
Assignes the reference state to a cache entry

Method Details

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')


createState

public State createState(State s)
Creates a new State.

Parameters:
s - the state to clone

Returns:
a new state which contains the same values (data and cache entry reference) than the existing state given in parameter


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


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.


isBound

public boolean isBound(CacheEntry ce)

Returns:
true if the persistent object referenced by the given cache entry, is persistent.


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.


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.


isFlushed

public boolean isFlushed(State state)

Returns:
true if the state has been marked as flushed without call to makeDirty, otherwise false


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.


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.


makeDirty

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


makeExported

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


makeFlushed

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

Parameters:
state -


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


makeUnexported

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


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.


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