Class MOXodusPersistenceProvider

  • All Implemented Interfaces:
    org.snmp4j.agent.cfg.EngineBootsProvider, org.snmp4j.agent.cfg.EngineIdProvider, org.snmp4j.agent.io.MOPersistenceProvider

    public class MOXodusPersistenceProvider
    extends java.lang.Object
    implements org.snmp4j.agent.io.MOPersistenceProvider, org.snmp4j.agent.cfg.EngineBootsProvider, org.snmp4j.agent.cfg.EngineIdProvider
    The MOXodusPersistenceProvider implements a MOPersistenceProvider that uses a JetBrains Xodus database for persistent storage of RandomAccessManagedObjects. Using RandomAccessManagedObject peristence with this MOXodusPersistenceProvider has the following advantages:
    • Less disk space usage than with DefaultMOPersistenceProvider
    • Any Managed object changes are store via MOChangeListener and MOTableRowListener persistently into the database immediately.
    • Concurrent access to storage is safe.
    See MOServerPersistence for sample code and further usage details.
    Version:
    3.0
    Author:
    Frank Fock
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getDefaultURI()
      Gets the URI of the default persistent storage for this provider.
      int getEngineBoots()
      Returns current engine boot counter value.
      org.snmp4j.smi.OctetString getEngineId​(org.snmp4j.smi.OctetString defaultEngineID)  
      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 uriString)
      Checks whether the supplied URI string is valid for this persistence provider.
      void resetEngineId​(org.snmp4j.smi.OctetString engineId)  
      void restore​(java.lang.String uri, int importMode)
      Restore (load) agent state from the specified URI (can be as simple as a file path).
      void store​(java.lang.String uri)
      Stores the current agent state to persistent storage specified by the supplied URI.
      int updateEngineBoots()
      Returns the current engine boot counter value incremented by one.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • restore

        public void restore​(java.lang.String uri,
                            int importMode)
                     throws java.io.IOException
        Restore (load) agent state from the specified URI (can be as simple as a file path).
        Specified by:
        restore in interface org.snmp4j.agent.io.MOPersistenceProvider
        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:
        java.io.IOException - if the restore operation fails.
        Since:
        1.2
      • store

        public void store​(java.lang.String uri)
                   throws java.io.IOException
        Stores the current agent state to persistent storage specified by the supplied URI.
        Specified by:
        store in interface org.snmp4j.agent.io.MOPersistenceProvider
        Parameters:
        uri - a string pointing to the persistent storage from which the agent state should be stored to. 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:
        java.io.IOException - if the store operation fails.
        Since:
        1.2
      • isValidPersistenceURI

        public boolean isValidPersistenceURI​(java.lang.String uriString)
        Checks whether the supplied URI string is valid for this persistence provider.
        Specified by:
        isValidPersistenceURI in interface org.snmp4j.agent.io.MOPersistenceProvider
        Parameters:
        uriString - a string identifying a persistent storage location for this storage provider.
        Returns:
        true if the uri is valid, false otherwise.
        Since:
        1.2
      • getPersistenceProviderID

        public java.lang.String getPersistenceProviderID()
        Returns an unique ID of the persistence provider which should identify the format and type of the persistence provider.
        Specified by:
        getPersistenceProviderID in interface org.snmp4j.agent.io.MOPersistenceProvider
        Returns:
        an 1-32 character long string that identifies the persistence provider.
        Since:
        1.2
      • getDefaultURI

        public java.lang.String getDefaultURI()
        Gets the URI of the default persistent storage for this provider.
        Specified by:
        getDefaultURI in interface org.snmp4j.agent.io.MOPersistenceProvider
        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.
      • updateEngineBoots

        public int updateEngineBoots()
        Returns the current engine boot counter value incremented by one. If that number would by greater than 2^31-1 then one is returned. The engine boots provider has to make sure that the returned value is persistently stored before the method returns.
        Specified by:
        updateEngineBoots in interface org.snmp4j.agent.cfg.EngineBootsProvider
        Returns:
        the last engine boots counter incremented by one.
      • getEngineBoots

        public int getEngineBoots()
        Returns current engine boot counter value.
        Specified by:
        getEngineBoots in interface org.snmp4j.agent.cfg.EngineBootsProvider
        Returns:
        the last engine boots counter.
      • getEngineId

        public org.snmp4j.smi.OctetString getEngineId​(org.snmp4j.smi.OctetString defaultEngineID)
        Specified by:
        getEngineId in interface org.snmp4j.agent.cfg.EngineIdProvider
      • resetEngineId

        public void resetEngineId​(org.snmp4j.smi.OctetString engineId)
        Specified by:
        resetEngineId in interface org.snmp4j.agent.cfg.EngineIdProvider