dev@glassfish.java.net

Re: name of config directory?

From: Bill Shannon <bill.shannon_at_sun.com>
Date: Wed, 12 Aug 2009 16:28:01 -0700

Ludovic Champenois wrote on 8/12/09 3:56 PM:
> On 8/12/09 3:29 PM, Bill Shannon wrote:
>> I'm writing some code that runs in the server and needs to create a file
>> in the config directory for the current domain. What's the right way to
>> get a String or File object representing the config directory?
>>
>>
> I think
> @Inject org.glassfish.server.ServerEnvironmentImpl env;
> ...
> String rootFolder =
> env.getProps().get(com.sun.enterprise.util.SystemPropertyConstants.INSTANCE_ROOT_PROPERTY)
> ;
> should gives you the domain dir, then /config is under it.

Thanks, that was the hint I needed. I ended up with:

@Inject ServerEnvironment env;

and used

env.getConfigDirPath()


Next question...

If I want to define a public constant for the name of the file in the
config directory, where should I define it? In SystemPropertyConstants?