Skip to main content
Pentaho Documentation

IService

pentaho.config.IService

The config.IService interface describes a service that manages configurations, usually of types.

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

The getAsync method gets a filtered configuration for a given environment.

From the returned configuration, rules for specific types or instances can be obtained by calling its selectType and selectInstance, respectively.

Rules that apply to a given type/instance and 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": {
        "type": "my.foo.component"
      },
      "apply": {
        "enabled": false
      }
    },

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

Now, given some implementation of a configuration service, we could use it like in the following example:

configService.getAsync({
  user:        "john",
  application: "not-so-super-app"
}).then(function(config) {

  var mergedConfigSpec = config.selectType("my.foo.component");

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

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

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

Methods

Name Description
getAsync(environment) : Promise.<!pentaho.config.IConfiguration>

Obtains a promise for a configuration that applies to a given platform environment.

selectInstance(instanceId) : Object

Obtains the merged configuration specification of the selection of configuration rules that apply to a given named instance.

selectType(typeId, keyArgs) : Object

Obtains the merged configuration specification of the selection of configuration rules that apply to a given type.

Methods Details

getAsync(environment) : Promise.<!pentaho.config.IConfiguration>

Obtains a promise for a configuration that applies to a given platform environment.

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

Parameters:
Name Default Value Summary
environment : pentaho.environment.IEnvironment
 
Optional

The platform environment that is used to select rules. When unspecified, a "null" environment is used.

A Nully variable value is equivalent to a variable that is not present. It matches only configuration rules that do not select that variable.

When the map is unspecified, every variable will appear as though it had been specified with a null value.

Variable values are matched against each value specified by a rule in its selection variables, using JavaScript's strict equality operator, ===.

Returns:
Name Description
Promise.<!pentaho.config.IConfiguration>

A promise for the configuration.

selectInstance(instanceId) : Object

Obtains the merged configuration specification of the selection of configuration rules that apply to a given named instance.

Source: doc-js/pentaho/config/IConfiguration.jsdoc, line 51

Parameters:
Name Default Value Summary
instanceId : string

The id of the instance whose configuration specification is desired.

Returns:
Name Description
Object

The merged configuration specification, if any rule was selected; or null, if no rule was selected.

selectType(typeId, keyArgs) : Object

Obtains the merged configuration specification of the selection of configuration rules that apply to a given type.

Source: doc-js/pentaho/config/IConfiguration.jsdoc, line 34

Parameters:
Name Default Value Summary
typeId : string

The id of the type whose configuration specification is desired.

keyArgs : Object
 
Optional

The keyword arguments object.

Parameters:
Name Default Value Summary
excludeBases : boolean
 
Optional
false

Indicates that rules that apply to base types should not be considered.

Returns:
Name Description
Object

The merged configuration specification, if any rule was selected; or null, if no rule was selected.