Defining plug-in variables
You can define name and value pairs in config.json
file
to reuse as variables in several areas of the plug-in.
Name and value pairs are defined within a
parms
object.- An item that is defined in
parms
can be referenced by name inconfig.json
. - Component and link transforms can access the values, and then put them in the topology document. Values in the topology document can then be used by other plug-in interfaces and role lifecycle scripts.
- All names that are defined in a
parms
object must have a value. - A
parms
defined inconfig.json
is not exposed in the console unless it is referencedconfig_meta.json
. Plug-in developers have the option of modifying the value and rebuilding the plug-in if they want to customize settings for deployments in their environment. - If a
parms
is referenced inconfig_meta.json
, the value can be modified in the console. This capability enables developers to set a value to"null"
or set a default value and then provide a way for a user to modify the value.To change a value in the console, click Select a plug-in and then click .Configure in the toolbar.
For information about how config.json
is used
to define global plug-in information such as pattern type associations,
parts, and node parts, see "Pattern type packaging reference."
Example
The
wasoracle
plug-in
provides an example of parms
reuse. A parms
object
in config.json
defines two variables for the JDBC
driver."WASOracle" : [
{
"parts" : [
{
"part" : "parts/wasxoracle.scripts.tgz",
"parms" : {
"jdbcDriver" : "$JDBC_DRIVER",
"jdbcInstallDir" : "$JDBC_INSTALL_DIR"
}
}
]
}
Later in the same file, the following parms
object
defines values for JDBC_DRIVER
and JDBC_INSTALL_DIR
"parms" : {
"JDBC_DRIVER" : null,
"JDBC_INSTALL_DIR" : "/opt/oraclejdbcjar"
Because
the JDBC_DRIVER
value is null
, the
user must specify a JDBC file name before the plug-in can be enabled,
and a warning icon is displayed next to the plug-in on the System
Plug-ins page to indicate that the configuration of the plug-in is
incomplete. The config_meta.json
file for the wasoracle
plug-in
includes "id" : "parms.JDBC_DRIVER"
to reference
the JDBC_DRIVER
name and value pair that is defined
in config.json
. [
{
"id" : "parms.JDBC_DRIVER",
"path" : "files",
"label" : "ORA_JDBC_DRIVER",
"description" : "ORA_JDBC_DRIVER_DESC",
"type" : "file",
"extensions" : [ "jar" ]
}
]