Why must one programatically use an API to change the server configuration - which is then saved to XML files. Why not just document the configuration files, and let me poke them directly (as some other application servers allow)?
Anyway, such is the world I have chosen to live in. So I try to make it at least bearable.
Most WebSphere configuration scripts I have seen, whether Jython or Jacl, tend to be a glorious mix of code and data. Which I guess is fine, if the data does not change much. And if anyone who must change the data are fluent in the given language, so they do not mess up the
logic. Not cool.
Once More From the Top
I decided to sprinkle a dose of Separation of Concerns on the issue. I had to rewrite some of our WebSphere configuration magic to handle some new features, and we are starting to look at WAS7 migration. So we needed a new tool.
What I ended up with is a Jython script that takes a configuration file as input. The configuration file contains commands in brackets followed by optional properties. It looks a bit like Windows ini files:
[command, options, ...]
key1=value1
key2=value2
...
keyN=valueN
So the logic for interaction with WebSphere is stored in the script.
And the configuration you want to stuff into WebSphere is stored in the configuration file. (See the comment in the script for command documentation.)
Not really revolutionary. But it works and we can have different configuration files for WAS6, WAS61, and WAS7. Without polluting the logic with knowledge about the diffent versions. And without changing the logic when we find some new configuration node we must set.
Missing Feature
I know there is at least one logic feature missing: to change the console group permissions, I need to find a specific numbered node, and change it. That is, I need assignment from list (or something similar).
The current script cannot do that - because I did not need it for anything else, and because the changing the console group fails from Jacl and Jython in WAS6. But I will probably extend the script when I start to look at WAS7 in earnest.
Also, since we only use it to set up the initial configuration, there are probably some other stuff it cannot handle in its current form.
You are welcome to extend it...
Making Configurations
So how to make a configuration file? I make a new configuration by more or less following these steps:
- Use [types] and [attributes] to find the relevant configuration type to use and its attributes.
- Use [list] and [show]/[showall] to examine the default configuration.
- Use [create] and [modify] to make changes.
- Again use [list] and [show]/[showall] to see the result.
I have also been searching files in WebSphere's config folder to find the nodes/types I need to modify after making manual modifications in the Administration Console.
Or asked Google if everything else failed...
Script
I have moved the script to Buildmeister@Kenai.
No comments:
Post a Comment