Skip to main content
Pentaho Documentation

IService

pentaho.config. IService

The config.IService interface describes a service that manages configurations of modules, and of module annotations, for a given environment.

It is up to the implementation how the environment it uses to select rules is obtained.

The add method is used to register a config.spec.IRuleSet with the service.

The configuration of a module or module annotation can be obtained by calling the selectAsync method.

Rules that apply to a given module and given environment variables are sorted by specificity and then their specifications are merged. For more information on the specificity of rules, see config.spec.IRuleSet.

Suppose that the following rule set is defined in the system:

{
  "rules": [
    // Disable a still experimental component.
    {
      "select": {
        "module": "my.foo.component"
      },
      "apply": {
        "enabled": false
      }
    },

    // Enable it, only for the dev user, "john", and the "super-app" application.
    {
      "select": {
        "module":      "my.foo.component",
        "user":        "john",
        "application": "super-app"
      },
      "apply": {
        "enabled": true
      }
    }
  ]
}

Additionally, assume that an implementation of a configuration service exists, setup for the environment:

{
  "user":        "john",
  "application": "not-so-super-app"
}

We could use it like in the following example:

configService.selectAsync("my.foo.component").then(function(mergedConfigSpec) {

  // Results in a configuration specification like:
  // {
  //   enabled: false
  // }
});

Source: doc-js/pentaho/config/IService.jsdoc, line 17

See also: pentaho.config.service , pentaho.config.spec.IRuleSet

Members

Name Description
getAnnotationsIds

Gets the identifiers of specified annotations of a module, if any, given its identifier.

hasAnnotation

Gets a value that indicates if a module annotation specification exists.

selectAsync

Selects, asynchronously, the configuration of a module, or module annotation, given their identifiers.

Members Details

getAnnotationsIds:

Gets the identifiers of specified annotations of a module, if any, given its identifier.

Source: doc-js/pentaho/config/IService.jsdoc, line 107

hasAnnotation:

Gets a value that indicates if a module annotation specification exists.

Source: doc-js/pentaho/config/IService.jsdoc, line 116

selectAsync:

Selects, asynchronously, the configuration of a module, or module annotation, given their identifiers.

Source: doc-js/pentaho/config/IService.jsdoc, line 96