[jboss-dev-forums] [JBoss AS7 Development] - Command Line Interface

Alexey Loubyansky do-not-reply at jboss.com
Fri Mar 4 11:08:57 EST 2011


Alexey Loubyansky [http://community.jboss.org/people/aloubyansky] modified the document:

"Command Line Interface"

To view the document, visit: http://community.jboss.org/docs/DOC-16581

--------------------------------------------------------------
The AS7 Command Line Interface (CLI) is a command line management tool for the AS 7 domain or a standalone server. It allows a user to connect to the AS7 domain controller or a standalone server and execute management operations available through the  http://community.jboss.org/docs/DOC-16317 AS7 detyped management model. Depending on the operation system, the CLI is launched using jboss-admin.sh or jboss-admin.bat located in the AS7 bin directory.

h2. Features

The CLI features include:
* connect to the specific controller or server instance by specifying the host and the port;
* send operation requests (providing the managed component's address, attribute or operation name and parameters) following the  http://community.jboss.org/docs/DOC-16317 AS7 detyped management model;
* view the available managed components, their attributes and operations;
* tab-completion for commands and operation requests;
* history of the executed commands and operation requests.


h2. Commands

There are commands and operations. Commands don't trigger server management actions, they are performed locally and may affect only the command line session settings. Operations, on the other hand, are actually translated into the operation requests and sent for the execution to the server.

To syntactically differentiate between the commands and the operations, the commands start with '/', e.g. '/help' which, btw, lists all the supported commands, options and other useful info. Another way to list all the supported commands is to type '/' and press the tab key.

h3. Connection

The first thing to do after the CLI has started is to connect to a managed AS7 instance. This is done using the connect command, e.g.

/connect

which is equivalent to

/connect localhost:9999

localhost:9999 is the default host and port combination for the AS7 model controller client. Both, the host and the port, are optional parameters and can be specified together or separately.

h3. Quit

To terminate the session type '/quit'.

h2. Operation requests

The format for the operation requests is

[node-type=node-name (,node-type=node-name)*] : operation-name [( [parameter-name=parameter-value (,parameter-name=parameter-value)*] )]

e.g.

profile=production,subsystem=threads,bounded-queue-thread-pool=pool1:write-core-threads (count=0, per-cpu=20)

It's a lot of typing but tab-completion is supported for all the composing parts, i.e. node-types and node-names, operation names and parameter names. We are also looking into adding custom commands/aliases that would be less verbose for the user but would translate into the corresponding operation requests on the background.

Whitespaces between the separators in the operation request strings are not significant.

Operation requests might not always have the address part or the parameters. E.g.

:read-resource

which will list all the root node types. Notice that ':' is still required before the operation name. This is not to confuse the tab-completion which will consider any string not prefix with ':' as a beginning of a node-type.

h3. How the tab-completion works

Suppose, the cursor is positioned at the beginning of an empty line. Pressing the tab key in this case will print a list of all the available node types. After selecting the node type you want and adding '=', pressing the tab key again will result in a list of all the node names available for the chosen node type. If, after selecting the node name from the list, you want to continue with the node path then add ',' after the selected node name and press the tab key again. This will print all the available node types for the previously select node.

After you are done with the node path, adding ':' at the end of the node path and pressing the tab key will print all the available operation names for the selected node.

To see all the parameters of the operation, add '(' after the operation name and press the tab key. Choose the parameter you want and specify its value after '='. Tab-completion for parameter values is not supported yet. If you want to add more parameters, add ',' and press the tab key to see the rest of the available parameter names.

Finally, when all the parameters have been specified, add ')' and press enter.


h2. Node path prefix

If you want to execute a series of operations against the same node, to avoid typing the same node path for every operation request you can set the current node path prefix to the target node using command '/prefix' or its shorter form '/to', e.g.

[~]/to subsystem=logging

After that the command line prompt will change to

[subsystem=logging]

and every operation entered w/o the node path will be executed against the node subsystem=logging. If you do specify a node path for the operation, it will be prefixed with subsystem=logging, in other words it will be relative to subsystem=logging.

The prefix might not necessarily end on a node name. It might be just

[~]/to subsystem
[subsystem]

Then to execute an operation against the logging subsystem you would type in

[subsystem] logging:read-resource

To reset the current prefix type in

[subsystem] /to ~
[~]

You can also navogate to the parent node

[subsystem=web,connector=http] /to ..
[subsystem=web]

or the node type

[subsystem=web] /to .type
[subsystem]

TODO: the node path tab-completion isn't supported for the argument of '/to' at the moment.
--------------------------------------------------------------

Comment by going to Community
[http://community.jboss.org/docs/DOC-16581]

Create a new document in JBoss AS7 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=102&containerType=14&container=2225]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20110304/6c01ba92/attachment.html 


More information about the jboss-dev-forums mailing list