Java Reference
In-Depth Information
Using advanced languages to create
powerful CLI scripts
So far, we have learned how to write CLI shell commands to manage the application serv-
er's resources. This approach has the advantage that you can easily access every server re-
source easily and quickly, thanks to the built-in autocompletion feature. If, on the other
hand, you want to perform some sophisticated logic around your commands, 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 capture
the output of the CLI and use the rich set of Unix/Linux tools to perform some administrat-
ive actions.
Supplying a short overview of the bash functionalities might be an amusing exercise;
however, if we do this, we would move away from the scope of this topic. We will instead
document some built-in functionalities such as the following:
• In the first section, we will show how to use a CLI remote client API from within a
Python script
• In the next section, we will use the raw management API to execute CLI com-
mands from within Java applications
There are multiple use cases in which the JBoss CLI scripts could be useful. A script could
be used to configure a developer's machine, a test environment, or as an initial configura-
tion for production. In many cases, the configuration needed to start a full-blown enterprise
application may be nontrivial; you might need to use a specific port configuration to cluster
tests or your own security domain. You might also need your continuous integration server
to do this for you. Besides this, it's better to have an automatic configuration script than set
up the configuration manually every time, which is just a waste of time and a potential
source of bugs.
Search WWH ::




Custom Search