Description Usage Arguments Format Details Author(s) See Also
StateServer
This class is responsible for serializing and deserializing
object states. Invoked by the StateManager class, this class is comprised of
two methods, saveState and restoreState. The saveState method takes as
its parameters, a state identifier and the object to be saved,
then serializes and saves the object to the States directory.
The restoreState method takes a state identifier as its parameter and
reads the object, designated by the state identifier from file and returns
it to the StateManager object.
1 |
key |
Character string indicating a unique request from the StateManager class. |
object |
A serializable object to be serialized and saved. |
stateId |
Character string which uniquely identifies an object and its state at a specific point in time. |
An object of class R6ClassGenerator
of length 24.
The StateServer class is a participant of the State family of classes.
State Family of Classes Overview: The State family of classes is responsible for object persistence and data recovery in the NLPStudio package and is comprised of the following participants.
State Class Family Participants:
State: This class oversees the process of saving, restoring and querying states. It takes requests from client applications and dispatches instantiates the appropriate visitor to fulfill the request. This class also provides state query functionality.
StateManager: This class has a persistent single object that receives a save/restore request from a visitor, keeps track of the saved states, and their locations, and dispatches the appropriate save/restore method within the StateServer class to serialize or deserialize the object.
StateServer: This class is responsible for serializing and deserializing object states.
VWriteState: This visitor class is invoked through the accept method of the originator object, and dispatches a request to the StateManager class for logging and fulfillment.
VReadState: This visitor class is invoked through the accept method of the originator object, and dispatches a request to the StateManager class for logging and fulfillment. This class also manages the process of restoring composite objects to the prior designated state by iterating through the composite hierarchy.
StateServer Methods: The following methods are defined for this class:
new(key)
Method that instantiates an object of the StateServer class. The method is invoked by the StateManager class with a unique key. This key is validated against future requests to confirm that the requests is originating from the StateManager class.
saveState(key, stateId, object)
Method for serializing and storing the object to disk.
restoreState(key, stateId)
Method for deserializing and returning the object from disk at state designated by the stateId parameter.
John James, jjames@datasciencesalon.org
Other State Classes: StateManager
,
State
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.