Leo Sutic wrote: > > From: Stefano Mazzocchi [mailto:[EMAIL PROTECTED]] > > > > 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:transformers> and <map:match pattern="*.html"> <map:generate src="xdocs/{1}.xml"/> <map:transform type="xinclude"/> <map:transform src="stylesheets/xml2html.xsl"/> <map:serialize/> </map:match> 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: transformer1.roleName=transformer:xslt transformer2.roleName=transformer:xinclude [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 used) 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. Robert. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>