Command Meta
This chapter gives an introduction to the command meta of PAK.
1. Glossary
In the following a short glossary is given to clarify the terms used in this chapter.
Term | Description |
---|---|
User Task |
Describes a command that needs some kind of input from the user, e.g. click a button or choose an item from a list. |
2. Command Meta Information
2.1. What is it
The command meta information is JSON file which contains relevant meta information of a Command implementation.
It contains
-
basic information such as name, id, interpreter, version etc.
-
documentation of the command functionality
-
information about the in- and outputs of a command
-
information about its interpreter
2.2. How is it created
The command meta file should be created by its corresponding Command Interpreter. So each of our existing Command Interpreters (Java, Html,Open-API) has the abilities to create CommandMetas and also to execute / interpret them.
The command meta files needs to be packed inside a somelibrary-pakmeta.jar which is basically a zip file which contains als command-meta json files. Here you can download an example of our generic commands package. Extract it as a zip-file and you will have a folder-structure which contains multiple command-meta json files
2.3. How is it used
It is used by multiple core components.
-
Command- Pool/Collector – to initialize the commands and their needed Command Interpreters for the engine
-
Command Interpreter – to map in- and outputs and to execute the command
-
Apps (Editor / Executor) – for building workflows / showing Documentation
3. Fields of Command Meta
The following fields can be defined by the command meta.
Field name | Description | Example |
---|---|---|
|
Defines the artifact group where the command can be found |
|
|
Defines the artifact name where the command can be found. |
|
|
Flag to tell if the command is deprecated and should not be used anymore. |
|
|
Tells why the command is deprecated. This can be shown to workflow developers. |
Command is deprecated as the api does not support this functionality anymore! |
Human-readable group name. One maven module usually provides one command group. But this is no law. |
Git / Generic / Jenkins / … |
|
|
Unique command id. Usually a fully qualified name analogous to Java classes. |
|
|
Java class of the interpreter implementation that can execute this command. |
|
|
Maven-style command version. Major version should be changed for API breaks, minor version for API enhancements and increment for all other changes (e.g. bugfixes). |
1.0.0 |
List with datastore variables that are read/written. Including their scope and data type. |
|
|
Language independent name of the command |
Git Clone |
|
|
Additional, interpreter specific properties. |
Map of keys and property objects |
List of services required by the command. |
|
|
|
Boolean flag to mark commands as user tasks. |
|
Additional documentation for the workflow developer. |
This command clones a remote repository to a local target |
4. Command Meta – Command Mappings
The command mappings are part of the command meta and contain more information on every datastore variable defined by a command.
Some fields may not be present if their value was not set, e.g. in case no information is present to fill it with.
The following fields are defined for the command mapping.
Field name | Description | Example |
---|---|---|
A list of values that the variable is allowed to hold. |
|
|
|
Boolean-flag that indicates if the given values defined in |
|
|
Object which defines an inclusive range for numerical mappings. |
|
|
Default value of the variable for the case no value will be set in the context. NOTE: This value is not set with Java Commands as the default value is derived from the initialized value in the command itself. |
|
A description for the datastore variable to explain what it is for. |
„The URI is needed to know what instance to clone. Use only github URIs!“ |
|
The name of the group of the variable. |
|
|
|
Flag to tell if the mapping is deprecated and should not be used anymore. |
|
|
Tells why the mapping is deprecated. This can be shown to workflow developers. |
Mapping is deprecated as the api does not support this functionality anymore! |
|
Name of the datastore variable. |
|
Flag that indicates if a value must exist in the datastore before executing the command. |
|
|
A regex to check String values against. |
|
|
Examples of Strings allowed by the pattern. |
HelloWorld, All Strings ending with World |
|
Determines whether the variable is to be read-only, written or both. |
|
|
|
Data type of the variable. |
|
5. Command Meta – Required Services
Commands can require services to function.
These services are also defined in the command meta and have the following property fields.
Field name | Description | Example |
---|---|---|
|
Fully qualified name of the class of the service |
|
|
The datastore key if the service can be found in the datastore |
|
|
Flag to determine if the service is optional or required. False stands for required and is the default. |
|
|
Increment version of the service – increased on bug fix releases |
10 |
|
Major version of the service – increased on non-backward compatible changes |
1 |
|
Minor version of the service – increased on api extensions |
3 |
|
Custom name of the service |
CanDoEverythingAdapter |