There have been a couple of questions recently on an internal forum asking how best to parameterise a module. For mediation modules the seemingly obvious answer is via promoted properties. However, in these scenarios the parameterisation was required to handle the deployment of a module in to different environments and the originators felt that promoted properties were more about making administrative changes to properties post-deployment. I pointed out that, in the admin console, if you use the J2EE application installation process (rather than the install button on the SCA modules panel) and select the “Show me all installation options and parameters” radio button then you will find a panel entitled “Edit module properties” that allows you to modify promoted properties on installation.
Now that is all very well but it is cumbersome and error prone if you have a large number of properties to modify. I’d also recommend that application deployment, as with any administrative action in anything but a workstation development environment, be performed by scripting. There is no special command for installing mediation modules (they just use the standard AdminApp.install command) so how to specify the module properties? An intial search of the InfoCenter failed to turn up anything useful so I resorted to running the AdminApp.installInteractive command. This showed me the syntax required for specifying the properties on the command line but I still needed to know the name of the corresponding task. I then looked at the wsadmin.traceout file in the profile logs directory where a entry is added showing the generated command. For example:
[20/05/09 16:15:38:000 BST] 0000000a AdminAppClien A WASX7278I: Generated command line: install 'c:/temp/module.ear' '[ -SIBSCAClientInstall [[, [group1]key1=value1,[group2]key2=value2]]]'
A little bit of massaging and I had the necessary Jython needed to modify properties on application installation:
AdminApp.install('c:/temp/module.ear',[ '-SIBSCAClientInstall', [[', [group1]key1=value1,[group2]key2=value2']]])
It wouldn’t take much to read the property names and values out of a property file to allow the necessary parameterisation for different environments.
The only place I found this task documented was in a very good IBM Education Assistant presentation covering promoted properties. Unfortunately this presentation only covers V6.1 so doesn’t show the syntax required for group names.
Lastly, an alternative approach (although not one that I’d necessarily advocate in terms of following a supported process) would be to have multiple copies of the sca-module-properties.xml file and build a different EAR for each environment. This file contains the default values for each promoted properties in the following format:
<sCAModuleProperty identifier="key1" value="value1" group="group1"/>