@ProviderType
public interface ConfigurationService
ConfigurableComponent
or the SelfConfiguringComponent
interface.
It works in concert with the OSGi Configuration Admin and the OSGi Meta Type services.
What it provides over the native OSGi services is the ability to easily access the current
configuration of a Configurable Component or a SelfConfiguring Component together with
their full Meta Type Object Class Definition,
the ability to take snapshots of the current configuration of all managed
services or rollback to older snapshots and, finally, the ability to access
and manage configurations remotely through the Cloud Service.
createFactoryConfiguration(String, String, Map, boolean)
.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
KURA_SERVICE_PID
The name of the the Kura persistent identity property.
|
Modifier and Type | Method and Description |
---|---|
void |
createFactoryConfiguration(java.lang.String factoryPid,
java.lang.String pid,
java.util.Map<java.lang.String,java.lang.Object> properties,
boolean takeSnapshot)
Creates a new ConfigurableComponent instance by creating a new configuration from a
Configuration Admin factory.
|
void |
deleteFactoryConfiguration(java.lang.String pid,
boolean takeSnapshot)
Deletes the ConfigurableComponent instance having the specified PID.
|
ComponentConfiguration |
getComponentConfiguration(java.lang.String pid)
Returns the ComponentConfiguration for the component identified with specified PID.
|
java.util.List<ComponentConfiguration> |
getComponentConfigurations()
Returns the list of ConfigurableComponents currently registered with the ConfigurationService.
|
java.util.Set<java.lang.String> |
getConfigurableComponentPids()
Return the PIDs for all the services that
implements the ConfigurableComponent Maker interface and registered themselves
with the container.
|
ComponentConfiguration |
getDefaultComponentConfiguration(java.lang.String pid)
Returns the default ComponentConfiguration
for the component having the specified PID.
|
java.util.Set<java.lang.String> |
getFactoryComponentPids()
Returns the list of Meta Type factory PIDs tracked by the Configuration Service.
|
java.util.List<ComponentConfiguration> |
getSnapshot(long sid)
Loads a snapshot given its ID and return the component configurations stored in that snapshot.
|
java.util.Set<java.lang.Long> |
getSnapshots()
Returns the ID of all the snapshots taken by the ConfigurationService.
|
long |
rollback()
Rolls back to the last saved snapshot if available.
|
void |
rollback(long id)
Rolls back to the specified snapshot id.
|
long |
snapshot()
Takes a new snapshot of the current configuration of all the registered ConfigurableCompoenents.
|
void |
updateConfiguration(java.lang.String pid,
java.util.Map<java.lang.String,java.lang.Object> properties)
Updates the Configuration of the registered component with the specified PID.
|
void |
updateConfiguration(java.lang.String pid,
java.util.Map<java.lang.String,java.lang.Object> properties,
boolean takeSnapshot)
Updates the Configuration of the registered component with the specified pid.
|
void |
updateConfigurations(java.util.List<ComponentConfiguration> configs)
Updates the Configuration of the registered components.
|
void |
updateConfigurations(java.util.List<ComponentConfiguration> configs,
boolean takeSnapshot)
Updates the Configuration of the registered components.
|
static final java.lang.String KURA_SERVICE_PID
java.util.Set<java.lang.String> getFactoryComponentPids()
void createFactoryConfiguration(java.lang.String factoryPid, java.lang.String pid, java.util.Map<java.lang.String,java.lang.Object> properties, boolean takeSnapshot) throws KuraException
factoryPid
- the ID of the factory.pid
- the value of the KURA_SERVICE_PID
that will be set in the component configuration properties.properties
- an optional map of properties describing the component configuration.
The Configuration Service will first create an initial map of properties
with the property KURA_SERVICE_PID
set to the provided pid parameter and
with the default component configuration from its OSGi Meta Type.
If properties is not null, the Configuration Service will first remove
KURA_SERVICE_PID
from the provided properties and then it will merge them with the initial map.takeSnapshot
- if set to true a snapshot will be taken.KuraException
- if pid is null, it already exists or creation fails.void deleteFactoryConfiguration(java.lang.String pid, boolean takeSnapshot) throws KuraException
pid
- the PID of the component instance to delete.takeSnapshot
- if set to true a snapshot will be taken.KuraException
- if the PID is not found or if the component instance was not created
via createFactoryConfiguration(String, String, Map, boolean)
.java.util.Set<java.lang.String> getConfigurableComponentPids()
java.util.List<ComponentConfiguration> getComponentConfigurations() throws KuraException
KuraException
ComponentConfiguration getComponentConfiguration(java.lang.String pid) throws KuraException
pid
- The ID of the component whose configuration is requested.KuraException
ComponentConfiguration getDefaultComponentConfiguration(java.lang.String pid) throws KuraException
pid
- The ID of the component whose configuration is requested.KuraException
void updateConfiguration(java.lang.String pid, java.util.Map<java.lang.String,java.lang.Object> properties) throws KuraException
pid
- The PID of the component whose configuration is requested.properties
- Properties to be used as the new Configuration for the specified Component.KuraException
- if the properties specified do not pass the validation of the ObjectClassDefinitionvoid updateConfiguration(java.lang.String pid, java.util.Map<java.lang.String,java.lang.Object> properties, boolean takeSnapshot) throws KuraException
pid
- The PID of the component whose configuration is requested.properties
- Properties to be used as the new Configuration for the specified Component.takeSnapshot
- defines whether or not this configuration update should trigger a snapshot.KuraException
- if the properties specified do not pass the validation of the ObjectClassDefinition.void updateConfigurations(java.util.List<ComponentConfiguration> configs) throws KuraException
configs
- The list of ComponentConfiguration whose update is requested.KuraException
- if the properties specified do not pass the validation of the ObjectClassDefinitionvoid updateConfigurations(java.util.List<ComponentConfiguration> configs, boolean takeSnapshot) throws KuraException
configs
- The list of ComponentConfiguration whose update is requested.takeSnapshot
- defines whether or not this configuration update should trigger a snapshot.KuraException
- if the properties specified do not pass the validation of the ObjectClassDefinitionjava.util.Set<java.lang.Long> getSnapshots() throws KuraException
KuraException
java.util.List<ComponentConfiguration> getSnapshot(long sid) throws KuraException
sid
- - ID of the snapshot to be loadedKuraException
long snapshot() throws KuraException
KuraException
long rollback() throws KuraException
KuraException
- if no snapshots are available orvoid rollback(long id) throws KuraException
id
- ID of the snapshot we need to rollback toKuraException
- if the snapshot is not found