-
- All Known Implementing Classes:
DefaultMOPersistenceProvider
public interface MOPersistenceProviderTheMOPersistenceProviderinterface defines how persistent storage can be used to save and restore an agents state. The interface intentionally does not define how the persistence provider gets access to the agent's state.- Version:
- 1.2
- Author:
- Frank Fock
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringgetDefaultURI()Gets the URI of the default persistent storage for this provider.StringgetPersistenceProviderID()Returns an unique ID of the persistence provider which should identify the format and type of the persistence provider.booleanisValidPersistenceURI(String uri)Checks whether the supplied URI string is valid for this persistence provider.voidrestore(String uri, int importMode)Restore (load) agent state from the specified URI (can be as simple as a file path).voidstore(String uri)Stores the current agent state to persistent storage specified by the supplied URI.
-
-
-
Method Detail
-
restore
void restore(String uri, int importMode) throws IOException
Restore (load) agent state from the specified URI (can be as simple as a file path).- Parameters:
uri- a string pointing to the persistent storage from which the agent state should be restored from. The format of he 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.importMode- specifies how the agent's current state should be update while restoring a previous state.- Throws:
IOException- if the restore operation fails.- Since:
- 1.2
-
store
void store(String uri) throws IOException
Stores the current agent state to persistent storage specified by the supplied URI.- 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.- Throws:
IOException- if the store operation fails.- Since:
- 1.2
-
isValidPersistenceURI
boolean isValidPersistenceURI(String uri)
Checks whether the supplied URI string is valid for this persistence provider.- Parameters:
uri- a string identifying a persistent storage location for this storage provider.- Returns:
trueif theuriis valid,falseotherwise.- Since:
- 1.2
-
getPersistenceProviderID
String getPersistenceProviderID()
Returns an unique ID of the persistence provider which should identify the format and type of the persistence provider.- Returns:
- an 1-32 character long string that identifies the persistence provider.
- Since:
- 1.2
-
getDefaultURI
String getDefaultURI()
Gets the URI of the default persistent storage for this provider.- 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.
-
-