You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Scott Neibarger <sc...@gmail.com> on 2012/03/12 02:11:20 UTC

[daemon] DaemonConfiguration question

Hi,

Perhaps I'm confused about extending Daemon, and using DaemonConfiguration,
but I hope not. I've created a DaemonConfiguration object and passed a file
to the load() method. It successfully loads without throwing any
exceptions, but when I try to get any properties from the file, getProperty
returns null, and the getPropertyArray() method returns an empty array.

I set up the properties file as such:

home.dir=/path/to/home
etc.dir=${home.dir}/etc
bin.dir=${home.dir}/bin

Should I be able to call getProperty("home.dir") and get /path/to/home ?

Re: [daemon] DaemonConfiguration question

Posted by Scott Neibarger <sc...@gmail.com>.
That resolved my problem. Thank you!

On Mon, Mar 12, 2012 at 12:45 PM, sebb <se...@gmail.com> wrote:

> On 12 March 2012 11:34, Scott Neibarger <sc...@gmail.com> wrote:
> > It returns a boolean and I am checking if it's false. I didn't build the
> > source, but I downloaded it to verify I was setting my properties file up
> > correctly. When DaemonConfiguration.getProperty() calls
> > Properties.getProperty(), it passes PREFIX as part of the key
> ("daemon."),
> > so I tried prefixing my calls to DaemonConfiguration.getProperty() with
> the
> > same prefix and got the same result.
>
> AIUI the class is only intended to support properties which are
> prefixed with the string "daemon.".
>
> So your property file needs to look like:
>
> daemon.abcd=123
>
> >
> > On Sun, Mar 11, 2012 at 10:55 PM, sebb <se...@gmail.com> wrote:
> >
> >> On 12 March 2012 01:11, Scott Neibarger <sc...@gmail.com>
> wrote:
> >> > Hi,
> >> >
> >> > Perhaps I'm confused about extending Daemon, and using
> >> DaemonConfiguration,
> >> > but I hope not. I've created a DaemonConfiguration object and passed a
> >> file
> >> > to the load() method. It successfully loads without throwing any
> >> > exceptions,
> >>
> >> The load() method catches Exceptions - did you check the return code?
> >>
> >> >  but when I try to get any properties from the file, getProperty
> >> > returns null, and the getPropertyArray() method returns an empty
> array.
> >> >
> >> > I set up the properties file as such:
> >> >
> >> > home.dir=/path/to/home
> >> > etc.dir=${home.dir}/etc
> >> > bin.dir=${home.dir}/bin
> >> >
> >> > Should I be able to call getProperty("home.dir") and get
> /path/to/home ?
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> >> For additional commands, e-mail: user-help@commons.apache.org
> >>
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

Re: [daemon] DaemonConfiguration question

Posted by sebb <se...@gmail.com>.
On 12 March 2012 11:34, Scott Neibarger <sc...@gmail.com> wrote:
> It returns a boolean and I am checking if it's false. I didn't build the
> source, but I downloaded it to verify I was setting my properties file up
> correctly. When DaemonConfiguration.getProperty() calls
> Properties.getProperty(), it passes PREFIX as part of the key ("daemon."),
> so I tried prefixing my calls to DaemonConfiguration.getProperty() with the
> same prefix and got the same result.

AIUI the class is only intended to support properties which are
prefixed with the string "daemon.".

So your property file needs to look like:

daemon.abcd=123

>
> On Sun, Mar 11, 2012 at 10:55 PM, sebb <se...@gmail.com> wrote:
>
>> On 12 March 2012 01:11, Scott Neibarger <sc...@gmail.com> wrote:
>> > Hi,
>> >
>> > Perhaps I'm confused about extending Daemon, and using
>> DaemonConfiguration,
>> > but I hope not. I've created a DaemonConfiguration object and passed a
>> file
>> > to the load() method. It successfully loads without throwing any
>> > exceptions,
>>
>> The load() method catches Exceptions - did you check the return code?
>>
>> >  but when I try to get any properties from the file, getProperty
>> > returns null, and the getPropertyArray() method returns an empty array.
>> >
>> > I set up the properties file as such:
>> >
>> > home.dir=/path/to/home
>> > etc.dir=${home.dir}/etc
>> > bin.dir=${home.dir}/bin
>> >
>> > Should I be able to call getProperty("home.dir") and get /path/to/home ?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: [daemon] DaemonConfiguration question

Posted by Scott Neibarger <sc...@gmail.com>.
It returns a boolean and I am checking if it's false. I didn't build the
source, but I downloaded it to verify I was setting my properties file up
correctly. When DaemonConfiguration.getProperty() calls
Properties.getProperty(), it passes PREFIX as part of the key ("daemon."),
so I tried prefixing my calls to DaemonConfiguration.getProperty() with the
same prefix and got the same result.

On Sun, Mar 11, 2012 at 10:55 PM, sebb <se...@gmail.com> wrote:

> On 12 March 2012 01:11, Scott Neibarger <sc...@gmail.com> wrote:
> > Hi,
> >
> > Perhaps I'm confused about extending Daemon, and using
> DaemonConfiguration,
> > but I hope not. I've created a DaemonConfiguration object and passed a
> file
> > to the load() method. It successfully loads without throwing any
> > exceptions,
>
> The load() method catches Exceptions - did you check the return code?
>
> >  but when I try to get any properties from the file, getProperty
> > returns null, and the getPropertyArray() method returns an empty array.
> >
> > I set up the properties file as such:
> >
> > home.dir=/path/to/home
> > etc.dir=${home.dir}/etc
> > bin.dir=${home.dir}/bin
> >
> > Should I be able to call getProperty("home.dir") and get /path/to/home ?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

Re: [daemon] DaemonConfiguration question

Posted by sebb <se...@gmail.com>.
On 12 March 2012 01:11, Scott Neibarger <sc...@gmail.com> wrote:
> Hi,
>
> Perhaps I'm confused about extending Daemon, and using DaemonConfiguration,
> but I hope not. I've created a DaemonConfiguration object and passed a file
> to the load() method. It successfully loads without throwing any
> exceptions,

The load() method catches Exceptions - did you check the return code?

>  but when I try to get any properties from the file, getProperty
> returns null, and the getPropertyArray() method returns an empty array.
>
> I set up the properties file as such:
>
> home.dir=/path/to/home
> etc.dir=${home.dir}/etc
> bin.dir=${home.dir}/bin
>
> Should I be able to call getProperty("home.dir") and get /path/to/home ?

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org