New Documentation of Petals CLI-Command Line Interface

compared with
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (43)

View Page History
{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}

h2. Return codes of Petals CLI

When a system command is executed in Petals CLI, the return code is the one of the system command.

h2. Error mManagement

h3. Options et and Arguments parsing

When using the script mode or inlined mode, parsing errors (invalid options and/or arguments) result in an interruption of Petals CLI.
If an error occurs during the execution of a flow of commands:
* The command that has thrown the error is interrupted.
* The return code of the command can be checked using the commands {{{*}isParsingErrorReturned{*}}}, {{{*}isExecutionErrorReturned{*}}}, {{{*}isNoErrorReturned{*}}}, _isParsingErrorReturned_, _isExecutionErrorReturned_, _isNoErrorReturned_, the ternary conditional operator, and the attribute {{{*}lastErrorCode{*}}}. _lastErrorCode_ attribute.
{code}
> ./petals-cli.sh - << EOF
* The attribute {{lastErrorCode}} is an argument of the command {{exit}} to return the return code of the last executed command.

h2. Exit from the 'console' Console mode

To exit the 'console' mode, use the '_exit_' command. If a number is set as an argument, it is used as return code. Otherwise, the return code 0 is used.
To exit the console mode, use the '_exit_' command.
If a number is set as an argument, it is used as return code. Otherwise, the 0 is returned.
{code}
> ./petals-cli.sh -C
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*. at _$PETALS_CLI_HOME/conf/preferences.properties_.

However, it is possible to move this file somewhere else thanks to an environement variable.
*_$PETALS_CLI_PREFS_* _$PETALS_CLI_PREFS_ is the variable environement that points to the location of the preferences file.

This file contains the following keys:

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_* _$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. Default connection

By default (if no argument or option is set):.
- In console mode, the connection is established with the values given in the preferences file.
{code}
> ./petals-cli.sh -C
{code}

- The confirmation can be skipped by adding the '_yes_' argument to the command.
{code}
> ./petals-cli.sh -C
{code}

- In command line mode, if no argument or option is set, a connection is established with the values defined in the preferences file.

{code}
> ./petals-cli.sh -c stop
{code}

{tip}This is necessary to easily stop a local container{tip}
- In 'script' mode, the connection is establish on command 'connect' to <default-host>:<-default-port> with credentials '<default-user>/<default-pwd>'.

In script mode, the connection is established with the values defined in the preferences file.
{code}
> ./petals-cli.sh - << EOF
{code}

If the preferences file does not exist and that _connect_ was invoked without an argument, the command returns the error code 2.

h2. Security

h2. Working with JBI artifacts

h3. Installation/Deployment and Start of an Artifact at once
h3. Deploying and Starting 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}
deploy <artifact-file> [<configuration-file> | <configuration-properties>]
{tip}Auto-completion is available on artifacts IDs and artifact file names.{tip}

h3. Installation/Deployment of an Artifact located in a Maven repository

Petals CLI is able to install/deploy and start an a JBI artifact located into a Maven repository by using the following command:
{code}
deploy <maven-artifact> [<configuration-file> | <configuration-properties>]
* *<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
h3. Bulk Deployment and Start

To deploy and start several artifacts in one command, just put them in a local directory and execute the command '_deploy_':
{code}
> ./petals-cli.sh -y - << EOF
If the argument _<artifact-file>_ of the '_deploy_' command 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, except if the flag '_yes_' is set on the command line.

h3. Starting an aArtifact

An artifact can be started by using the '_start_' command with the argument '_artifact_':
h3. Stopping an artifact

An artifact can be stopped by using the command '_stop_' with the argument '_artifact_':
{code}
> ./petals-cli.sh -c stop artifact [ <artifact-file> | [<artifact-type> <artifact-id>] ]
{tip}Auto-completion is available on artifacts IDs and artifact file names.{tip}

h3. Uninstallation/Undeployment and Stop of an Artifact at once
h3. Undeploying and Stopping 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:
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 arteifacts

All the installed JBI artefacts can be listed using the command '_list \[<artifact-pattern> \[artifact-type\]\]_':
{code}
> ./petals-cli.sh -c list
* Its type (SL, BC, SE, SA, SU).

h3. Getting information about an aArtifact

Information about a JBI artifact can be got by using with the '_show_' command:
{code}
> ./petals-cli.sh -c show [-e] [ <artifact-file> | [<artifact-type> <artifact-id>] ]
h2. Working with the Container

h3. Getting the versions of related to a Petals node

To get the version of a Petals node, the version of the JVM running Petals node, and its operating system, use the command '_version_' command:
{code}
> ./petals-cli.sh -c version
h3. Stopping the container

The container can be stopped by using the '_stop_' command with the argument '_container_':
{code}
> ./petals-cli.sh -c stop container
{code}

\\
This command shows a set of Petals nodes, sorted by domain and sub-domains, each node having the following information:
* Container name
{code}

You can also use a regular expression to filter the candidate results.
{code}
petals-cli@host:port> loggers <regular expression>
{code}

\\
A synchronization of all the topology nodes can be done with the same command and the '_\--all_' argument.
{code}
{code}

\\
{note}Global synchronization is done in two passes:
* Each slave declares its end-points to the master node (n-1 synchronizations, where n is the number of nodes in the topology).
* Each slave gets the master end-points (start from the n-2{html}<sup>th</sup>{html} nodes until we get back to the first slave).
{note}

The response message is displayed in 'console' console mode only.

h3. Showing the registry's full content