Plug-in validation

When you build or import a plug-in, a validation check runs to verify the contents of the plug-in.

During the validation process, the validator identifies issues and generates errors or warnings that are based on the type of issue. If an error is found, the build or import operation fails. The following sections describe which files are validated and what validation rules are applied.

Plug-in validation

Table 1. Validation criteria for plug-ins
Object Validated item Validation criteria Result if validation fails
JSON files *.json The file must contain well-formed JSON syntax Error
appmodel/locales/messages.json   If the file exists, the file must contain well-formed JSON syntax Warning
config.json name*
  • Must be a non-empty string
  • Cannot contain a forward slash (/)
Error
  patterntypes*

The file must contain a patterntypes element. At a minimum, a primary pattern type or a secondary pattern type must be defined.

Examples of valid elements.
"patterntypes" : {"primary" : {"webapp":"2.0"} }

"patterntypes" : {"secondary" : [ {"*" : "*"} ]   }

"patterntypes" : {"primary" : {"dbaas":"1.1"},
                  "secondary ": {"webapp":"*"} }
Error
   
For primary pattern types:
  • The pattern type must be in a JSON object
  • The version must be a string and match the regular expression
    [\d+(\.\d+)]
    The format of the version number N.N. For example 1.2.
A plug-in must have only one primary pattern type.
For secondary pattern types:
  • The pattern types must be in a JSON object or a JSON array.
  • The version must be a string and match the regular expression
    [(\d+(\.\d+))|\*]
    The format of the version number is N.N. For example 1.2. To indicate any version, * is supported.
Error
  version* The plug-in version must be a non-empty string and match the regular expression [\d+(\.\d+){3}]. The format of the version number must be N.N.N.N. For example, a valid version number is 1.0.0.3. Error
  "parts","node-parts"
  • At build-time, the corresponding directory of each "part" and "node-part" declared in config.json must exist in the /plugin directory.
  • During import, the corresponding .tgz package file of each "part" and "node-part" declared in config.json must exist in the /plugin directory
Build: Error
Import: Warning
config_meta.json   If the file exists, it is a JSON array of JSON objects, each of which is a valid attribute. The id should start with "parms" Warning
metadata.json attributes
  • If the file exists, it must be a valid JSON array of JSON objects. Each JSON object can have an "attributes" attribute, which must be a JSON array of JSON objects, or null for no attributes. Each of these JSON objects must represent a valid attribute.
  • For all attributes, sampleValue must be consistent with the value of the type (string, number, boolean)
  • For the attributes with the type range:
    • min must be less than sampleValue
    • sampleValue must be less than max
Build: Error
Import: Warning
Python files *.py All .py files in parts and nodeparts directories cannot contain syntax errors. Build: Error
/parts directory   If a plug-in has a parts directory, it cannot be empty. Warning
  Each part Each ${PART}.tgz or directory under /parts must include an install.py part installation script. Warning
Transformer .jar file META-INF/ MANIFEST.MF Each bundle must contain a MANIFEST.MF Error
    MANIFEST.MF must declare Service-Component Warning
    The .xml referenced in Service-Component in MANIFEST.MF must exist.
Build: Warning
Import: Error
    MANIFEST.MF must reference all .xml files under the directory OSGI-INF/ Warning
  OSGI-INF/*.xml The bundle must provide a valid interface:
"com.ibm.maestro.model.transform.TopologyProvider",

"com.ibm.maestro.plugin.services.PluginProvider",

"com.ibm.maestro.model.transform.TopologyProcessor",

"com.ibm.maestro.iaas.ServiceProvisioner",

"com.ibm.maestro.iaas.RegistryProvider",

"com.ibm.maestro.iaas.PostProvisioner
Warning
    Each service component that is mapped to a component in metadata.json must provide the interface:
"com.ibm.maestro.model.transform.TopologyProvider"
Error
operation.json   If the file exists, it must be a valid JSON object. Each element of the JSON object must have a String key (which is a role name) and a value, which is a JSON array of JSON objects, each of which presents an operation that is exposed by the role. Build: Error
  "id" Each operation JSON object must have an "id" attribute, with a value that is unique and a non-null String. Build: Error
  "script" Each operation JSON object must have a "script" attribute, with a value that is a non-null String. The value is the name of a script to execute, like operation1.py. The script name can be followed by a space and a parameter or method name. The script (.py file) referenced in operation.json must exist. Build: Error
  "attributes" Each operation JSON object can have an "attributes" attribute, which must be a JSON array of JSON objects, or null for no attributes. Each of these attribute JSON objects must represent valid attributes. Build: Error
  "preset_status" Each operation JSON object can have a "preset_status" attribute, with a value that is a non-null String. The value must be one of these valid Role states:
INITIAL
INITIALIZING
INSTALLING
CONFIGURING
ERROR
FAILED
RUNNING
SAFERUNNING
STARTING
STOPPING
STOPPED
TERMINATING
TERMINATED
SUSPENDING
SUSPEND_SUCCESSED
SUSPEND_FAILED
CHECKPOINTING
CHECKPOINT_SUCCESSED
CHECKPOINT_FAILED
RESUMING
UNKNOWN
Build: Error
tweak.json   If the file exists, it must be a valid JSON array of tweak JSON objects. Each tweak JSON object must be a valid attribute and include an "id" attribute with a non-null String value. The tweak.json file can refer to attributes defined in metadata.json. The reference is made by using the "ref-id" attribute, and one of the "ref-component", "ref-link", "ref-policy" attributes. These attributes should all be non-null Strings. A valid ref tweak JSON object has 3 keys: "id", "ref-id", and one "ref-component", "ref-link", or "ref-policy". Build: Error
  "ref-id", "ref-xxxxx" The referenced attribute (ref-id) in the referenced component/link/policy must exist in metadata.json. Build: Error
Velocity templates /template/*.vm All .vm template file must use correct syntax Error
    Each .xml file of a template transformer must reference a valid .vm template file. Error

Attribute validation

Table 2. Validation criteria for attributes
Attribute Validated item Validation criteria Result if validation fails
All attributes id The value must be a non-null, non-empty String. Error
  type The value must be a String. Only the following values are valid: string, boolean, number, range, file, array. Error
string regExp If there is a regExp attribute, it must be a String containing a valid Java™ regular expression. Error
  options
  • If there is an options attribute, it must be a non-empty JSON array that contains JSON objects.
  • Each JSON object must have "name" and "name" attributes that are Strings.
  • The name value cannot be null. It can be a String that represents a Kernel Services API call.
Error
  sampleValue
  • If there is a sampleValue attribute, it must be a non-null String.
  • If "regExp" is specified, the value of sampleValue must match the regular expression that is defined by "regExp".
  • If "options" is specified, the sampleValue must be one of the options.
Error
boolean sampleValue
  • If there is a sampleValue attribute, it must be a valid boolean value: true or false JSON values.
  • A null value is interpreted as true.
  • A String of "true", ignoring case, is interpreted as true. Any other string value is interpreted as false.
  • Any other value type is invalid, including a number.
Error
file extensions If there is an "extensions" attribute, it must be a non-empty JSON array that contains Strings. Error
array entryType
An array must include one of the following attributes:
  • An "entryType" attribute. Only the following values are valid: string, boolean, number, range, file, array.
  • Both a "referenceKey" attribute and a "referenceType" attribute.
These attributes must be non-null Strings.
Error
number min,max The min and max attributes are optional. If specified, the following requirements apply:
  • The value must be a Long number.
  • If both min and max attributes are specified and have valid values, the min value must be less than or equal to the max value.
Error
  sampleValue If there is a "sampleValue" attribute, it must be a valid Long number. Null is a valid value. The sample value must be:
  • Greater than or equal to a specified min value.
  • Less than or equal to a specified max value.
Error
range min, max The min and max attributes are required.
  • For each attribute, the value must be a Long number.
  • The min value must be less than or equal to the max value.
Error
  sampleValue If there is a "sampleValue" attribute, it must be a JSON array of two Long numbers.
  • The sample minimum value must be greater than or equal to a specified min value.
  • The sample maximum value must be less than or equal to a specified max value.
  • The first sample value must be less than or equal to the second sample value.
Error

Pattern type validation

Table 3. Validation criteria for pattern types
Object Validated item Validation criteria Result if validation fails
All .json files *.json The file must contain well-formed JSON syntax. This validation occurs only at build time. Error
patterntype.json name This validation occurs only at build time.
  • Must be a non-empty string
  • Cannot contain a forward slash (/)
Error
  version This validation occurs only at build time. The pattern type version must be a non-empty string and match the regular expression [\d+(\.\d+){3}]. The format of the version number must be N.N.N.N. For example, a valid version number is 1.0.0.3. Error
  firmware Optional. This validation occurs only during import of the pattern. The value must be a string that is listed in VRMF format. For example, a valid firmware number is 3.1.0.7. The PLATFORM.FIRMWARE_LEVEL reported by the platform must be equal to or greater than the specified firmware value. Error