org.ops4j.pax.coin.spi
Interface ConfigGroup


public interface ConfigGroup

Group of configurations.

Since:
0.3.0, February 26, 2008
Author:
Alin Dreghiciu

Method Summary
 void delete(String id)
          Deletes a configuration item.
 Config getConfiguration(String id)
          Returns the configuration with the specified id, if exists.
 Config[] getConfigurations()
          Returns an array of configurations that belong to this group.
 String getId()
          Configuration group identifier.
 String getLocation()
          Bundle location of the targeted managed service/managed service factory.
 String getMetadata(String key)
          Returns the value of a metadata property by key.
 boolean isEmpty()
          Returns true if there is no configuration in this group
 void setLocation(String location)
          Sets the bundle location for this configuration.
 void setMetdata(String key, String value)
          Sets a metadata property.
 void update(String id, Map<String,Object> properties)
          Updates a configuration item.
 

Method Detail

getId

String getId()
Configuration group identifier. Cannot be null.
/ If the configuration group is targeting a managed service, the id must be equal with the persistent identifier (pid) of targeted managed service.
If the configuration groups is targeting a managed service factory, the id must be equal with the factory persistent identifier (factory pid) of targeted managed service factory.

Returns:
identifier

getLocation

String getLocation()
Bundle location of the targeted managed service/managed service factory. Can be null if the configuration is not bounded, case when it will be bounded on first use.

Returns:
location if configuration is bounded, null otherwise.

setLocation

void setLocation(String location)
Sets the bundle location for this configuration. If location is null the location is considered an unbounded configuration.

Parameters:
location - bundle location or null for an unbounded configuration
Throws:
IllegalArgumentException - - If location is empty

getMetadata

String getMetadata(String key)
Returns the value of a metadata property by key. Metadata contains custom information about the configuration that can be used for example during selection of an active configuration (see ConfigSelector for details). Examples of metadata:
- timestamp: configuration time stamp such as when it was last updated - version: configuration version

Parameters:
key - metadata key
Returns:
metadata value

setMetdata

void setMetdata(String key,
                String value)
Sets a metadata property. If the property value is null, metadata property is removed.

Parameters:
key - metadata key
value - metadata value

getConfigurations

Config[] getConfigurations()
Returns an array of configurations that belong to this group. Cannot be null. In the case that the group does not contain any configuration it should return an empty array (size 0).
For a managed service the returned array should contain only one configuration.
For a managed service factory it can contain any number of configurations.

Returns:
aray of configurations

getConfiguration

Config getConfiguration(String id)
Returns the configuration with the specified id, if exists. If there is no configuration with the specified id it will return null.

Parameters:
id - configuration id
Returns:
configuration for the specified id or null if such a configuration does not exist

isEmpty

boolean isEmpty()
Returns true if there is no configuration in this group

Returns:
true if there is no configuration in this group

update

void update(String id,
            Map<String,Object> properties)
Updates a configuration item.

Parameters:
id - configuration item identifier; cannot be null
properties - configuration properties; cannot be null
Throws:
IllegalArgumentException - - If id is null or empty - If properties is null

delete

void delete(String id)
Deletes a configuration item.

Parameters:
id - configuration item identifier; cannot be null
Throws:
IllegalArgumentException - - If id is null or empty
IllegalStateException - - If there is no configuration item with the specified id


Copyright © 2006-2012 OPS4J - Open Participation Software for Java. All Rights Reserved.