|
Key
This line was removed.
This word was removed. This word was added.
This line was added.
|
Changes (99)
View Page History{code}
On Windows, this command is wrapped by another shell: petals-cli-console.bat. script: *petals-cli-console.bat*.
On Linux, there is no wrapper script but a shell alias can be created.
h3. Getting help on command line options and arguments
The help on command line options and arguments is available through the '_\-H_' option '-H'. A text containing options, arguments and available commands is displayed according to the usage defined above.
{code}
> ./petals-cli.sh -H
> ./petals-cli.sh -H
h3. Getting help on commands from the command line
The help on a command is available by using the command '{{help}}'. '_help_'. A usage and a description of the command is displayed:
{code}
> ./petals-cli.sh -c help <command>
> ./petals-cli.sh -c help <command>
<command description>
>
{code}
{code}
h3. Getting help on available commands and on a command in interactive mode
The list of available commands is available by using the command '{{help}}' '_help_' without argument.
Help about a command is available by using the '{{help}}' '_help_' command. Command's usage and description are then displayed.
{code}> ./petals-cli.sh -C
<command description>
>
petals-cli>
{code}
where:
where:
h2. Getting the version of Petals CLI
To get the version of Petals CLI, the version of the JVM running Petals CLI, and its operating system, use the '_\-V_' option:
{code}
> ./petals-cli.sh -V
> ./petals-cli.sh -V
{code}
In interactive mode, you can also use the '_version_' command.
{code}
petals-cli> version
Petals JMX Command Line Interface 1.1.0-SNAPSHOT
Java(TM) SE Runtime Environment 1.6.0_26-b03
Linux 3.0.0-16-generic-pae
petals-cli>
{code}
{code}
petals-cli> version
Petals JMX Command Line Interface 1.1.0-SNAPSHOT
Java(TM) SE Runtime Environment 1.6.0_26-b03
Linux 3.0.0-16-generic-pae
petals-cli>
{code}
h2. Return codes of Petals CLI
When there is an error about options and arguments of a command, the return code of Petals CLI is 1.
h3. Return code when executing a system command in Petals CLI
When a system command is executed in Petals CLI, the return code is the one of the system command.
When a system command is executed in Petals CLI, the return code is the one of the system command.
h2. Error management
h2. Exit from the 'console' mode
To exit the 'console' mode, use the '{{{*}exit{*}}}' '_exit_' command. If a number is set as an argument, it is used as a return code. Otherwise, the return code 0 is used.
{code}
> ./petals-cli.sh -C
> ./petals-cli.sh -C
{code}
h2. Petals CLI Preferences
It is possible to define preferences in Petals CLI.
The preferences are defined a properties file, as key/value pairs.
By default, this file is located in *_$PETALS_CLI_HOME_/conf/preferences.properties*.
However, it is possible to move this file somewhere else thanks to an environement variable.
*_$PETALS_CLI_PREFS_* is the variable environement that points to the location of the preferences file.
This file contains the following keys:
* *host*: the host of the default Petals node (required). Initial Value: localhost
* *port*: the JMX port of the default Petals node (required). Initial Value: 7700
* *user*: the JMX user name for the default Petals node (optional). Initial Value: petals
* *password*: the JMX password for the default Petals node (optional). Initial Value: petals
* *lang*: the language to use in Petals CLI (FR/EN for the moment). If the value is unknown, then English is picked up.
When optional keys are not defined, Petals CLI will ask for their values manually (or you will have to use the right options with the commands).
If the file does not exist, or that *_$PETALS_CLI_PREFS_* points to an invalid location, Petals CLI will use default settings when possible. Otherwise, it will display an error message.
It is possible to define preferences in Petals CLI.
The preferences are defined a properties file, as key/value pairs.
By default, this file is located in *_$PETALS_CLI_HOME_/conf/preferences.properties*.
However, it is possible to move this file somewhere else thanks to an environement variable.
*_$PETALS_CLI_PREFS_* is the variable environement that points to the location of the preferences file.
This file contains the following keys:
* *host*: the host of the default Petals node (required). Initial Value: localhost
* *port*: the JMX port of the default Petals node (required). Initial Value: 7700
* *user*: the JMX user name for the default Petals node (optional). Initial Value: petals
* *password*: the JMX password for the default Petals node (optional). Initial Value: petals
* *lang*: the language to use in Petals CLI (FR/EN for the moment). If the value is unknown, then English is picked up.
When optional keys are not defined, Petals CLI will ask for their values manually (or you will have to use the right options with the commands).
If the file does not exist, or that *_$PETALS_CLI_PREFS_* points to an invalid location, Petals CLI will use default settings when possible. Otherwise, it will display an error message.
h1. Connection to a Petals node
h2. Interacting with several Petals nodes without exiting Petals CLI
In interactive mode or script mode, we should be able to close a connection and open another one without leaving Petals CLI. This is achieved with the '{{{*}connect{*}}}' and '{{{*}disconnect{*}}}' commands. If no argument is set on the 'connect' command, default values are used. These default values are specified in a properties file located in the Petals CLI directory. The default values defined in this properties file are (localhost:7700, login=petals, pwd=petals).
In interactive mode or script mode, we should be able to close a connection and open another one without leaving Petals CLI. This is achieved with the '_connect_' and '_disconnect_' commands. If no argument is set on the '_connect_' command, default values are used. These default values are specified in the preferences file.
{code}
By default (if no argument or option is set):
- In 'console' console mode, the connection is established on command '{{{*}connect{*}}}' to with the values given in the preferences file.
{code}
> ./petals-cli.sh -C
> ./petals-cli.sh -C
{code}
- The confirmation can be skipped by adding the "yes" '_yes_' argument to the command.
{code}
> ./petals-cli.sh -C
> ./petals-cli.sh -C
{code}
- In 'command line' mode, if no argument or option is set, a connection is established to with the values defined in the preferences file.
{code}
h2. Working with JBI artifacts
h3. Installation/Deployment and start of an artifact in one command
h3. Installation/Deployment and Start of an Artifact at once
Petals CLI is able to install/deploy and start a JBI artifact without distinction between shared-library, component and service assembly using the following command:
{code}
where:
where:
* {{<artifact-file>}} *<artifact-file>* is the local file name or the URL of the artifact to install or deploy and start
* {{<configuration-file>}} *<configuration-file>* is the local file name or the URL of the properties file used to configure the artifact. This argument is used only if the artifact is a component. It has no sense for other artifacts. This argument is exclusive with {{<configuration-properties>}}.
* {{<configuration-properties>}} *<configuration-properties>* is a list of '{{<property-name>=<property-value>}}', '_<property-name>=<property-value>_', separated by a space, where {{<property-name>}} _<property-name>_ is the name of the property to configure with {{<property-value>}}. _<property-value>_. This argument is used only if the artifact is a component. It has no sense for other artifacts. This argument is exclusive with {{<configuration-file>}}. *<configuration-file>*.
\\
{tip}Auto-completion is available on artifacts IDs and artifact file names.{tip}
h3. Installation/Deployment of an aArtifact located into a Maven repository
Petals CLI is able to install/deploy and start an JBI artifact located into a Maven repository using the following command:
{code}
where:
where:
* {{<maven-artifact>}} *<maven-artifact>* is the Maven identifiers of the artifact to install: {{group-id:artifact-id:version{}}}{{[:classifier]}}. _group-id:artifact-id:version\[:classifier\]_. If required, the Maven repository can be defined in the Maven configuration file ($HOME/.m2/settings.xml)
* {{<configuration-file>}} *<configuration-file>* is the local file name or the URL of the properties file used to configure the artifact. This argument is used only if the artifact is a component. It has no sense for other artifacts. This argument is exclusive with {{<configuration-properties>}}.
* {{<configuration-properties>}} is a list of '{{<property-name>=<property-value>}}', separated by space, where {{<property-name>}} is the name of the property to configure with {{<property-value>}}. This argument is used only if the artifact is a component. It has no sense for other artifacts. This argument is exclusive with {{<configuration-file>}}.
* *<configuration-properties>* is a list of '_<property-name>=<property-value>_', separated by a white character, where _<property-name>_ is the name of the property to configure with _<property-value>_. This argument is used only if the artifact is a component. It has no sense for other artifacts. This argument is exclusive with *<configuration-file>*.
h3. Installation/Deployment and start in mass
To deploy several artifacts in one command, just put them in a local directory and execute the command '{{{*}deploy{*}}}': '_deploy_':
{code}
> ./petals-cli.sh -y - << EOF
> ./petals-cli.sh -y - << EOF
{code}
If the argument {{<artifact-file>}} _<artifact-file>_ of the '_deploy_' command {{deploy}} is a local directory, all artifacts of the directory are deployed. In this case, a confirmation is expected, except if the flag '_yes_' is set on the command line. A confirmation message is displayed in the mode 'console', console, except if the flag '_yes_' is set on the command line.
h3. Starting an artifact
An artifact can be started using the command '{{{*}start{*}}}' with the argument '{{{*}artifact{*}}}':
An artifact can be started by using the '_start_' command with the argument '_artifact_':
{code}
> ./petals-cli.sh -c start artifact [ <artifact-file> | [<artifact-type> <artifact-id>] ]
{code}
where:
> ./petals-cli.sh -c start artifact [ <artifact-file> | [<artifact-type> <artifact-id>] ]
{code}
where:
* {{<artifact-file>}} *<artifact-file>* is the local file name or the URL of the artifact to start.
* {{<artifact-type>}} *<artifact-type>* is the nature (SL, component, SA) of the artifact to start.
* {{<artifact-id>}} *<artifact-id>* is the JBI identifier of the artifact to start.
\\
{tip}Auto-completion is available on artifacts IDs and artifact file names.{tip}
h3. Stopping an artifact
h3. Stopping an artifact
An artifact can be stopped using the command '{{{*}stop{*}}}' '_stop_' with the argument '{{{*}artifact{*}}}': '_artifact_':
{code}
> ./petals-cli.sh -c stop artifact [ <artifact-file> | [<artifact-type> <artifact-id>] ]
{code}
where:
> ./petals-cli.sh -c stop artifact [ <artifact-file> | [<artifact-type> <artifact-id>] ]
{code}
where:
* {{<artifact-file>}} *<artifact-file>* is the local file name or the URL of the artifact to stop.
* {{<artifact-type>}} *<artifact-type>* is the nature (SL, component, SA) of the artifact to stop.
* {{<artifact-id>}} *<artifact-id>* is the JBI identifier of the artifact to stop.
\\
{tip}Auto-completion is available on artifacts IDs and artifact file names.{tip}
h3. Uninstallation/Undeployment and stop of an artifact in one command
h3. Uninstallation/Undeployment and Stop of an Artifact at once
Petals CLI is able to stop and uninstall/undeploy a JBI artifact without distinction between shared-library, component and service assembly using the following command:
{code}
where:
where:
* {{<artifact-file>}} *<artifact-file>* is the local file name or the URL of the artifact to undeploy.
* {{<artifact-type>}} *<artifact-type>* is the nature (SL, component, SA) of the artifact to undeploy.
* {{<artifact-id>}} *<artifact-id>* is the JBI identifier of the artifact to undeploy.
\\
{tip}Auto-completion is available on artifacts IDs and artifact file names.{tip}
h3. Uninstallation/Undeployment and stop in mass
h3. Bulk Undeployment and Stop
To undeploy several artifacts in one command, just put them in a local directory and execute the command '{{{*}undeploy{*}}}': '_undeploy_' command:
{code}
> ./petals-cli.sh -y - << EOF
> ./petals-cli.sh -y - << EOF
{code}
If no argument is set on command {{undeploy}}, all artifacts are undeployed. In this case a confirmation is expected, except if the flag 'yes' is set on the command line. A confirmation message is displayed in the mode 'console', except is the flag 'yes' is set on the command line.
If no argument is set on command '_undeploy_', all the artifacts are undeployed. In this case a confirmation is expected, except if the '_yes_' flag is set on the command line. A confirmation message is displayed in the console mode, except is the '_yes_' flag is set on the command line.
h3. Showing installed JBI artefacts
All installed JBI artefacts can be listed using the command '{{{*}list '_list \[<artifact-pattern> \[artifact-type\]\]*}}': \[artifact-type\]\]_':
{code}
> ./petals-cli.sh -c list
> ./petals-cli.sh -c list
{code}
where:
where:
* {{<artifact-pattern>}} *<artifact-pattern>* is an optional RegExp pattern to filter the content of the returned list. All the returned JBI artifacts must have a JBI identifier matching the pattern. If no pattern is defined, all the installed artifacts are returned.
* {{<artifact-type>}} *<artifact-type>* is one of the following values: SL, BC, SE, SA, SU, used to restrict the returned list.
For each artifact, the command displays (caution to the padding):
h3. Getting information about an artifact
Information about a JBI artifact can be got by using the '_show_' command '{{{*}show{*}}}':
{code}
> ./petals-cli.sh -c show [-e] [ <artifact-file> | [<artifact-type> <artifact-id>] ]
{code}
where:
> ./petals-cli.sh -c show [-e] [ <artifact-file> | [<artifact-type> <artifact-id>] ]
{code}
where:
* {{<artifact-file>}} *<artifact-file>* is the local file name or the URL of the artifact to show.
* {{<artifact-type>}} *<artifact-type>* is the nature (SL, component, SA) of the artifact to show.
* {{<artifact-id>}} *<artifact-id>* is the JBI identifier of the artifact to show.
The '_\-e' option '{{\-e}}' displays extended information.
Displayed information includes:
*** Its target component ((displayed using its JBI identifier)
\\
{tip}Auto-completion is available on artifacts IDs and artifact file names.{tip}
h3. Interrupting a flow of commands
h3. Interrupting a flow of commands
A flow of commands can be interrupted by using the command '{{{*}exit{*}}}'. If a number is set as argument, it is used as return code. The argument '{{lastErrorCode}}' is used as return code value of the last executed command. Otherwise the return code 0 is returned to the shell:
A flow of commands can be interrupted by using the '_exit_' command. If a number is set as argument, it is used as return code. The argument '_lastErrorCode_' is used as return code value of the last executed command. Otherwise, 0 is returned to the shell.
{code}
> ./petals-cli.sh -y - << EOF
> ./petals-cli.sh -y - << EOF
h3. Ending a flow of commands
When the end of a flow of commands is reached, if the last command is not '{{exit}}', the command '{{exit lastErrorCode}}' is implicitly executed:
When the end of a flow of commands is reached, if the last command is not '_exit_', the '_exit lastErrorCode_' command is implicitly executed.
{code}
> ./petals-cli.sh -y - << EOF
> ./petals-cli.sh -y - << EOF
h3. Getting the versions of a Petals node
To get the version of Petals node, the version of the JVM running Petals node, and its operating system, use the command '{{{*}version{*}}}': '_version_':
{code}
> ./petals-cli.sh -c version
> ./petals-cli.sh -c version
h3. Stopping the container
The container can be stopped using the '_stop_' command '{{{*}stop{*}}}' with the argument '{{{*}container{*}}}': '_container_':
{code}
> ./petals-cli.sh -c stop container
> ./petals-cli.sh -c stop container
h3. Shutdowning the container
The container can be shutdowned by using the command '{{{*}stop{*}}}' '_stop_' with the argument '{{{*}container{*}}}' '_container_' and the parameter '{{*\--shutdown{*}}}': '_\--shutdown_'.
{code}
> ./petals-cli.sh -c stop container --shutdown
Are you sure you want to shutdown the container? (y/n)
{code}
> ./petals-cli.sh -c stop container --shutdown
Are you sure you want to shutdown the container? (y/n)
{code}
A confirmation is expected, except if the flag 'yes' is set on the command line. A confirmation message is displayed in the mode 'console', except is the flag 'yes' is set on the command line.
A confirmation is expected, except if the '_yes_' flag is set on the command line. A confirmation message is displayed in the console mode, except if the '_yes_' flag is set on the command line.
h3. Getting the topology
h3. Getting the server properties
When connected to a container, it is possible to get all the values defined in the its *server.properties* file.
{code}
...
{code}
{code}
where "key1N" and "value1N" are the keys and values defined in the *server.properties* file of this container.
h3. Changing logger levels
h3. Synchronizing the registry
A synchronization of the registry on a specific node can be done with the command '{{{*}registry-sync{*}}}': '_registry-sync_' command:
{code}
> registry-sync
> registry-sync
{code}
A synchronization of all the topology nodes can be done with the same command and the *--all* '_\--all_' argument.
{code}
> registry-sync --all
> registry-sync --all
h3. Showing the registry's full content
The full content of the registry can be dumped by using the command '{{{*}registry-list{*}}}': '_registry-list_' command:
{code}
./petals-cli.sh -c registry-list
petals-cli> registry-list
Endpoints:
<endpoint-name-1>: <endpoint-1-characteristics>
<endpoint-name-1>: <endpoint-1-characteristics>
* <endpoints-list> is the list of endpoint name implementing the interface or service.
h3. Filtering the registry's full content by endpoint
The content of the registry related to an endpoint can be dumped by using the command '{{{*}registry-list{*}}}':
The content of the registry can be dumped by using the '_registry-list_' command.
It is however possible to filter the dumped result.
It is however possible to filter the dumped result.
{code}
./petals-cli.sh -c registry-list endpoint <endpoint-name-regexp>
petals-cli> registry-list endpoint <endpoint-name-regexp> service <service-name-regexp> interface <interface-name-regexp>
Endpoints:
<endpoint-name>: <endpoint-characteristics>
<endpoint-name>: <endpoint-characteristics>
where:
* *<endpoint-name-regexp>* is a regular expression used as filter on the full end-point name.
* *<service-name-regexp>* is a regular expression used as filter on the full service name.
* *<interface-name-regexp>* is a regular expression used as filter on the full interface name.
In the result:
* *<interface-name-regexp>* is a regular expression used as filter on the full interface name.
In the result:
* <endpoint-name> is the endpoint name used.
* <endpoint-characteristics> is the attributes of the endpoint, separated by comma: container identifier, component identifier, endpoint type.
* <service-name-x> is the services associated to the specified endpoint.
* <interface-name-x> is the interface names associated with the specified endpoint.
* <service-name-x> is the services associated to the specified endpoint.
* <interface-name-x> is the interface names associated with the specified endpoint.
h3. Filtering the registry's full content by service
The parameter order (endpoint, service, interface) does not matter.
All are optional. If none is specified, the entire regitry content is dumped.
All are optional. If none is specified, the entire regitry content is dumped.
The content of the registry related to a service can be dumped by using the command '{{{*}registry-list{*}}}':
h2. System Commands
Petals CLI can directly execute system commands.
To achieve it, the system command must be prefixed with *system:*.
Petals CLI can directly execute system commands.
To achieve it, the system command must be prefixed with *system:*.
{code}
./petals-cli.sh -c registry-list service <service-name-regexp>
Endpoints:
<endpoint-name-1>: <endpoint-1-characteristics>
<endpoint-name-2>: <endpoint-2-characteristics>
Services:
<service-name>:
<endpoints-list>
Interfaces:
<interface-name-1>:
<endpoints-list>
<interface-name-2>:
<endpoints-list>
Endpoints:
<endpoint-name-1>: <endpoint-1-characteristics>
<endpoint-name-2>: <endpoint-2-characteristics>
Services:
<service-name>:
<endpoints-list>
Interfaces:
<interface-name-1>:
<endpoints-list>
<interface-name-2>:
<endpoints-list>
petals-cli> system:<system-command>
{code}
where:
* <endpoint-name-x> are the endpoint names implementing the service.
* <endpoint-x-characteristics> is the attributes of the endpoint, separated by comma: container identifier, component identifier, endpoint type.
* <service-name-regexp> is a regular expression used as a filter on the full service name.
* <service-name> is the service full-name.
* <interface-name-x> are the interfaces of the service.
* <endpoints-list> is the list of endpoint name implementing the interface or service.
* <endpoint-name-x> are the endpoint names implementing the service.
* <endpoint-x-characteristics> is the attributes of the endpoint, separated by comma: container identifier, component identifier, endpoint type.
* <service-name-regexp> is a regular expression used as a filter on the full service name.
* <service-name> is the service full-name.
* <interface-name-x> are the interfaces of the service.
* <endpoints-list> is the list of endpoint name implementing the interface or service.
As an example,
h3. Filtering the registry's full content by interface
The content of the registry related to an interface can be dumped by using the command '{{{*}registry-list{*}}}':
The content of the registry related to an interface can be dumped by using the command '{{{*}registry-list{*}}}':
{code}
./petals-cli.sh -c registry-list interface <interface-name-regexp>
Endpoints:
<endpoint-name-1>: <endpoint-1-characteristics>
<endpoint-name-2>: <endpoint-2-characteristics>
Services:
<service-name-x>:
<endpoints-list>
Interfaces:
<interface-name>:
<endpoints-list>
Endpoints:
<endpoint-name-1>: <endpoint-1-characteristics>
<endpoint-name-2>: <endpoint-2-characteristics>
Services:
<service-name-x>:
<endpoints-list>
Interfaces:
<interface-name>:
<endpoints-list>
petals-cli> system:pwd
{code}
where:
* <endpoint-name-x> are the endpoint names implementing the interface.
* <endpoint-x-characteristics> is the attributes of the endpoint, separated by comma: container identifier, component identifier, endpoint type.
* <service-name-x> are the service names implementing the interface.
* <interface-name> is the interface full-name.
* <interface-name-regexp> is a regular expression used as a filter on the full interface name.
* <endpoints-list> is the list of endpoint name implementing the interface or service.
* <endpoint-name-x> are the endpoint names implementing the interface.
* <endpoint-x-characteristics> is the attributes of the endpoint, separated by comma: container identifier, component identifier, endpoint type.
* <service-name-x> are the service names implementing the interface.
* <interface-name> is the interface full-name.
* <interface-name-regexp> is a regular expression used as a filter on the full interface name.
* <endpoints-list> is the list of endpoint name implementing the interface or service.
displays the directory in which Petals CLI runs.
The return code of the wrapping command is the return code of the system code.
The return code of the wrapping command is the return code of the system code.