Java Reference
In-Depth Information
jboss-as-7.2.0.Alpha1-SNAPSHOT/bin/client/
jboss-cli-client.jar
Ok, now we will create our first script that will basically return the JNDI view of our
application server.
Note
Be aware that Jython, just like Python, uses indentation to determine the code
structure instead of using braces or keywords. Therefore, do not use them ran-
domly!
Create a file named script.py containing the following code:
from org.jboss.as.cli.scriptsupport import CLI
cli = CLI.newInstance()
cli.connect()
cli.cmd("cd /subsystem=naming")
result =
cli.cmd(":jndi-view")
response = result.getResponse()
print 'JNDI VIEW ======================= '
print response
cli.disconnect()
Now execute the script with the following code:
jython script.py
As you can see, the code is very self explanatory; we are importing the
org.jboss.as.cli.scriptsupport.CLI class, which is used to send com-
Search WWH ::




Custom Search