ManagedService
or
ManagedServiceFactory
object. The Configuration Admin service uses
this interface to represent the configuration information for a
ManagedService
or for a service instance of a
ManagedServiceFactory
.
A Configuration
object contains a configuration dictionary and allows
the properties to be updated via this object. Bundles wishing to receive
configuration dictionaries do not need to use this class - they register a
ManagedService
or ManagedServiceFactory
. Only administrative
bundles, and bundles wishing to update their own configurations need to use
this class.
The properties handled in this configuration have case insensitive
String
objects as keys. However, case must be preserved from the last
set key/value.
A configuration can be bound to a specific bundle or to a region of
bundles using the location. In its simplest form the location is the
location of the target bundle that registered a Managed Service or a Managed
Service Factory. However, if the location starts with ?
then the
location indicates multiple delivery. In such a case the configuration must
be delivered to all targets. If security is on, the Configuration Permission
can be used to restrict the targets that receive updates. The Configuration
Admin must only update a target when the configuration location matches the
location of the target's bundle or the target bundle has a Configuration
Permission with the action ConfigurationPermission#TARGET
and a name
that matches the configuration location. The name in the permission may
contain wildcards ( '*'
) to match the location using the same
substring matching rules as Filter
. Bundles can always create,
manipulate, and be updated from configurations that have a location that
matches their bundle location.
If a configuration's location is null
, it is not yet bound to a
location. It will become bound to the location of the first bundle that
registers a ManagedService
or ManagedServiceFactory
object
with the corresponding PID.
The same Configuration
object is used for configuring both a Managed
Service Factory and a Managed Service. When it is important to differentiate
between these two the term "factory configuration" is used.
Modifier and Type | Class and Description |
---|---|
public static enum | Configuration.
Configuration Attributes. |
Modifier and Type | Method and Description |
---|---|
public void | addAttributes(Configuration.
The attributes to add. attrsAdd attributes to the configuration. |
public void | |
public boolean | |
public Set | |
public String | Returns: location to which this configuration is bound, ornull .Get the bundle location. |
public long | Returns: A monotonically increasing value reflecting changes in this Configuration.Get the change count. |
public String | Returns: factory PID ornull For a factory configuration return the PID of the corresponding Managed
Service Factory, else return |
public String | |
public Dictionary | Returns: A private copy of the processed properties for the caller ornull . These properties must not contain the
"service.bundleLocation" property. The value of this property may
be obtained from the getBundleLocation() method.The reference to the Managed Service or Managed Service
Factory to pass to the registered reference)ConfigurationPlugin s
handling this configuration. Must not be null .Return the processed properties of this |
public Dictionary | Returns: A private copy of the properties for the caller ornull .
These properties must not contain the "service.bundleLocation"
property. The value of this property may be obtained from the
getBundleLocation() method.Return the properties of this |
public int | |
public void | removeAttributes(Configuration.
The attributes to remove. attrsRemove attributes from this configuration. |
public void | setBundleLocation(String
a location, region, or location)null Bind this |
public void | update(Dictionary<String, ?>
the new set of properties for this configuration properties)Update the properties of this |
public void | |
public boolean | Returns: If the properties are different and the configuration is updatedtrue is returned. If the properties are the same,
false is returned.The new set of properties for this configuration. properties)Update the properties of this |
addAttributes | back to summary |
---|---|
public void addAttributes(Configuration. Add attributes to the configuration.
|
delete | back to summary |
---|---|
public void delete() throws IOException Delete this
Removes this configuration object from the persistent store. Notify
asynchronously the corresponding Managed Service or Managed Service
Factory. A
Also notifies all Configuration Listeners with a
|
equals | back to summary |
---|---|
public boolean equals(Object other) Equality is defined to have equal PIDs Two Configuration objects are equal when their PIDs are equal. |
getAttributes | back to summary |
---|---|
public Set Get the attributes of this configuration.
|
getBundleLocation | back to summary |
---|---|
public String getBundleLocation() Get the bundle location.
Returns the bundle location or region to which this configuration is
bound, or
|
getChangeCount | back to summary |
---|---|
public long getChangeCount() Get the change count. Each Configuration must maintain a change counter that is incremented with a positive value every time the configuration is updated and its properties are stored. The counter must be incremented before the targets are updated and events are sent out.
|
getFactoryPid | back to summary |
---|---|
public String getFactoryPid() For a factory configuration return the PID of the corresponding Managed
Service Factory, else return
|
getPid | back to summary |
---|---|
public String getPid() Get the PID for this
|
getProcessedProperties | back to summary |
---|---|
public Dictionary Return the processed properties of this
The
Before the properties are returned they are processed by all the
registered
If called just after the configuration is created and before update has
been called, this method returns
|
getProperties | back to summary |
---|---|
public Dictionary Return the properties of this
If called just after the configuration is created and before update has
been called, this method returns
|
hashCode | back to summary |
---|---|
public int hashCode() Hash code is based on PID. The hash code for two Configuration objects must be the same when the Configuration PID's are the same.
|
removeAttributes | back to summary |
---|---|
public void removeAttributes(Configuration. Remove attributes from this configuration.
|
setBundleLocation | back to summary |
---|---|
public void setBundleLocation(String location) Bind this
If the location starts with
If the location is changed then existing targets must be informed. If
they can no longer see this configuration, the configuration must be
deleted or updated with
Also notifies all Configuration Listeners with a
|
update | back to summary |
---|---|
public void update(Dictionary<String, ?> properties) throws IOException Update the properties of this Stores the properties in persistent storage after adding or overwriting the following properties:
String .
If the corresponding Managed Service/Managed Service Factory is registered, its updated method must be called asynchronously. Else, this callback is delayed until aforementioned registration occurs.
Also notifies all Configuration Listeners with a
|
update | back to summary |
---|---|
public void update() throws IOException Update the
This is the only way for a bundle that uses a Configuration Plugin
service to initiate a callback. For example, when that bundle detects a
change that requires an update of the Managed Service or Managed Service
Factory via its
|
updateIfDifferent | back to summary |
---|---|
public boolean updateIfDifferent(Dictionary<String, ?> properties) throws IOException Update the properties of this
update(Dictionary) method.
|
Modifier and Type | Field and Description |
---|---|
public static final Configuration. | READ_ONLY
The configuration is read only. |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
public static Configuration. | |
public static Configuration. |
READ_ONLY | back to summary |
---|---|
public static final Configuration. The configuration is read only. |
ConfigurationAttribute | back to summary |
---|---|
private ConfigurationAttribute() |
valueOf | back to summary |
---|---|
public static Configuration. |
values | back to summary |
---|---|
public static Configuration. |