Class MemoryPersistenceManager
- All Implemented Interfaces:
NotCachablePersistenceManager,PersistenceManager
MemoryPersistenceManager holds all configurations in memory.-
Field Summary
Fields inherited from interface org.apache.felix.cm.PersistenceManager
PROPERTY_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidRemoves theDictionaryfor the givenpid.booleanReturnstrueif a persistedDictionaryexists for the givenpid.Returns an enumeration of allDictionaryobjects known to this persistence manager.Returns theDictionaryfor the givenpid.voidstore(String pid, Dictionary properties) Stores theDictionaryunder the givenpid.
-
Constructor Details
-
MemoryPersistenceManager
public MemoryPersistenceManager()
-
-
Method Details
-
delete
Description copied from interface:PersistenceManagerRemoves theDictionaryfor the givenpid. If such a dictionary does not exist, this method has no effect.- Specified by:
deletein interfacePersistenceManager- 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
Description copied from interface:PersistenceManagerReturnstrueif a persistedDictionaryexists for the givenpid.- Specified by:
existsin interfacePersistenceManager- Parameters:
pid- The identifier for the dictionary to test.- Returns:
trueif a persisted dictionary exists for the pid.
-
getDictionaries
Description copied from interface:PersistenceManagerReturns an enumeration of allDictionaryobjects 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
Enumerationreturned from this method must be stable against concurrent calls to either of thePersistenceManager.load(String),PersistenceManager.store(String, Dictionary), andPersistenceManager.delete(String)methods.- Specified by:
getDictionariesin interfacePersistenceManager- Returns:
- A possibly empty Enumeration of all dictionaries.
- Throws:
IOException- If an error occurs getting the dictionaries.
-
load
Description copied from interface:PersistenceManagerReturns theDictionaryfor the givenpid.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 holdtrue.- Specified by:
loadin interfacePersistenceManager- Parameters:
pid- The identifier for the dictionary to load.- Returns:
- The dictionary for the identifier. This must not be
nullbut may be empty. - Throws:
IOException- If an error occurs loading the dictionary. AnIOExceptionmust also be thrown if no dictionary exists for the given identifier.
-
store
Description copied from interface:PersistenceManagerStores theDictionaryunder the givenpid.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:
storein interfacePersistenceManager- Parameters:
pid- The identifier of the dictionary.properties- TheDictionaryto store.- Throws:
IOException- If an error occurs storing the dictionary. If this exception is thrown, it is expected, thatexists(pidreturnsfalse.
-