You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Janne K. Olesen" <jk...@mobi-tech.com> on 2007/11/30 10:31:56 UTC

Accessing sitemap label-attribute in TraxTransformer

hallo out there,

does anybody know if there is a possibility to access the "label"-attribute from <map:transform> inside the 
TraxTransformer (java-code)?

I wrote my own TraxTransformer and I want to use the sitemap "label"-attribute as a logger name.

Greetings
Janne Olesen

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Accessing sitemap label-attribute in TraxTransformer

Posted by "Janne K. Olesen" <jk...@mobi-tech.com>.
Hi Andrew,

Andrew Stevens wrote:
> You seem to be missing the point of dependency injection - the TraxTransformer doesn't 
> look up its logger or specify its name or anything like that.  It just declares "I want a logger"
> (by implementing a "loggable" interface), and the component manager gives it one.
> So to do what you are suggesting would involve changing the component manager, not
> your transformer, so that it uses the label attribute or whatever to determine the logger 
> that it passes into the transformer after creating it.
> 
> What are you trying to achieve, though?  If you just want your transformer to use a different
> name/category to the default TraxTransformer, why not just specify a different logger=...
> parameter when you declare your component in the map:transformers section of your
> sitemap?

We wrote our own framework using cocoon, inside the framework we are publishing applications.
Each application uses its own log4j logger for debug output. The appropriate logger is created by an action, depending 
on the application-path inside cocoon. Available transformers are defined for the framework, not for each application.
I'm able to set a logger for our Transformer using enableLogging(Logger) from interface "loggable". But since we are 
using the Transformer quite a lot, it would be nice to distinguish the different Transformer calls.

Basically I want to achieve a logger hierarchy like:

<application>.MyTransformer.<label from sitemap>

Greetings Janne

> 
> Andrew.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: Accessing sitemap label-attribute in TraxTransformer

Posted by Andrew Stevens <at...@hotmail.com>.
You seem to be missing the point of dependency injection - the TraxTransformer doesn't 
look up its logger or specify its name or anything like that.  It just declares "I want a logger"
(by implementing a "loggable" interface), and the component manager gives it one.
So to do what you are suggesting would involve changing the component manager, not
your transformer, so that it uses the label attribute or whatever to determine the logger 
that it passes into the transformer after creating it.

What are you trying to achieve, though?  If you just want your transformer to use a different
name/category to the default TraxTransformer, why not just specify a different logger=...
parameter when you declare your component in the map:transformers section of your
sitemap?


Andrew.
-- 
http://pseudoq.sourceforge.net/  Open source java Sudoku solver

> Date: Fri, 30 Nov 2007 10:31:56 +0100
> From: jko@mobi-tech.com
>
> hallo out there,
>
> does anybody know if there is a possibility to access the "label"-attribute from map:transform inside the
> TraxTransformer (java-code)?
>
> I wrote my own TraxTransformer and I want to use the sitemap "label"-attribute as a logger name.
>
> Greetings
> Janne Olesen

_________________________________________________________________
Celeb spotting – Play CelebMashup and win cool prizes
https://www.celebmashup.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org