Class MemoryPersistenceManager

java.lang.Object
org.apache.felix.cm.impl.persistence.MemoryPersistenceManager
All Implemented Interfaces:
NotCachablePersistenceManager, PersistenceManager

public class MemoryPersistenceManager extends Object implements NotCachablePersistenceManager
The MemoryPersistenceManager holds all configurations in memory.
  • Constructor Details

    • MemoryPersistenceManager

      public MemoryPersistenceManager()
  • Method Details

    • delete

      public void delete(String pid) throws IOException
      Description copied from interface: PersistenceManager
      Removes the Dictionary for the given pid. If such a dictionary does not exist, this method has no effect.
      Specified by:
      delete in interface PersistenceManager
      Parameters:
      pid - The identifier of the dictionary to delete.
      Throws:
      IOException - If an error occurs deleting the dictionary. This exception must not be thrown if no dictionary with the given identifier exists.
    • exists

      public boolean exists(String pid)
      Description copied from interface: PersistenceManager
      Returns true if a persisted Dictionary exists for the given pid.
      Specified by:
      exists in interface PersistenceManager
      Parameters:
      pid - The identifier for the dictionary to test.
      Returns:
      true if a persisted dictionary exists for the pid.
    • getDictionaries

      public Enumeration getDictionaries() throws IOException
      Description copied from interface: PersistenceManager
      Returns an enumeration of all Dictionary objects known to this persistence manager.

      Implementations of this method are allowed to return lazy enumerations. That is, it is allowable for the enumeration to not return a dictionary if loading it results in an error.

      Implementations are expected to return dictionary instances which may be modified by the caller without affecting any underlying data or affecting future calls to this method.

      The Enumeration returned from this method must be stable against concurrent calls to either of the PersistenceManager.load(String), PersistenceManager.store(String, Dictionary), and PersistenceManager.delete(String) methods.

      Specified by:
      getDictionaries in interface PersistenceManager
      Returns:
      A possibly empty Enumeration of all dictionaries.
      Throws:
      IOException - If an error occurs getting the dictionaries.
    • load

      public Dictionary load(String pid) throws IOException
      Description copied from interface: PersistenceManager
      Returns the Dictionary for the given pid.

      Implementations are expected to return dictionary instances which may be modified by the caller without affecting any underlying data or affecting future calls to this method with the same PID. In other words the reference equation load(pid) != load(pid) must hold true.

      Specified by:
      load in interface PersistenceManager
      Parameters:
      pid - The identifier for the dictionary to load.
      Returns:
      The dictionary for the identifier. This must not be null but may be empty.
      Throws:
      IOException - If an error occurs loading the dictionary. An IOException must also be thrown if no dictionary exists for the given identifier.
    • store

      public void store(String pid, Dictionary properties) throws IOException
      Description copied from interface: PersistenceManager
      Stores the Dictionary under the given pid.

      The dictionary provided to this method must be considered private to the caller. Any modification by the caller after this method finishes must not influence any internal storage of the provided data. Implementations must not modify the dictionary.

      Specified by:
      store in interface PersistenceManager
      Parameters:
      pid - The identifier of the dictionary.
      properties - The Dictionary to store.
      Throws:
      IOException - If an error occurs storing the dictionary. If this exception is thrown, it is expected, that exists(pid returns false.