|
OSGi™ Service Platform Release 2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The configuration information for a 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 set of 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 is preserved from the last set key/value. The value of the property may be of the following types:
type = String | Integer | Long | Float | Double | Byte | Short | BigInteger | BigDecimal | Character | Boolean | vector | arrays primitive = long | int | short | char | byte | double | float arrays = primitive '[]' | type '[]' vector = Vector of type
A configuration can be bound to a bundle location (Bundle.getLocation()). The purpose of binding a Configuration object to a location is to make it impossible for another bundle to forge a PID that would match this configuration. When a configuration is bound to a specific location, and a bundle with a different location registers a corresponding ManagedService object or ManagedServiceFactory object, then the configuration is not passed to the updated method of that object.
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.
Method Summary | |
void |
delete()
Delete this Configuration object. |
java.lang.String |
getBundleLocation()
Get the bundle location. |
java.lang.String |
getFactoryPid()
For a factory configuration return the PID of the corresponding Managed Service Factory, else return null. |
java.lang.String |
getPid()
Get the PID for this Configuration object. |
java.util.Dictionary |
getProperties()
Return the properties of this Configuration object. |
void |
setBundleLocation(java.lang.String bundleLocation)
Bind this Configuration object to the specified bundle location. |
void |
update()
Update the Configuration object with the current properties. |
void |
update(java.util.Dictionary properties)
Update the properties of this Configuration object. |
Method Detail |
public java.lang.String getPid()
java.lang.IllegalStateException
- if this configuration has been deletedpublic java.util.Dictionary getProperties()
If called just after the configuration is created and before update has been called, this method returns null.
java.lang.IllegalStateException
- if this configuration has been deletedpublic void update(java.util.Dictionary properties) throws java.io.IOException
If the corresponding Managed Service/Managed Service Factory is registered, its updated method will be called on another thread. Else, this callback is delayed until aforementioned registration occurs.
properties
- the new set of properties for this configuration
java.io.IOException
- if update cannot be made persistent
java.lang.IllegalArgumentException
- if the Dictionary object contains invalid configuration types
java.lang.IllegalStateException
- if this configuration has been deletedpublic void delete() throws java.io.IOException
java.io.IOException
- If delete fails
java.lang.IllegalStateException
- if this configuration has been deletedpublic java.lang.String getFactoryPid()
java.lang.IllegalStateException
- if this configuration has been deletedpublic void update() throws java.io.IOException
This is the only way for a bundle that uses a Configuration Plugin service to initate a callback. For example, when that bundle detects a change that requires an update of the Managed Service or Managed Service Factory via its ConfigurationPlugin object.
java.io.IOException
- if update cannot access the properties in persistent storage
java.lang.IllegalStateException
- if this configuration has been deletedConfigurationPlugin
public void setBundleLocation(java.lang.String bundleLocation)
This method requires AdminPermission.
bundleLocation
- a bundle location or null
java.lang.SecurityException
- if the caller does not have AdminPermission
java.lang.IllegalStateException
- if this configuration has been deletedpublic java.lang.String getBundleLocation()
This call requires AdminPermission.
java.lang.SecurityException
- if the caller does not have AdminPermission.
java.lang.IllegalStateException
- if this Configuration object has been deleted.
|
OSGi™ Service Platform Release 2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |