2005-10-13

Scratching a BEA Workshop itch

BEA Workshop have somewhat strange project layout, making it difficult to use a really good IDE. It's also difficult to use ANT or Maven in a 'standard' way since the generated ANT scripts from Workshop just generates one target doing all the magic. But since BEA Portal does have tight integration with Workshop, it's not an option to drop using Workshop.

Workshop offers a menu item to generate an EAR file for the portal project. This is a good thing, but when we're working in a development environment we typical would like to have different settings than in test and/or production. One example is that we really want to have much more strict security settings in test/production than in the development environment. There's also a several performance related options that should be very different in test/production compared to development.

Since the generated ANT scripts hides away everything regarding building and packaging of the portal ear, it has been a bit difficult to change these settings when moving from development to test/production. For this reason I made a Jython script which reads a configuration change from a XML file and then inserts these changes into web.xml, weblogic.xml and application-config.xml. This script supports the possibility to change an existing setting, but also to append a new setting that doesn't already exist in the XML configuration file.

In order to do this, I tried a couple of options. First the DOM support in Python/Jython, but problems with minidom in Jython and the crappy DOM api made me drop this. Then I tried to look into XMLBeans but since I didn't have the XML Schema for web.xml and weblogic.xml I couldn't generate JavaBeans representing these Schemas. XMLBeans has a token mechanism, but this was way to ackward to use for my needs. So I ended with using dom4j and I'm pretty happy with the choice. Compared to jdom, dom4j seems more pleasant to work with.

If you are struggeling with the same itch, leave a notice and I will ask my customer if I can give the code to you....

4 comments:

Anonymous said...

You might also look at the XMLTask for Ant (http://sourceforge.net/projects/xmltask/). I've done similar hacking of Weblogic/Workshop files using it.

Anonymous said...

Great article! Thanks.

Anonymous said...

Thanks for interesting article.

Anonymous said...

Excellent website. Good work. Very useful. I will bookmark!