You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Mark Woon <mo...@SMI.Stanford.EDU> on 2002/02/08 22:55:26 UTC

How do you define/use context keys?

Hello,

In the JavaDocs for FileTargetFactory is says that I can use something
like:

 <file id="foo">
  <filename>${context-key}/real-name/...</filename>
 </file>

How do you specify/use a ${context-key}?

-Mark


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


RE: How do you define/use context keys?

Posted by Stephen McConnell <mc...@apache.org>.
Mark:

The Context interface defines an object that is used as an argument
to an implementation of Contextualizable.  Context is simply a container
of Objects that are accessible by name (which is probably what
${context-key} is referring to below).  Typically a context implementation
does not have any significant behaviour beyond returning an object based
on the supplied key.  This is significantly different to something like
ComponentManager which also returns object based on keys, but is likely
to contain some level of logic concerning creation or resolution of the
object requested.

You can think of the three interfaces Configuration, ComponentManager, and
Context as a logical breakdown of the types of argument values passes to
some black-box.  Configuration represents the static information (typically
modified by someone managing the black-box).  ComponentManager represents
the
set of arguments that will typically require computation by the manager.
And Context represents other runtime variable.

A good example of Context is in org.apache.avalon.phoenix.BlockContext
It contains information such as the directory that an application should
consider as the base (the sort of thing that is figured out at runtime
as opposed to a static configuration).

Cheers, Steve.


> -----Original Message-----
> From: woon@SMI.Stanford.EDU [mailto:woon@SMI.Stanford.EDU]On Behalf Of
> Mark Woon
> Sent: Saturday, 09 February, 2002 03:20
> To: Avalon Developers List
> Subject: Re: How do you define/use context keys?
>
>
> Peter Donald wrote:
>
> > On Sat, 9 Feb 2002 08:55, Mark Woon wrote:
> > >
> > >  <file id="foo">
> > >   <filename>${context-key}/real-name/...</filename>
> > >  </file>
> > >
> > > How do you specify/use a ${context-key}?
> >
> > I don't actually use this component yet so take what I say with
> a grain of
> > salt but ...
> >
> > I assume these are values that are retrieved from the Context
> object passed
> > into the LoggerManager if it is Contextualizable.
>
> Are there any sample apps that actually use Contextualizable?
> There's another
> gap in the documentation on how they're actually used.  I can
> figure out how to
> create them, and pass them around, but is there a standard way of actually
> using Context?  Is there some default/automatic ${context-key} parsing
> facility?
>
> -Mark
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>


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


Re: How do you define/use context keys?

Posted by Mark Woon <mo...@SMI.Stanford.EDU>.
Peter Donald wrote:

> On Sat, 9 Feb 2002 08:55, Mark Woon wrote:
> >
> >  <file id="foo">
> >   <filename>${context-key}/real-name/...</filename>
> >  </file>
> >
> > How do you specify/use a ${context-key}?
>
> I don't actually use this component yet so take what I say with a grain of
> salt but ...
>
> I assume these are values that are retrieved from the Context object passed
> into the LoggerManager if it is Contextualizable.

Are there any sample apps that actually use Contextualizable?  There's another
gap in the documentation on how they're actually used.  I can figure out how to
create them, and pass them around, but is there a standard way of actually
using Context?  Is there some default/automatic ${context-key} parsing
facility?

-Mark


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


Re: How do you define/use context keys?

Posted by Peter Donald <pe...@apache.org>.
On Sat, 9 Feb 2002 08:55, Mark Woon wrote:
> Hello,
>
> In the JavaDocs for FileTargetFactory is says that I can use something
> like:
>
>  <file id="foo">
>   <filename>${context-key}/real-name/...</filename>
>  </file>
>
> How do you specify/use a ${context-key}?

I don't actually use this component yet so take what I say with a grain of 
salt but ...

I assume these are values that are retrieved from the Context object passed 
into the LoggerManager if it is Contextualizable.

-- 
Cheers,

Pete

--------------------------------
 These aren't the droids you're 
 looking for. Move along. 
--------------------------------

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