avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Mouat <rob...@mouat.net>
Subject RE: Fresh Outlook: (was RE: [desperate plea] RE: The need for 'hints')
Date Wed, 26 Jun 2002 16:25:34 GMT
Leo Sutic wrote:

> > From: Stefano Mazzocchi [mailto:stefano@apache.org] 
> > 
> >  lookup(role,hint);
> > 
> > and
> > 
> >  lookup(role+"/"+hint);
> FWIW, I'm very pro-lookup(role,hint);

both role,hint and role/hint may be unnecessary...

Assumption: any resolution of role+hint (or role,hint or role/hint) that a
container can be reasonably expected to do, the assembler can also be
expected to do.

[i.e. if a hint is generated at runtime, and requires runtime resolution
then it is probably beyond the scope of the container -- and should be
resolved by a specialised ComponentSelector component]

Claim: a component doesn't need lookup(role,hint), and doesn't need to do
any string concatenation implied by lookup(role+"/"+hint) -- i.e.
lookup(role) should be enough.

Basically, the work gets shifted to the assembler.  The assembler does the
resolution (at assembly time), determines an unambiguous role name for the
component to be lookup up, and passes this role name onto the client
component via it's configuration.

e.g. given a cocoon site map containing:
[appologies in advance for not being very familiar with cocoon]

  <map:transformers default="xslt">
   <map:transformer name="xslt" src="org.apache.cocoon.transformation.TraxTransformer"/>
   <map:transformer name="xinclude" src="org.apache.cocoon.transformation.XIncludeTransformer"/>


  <map:match pattern="*.html">
   <map:generate src="xdocs/{1}.xml"/>
   <map:transform type="xinclude"/>
   <map:transform src="stylesheets/xml2html.xsl"/>

the assembler [code that compiles the sitemap] could:

  - create components with role names transformer:xslt and transformer:xinclude

  - pass these role names into the pipeline's configuration e.g. something
    equivalent to:

[or, more precisely, tell the container to do this]

Then when the component wants to lookup the first transformer it fetches
the role name from it's configuration and passes the result to lookup().

So now the component doesn't need to do string concatenation and the
component locater doesn't need to check for string concatenation (i.e.
search the role name for the "/" character to determine if a hint was

This work is given to the assembler: who now has control of both giving
the transformer it's name (transformer:xslt) *and* telling the component
what name to lookup (transformer:xslt).  (note: the assembler could have
chosen "asdfghjkl" as the role name if it desired [though this might
make log files confusing :)]).

I think this approach looks a little nicer that role+"/"+hint -- and while
potentially not as powerful as role,hint (in the case of runtime data), it
makes it clear exactly what is going to happen.


To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>

View raw message