Java Reference
In-Depth Information
Using advanced languages to create
powerful CLI scripts
So far, we have learnt how to write CLI shell commands to manage the application
server's resources. This approach has the advantage that you can easily access
every server resource easily and quickly, thanks to the built-in autocompletion feature.
If, on the other hand, you want to perform some sophisticated logic around your com-
mands, then you need to find some other alternatives.
If you are a shell guru, you might easily resort to some bash scripting in order to cap-
ture the output of the CLI, and use the rich set of Unix/Linux tools to perform some
administrative actions.
Supplying a short overview of the bash functionalities might be an amusing exercise;
however, we would move away from the scope of this topic. We will instead document
some built-in functionalities, such as:
• In the first section, we will show how to use the CLI remote client API from
within a Python script
• In the next section we will use the raw management API to execute CLI
commands from within Java applications
Using scripting languages to wrap CLI execution
JBoss AS 7 has introduced a new CLI remote API that acts as a façade for the
CLI public API. The core class that acts as a bridge between these two APIs is the
scriptsupport.CLI class, which is contained in the JBOSS_HOME/bin/client/
jboss-client.jar file.
Note
In order to use these new functionalities, you need to grab one of the latest
7.2.0 snapshots available at https://ci.jboss.org/jenkins/job/JBoss-AS-7.x-latest/ ,
or use the RedHat EAP 6.1.0 that is now available for nonproduction use at ht-
tp://www.jboss.org/jbossas/downloads .
Search WWH ::




Custom Search