dev@glassfish.java.net

Obtaining Service Engine properties programmatically

From: Andy Knight <Andy.Knight_at_Sun.COM>
Date: Thu, 14 Jan 2010 06:54:09 +0000

This question could apply to any SE but for the sake of this posting I'm going to refer to a problem I have working with the IEP SE.

The IEP SE has, amongst others, a property known as "DatabaseNonXAJNDIName". This property's value is (not surprisingly) a JNDI name - e.g. jdbc/iepseDerbyNonXA

I need to be able to find this property and its associated value in a Web Application deployed in the same GlassFish instance as the IEP SE. [ Deployment of the WebApp and the SE in the same domain is currently a requirement ]

If I know where my domain instance is located on a filesystem, I could navigate to <myDomain>/jbi/components/sun-iep-engine/install_root/workspace and process the config.properties file that I will find there. But I don't see that as a satisfactory solution as, in principle, the SE and WebApp could be deployed anywhere!

I discovered that the "current working directory" of my WebApp is <myDomain>/config

There is certainly no code in my application that explicitly changes directory to anywhere, so I'm wondering if this "current working directory" is always going to be the same. If t is, then I can use filesystem navigation relatively - i.e.

../jbi/components/sun-iep-engine/install_root/workspace/config.properties

But I can only do that if I can be sure that my "current working directory" is well known and guaranteed always to be the same.

I can't help thinking that there must be a "proper" way to do this but I just don't know what it is.

         Andy Knight
Principal Engineer,
Sun Microsystems, Inc.
Java House, Guillemont Park, Minley Road,
Camberley, Surrey GU17 9QG United Kingdom
Home office: +44 1494 462438
Mobile: +44 7775 583415
Skype: aprknight
Email: Andy.Knight_at_Sun.COM
Blog: http://blogs.sun.com/andky