Re: Setting PropertySourceVault programatically in o.a.t.util.digester.Digester

2017-09-12 Thread Rémy Maucherat
On Mon, Sep 11, 2017 at 10:56 PM, Mark Thomas  wrote:

> On 11/09/17 21:07, Coty Sutherland wrote:
> > On Mon, Sep 11, 2017 at 2:43 PM, Mark Thomas  wrote:
> >> On 11/09/17 19:07, Coty Sutherland wrote:
> >>
> >>> So, my questions comes down to "Can I configure a PropertySource
> >>> instance and pass that to tomcat's Digester before tomcat starts?".
> >>
> >> No, because of the way it is currently coded.
> >
> > I thought so.
> >
> >>> Is this a silly question? If so, why?
> >>
> >> No. N/A.
> >>
> >> I can see the benefit in making it configurable.
> >>
> >> It looks like you'd need something along the lines of an
> >> addSource(IntrospectionUtils.PropertySource) method that added to the
> >> source array.
> >
> > Hm. So I took a look at the Digester and having a way to add the
> > source there would be ideal, but I think that only solves the issue of
> > having tomcat's internal classes configure it, right? I don't see a
> > way to do something like tomcat.setDigester(myDigester) anywhere. As
> > far as the digester that loads the server.xml I just see
> > o.a.c.startup.Catalina.createStartDigester(). I've only had a second
> > to look at it, but I'd love to figure this out. Hints appreciated :)
>
> I don't think I looked at it for much longer.
>
> You don't want that Digester instance - the Tomcat class doesn't parse
> server.xml. You want the equivalent for the Context which is set in
> ContextConfig. (or is this for web.xml?)
>
> Take a look at the difference between addWebApp and addContext.
>
> It sounds like you are using addWebApp. In which case maybe a property
> source setter on ContextConfig that is then injected into that Digester
> instance?
>
> > I guess I should create an enhancement BZ for this?
>
> I think so. There are a few different digester instances. It would be
> good to have a solution that handled all likely variations.
>

Right now the property source comes from a system property. So the
equivalent would be to use a static method to set some.

Rémy


Re: Setting PropertySourceVault programatically in o.a.t.util.digester.Digester

2017-09-11 Thread Mark Thomas
On 11/09/17 21:07, Coty Sutherland wrote:
> On Mon, Sep 11, 2017 at 2:43 PM, Mark Thomas  wrote:
>> On 11/09/17 19:07, Coty Sutherland wrote:
>>
>>> So, my questions comes down to "Can I configure a PropertySource
>>> instance and pass that to tomcat's Digester before tomcat starts?".
>>
>> No, because of the way it is currently coded.
> 
> I thought so.
> 
>>> Is this a silly question? If so, why?
>>
>> No. N/A.
>>
>> I can see the benefit in making it configurable.
>>
>> It looks like you'd need something along the lines of an
>> addSource(IntrospectionUtils.PropertySource) method that added to the
>> source array.
> 
> Hm. So I took a look at the Digester and having a way to add the
> source there would be ideal, but I think that only solves the issue of
> having tomcat's internal classes configure it, right? I don't see a
> way to do something like tomcat.setDigester(myDigester) anywhere. As
> far as the digester that loads the server.xml I just see
> o.a.c.startup.Catalina.createStartDigester(). I've only had a second
> to look at it, but I'd love to figure this out. Hints appreciated :)

I don't think I looked at it for much longer.

You don't want that Digester instance - the Tomcat class doesn't parse
server.xml. You want the equivalent for the Context which is set in
ContextConfig. (or is this for web.xml?)

Take a look at the difference between addWebApp and addContext.

It sounds like you are using addWebApp. In which case maybe a property
source setter on ContextConfig that is then injected into that Digester
instance?

> I guess I should create an enhancement BZ for this?

I think so. There are a few different digester instances. It would be
good to have a solution that handled all likely variations.

Mark

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Setting PropertySourceVault programatically in o.a.t.util.digester.Digester

2017-09-11 Thread Coty Sutherland
On Mon, Sep 11, 2017 at 2:43 PM, Mark Thomas  wrote:
> On 11/09/17 19:07, Coty Sutherland wrote:
>
>> So, my questions comes down to "Can I configure a PropertySource
>> instance and pass that to tomcat's Digester before tomcat starts?".
>
> No, because of the way it is currently coded.

I thought so.

>> Is this a silly question? If so, why?
>
> No. N/A.
>
> I can see the benefit in making it configurable.
>
> It looks like you'd need something along the lines of an
> addSource(IntrospectionUtils.PropertySource) method that added to the
> source array.

Hm. So I took a look at the Digester and having a way to add the
source there would be ideal, but I think that only solves the issue of
having tomcat's internal classes configure it, right? I don't see a
way to do something like tomcat.setDigester(myDigester) anywhere. As
far as the digester that loads the server.xml I just see
o.a.c.startup.Catalina.createStartDigester(). I've only had a second
to look at it, but I'd love to figure this out. Hints appreciated :)

I guess I should create an enhancement BZ for this?

> Mark
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Setting PropertySourceVault programatically in o.a.t.util.digester.Digester

2017-09-11 Thread Mark Thomas
On 11/09/17 19:07, Coty Sutherland wrote:

> So, my questions comes down to "Can I configure a PropertySource
> instance and pass that to tomcat's Digester before tomcat starts?".

No, because of the way it is currently coded.

> Is this a silly question? If so, why?

No. N/A.

I can see the benefit in making it configurable.

It looks like you'd need something along the lines of an
addSource(IntrospectionUtils.PropertySource) method that added to the
source array.

Mark

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Setting PropertySourceVault programatically in o.a.t.util.digester.Digester

2017-09-11 Thread Coty Sutherland
Hi all,

I'm fairly certain that there isn't a way to do this currently (I'm
not so good with Reflection, so there could be), but I have to ask
anyway. Let me explain my use case...

I'm using tomcat embedded (8.5.x/trunk) and have a need to
programmatically configure and use a PropertySource before starting
tomcat. Using an instance that way is easy. The problem falls when
users need to configure tomcat to also use the PropertySource
implementation to extract information from their application XMLs by
way of the Digester. The issue with this is that I cannot instantiate
two instances of the PropertySource implementation class that I'm
using because the library won't allow it and therefore Tomcat doesn't
correctly configure the PropertySource.

So, my questions comes down to "Can I configure a PropertySource
instance and pass that to tomcat's Digester before tomcat starts?". Is
this a silly question? If so, why?



Thanks,
Coty

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org