Wiki

Clone wiki

washlib / Home

Welcome


FAQ

What is "washlib"?

  • Washlib (the WebSphere Admin Scripting Helper Library) is a set of jython files aimed at providing a more pythonic API to WebSphere's wsadmin / jython scripting support.

Why does it exist?

  • The standard scripting environment for WebSphere is Python/Java ("jython"), which is a python wrapper over remote SOAP calls to a running instance of WebSphere (for the most part). Some problems with IBM's implementation prompted me to write this.
  • The wsadmin jython platform is almost a direct transliteration of the earlier scripting platform built on Java/Tcl ("jacl"). What this means practically is that when the documentation says a function takes a list, it actually takes a string that looks like a Tcl list. For example, the third item in this function call is a "list" of options:
#! /usr/bin/env python

AdminConfig.installResourceAdapter('c:/rar/mine.rar', 'mynode', 
        '[-rar.name myResourceAdapter -rar.desc "My rar file"]')
  • Return values of type "list" are actually line terminated strings.
#! /usr/bin/env python

# return type of this function is a list of the instances of the named config type
print repr(AdminConfig.list('JDBCProvider'))
'Db2JdbcDriver(cells/mycell/nodes/DefaultNode|resources.xml#JDBCProvider_1)\nDb2JdbcDriver(cells/mycell/nodes/DefaultNode/servers/deploymentmgr|resources.xml#JDBCProvider_1)\nDb2JdbcDriver(cells/mycell/nodes/DefaultNode/servers/nodeAgent|resources.xml#JDBCProvider_1)'

# Using the standard { .splitlines() }
AdminConfig.list('JDBCProvider').splitlines()
['Db2JdbcDriver(cells/mycell/nodes/DefaultNode|resources.xml#JDBCProvider_1)', 'Db2JdbcDriver(cells/mycell/nodes/DefaultNode/servers/deploymentmgr|resources.xml#JDBCProvider_1)', 'Db2JdbcDriver(cells/mycell/nodes/DefaultNode/servers/nodeAgent|resources.xml#JDBCProvider_1)']
  • Therefore the standard wsadmin jython idiom is to process any returned "list" with Python's string.splitlines()
  • Numerous exceptions and caveats exist, such as for nested lists and embedded special characters, like the line separator.
  • Even in WebSphere v8, the jython version is 2.1! That's over ten years old! Although upgrading is possible, some managed installations (that is an installation that you do not have direct control over) will not do that as it could adversely affect the core admin utilities. And numerous advances to the Python language have been added in 2.2 - such as the boolean literals True and False, and real ("new style") classes. Many tools for operating over collections were added in Python 2.7! Sadly, Jython (available at jython.org) is at version 2.5; 2.7 is currently (as of January 2013) in alpha status.
  • The programming model of the default API that IBM exposes is a procedural library. Keeping track of all the intermediate variables quickly becomes unwieldy as they must be continually passed to the main object façades. Those objects (AdminApp, AdminConfig, AdminControl, and AdminTask are the big 4) are essentially a poor man's namespace for a bunch of static functions. AdminTask declares over 1000 functions!

What do I need to use this?

  • You will need an installation of WebSphere Application Server to run commands against of course, and if you are running these scripts on a separate machine, an installation of the WebSphere thin client. I plan on setting up instructions on how to create a testing environment using some lightweight virtual machines...
  • If you are using the thin client, you will also need a working wsadmin.sh or wsadmin.bat script to kick it off. The examples provided by IBM are very poor. The cop out instructions to "grab the actual shell script from a working full installation" failed for me on v7.0. that's also coming soon

How do I install this?

details coming soon

  1. Check out (git clone) the repository
  2. Switch to your preferred release tag
  3. Copy (or symlink) the necessary files in place.
  4. If using the default Application Server (not thin client) wsadmin shell, add the necessary package path and library path to the command line invocation.

What is provided?

  • A single jython "script library" file used to initialize the default wsadmin objects into the package namespace
  • A set of jython packages providing washlib itself.
  • Shell script launchers (Windows and *nix) to kick off the Jython program. These should be a drop in replacement for the standard shell script launchers provided by IBM (with some much needed improvements).

What License is this released under?


A note about the future

Patching over IBM's poor implementation of an python API I believe is doomed to failure. For one, the "thin client" is not all that thin. The installation takes up 370 MB. Most of that is useless to the Python API. And it has to run on top of the IBM JDK accounting for over half the size and s severe performance degradation. I think at some point in the future I am going to re-implement it in pure python, probably version 3, and just rely on the SOAP calls directly.


FIN!

Updated