Here is a first crack at the interface. I'm assuming that there will be
parent/child scopes here, which the last few methods deal with. I also
thought about having a few other 'collection' type methods, but don't
know what everyone else would think, such as contains( object ),
values(), isEmpty(), keySet(), etc.
Back to the JellyContext, what about finding variables in nested scopes?
For example, say we have one JellyContext (no parent), and it has the
following scopes:
- default scope
- customScope1
- HttpApplication which contains as a child a HttpSession scope
A client does a findVariable() call on the context. We can assume that
the context would search the default, customScope1 and the
HttpApplication scope, but what about the session scope?. If the leaf,
or last scope in a parent/child graph, is bound and not the top parent,
this is no problem, since the child parent can do a
getParent().findVariable() type of call. This doesn't mention if we have
nested Contexts as well.
I can think of three options:
1. we don't have nested scopes and the search is easy. Each context has
its own list of scopes and it can ask its parent.
2. we allow walking down the scope graph as well as up, via a
getChildScope() or something like that. Maybe have that as a protected
method on a BaseScope or something, and the context or the scope itself
can check for that.
3. ???
~Robert
Robert McIntosh wrote:
> I don't have a use case for events either, but I thought I would throw
> it out there for discussion. I agree that the Scope interface be very
> simple and the context should have a default scope, which can be
> overridden by the user.
>
> ~Robert
>
> bob mcwhirter wrote:
>
>>> 2. Have/keep the scope listeners and events?
>>>
>>
>>
>> I personally see Scope as a way to keep me from having to keep writing
>> subclasses of JellyContext when I want the context to be backed by my
>> own data structure.
>>
>> Talking with Strachan I think we're pondering
>> context.setDefaultScope( myScope );
>>
>> In that vein, making Scope very simple be best for my particular
>> use-case.
>>
>> public interface Scope
>> {
>> void setVariable(String name, Object value);
>> Object getVariable(String name);
>> }
>>
>> If the JellyContext wants to check for ListenableScope and fire events,
>> that's cool, but it'd also be overblown for all of my use-cases.
>>
>> -bob
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
|