New Documentation of Petals CLI-Command Line Interface

Usage of Petals CLI

usage: Petals JMX Command Line Interface

[-d] [-y] [-h <host>] [-n <port>] [-u <user>] [-p <password>] [-H | -V | -f <file> | -c <command> <command-args> | -C]

 -c,--command <command>     Execute a command given on the command line.
 -C,--console               Enable the mode 'console'.
 -d,--debug                 Print stack trace and debugging informations
 -f,--file <filename>       Enable the script file execution. If filename is '-', commands are read from the stdin.
 -H,--help                  Print this help message and exit.
 -h,--host <host>           remote petals ESB host name.
 -n,--port <port>           port number.
 -p,--password <password>   password.
 -u,--user <user>           username.
 -V,--version               Print the version number and exit.

Which evolution would you like on Petals? Share it! http://www.petalslink.com/feedback

Available commands of Petals CLI

When launched petals-cli, it offers the following commands :

  • deploy: Deploy and start a JBI artifact in petals container.
  • exit: Exit this shell.
  • help: Display this help message or help for a specific command.
  • listartefacts: List JBI artifacts name and current status.
  • listregistry: List the entries of the registry.
  • load: Load properties from files.
  • print: Print a message.
  • pwd: Print the working directory.
  • set: Assign a value to the system property named key.
  • show: Print informations about a JBI artifact.
  • shutdown: Shutdown the container.
  • stop: Stop the container.
  • undeploy: Stop and uninstall or undeploy JBI artifacts.
  • version: Print version informations about petals container.
Contributors
No contributors found for: authors on selected page(s)

Use cases

Petals CLI realizes the following use-cases.

Petals CLI capabilities about script and shell usages

Interactive console

Launching the Petals CLI with the following command line starts an interactive console with a prompt where the user can enter commands:

> ./petals-cli.sh -C

Type 'help' for help.
------------------------------------------------------------------------------
petals-cli>

This command is wrapped by another shell: petals-cli-console.sh

Execution of a Petals CLI command directly on the command line

Launching the Petals CLI with the following command line executes the command specified on the command line:

> ./petals-cli.sh -c <command> <command-args>

Execution of a Petals script file

Launching the Petals CLI with the following command line executes commands of a Petals script:

> ./petals-cli.sh -f <filename>
A Petals script is text file containing command supported by Petals CLI.

Execution of an inlined Petals script

Launching the Petals CLI with the following command line executes commands provided through the 'stdin':

> cat <filename> | ./petals-cli.sh -f -
> ./petals-cli.sh -f - << EOF
<command1> <command1-args>
<command2> <command2-args>
EOF

Connection to a Petals node

Connection options from the command line

All parameters needed to a JMX connection to a remote Petals node must be configurable on the command line as options:

> ./petals-cli.sh -h <host> -n <port> -u <user> -p <password> -c <command>
> ./petals-cli.sh -h <host> -n <port> -u <user> -p <password> -C
Conected on <host1>:<port1> with <user1>
petals-cli>

Interacting with several Petals node 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 done by commands 'close' and 'open'. If no arguments are set on command 'open', default values (localhost:7700, login=petals, pwd=petals) are used:

> ./petals-cli.sh -C

Type 'help' for help.
------------------------------------------------------------------------------
petals-cli> open <user1>:<password1>@<host1>:<port1>
Conected on <host1>:<port1> with '<user1>'
petals-cli> close
petals-cli> open
Conected on localhost:7700 with 'petals'

Default connection

By default (if no argument or option is set):

  • In mode 'console', the connexion is establish on command 'open' to localhost:7700 with credentials 'petals/petals',
    > ./petals-cli.sh -C
    
    Type 'help' for help.
    ------------------------------------------------------------------------------
    petals-cli> open
    Conected on localhost:7700 with 'petals'
    
  • In mode 'command line', connexion parameter are mandatory
    > ./petals-cli.sh -h <host> -n <port> -u <user> -p <password> -c <command>
    
  • In mode 'script', the connexion is establish on command 'open' to localhost:7700 with credentials 'petals/petals'
    > ./petals-cli.sh -f - << EOF
    open
    EOF
    

Petals CLI commands

Installation/Deployment and start of an artifact in one command

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:

deploy <artifact-file> [<configuration-file> | <configuration-properties>]

where:

  • <artifact-file> is the local file name or the URL of the artifact to install or deploy and start
  • <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 component is a component. It has no sens 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 component is a component. It has no sens for other artifacts. This argument is exclusive with <configuration-file>.

Uninstallation/Undeployment and stop of an artifact in one command

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:

undeploy [ <artifact-file> | [<artifact-type> <artifact-id>] ]

where:

  • <artifact-file> is the local file name or the URL of the artifact to undeploy
  • <artifact-type> is the nature (SL, component, SA) of the artifact to undeploy
  • <artifact-id> is the JBI identifier of the artifact to undeploy

If no arguments is set, all artifacts are undeployed. In this case a confirmation is expected, except is 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.

> ./petals-cli.sh -y -f - << EOF
undeploy
EOF
> ./petals-cli.sh -C

Type 'help' for help.
------------------------------------------------------------------------------
petals-cli> undeploy
Are you sure to undeploy all artefacts (Y/n) ?
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.