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
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* |
|
Error |
patterntypes* |
The file must contain a Examples of valid elements.
|
Error | |
For primary pattern types:
For
secondary pattern types:
|
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" |
|
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 |
|
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:
|
Warning | |
Each service component that is mapped to a component
in metadata.json must provide the interface:
|
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: |
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
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 |
|
Error | |
sampleValue |
|
Error | |
boolean | sampleValue |
|
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:
|
Error |
number | min,max |
The min and max attributes
are optional. If specified, the following requirements apply:
|
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:
|
Error | |
range | min, max |
The min and max attributes
are required.
|
Error |
sampleValue |
If there is a "sampleValue" attribute,
it must be a JSON array of two Long numbers.
|
Error |
Pattern type validation
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.
|
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 |