Configuration API
You can configure the JavaScript modules with the Pentaho Configuration API. Pentaho uses JavaScript objects, known as Configurations, to conform to the pentaho.config.spec.IRuleSet interface. These Configurations are a set of configuration rules defined in pentaho.config.spec.IRule. Configurations are provided through the value returned by the AMD/RequireJS module. You must register the configuration module with pentaho/modules as an instance of pentaho/config/spec/IRuleSet to use these Configurations.
The Configurations (the configuration rules) are composed of the following parts:
The
selectobjectSpecifies the targeted module, and the values of any
Pentaho environment variablesto which it applies. Alternative values for a variable can be specified using a JavaScript array. The most useful environment variable isapplication, as it allows creating rules that only apply when a module is being used by a certain application. For example, when a variable is used by the CDF or Analyzer application. See Known Values of Pentaho Environment Variables for known values for common applications and themes.The
applyobjectSpecifies the configuration properties and their values. Consult the reference documentation of your target module for a list of available properties. For example, the
Visualization API’sModeltype, being aComplextype, can be configured with the properties of theIComplexTypeinterface. Theapplyproperty can also be a function. You can call it to determine the configuration object, only when and if the selected module or modules are loaded.The
depsarrayContains a list of additional module identifiers that are loaded only when and if the selected module or modules are loaded. When
applyis a function, the values of the specified modules are given as arguments.The
priorityvalueAllows fine-tuning of the order by which rules that target the same module are merged for fine-tuning. Higher values have higher priority. The
priorityvalue is optional and defaults to 0. SeeRule Specificityfor more information on the order by which configuration rules having the same target are merged.
Configuration module example
The following example AMD/RequireJS configuration module contains four configuration rules:
define(function() {
"use strict";
// The value of the module is an IRuleSet.
return {
rules: [
// IRule 1
{
select: {
module: "my/Car",
application: "my/vehicleEditor"
},
apply: {
tireSize: 18,
exteriorColor: "caribbean-blue"
}
},
// IRule 2
{
priority: 1,
select: {
module: "my/Candy"
},
apply: {
cocoaPercentage: 0.9,
fillingFlavour: "orange"
}
},
// IRule 3
{
select: {
module: [
"my/friends/john",
"my/friends/marie"
]
},
apply: {
empathyLevel: 0.6
}
},
// IRule 4
{
select: {
module: "my/houses/main"
},
deps: [
"lodash",
"./baseHouseSchematics"
],
apply: function(_, baseHouseSchematics) {
return _.merge(baseHouseSchematics, {
averageSummerTemperature: 23
});
}
}
]
}
});
This above example contains the following four configuration rules:
The first rule
Targets the
my/Cartype module when it is used by themy/vehicleEditorapplication. This module specifies the value of itstireSizeandexteriorColorproperties.The second rule
Targets the
my/Candytype module for whichever application is using it. This rule has a higher-than-default priority and specifies the value of itscocoaPercentageandfillingFlavourproperties.The third rule
Targets the
my/friends/john1andmy/friends/marieinstance modules for whichever application using them. These modules specify the value of theirempathyLevelproperty.The fourth rule
Targets the instance module
my/houses/main, whatever the application using it, and configures it; the configuration is based on a configuration obtained as a dependency from the sibling modulebaseHouseSchematics.
Global configuration file
Your systems integrators or system administrators can add ad hoc configuration rules by placing them in the global configuration file, which is pre-registered.
The config/web-client/config.js file is located within the Apache Karaf folder. Depending on the product, the Karaf folder is located in following location:
PDI
data-integration/system/karaf/Pentaho Server
pentaho-server/pentaho-solutions/system/karaf/
Your system refreshes its configurations after you edit and save the file. You do not need to restart to apply these ad hoc configurations.
The configuration file is shipped with a small set of illustrative (but commented-out) rules.
You can bundle and deploy your own Pentaho web package containing a registered configuration module as an alternative to using a global configuration file. You can also use the same Pentaho web package to include and register a default configuration along with the component. See Pentaho Web Package for further instructions.
Known values of Pentaho platform environment variables
The following values are already defined as Pentaho platform environment variables:
applicationCDF
pentaho/cdfAnalyzer
pentaho/analyzerAnalyzer in Dashboard Designer
pentaho/dashboardDesignerPDI
pentaho/det
themesapphirecrystalruby
locale
The possible values are those defined by RFC 5646.
Last updated

