|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ConfigurationService
The Configuration Service is used to manage the configuration of ConfigurableComponents.
It works in concert with the OSGi ConfigurationAdmin and the OSGi MetaTypeService services.
What it provides over the native OSGi services is the ability to easily access the current
configuration of a ConfigurableComponent together with its full ObjectClassDefintion,
the ability to take snapshots of the current configuration of all registered
ConfigurableComponents or rollback to older snapshots and, finally, the ability to access
and manage configurations remotely through the CloudService.
The Configuration Service operates on a subset of all the Components registered under the OSGi container.
It tracks all OSGi Components which implement the ConfigurableComponent
marker interface.
When a ConfigurableComponent is registered, the Configuration Service will call its "update"
method with the latest saved configuration as returned the ConfigurationAdmin or, if none
is available, with the Configuration properties fabricated from the default attribute values as
specified in the ObjectClassDefinition of this service.
In OSGi terms, this process in similar to the Auto Configuration Service.
The ConfigurationService assumes that Meta Type Information XML resource
for a given Declarative Service with name abc" to be stored under OSGI-INF/metatype/abc.xml.
This is an extra restriction over the OSGi specification: the Meta Type Information XML resource
must be named as the name of the Declarative Service Component.
The ConfigurationService has the ability to create a snapshot for the current configuration
of all the registered ConfigurableComponents. The snapshot is saved in the form of an
XML file stored under $EsfHome/snapshots/snapshot_epoch.xml where epoch is replaced
with the epoch timestamp at the time of the snapshot creation.
The ConfigurationService also has the ability to rollback the configuration of the
registered components taking them back to a previous stored snapshot.
The ConfigurationService interacts with the CloudService to allow to access
current configuration and to modify it remotely through messages sent and received via cloud.
Method Summary | |
---|---|
ComponentConfiguration |
getComponentConfiguration(String pid)
Returns the ComponentConfiguration for the component identified with specified PID (service's persistent identity). |
List<ComponentConfiguration> |
getComponentConfigurations()
Returns the list of ConfigurableComponents currently registered with the ConfigurationService. |
Set<String> |
getConfigurableComponentPids()
Return the PIDs (service's persistent identity) for all the services that implements the ConfigurableComponent Maker interface and registered themselves with the container. |
List<ComponentConfiguration> |
getSnapshot(long sid)
Loads a snapshot given its ID and return the component configurations stored in that snapshot. |
Set<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(String pid,
Map<String,Object> properties)
Updates the Configuration of the registered component with the specified pid. |
void |
updateConfigurations(List<ComponentConfiguration> configs)
|
Method Detail |
---|
Set<String> getConfigurableComponentPids()
List<ComponentConfiguration> getComponentConfigurations() throws EsfException
EsfException
ComponentConfiguration getComponentConfiguration(String pid) throws EsfException
pid
- The ID of the component whose configuration is requested.
EsfException
void updateConfiguration(String pid, Map<String,Object> properties) throws EsfException
pid
- The ID of the component whose configuration is requested.properties
- Properties to be used as the new Configuration for the specified Component.
EsfException
- if the properties specified do not pass the validation of the ObjectClassDefinitionvoid updateConfigurations(List<ComponentConfiguration> configs) throws EsfException
EsfException
Set<Long> getSnapshots() throws EsfException
EsfException
List<ComponentConfiguration> getSnapshot(long sid) throws EsfException
sid
- - ID of the snapshot to be loaded
EsfException
long snapshot() throws EsfException
EsfException
long rollback() throws EsfException
EsfException
- if no snapshots are available orvoid rollback(long id) throws EsfException
id
- ID of the snapshot we need to rollback to
EsfException
- if the snapshot is not found
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |