You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Berin Loritsch <bl...@apache.org> on 2002/06/15 17:18:58 UTC

[A5] Context

I am very happy with the Context package.

We should add some extra information on the package.html file to direct
users how to extend the semantics of Context so that they can use it for
their own purposes.


"They that give up essential liberty to obtain a little temporary safety
 deserve neither liberty nor safety."
                - Benjamin Franklin


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [A5] Context

Posted by Peter Royal <pr...@apache.org>.
On Saturday 15 June 2002 12:46 pm, Nicola Ken Barozzi wrote:
> In reality, it can be used to do anything.

Yes, I believe that is the point :)

> It's too generic to be made to enforce anything;
> if a Container wants to tell something to its child,
> why not simply call a child's method, instead of giving the child
> a handle, which really makes the child a container itself.

The Context lets the container publish information to its children. It is up 
to the children to (a) care enough to receive it (implement Contextualizable) 
and (b) act upon the information in there.
-pete


-- 
peter royal -> proyal@apache.org

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [A5] Context

Posted by Stephen McConnell <mc...@osm.net>.

Nicola Ken Barozzi wrote:
> Peter Royal wrote:
>>> Aren't ComponentManagers(nowLocators) doing a similar thing (ie giving a
>>> class based on a name-role)?
>>
>>
>>
>> Not exactly. For some examples, in Phoenix a block is actually passed 
>> an instance of a BlockContext, from which a block can determine base 
>> directory that the block is running in as well as its configured name. 
>> It is my understanding that the Context was designed for the passage 
>> of runtime information from the container to components.
> 
> 
> In reality, it can be used to do anything.
> 
> It's too generic to be made to enforce anything;
> if a Container wants to tell something to its child,
> why not simply call a child's method, instead of giving the child
> a handle, which really makes the child a container itself.

This would create a requirement for the container to be aware of the 
component method to handle a particular value.  It also eliminates the 
hirachical retrival process of a context (which is so nice to use).

You can enforce context management if you introduce meta-info on a 
compoennt type that declares the context contract.

Steve.


-- 

Stephen J. McConnell

OSM SARL
digital products for a global economy
mailto:mcconnell@osm.net
http://www.osm.net


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [A5] Context

Posted by Nicola Ken Barozzi <ni...@apache.org>.

Peter Royal wrote:
> On Saturday 15 June 2002 11:29 am, Nicola Ken Barozzi wrote:
> 
>>Personally I don't like contexts, they smell of "global variables" to me.
> 
> 
> They are, but only in the context of a container :)
> 
> 
>>Aren't ComponentManagers(nowLocators) doing a similar thing (ie giving a
>>class based on a name-role)?
> 
> 
> Not exactly. For some examples, in Phoenix a block is actually passed an 
> instance of a BlockContext, from which a block can determine base directory 
> that the block is running in as well as its configured name. It is my 
> understanding that the Context was designed for the passage of runtime 
> information from the container to components.

In reality, it can be used to do anything.

It's too generic to be made to enforce anything;
if a Container wants to tell something to its child,
why not simply call a child's method, instead of giving the child
a handle, which really makes the child a container itself.

-- 
Nicola Ken Barozzi                   nicolaken@apache.org
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)
---------------------------------------------------------------------


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [A5] Context

Posted by Peter Royal <pr...@apache.org>.
On Saturday 15 June 2002 11:29 am, Nicola Ken Barozzi wrote:
> Personally I don't like contexts, they smell of "global variables" to me.

They are, but only in the context of a container :)

> Aren't ComponentManagers(nowLocators) doing a similar thing (ie giving a
> class based on a name-role)?

Not exactly. For some examples, in Phoenix a block is actually passed an 
instance of a BlockContext, from which a block can determine base directory 
that the block is running in as well as its configured name. It is my 
understanding that the Context was designed for the passage of runtime 
information from the container to components.
-pete

-- 
peter royal -> proyal@apache.org

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [A5] Context

Posted by Stephen McConnell <mc...@osm.net>.

Nicola Ken Barozzi wrote:
> 
> 
> Berin Loritsch wrote:
> 
>> I am very happy with the Context package.
> 
> 
> Hmmm...
> 
> Personally I don't like contexts, they smell of "global variables" to me.

Context values can be created specifically for a point in a component 
instance hierachy.  Access is restricted to the components that a 
container supplies them to - i.e. there are not global.

> Aren't ComponentManagers(nowLocators) doing a similar thing (ie giving a 
> class based on a name-role)?

Not a "role" name - its a "key" (flat table lookup).

Steve.


-- 

Stephen J. McConnell

OSM SARL
digital products for a global economy
mailto:mcconnell@osm.net
http://www.osm.net


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [A5] Context

Posted by Nicola Ken Barozzi <ni...@apache.org>.
Berin Loritsch wrote:
>>From: Nicola Ken Barozzi [mailto:nicolaken@apache.org] 
>>
>>
>>Berin Loritsch wrote:
>>
>>>I am very happy with the Context package.
>>
>>Hmmm...
>>
>>Personally I don't like contexts, they smell of "global 
>>variables" to me.
> 
> 
> And that is one of their uses.  A way of sharing contextual
> information with a large group of components.
> 
> That beats repeating config information in several locations.

Like local variables do.
But can be a very delicate point.

>>Aren't ComponentManagers(nowLocators) doing a similar thing 
>>(ie giving a 
>>class based on a name-role)?
> 
> 
> That's a different concern.  Don't confuse them.

Which in fact happens.
On James they are talking about getting a Logger from a Context :-S

>>Also, look at the Cocoon Context: it's a real PITA to understand that 
>>you need to get a context from a context...
> 
> Please take off your Cocoon hat.  That's a Cocoon decision, not an
> Avalon one.

;-P

What I mean is that if the major Avalon user took this decision,
I guess there is something wrong with it.

-- 
Nicola Ken Barozzi                   nicolaken@apache.org
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)
---------------------------------------------------------------------


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: [A5] Context

Posted by Berin Loritsch <bl...@apache.org>.
> From: Nicola Ken Barozzi [mailto:nicolaken@apache.org] 
> 
> 
> Berin Loritsch wrote:
> > I am very happy with the Context package.
> 
> Hmmm...
> 
> Personally I don't like contexts, they smell of "global 
> variables" to me.

And that is one of their uses.  A way of sharing contextual
information with a large group of components.

That beats repeating config information in several locations.


> Aren't ComponentManagers(nowLocators) doing a similar thing 
> (ie giving a 
> class based on a name-role)?

That's a different concern.  Don't confuse them.


> Also, look at the Cocoon Context: it's a real PITA to understand that 
> you need to get a context from a context...

Please take off your Cocoon hat.  That's a Cocoon decision, not an
Avalon one.



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [A5] Context

Posted by Nicola Ken Barozzi <ni...@apache.org>.

Berin Loritsch wrote:
> I am very happy with the Context package.

Hmmm...

Personally I don't like contexts, they smell of "global variables" to me.

Aren't ComponentManagers(nowLocators) doing a similar thing (ie giving a 
class based on a name-role)?

Also, look at the Cocoon Context: it's a real PITA to understand that 
you need to get a context from a context...

> We should add some extra information on the package.html file to direct
> users how to extend the semantics of Context so that they can use it for
> their own purposes.

Definately.
See the James MailContext class as a possible candidate of a special 
Context.

-- 
Nicola Ken Barozzi                   nicolaken@apache.org
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)
---------------------------------------------------------------------


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [A5] Context

Posted by Stephen McConnell <mc...@osm.net>.

Berin Loritsch wrote:
> I am very happy with the Context package.
> 
> We should add some extra information on the package.html file to direct
> users how to extend the semantics of Context so that they can use it for
> their own purposes.
> 

Also - there is the question of how a context can defined via XML.  You 
mentioned in another thread that there are several meta-models and 
several configuration formats that are different.  Something to go onto 
the overall A5 agrenda is agreeing on at standard context definition 
schema before we see the emergence of mutiple solutions.

The only context schema that I know of at the moment is the 
ContextFactory class in the Merlin tree. I think that an excellent 
reference point but needs examples and lots more documentation.

Also, at the meta-info level - we need a mechanisms to declare that a 
component references context keys - either as "requires" or "optional". 
  This can be used by the container to ensure (a) that context 
defintions are provided and that the component context contract can be 
fullfilled.

Steve.


-- 

Stephen J. McConnell

OSM SARL
digital products for a global economy
mailto:mcconnell@osm.net
http://www.osm.net


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [A5] Context

Posted by Stephen McConnell <mc...@osm.net>.

Berin Loritsch wrote:
> I am very happy with the Context package.
> 

Me too!

> We should add some extra information on the package.html file to direct
> users how to extend the semantics of Context so that they can use it for
> their own purposes.
> 

+1
I am seeing examples of extensions getting it wrong.
A basic example together with the rationale is all that is needed.


-- 

Stephen J. McConnell

OSM SARL
digital products for a global economy
mailto:mcconnell@osm.net
http://www.osm.net


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [A5] Context

Posted by Leo Simons <le...@apache.org>.
On Sat, 2002-06-15 at 17:18, Berin Loritsch wrote:
> I am very happy with the Context package.

+1.

- Leo



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>