Difference between revisions of "Orion/Documentation/Developer Guide/Configuration services"

From Eclipsepedia

Jump to: navigation, search
(New page: = Overview of configuration services = Orion provides a number of service APIs related to service configuration. = orion.cm.configadmin = Provides configuration management. This service i...)
 
Line 3: Line 3:
  
 
= orion.cm.configadmin =
 
= orion.cm.configadmin =
Provides configuration management. This service is analogous to the OSGi [http://www.osgi.org/javadoc/r4v42/org/osgi/service/cm/ConfigurationAdmin.html ConfigurationAdmin].
+
The <code>orion.cm.configadmin</code> service provides management of configuration data.
 +
This service is analogous to the OSGi [http://www.osgi.org/javadoc/r4v42/org/osgi/service/cm/ConfigurationAdmin.html ConfigurationAdmin].
 +
 
 +
Here is an example of how to use the ConfigurationAdmin service to print out all existing configurations and their property values:
 +
var configurations = serviceRegistry.getService("orion.cm.configadmin").listConfigurations().then(function(configurations) {
 +
        configurations.forEach(function(configuration) {
 +
            var properties = configuration.getProperties();
 +
            var propertyInfo = Object.keys(properties).map(function(propertyName) {
 +
                if (propertyName !== "pid") {
 +
                    return "\n        " + propertyName + ": " + JSON.stringify(properties[propertyName]) + "\n";
 +
                }
 +
            }).join("");
 +
            console.log("Configuration pid: " + configuration.getPid() + "\n"
 +
                      + "  properties: {" + propertyInfo + "\n"
 +
                      + "  }");
 +
        });
 +
});
 +
The result might look something like this:
 +
Configuration pid: nonnls.config
 +
  properties: {
 +
        enabled: false
 +
  }
 +
Configuration pid: jslint.config
 +
  properties: {
 +
        options: "laxbreak:true, maxerr:50"
 +
  }
 +
 
 +
Refer to <code>orion.cm.ConfigurationAdmin</code> in the client API reference for a full description of this service's API methods.
  
 
= orion.cm.metatype =
 
= orion.cm.metatype =
Line 12: Line 39:
 
Contributes a ''managed service''. A managed service is a service that can receive configuration info.
 
Contributes a ''managed service''. A managed service is a service that can receive configuration info.
 
This is analogus to the OSGi [http://www.osgi.org/javadoc/r4v42/org/osgi/service/cm/ManagedService.html Managed Service].
 
This is analogus to the OSGi [http://www.osgi.org/javadoc/r4v42/org/osgi/service/cm/ManagedService.html Managed Service].
 +
 +
= See also =
 +
[[Orion/Documentation/Developer Guide/Plugging into the settings page|Plugging into the settings page]]

Revision as of 11:35, 27 August 2012

Contents

Overview of configuration services

Orion provides a number of service APIs related to service configuration.

orion.cm.configadmin

The orion.cm.configadmin service provides management of configuration data. This service is analogous to the OSGi ConfigurationAdmin.

Here is an example of how to use the ConfigurationAdmin service to print out all existing configurations and their property values:

var configurations = serviceRegistry.getService("orion.cm.configadmin").listConfigurations().then(function(configurations) {
        configurations.forEach(function(configuration) {
            var properties = configuration.getProperties();
            var propertyInfo = Object.keys(properties).map(function(propertyName) {
                if (propertyName !== "pid") {
                    return "\n        " + propertyName + ": " + JSON.stringify(properties[propertyName]) + "\n";
                }
            }).join("");
            console.log("Configuration pid: " + configuration.getPid() + "\n"
                      + "  properties: {" + propertyInfo + "\n"
                      + "  }");
        });
});

The result might look something like this:

Configuration pid: nonnls.config
  properties: {
        enabled: false
  }
Configuration pid: jslint.config
  properties: {
        options: "laxbreak:true, maxerr:50"
  }

Refer to orion.cm.ConfigurationAdmin in the client API reference for a full description of this service's API methods.

orion.cm.metatype

Contributes type definitions, which may be associated with a service's configuration. This is analogus to the OSGi Metatype.

orion.cm.managedservice

Contributes a managed service. A managed service is a service that can receive configuration info. This is analogus to the OSGi Managed Service.

See also

Plugging into the settings page