[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jakarta-commons-dev
Subject:    Re: [configuration] Accessing from EL script
From:       "Mark R. Diggory" <mdiggory () latte ! harvard ! edu>
Date:       2004-05-19 14:16:55
Message-ID: 40AB6C57.40906 () latte ! harvard ! edu
[Download RAW message or body]



Oliver Heger wrote:

> Hierarchical configurations would provide such a hierarchical context 
> mentioned in this thread. But wouldn't there be ambiguities?
> 
> Imagine you have a configuration containing the properties foo=something 
> and foo.bar=something_different. If you now want to access 
> ${sessionScope.configAttribute.foo} and 
> ${sessionScope.configAttribute.foo.bar}, how could an implementation 
> know whether foo means a context or a property value?
> 
> Oliver

That is a good point, one posibility would be to have some simple 
precidence rules that when tracing the substrings of a property name.

If it resolves to a fully qualified object in the properties, then 
return it, otherwise, if any substrings match return a set of those 
substrings matching it.


For instance, storing :

config.add("a.b", z);
config.add("a.b.c", y);
config.add("a.b.c.d.e", x);
config.add("a.b.c.d.e.f", w);

${sessionScope.configAttribute.a.b} --> z
${sessionScope.configAttribute.a.b.c} --> y
${sessionScope.configAttribute.a.b.c.d.e} --> x
${sessionScope.configAttribute.a.b.c.d.e.f} --> w

but

${sessionScope.configAttribute.a.b.c.d}
    --> Map containing {"e",x; "e.f",w}

I'm sure there are other cases to take into consideration too.
-Mark

> 
> Emmanuel Bourg schrieb:
> 
>> Mark R. Diggory wrote:
>>
>>> Hmm, I'm not sure your getting me, I'm refering to making the 
>>> Configuration interface a proper Map via an extension of the 
>>> Collection API's Map Interface and requiring all implementations to 
>>> support that interface (Which could be facilitated through 
>>> Abstraction/Polymorphism) with little impact to the existing usage.
>>
>>
>>
>> I have been supporting the idea of basing the Configuration interface 
>> on java.util.Map for quite some time, that's why I filed Bug 26102 to 
>> start the convergence of the 2 interfaces but there was no urgent need 
>> to implement the Map interface. This EL use case is an interesting 
>> argument to push toward this change, but I'm not sure it will work 
>> well once we address the issue of hierarchical configurations.
>>
>> Emmanuel Bourg
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>>
>>
> 
> 

-- 
Mark Diggory
Software Developer
Harvard MIT Data Center
http://www.hmdc.harvard.edu

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic