public class DefaultMOPersistenceProvider extends Object implements MOPersistenceProvider
DefaultMOPersistenceProvider provides agent state
persistence using a file with DefaultMOInput and
DefaultMOOutput input/output.| Constructor and Description |
|---|
DefaultMOPersistenceProvider(MOServer[] server,
String defaultURI)
Creates a persistence provider for the supplied
MOServer instances. |
| Modifier and Type | Method and Description |
|---|---|
String |
getDefaultURI()
Gets the URI of the default persistent storage for this provider.
|
String |
getPersistenceProviderID()
Returns an unique ID of the persistence provider which should identify the
format and type of the persistence provider.
|
boolean |
isValidPersistenceURI(String uri)
Checks whether the supplied URI string is valid for this persistence
provider.
|
void |
restore(String uri,
int importMode)
Restore (load) agent state from the specified file URI or file name.
|
void |
store(String uri)
Stores the current agent state to persistent storage specified by the
supplied URI.
|
public DefaultMOPersistenceProvider(MOServer[] server, String defaultURI)
MOServer instances.
The content and state of the managed objects of those servers are subject
to store(java.lang.String) and restore(java.lang.String, int) operations.server - an array of MOServer instances (possibly empty).defaultURI - the (optional) default URI (i.e., file path) to be used for this
persistence provider.public String getPersistenceProviderID()
getPersistenceProviderID in interface MOPersistenceProviderpublic boolean isValidPersistenceURI(String uri)
isValidPersistenceURI in interface MOPersistenceProvideruri - a string identifying a persistent storage location for this
storage provider.true if the uri is valid,
false otherwise.public void restore(String uri, int importMode) throws IOException
restore in interface MOPersistenceProvideruri - a string pointing to the persistent storage file from which the
agent state should be restored from. The format of he string is
either a simple file name or an URI starting with "file:".importMode - specifies how the agent's current state should be
update while restoring a previous state.IOException - if the restore operation fails.public void store(String uri) throws IOException
store in interface MOPersistenceProvideruri - a string pointing to the persistent storage file to use.
The format of he string is either a simple file name or an URI
starting with "file:".IOException - if the store operation fails.public String getDefaultURI()
MOPersistenceProvidergetDefaultURI in interface MOPersistenceProvidernull
value indicates that there is no default location.Copyright © 2020 SNMP4J.org. All rights reserved.