Interface MOPersistenceProvider

All Known Implementing Classes:
DefaultMOPersistenceProvider

public interface MOPersistenceProvider
The MOPersistenceProvider interface 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:
3.5.0
Author:
Frank Fock
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets 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.
    boolean
    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 URI (can be as simple as a file path).
    default void
    restore(String uri, int importMode, MOPriorityProvider priorityProvider)
    Restore (load) agent state from the specified URI (can be as simple as a file path).
    void
    Stores the current agent state to persistent storage specified by the supplied URI.
    void
    store(String uri, MOPriorityProvider priorityProvider)
    Stores the current agent state to persistent storage specified by the supplied URI in the order defined by the given MOPriorityProvider.getPriorityMap(OctetString).
  • Method Details

    • 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. A null value can be specified to let the persistence provider use its default URI. If that default URI is null too, a NullPointerException will 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
    • restore

      default void restore(String uri, int importMode, MOPriorityProvider priorityProvider) 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. A null value can be specified to let the persistence provider use its default URI. If that default URI is null too, a NullPointerException will be thrown.
      importMode - specifies how the agent's current state should be update while restoring a previous state.
      priorityProvider - provides the boot managed object and its priority map that defines the order of restoring all other managed objects.
      Throws:
      IOException - if the restore operation fails.
      Since:
      3.5.0
    • 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. A null value can be specified to let the persistence provider use its default URI. If that default URI is null too, a NullPointerException will be thrown.
      Throws:
      IOException - if the store operation fails.
      Since:
      1.2
    • store

      void store(String uri, MOPriorityProvider priorityProvider) throws IOException
      Stores the current agent state to persistent storage specified by the supplied URI in the order defined by the given MOPriorityProvider.getPriorityMap(OctetString).
      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. A null value can be specified to let the persistence provider use its default URI. If that default URI is null too, a NullPointerException will 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.
      Since:
      3.5.0
    • 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:
      true if the uri is valid, false otherwise.
      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 null value indicates that there is no default location.