dev@glassfish.java.net

Re: Obtaining Service Engine properties programmatically

From: Andreas Egloff <Andreas.Egloff_at_Sun.COM>
Date: Thu, 14 Jan 2010 07:18:48 -0800

The supported way to get (and set) information is via the common client,
e.g. using getComponentConfiguration / setComponentConfiguration
http://wiki.open-esb.java.net/Wiki.jsp?page=Glassfish9.1CommonClient

Behind the scenes this works through JMX, so technically it is also
possible to retrieve and operate on the MBeans directly; but the MBean
names and MBeans temselves are not guaranteed to stay compatible, hence
this direct use is not covered by product support.

Andi

Andy Knight wrote:
> 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.
>
> <http://www.sun.com> 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 <mailto:Andy.Knight_at_Sun.COM>
> Blog: http://blogs.sun.com/andky
> <http://www.sun.com>
>
>