MOPersistenceProvider
public class DefaultMOPersistenceProvider extends java.lang.Object implements MOPersistenceProvider
DefaultMOPersistenceProvider
provides agent state
persistence using a file with DefaultMOInput
and
DefaultMOOutput
input/output.Constructor | Description |
---|---|
DefaultMOPersistenceProvider(MOServer[] server,
java.lang.String defaultURI) |
Creates a persistence provider for the supplied
MOServer instances. |
Modifier and Type | Method | Description |
---|---|---|
java.lang.String |
getDefaultURI() |
Gets the URI of the default persistent storage for this provider.
|
java.lang.String |
getPersistenceProviderID() |
Returns an unique ID of the persistence provider which should identify the
format and type of the persistence provider.
|
boolean |
isValidPersistenceURI(java.lang.String uri) |
Checks whether the supplied URI string is valid for this persistence
provider.
|
void |
restore(java.lang.String uri,
int importMode) |
Restore (load) agent state from the specified file URI or file name.
|
void |
store(java.lang.String uri) |
Stores the current agent state to persistent storage specified by the
supplied URI.
|
public DefaultMOPersistenceProvider(MOServer[] server, java.lang.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 java.lang.String getPersistenceProviderID()
getPersistenceProviderID
in interface MOPersistenceProvider
public boolean isValidPersistenceURI(java.lang.String uri)
isValidPersistenceURI
in interface MOPersistenceProvider
uri
- a string identifying a persistent storage location for this
storage provider.true
if the uri
is valid,
false
otherwise.public void restore(java.lang.String uri, int importMode) throws java.io.IOException
restore
in interface MOPersistenceProvider
uri
- 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.java.io.IOException
- if the restore operation fails.public void store(java.lang.String uri) throws java.io.IOException
store
in interface MOPersistenceProvider
uri
- 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:".java.io.IOException
- if the store operation fails.public java.lang.String getDefaultURI()
MOPersistenceProvider
getDefaultURI
in interface MOPersistenceProvider
null
value indicates that there is no default location.Copyright © 2018 SNMP4J.org. All rights reserved.