java.lang.Object
org.snmp4j.agent.io.DefaultMOPersistenceProvider
- All Implemented Interfaces:
MOPersistenceProvider
The
DefaultMOPersistenceProvider provides agent state
persistence using a file with DefaultMOInput and
DefaultMOOutput input/output.- Version:
- 1.2
- Author:
- Frank Fock
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultMOPersistenceProvider(MOServer[] server, String defaultURI) Creates a persistence provider for the suppliedMOServerinstances. -
Method Summary
Modifier and TypeMethodDescriptionGets the URI of the default persistent storage for this provider.Returns an unique ID of the persistence provider which should identify the format and type of the persistence provider.booleanChecks whether the supplied URI string is valid for this persistence provider.voidRestore (load) agent state from the specified file URI or file name.voidStores the current agent state to persistent storage specified by the supplied URI.voidstore(String uri, MOPriorityProvider priorityProvider) Stores the current agent state to persistent storage specified by the supplied URI in the order defined by the givenMOPriorityProvider.getPriorityMap(OctetString).Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.snmp4j.agent.io.MOPersistenceProvider
restore
-
Constructor Details
-
DefaultMOPersistenceProvider
Creates a persistence provider for the suppliedMOServerinstances. The content and state of the managed objects of those servers are subject tostore(java.lang.String)andrestore(java.lang.String, int)operations.- Parameters:
server- an array ofMOServerinstances (possibly empty).defaultURI- the (optional) default URI (i.e., file path) to be used for this persistence provider.
-
-
Method Details
-
getPersistenceProviderID
Returns an unique ID of the persistence provider which should identify the format and type of the persistence provider.- Specified by:
getPersistenceProviderIDin interfaceMOPersistenceProvider- Returns:
- "default".
-
isValidPersistenceURI
Checks whether the supplied URI string is valid for this persistence provider.- Specified by:
isValidPersistenceURIin interfaceMOPersistenceProvider- Parameters:
uri- a string identifying a persistent storage location for this storage provider.- Returns:
trueif theuriis valid,falseotherwise.
-
restore
Restore (load) agent state from the specified file URI or file name.- Specified by:
restorein interfaceMOPersistenceProvider- Parameters:
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.- Throws:
IOException- if the restore operation fails.
-
store
Stores the current agent state to persistent storage specified by the supplied URI.- Specified by:
storein interfaceMOPersistenceProvider- Parameters:
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:".- Throws:
IOException- if the store operation fails.
-
store
Description copied from interface:MOPersistenceProviderStores the current agent state to persistent storage specified by the supplied URI in the order defined by the givenMOPriorityProvider.getPriorityMap(OctetString).- Specified by:
storein interfaceMOPersistenceProvider- Parameters:
uri- a string pointing to the persistent storage from which the agent state should be restored from. The format of the string is specified by the persistence provider. Anullvalue can be specified to let the persistence provider use its default URI. If that default URI isnulltoo, aNullPointerExceptionwill be thrown.priorityProvider- provides the boot managed object and its priority map that defines the order of storing all other managed objects.- Throws:
IOException- if the store operation fails.
-
getDefaultURI
Description copied from interface:MOPersistenceProviderGets the URI of the default persistent storage for this provider.- Specified by:
getDefaultURIin interfaceMOPersistenceProvider- Returns:
- the URI (e.g. file path) for the default persistent storage location of
this provider. A provider may use a different one. A
nullvalue indicates that there is no default location.
-