The main purpose of this interface is to store bundle configuration data persistently. This information is represented in {@code Configuration}objects. The actual configuration data is a {@code Dictionary} of propertiesinside a {@code Configuration} object.
There are two principally different ways to manage configurations. First there is the concept of a Managed Service, where configuration data is uniquely associated with an object registered with the service registry.
Next, there is the concept of a factory where the Configuration Admin service will maintain 0 or more {@code Configuration} objects for a Managed ServiceFactory that is registered with the Framework.
The first concept is intended for configuration data about "things/services" whose existence is defined externally, e.g. a specific printer. Factories are intended for "things/services" that can be created any number of times, e.g. a configuration for a DHCP server for different networks.
Bundles that require configuration should register a Managed Service or a Managed Service Factory in the service registry. A registration property named {@code service.pid} (persistent identifier or PID) must be used toidentify this Managed Service or Managed Service Factory to the Configuration Admin service.
When the ConfigurationAdmin detects the registration of a Managed Service, it checks its persistent storage for a configuration object whose {@code service.pid} property matches the PID service property ({@code service.pid}) of the Managed Service. If found, it calls {@link ManagedService#updated(Dictionary)} method with the new properties.The implementation of a Configuration Admin service must run these call-backs asynchronously to allow proper synchronization.
When the Configuration Admin service detects a Managed Service Factory registration, it checks its storage for configuration objects whose {@code service.factoryPid} property matches the PID service property of theManaged Service Factory. For each such {@code Configuration} objects, itcalls the {@code ManagedServiceFactory.updated} method asynchronously withthe new properties. The calls to the {@code updated} method of a{@code ManagedServiceFactory} must be executed sequentially and not overlapin time.
In general, bundles having permission to use the Configuration Admin service can only access and modify their own configuration information. Accessing or modifying the configuration of other bundles requires {@code ConfigurationPermission[location,CONFIGURE]}, where location is the configuration location.
{@code Configuration} objects can be bound to a specified bundlelocation or to a region (configuration location starts with {@code ?}). If a location is not set, it will be learned the first time a target is registered. If the location is learned this way, the Configuration Admin service must detect if the bundle corresponding to the location is uninstalled. If this occurs, the {@code Configuration} object must beunbound, that is its location field is set back to {@code null}.
If target's bundle location matches the configuration location it is always updated.
If the configuration location starts with {@code ?}, that is, the location is a region, then the configuration must be delivered to all targets registered with the given PID. If security is on, the target bundle must have Configuration Permission[location,TARGET], where location matches given the configuration location with wildcards as in the Filter substring match. The security must be verified using the {@link org.osgi.framework.Bundle#hasPermission(Object)} method on the targetbundle.
If a target cannot be updated because the location does not match or it has no permission and security is active then the Configuration Admin service must not do the normal callback.
The method descriptions of this class refer to a concept of "the calling bundle". This is a loose way of referring to the bundle which obtained the Configuration Admin service from the service registry. Implementations of {@code ConfigurationAdmin} must use a{@link org.osgi.framework.ServiceFactory} to support this concept. @noimplement @author $Id: cf748cd876c4ff2f88ca7f88ca0030cd1ce94bef $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|