Configuration services | ||
---|---|---|
![]() |
||
orion.cm.configadmin |
Orion provides a number of service APIs related to service configuration. This page explains the service configuration APIs. For a basic overview of Orion's service architecture, see Architecture.
A service may need configuration information before it can perform its intended functionality. Such services are called
Managed Services
. A Managed Service implements a method, updated()
, which is called by the Orion configuration framework to provide configuration data to the service. As with all service methods, updated()
is called asynchronously. The configuration data takes the form of a dictionary of key-value pairs, called properties. If no configuration data exists for the Managed Service, null
properties are passed.
A Managed Service needs to receive its configuration information before the service is invoked to perform other work. For example, a configurable
validation service would want to receive any custom validation options (or null
, if no custom options were configured) before actually performing any validation. For this reason, the framework guarantees that a Managed Service's updated()
method will be called prior to any other service methods the service may implement.
Managed Services can be contributed by registering against the
orion.cm.managedservice service name. Every Managed Service must provide a service property named "pid"
which gives a
PID (persistent identifier). The serves as a primary key for the configuration information of a Managed Service.
The Orion concept of a Managed Service is analogous to the OSGi Managed Service.
A Metatype describes the shape of configuration data*. In other words, it specifies what property names can appear in the properties dictionary, and what data types (string, boolean, number, etc) their values may have. Metatype information is defined in terms of Object Class Definitions (OCDs), which can be reused. Metatype information is associated with a Managed Service's PID. Metatype information is optional, so not every Managed Service need have Metatype information associated with it.
Metatype information can be contributed by registering a service with the orion.cm.metatype service name.
The Orion concept of a Metatype is analogous to the OSGi Metatype.
Configuration data is managed by a ConfigurationAdmin service, which maintains a database of Configuration objects. The ConfigurationAdmin monitors the service registry and provides configuration data to Managed Services that are registered. Orion's implementation of ConfigurationAdmin persists configuration data to a Preferences Service.
In JavaScript code, configuration information is represented as Configuration
objects (refer to "orion.cm.Configuration" in the client API reference for details), which are returned by the ConfigurationAdmin's service methods. Because the ConfigurationAdmin service is currently only accessible to code running in the same window as the service registry, Configuration objects cannot be directly interacted with by external services. Managed Services can only receive configuration information via their updated()
method.
The Orion ConfigurationAdmin service is analogous to the OSGi ConfigurationAdmin.
On top of the basic configuration and metatype APIs, Orion also provides a higher-level Settings API. See Plugging into the settings page for details.
![]() |
||
orion.cm.configadmin |