org.apache.felix.cm
Interface PersistenceManager

All Known Implementing Classes:
FilePersistenceManager

public interface PersistenceManager

The PersistenceManager interface defines the API to be implemented to support persisting configuration data. This interface may be implemented by bundles, which support storing configuration data in different locations.

The Apache Felix Configuration Admin Service bundles provides an implementation of this interface using the platform filesystem to store configuration data.

Implementations of this interface must support loading and storing java.util.Dictionary objects as defined in section 104.4.2, Configuration Properties, of the Configuration Admin Service Specification Version 1.2.

To make implementations of this interface available to the Configuration Admin Service they must be registered as service for this interface. The Configuration Admin Service will consider all registered services plus the default platform file system based implementation to load configuration data. To store new configuration data, the persistence manager service with the highest rank value - the service.ranking service property - is used. If no pesistence manager service has been registered, the platfrom file system based implementation is used.

Author:
fmeschbe

Method Summary
 void delete(java.lang.String pid)
          Removes the Dictionary for the given pid.
 boolean exists(java.lang.String pid)
          Returns true if a persisted Dictionary exists for the given pid.
 java.util.Enumeration getDictionaries()
          Returns an enumeration of all Dictionary objects known to this persistence manager.
 java.util.Dictionary load(java.lang.String pid)
          Returns the Dictionary for the given pid.
 void store(java.lang.String pid, java.util.Dictionary properties)
          Stores the Dictionary under the given pid.
 

Method Detail

exists

boolean exists(java.lang.String pid)
Returns true if a persisted Dictionary exists for the given pid.

Parameters:
pid - The identifier for the dictionary to test.

load

java.util.Dictionary load(java.lang.String pid)
                          throws java.io.IOException
Returns the Dictionary for the given pid.

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:
java.io.IOException - If an error occurrs loading the dictionary. An IOException must also be thrown if no dictionary exists for the given identifier.

getDictionaries

java.util.Enumeration getDictionaries()
                                      throws java.io.IOException
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.

Returns:
A possibly empty Enumeration of all dictionaries.
Throws:
java.io.IOException - If an error occurrs getting the dictionaries.

store

void store(java.lang.String pid,
           java.util.Dictionary properties)
           throws java.io.IOException
Stores the Dictionary under the given pid.

Parameters:
pid - The identifier of the dictionary.
properties - The Dictionary to store.
Throws:
java.io.IOException - If an error occurrs storing the dictionary. If this exception is thrown, it is expected, that exists(pid returns false.

delete

void delete(java.lang.String pid)
            throws java.io.IOException
Removes the Dictionary for the given pid. If such a dictionary does not exist, this method has no effect.

Parameters:
pid - The identifier of the dictionary to delet.
Throws:
java.io.IOException - If an error occurrs deleting the dictionary. This exception must not be thrown if no dictionary with the given identifier exists.