|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.jameleon.util.StateStorer
public class StateStorer
A bean that keeps track of a list of Storables
and calls the store
on each at the appropriate time.
The appropriate times are:
storableEvent
event is checked to see if the event
is to be recorded. If the event is not to be recorded, then nothing happens. If the event is to be recorded,
then the Storable.store(java.lang.String,int)
is called for each
Storable
in the list of registered Storables.
Field Summary | |
---|---|
protected boolean |
available
|
static int |
DEFAULT_EVENT
The default event at which to store the state of the object. |
static String |
DEFAULT_STORE_DIR
The default event at which to store the state of the object. |
protected static org.apache.log4j.Logger |
log
|
static int |
ON_COMMAND_EVENT
Don't store the state of the object. |
static int |
ON_ERROR_EVENT
Only store the state of the object on an unexpected error ( not an assertion error ). |
static int |
ON_NO_EVENT
Don't store the state of the object. |
static int |
ON_STATE_CHANGE_EVENT
Store the state of the object everytime the state itself changes. |
protected static StateStorer |
stateStorer
|
protected int |
storableEvent
When to store the state of the Storables . |
protected Set |
storables
A list of storables whose state will be stored at the appropriate time. |
protected File |
storeDir
The directory to store the Storables ' state to. |
Method Summary | |
---|---|
void |
addStorable(Storable s)
Adds a Storable for which the state will be stored when the appropriate event occurs.. |
void |
eventOccured(int event)
Records that an event occured. |
static StateStorer |
getInstance()
|
int |
getStorableEvent()
|
Set |
getStorables()
Gets the list of storables to be stored when the appropriate event occurs. |
File |
getStoreDir()
|
protected boolean |
isStateStorable(int event)
Tests whether the state of a storable is to be stored or not. |
void |
removeStorable(Storable s)
Removes a Storable for which the state will be stored when the appropriate event occurs.. |
void |
reset()
|
void |
setStorableEvent(int event)
Sets the event at which the state of the storables will be saved. |
void |
setStoreDir(File dir)
|
protected void |
storeState(int event)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static StateStorer stateStorer
protected int storableEvent
Storables
.
protected Set storables
public static final String DEFAULT_STORE_DIR
protected File storeDir
Storables
' state to.
public static final int ON_ERROR_EVENT
public static final int ON_STATE_CHANGE_EVENT
public static final int ON_NO_EVENT
public static final int ON_COMMAND_EVENT
public static final int DEFAULT_EVENT
protected static org.apache.log4j.Logger log
protected boolean available
Method Detail |
---|
public static StateStorer getInstance()
public void reset()
protected boolean isStateStorable(int event)
event
- - use ON_ERROR
for an error or ON_STATE_CHANGE
for a simple state change.
public void eventOccured(int event)
event
occured. If the event is set as a storable event at runtime,
then thee state of all Storables will be recorded.
event
- - The event type that occured.public int getStorableEvent()
event
at which the Storables
' state will be stored.public void setStorableEvent(int event)
event
- - the event at which the Storables
' state will be stored.
If an invalid event
is passed, the storableEvent will not be changed.
public Set getStorables()
public void addStorable(Storable s)
Storable
for which the state will be stored when the appropriate event occurs..
s
- - a Storable
object..public void removeStorable(Storable s)
Storable
for which the state will be stored when the appropriate event occurs..
s
- - the Storable
object to removed from the list of objectsprotected void storeState(int event)
public File getStoreDir()
public void setStoreDir(File dir)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |