StateManager: StateManager

Description Usage Arguments Format Details Value Author(s) See Also

Description

StateManager Class for managing persistence and states of objects within the NLPStudio package.

Usage

1

Arguments

object

The object to be loaded or saved. Required parameter for the saveState method.

stateId

The unique identifier for the object and state. Required parameter for the restoreState method.

files

statesical indicating whether the files associated with an object should be archived.

dateFrom

Character string containing a date in any ISO 8601 format, from which state records should be returned.

dateTo

Character string containing a date in any ISO 8601 format, from which state records should be returned.

class

Character string indicating the class for which state records should be returned.

object

Character string indicating the name of the object for which state records should be returned.

Format

An object of class R6ClassGenerator of length 24.

Details

StateManager Class Overview: The StateManager class object provides overall management of object state within the NLPStudio package. It accepts a save or restore request from a client object, statess the request, dispatches the appropriate StateManager (and, if requested, StateArchiver) object(s). Once the request is fulfilled by the subclass(es), the object is returned to the StateManager. The StateManager adds the object with a designated stateId to its inventory of states. A summary of the request is also stored for query and restore purposes.

State Class Family Overview: The State family of classes is responsible for managing object persistence and an archive / restore capability within the NLPStudio objects.

State Class Family Participants: The participants of the family are as follows:

StateManager Methods: The methods for the StateManager class are as follows:

getState(stateId)

Returns the object at the state designated by the stateId parameter.

restoreState(stateId, files = FALSE)

Restores the object at the state designated by the stateId parameter to the global environment. If files is set TRUE, previously archived directories and files are restored. If the object is part of a composite, e.g. Document or DocumentCollection class object, and its parent does not exist, the files will be restored to an orphan object according to the class of the object, the files will be restored to the orphan object directory, and the parent will be changed accordingly. In this case the restored object may then be moved to another parent as required.

saveState(object, files = FALSE)

Saves the current state of an object and dispatches a StateManager object to save the state to disk. If the files parameter is set to true, a VisitorArchive object will be instantiated to compress and save the files associated with the object to an archive directory.

Value

stateId From the setState function, a character string with the stateId assigned by the stateManager

object From the restoreState method the object returned from the state archive.

Author(s)

John James, jjames@datasciencesalon.org

See Also

Other State Classes: StateServer, State


j2scode/nlpStudio documentation built on May 9, 2019, 12:54 p.m.