This is a discussion on Figuring out how to script WebSphere app server with Jython - Solaris Rss ; A single, comprehensive reference document for WebSphere application server's Jython API is doubtless hidden away in the dark, tangled thicket that is IBM's web site. I am as certain of this as I am that I will never find it. ...
A single, comprehensive reference document for WebSphere application server's Jython API is doubtless hidden away in the dark, tangled thicket that is IBM's web site. I am as certain of this as I am that I will never find it. When, long ago, I wrote a script to automate deployments to a WebSphere app server, I cobbled it together using both the odd blog post and vague samples scattered through IBM's documentation, and some of those samples were written in JACL, not Jython. It almost goes without saying that there was an easier way to find this information.
Before anything else, you need to know that four objects are available as global variables to any Jython process that has been created by wsadmin. They are:
If you fire up the interactive Jython interpreter, you can look at these objects: $WASHOME/bin/wsadmin.sh -lang jython. If you're familiar with Python's built-in introspection commands, like dir() and help(), you'll quickly see that they're of no use to you. Fortunately, the four wsadmin objects implement their own help() methods. To use them, print the output of AdminObject.help(). For example, print AdminApp.help() prints out the following:WASX7095I: The AdminApp object allows application objects to be manipulated -- this includes installing, uninstalling, editing, and listing. Most of the commands supported by AdminApp operate in two modes: the default mode is one in which AdminApp communicates with theWebSphere server to accomplish its tasks. A local mode is also possible, in which no server communication takes place. The local mode of operation is invoked by bringing up the scripting client with no server connected using the command line "-conntype NONE" option or setting the "com.ibm.ws.scripting.connectionType=NONE" property in the wsadmin.properties...Calling help() with the name of a command provides details on that command. So print AdminApp.help("edit") prints out:
deleteUserAndGroupEntries Deletes all the user/group information for all the roles and all the user name/password information for RunAs roles for a given application.
edit Edit the properties of an application
editInteractive Edit the properties of an application interactively...
WASX7104I: Method: editThis is absolutely basic stuff, but it took me forever to find it. Later, I'll cover the basics of scripting a deployment, which will exhaust my knowledge of this subject.
Arguments: application name, options
Description: Modifies the application specified by "application name" using the options specified by "options". The user is not prompted for any information.
Read More about [Figuring out how to script WebSphere app server with Jython...