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.<<code>!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.<<code>!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
|
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
|
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
|