Package com.nt.udc.util.state
Class StateManager
java.lang.Object
com.nt.udc.util.state.StateManager
- Direct Known Subclasses:
AsynchronousStateManager
,SynchronousStateManager
The StateManager is responsible for holding a set of
StateDirectorySaveable or StateBufferSaveable Objects, and
saving/restoring those Objects when told to.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StateFreezable[]
protected int[]
protected File
protected LoggerIfc
protected File
protected String
protected StateBufferSaveable[]
protected StateDirectorySaveable[]
-
Constructor Summary
ConstructorsConstructorDescriptionStateManager
(LoggerIfc logger, File scratchDir) Creates the default StateManagerStateManager
(LoggerIfc logger, File scratchDir, String stateBufferFileName) Creates the StateManager with a buffer file. -
Method Summary
Modifier and TypeMethodDescriptionabstract StateManagementType
getType()
Returns this type of StateManager.void
manageActiveObject
(StateFreezable activeObject) Manages a single active Object.void
manageState
(StateBufferSaveable state) Adds a single StateBufferSaveable object to be managed.void
Adds a single StateDirectorySaveable object to be managed.void
manageStates
(StateBufferSaveable[] states) Adds an array of StateBufferSaveable objects for managing.void
manageStates
(StateDirectorySaveable[] states) Adds an array of StateDirectorySaveable objects for managing.abstract void
Restores the state of the system.abstract void
This method saves the state.abstract void
This method requests a save state from the StateSaver.void
setStateBufferFileName
(String stateBufferFileName) Sets the current state buffer file.void
shutdown()
Shuts down the StateManager, and cleans up any remaining state-related files.
-
Field Details
-
stateDirObjArray
-
stateBufferObjArray
-
activeObjArray
-
activeObjListenersArray
protected int[] activeObjListenersArray -
stateBufferFileName
-
logger
-
scratchDir
-
baseStateDir
-
-
Constructor Details
-
StateManager
Creates the default StateManager- Parameters:
logger
- Activity loggerscratchDir
- Directory which to store state data
-
StateManager
Creates the StateManager with a buffer file.- Parameters:
logger
- Activity loggerscratchDir
- Directory which to store state data.stateBufferFileName
- Buffer File name
-
-
Method Details
-
shutdown
public void shutdown()Shuts down the StateManager, and cleans up any remaining state-related files. -
setStateBufferFileName
Sets the current state buffer file.- Parameters:
stateBufferFileName
- Buffer file, containing the states.
-
manageState
Adds a single StateBufferSaveable object to be managed.- Parameters:
stateDirObj
- State object to manage
-
manageState
Adds a single StateDirectorySaveable object to be managed.- Parameters:
stateDirObj
- State object to manage
-
manageStates
Adds an array of StateBufferSaveable objects for managing.- Parameters:
states
- Array of state objects
-
manageStates
Adds an array of StateDirectorySaveable objects for managing.- Parameters:
states
- Array of state objects
-
manageActiveObject
Manages a single active Object. This Object will be told to freeze before all state saving routines occur. Note that using this method implies that there are **NO** order dependencies related to the given Object.- Parameters:
activeObject
- Object to be frozen during state save
-
getType
Returns this type of StateManager. -
saveState
This method requests a save state from the StateSaver. (Where applicable)- Throws:
StateException
-
saveState
This method saves the state.- Throws:
StateException
-
restoreState
Restores the state of the system.- Throws:
StateException
-