You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Sy...@swisscom.com on 2003/12/04 15:25:39 UTC

RE : RE : error when using my own transformer

OK, thanks.

I have another problem with Parameters.
I set a parameter when I use my transformer like this:
	<map:transform type="role">
		<map:parameter name="username" value="myusername"/>
	</map:transform>

But when I execute the parameterize(Parameters parameters) method, the parameters object is empty.

Have you an idea?
Thanks
Sylvain

My method:
public void parameterize(Parameters parameters) throws ParameterException {
  this.usernameEntered = parameters.getParameter("username");
}


> -----Original Message-----
> From: Jorg Heymans [mailto:jh@domek.be] 
> Sent: Thursday, December 04, 2003 2:12 PM
> To: users@cocoon.apache.org
> Subject: Re: RE : error when using my own transformer
> 
> 
> the uri is the namespace that is attached to the element, if your 
> element does not use a namespace then this will be empty (or null)
> 
> 
> Sylvain.Thevoz@swisscom.com wrote:
> 
> > Hi,
> > 
> > Yes, you're right.
> > The problem is when the method below is called, the uri 
> parameter is empty.
> > 
> > public void startElement(String uri, String name, String 
> raw, Attributes attr)
> > 
> > Do you know where this parameter comes from?
> > 
> > Thanks
> > Sylvain
> > 
> > 
> > 
> >>-----Original Message-----
> >>From: Marco Rolappe [mailto:m_rolappe@web.de] 
> >>Sent: Thursday, December 04, 2003 1:35 PM
> >>To: users@cocoon.apache.org
> >>Subject: AW: error when using my own transformer
> >>
> >>
> >>hi sylvain,
> >>
> >>your transformer probably throws an exception in one of the 
> lifecycle
> >>methods (setup, initialize, whatever...). quickest way to 
> >>find out (if not
> >>obvious from the logs) is to set breakpoints on those methods 
> >>(and maybe on
> >>exceptions thown) and see what happens.
> >>
> >>
> >>
> >>>-----Ursprüngliche Nachricht-----
> >>>Von: users-return-59478-m_rolappe=web.de@cocoon.apache.org
> >>>
> >>
> >>[mailto:users-return-59478-m_rolappe=web.de@cocoon.apache.org]
> >>Im Auftrag
> >>
> >>>von Sylvain.Thevoz@swisscom.com
> >>>Gesendet: Donnerstag, 4. Dezember 2003 12:56
> >>>An: users@cocoon.apache.org
> >>>Betreff: error when using my own transformer
> >>>
> >>>
> >>>Hello,
> >>>
> >>>I have created a new transformer called "RoleTransformer". It
> >>>doesn't have lot of features at this moment: it simply adds some
> >>>XML tags in a document.
> >>>
> >>>I have declared this new transformer in the main sitemap like:
> >>><map:transformer logger="sitemap.transformer.role" name="role"
> >>>src="com.itservices.woc.transformation.RoleTransformer"/>
> >>>
> >>>And I use it in another sitemap:
> >>><map:transform type="role">
> >>>	<map:parameter name="username" value="{request-param:name}"/>
> >>></map:transform>
> >>>
> >>>But it seems that Cocoon doesn't find it. The error below occurs.
> >>>
> >>>Do I have forget something?
> >>>
> >>>Thanks for any help
> >>>Sylvain
> >>>
> >>>**error**
> >>>ERROR   (2003-12-04) 12:41.09:390 Lookup of transformer for role
> >>>'role' failed.:
> >>>org.apache.avalon.framework.component.ComponentException:
> >>>transformers: ComponentSelector could not access the Component
> >>>for hint [role] (key [role])
> >>>	at
> >>>org.apache.cocoon.webapps.authentication.components.PipelineAuthen
> >>>ticator.authenticate(PipelineAuthenticator.java:199)
> >>>	at
> >>>org.apache.cocoon.webapps.authentication.components.DefaultAuthent
> >>>icationManager.login(DefaultAuthenticationManager.java:238)
> >>>etc...
> >>>**error**
> >>>
> >>>
> >>
> >>------------------------------------------------------------
> ---------
> >>
> >>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >>>For additional commands, e-mail: users-help@cocoon.apache.org
> >>>
> >>
> >>
> >>------------------------------------------------------------
> ---------
> >>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >>For additional commands, e-mail: users-help@cocoon.apache.org
> >>
> >>
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 

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


AW: RE : RE : error when using my own transformer

Posted by Marco Rolappe <m_...@web.de>.
sylvain,

the parameterize method (from Avalon's Parameterizable interface) can be
used as an alternative to the configure method (from Avalon's Configurable
interface). this means that your transformer's configuration (from the
map:transformers section) would be passed to parameterize. but I assume you
don't want that. you want to get the pipeline parameters for your
transformer. as joerg already mentioned Cocoon passes these via the setup
method (from Cocoon's SiteMapModelComponent interface AFAIR).

> -----Ursprüngliche Nachricht-----
> Von: users-return-59494-m_rolappe=web.de@cocoon.apache.org
> [mailto:users-return-59494-m_rolappe=web.de@cocoon.apache.org]Im Auftrag
> von Jorg Heymans
> Gesendet: Donnerstag, 4. Dezember 2003 15:34
> An: users@cocoon.apache.org
> Betreff: Re: RE : RE : error when using my own transformer
>
>
> I am not sure where you get the parametrize method from, but can't you
> override setup for this (2.0.4)?
>
> 	public void setup(
> 		SourceResolver resolver,
> 		Map objectModel,
> 		String src,
> 		Parameters par)
> 		throws ProcessingException, SAXException, IOException {
>
> The Parameters object in here has always worked for me.
>
>
> Sylvain.Thevoz@swisscom.com wrote:
>
> > OK, thanks.
> >
> > I have another problem with Parameters.
> > I set a parameter when I use my transformer like this:
> > 	<map:transform type="role">
> > 		<map:parameter name="username" value="myusername"/>
> > 	</map:transform>
> >
> > But when I execute the parameterize(Parameters parameters)
> method, the parameters object is empty.
> >
> > Have you an idea?
> > Thanks
> > Sylvain
> >
> > My method:
> > public void parameterize(Parameters parameters) throws
> ParameterException {
> >   this.usernameEntered = parameters.getParameter("username");
> > }
> >
> >
> >
> >>-----Original Message-----
> >>From: Jorg Heymans [mailto:jh@domek.be]
> >>Sent: Thursday, December 04, 2003 2:12 PM
> >>To: users@cocoon.apache.org
> >>Subject: Re: RE : error when using my own transformer
> >>
> >>
> >>the uri is the namespace that is attached to the element, if your
> >>element does not use a namespace then this will be empty (or null)
> >>
> >>
> >>Sylvain.Thevoz@swisscom.com wrote:
> >>
> >>
> >>>Hi,
> >>>
> >>>Yes, you're right.
> >>>The problem is when the method below is called, the uri
> >>
> >>parameter is empty.
> >>
> >>>public void startElement(String uri, String name, String
> >>
> >>raw, Attributes attr)
> >>
> >>>Do you know where this parameter comes from?
> >>>
> >>>Thanks
> >>>Sylvain
> >>>
> >>>
> >>>
> >>>
> >>>>-----Original Message-----
> >>>>From: Marco Rolappe [mailto:m_rolappe@web.de]
> >>>>Sent: Thursday, December 04, 2003 1:35 PM
> >>>>To: users@cocoon.apache.org
> >>>>Subject: AW: error when using my own transformer
> >>>>
> >>>>
> >>>>hi sylvain,
> >>>>
> >>>>your transformer probably throws an exception in one of the
> >>
> >>lifecycle
> >>
> >>>>methods (setup, initialize, whatever...). quickest way to
> >>>>find out (if not
> >>>>obvious from the logs) is to set breakpoints on those methods
> >>>>(and maybe on
> >>>>exceptions thown) and see what happens.
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>-----Ursprüngliche Nachricht-----
> >>>>>Von: users-return-59478-m_rolappe=web.de@cocoon.apache.org
> >>>>>
> >>>>
> >>>>[mailto:users-return-59478-m_rolappe=web.de@cocoon.apache.org]
> >>>>Im Auftrag
> >>>>
> >>>>
> >>>>>von Sylvain.Thevoz@swisscom.com
> >>>>>Gesendet: Donnerstag, 4. Dezember 2003 12:56
> >>>>>An: users@cocoon.apache.org
> >>>>>Betreff: error when using my own transformer
> >>>>>
> >>>>>
> >>>>>Hello,
> >>>>>
> >>>>>I have created a new transformer called "RoleTransformer". It
> >>>>>doesn't have lot of features at this moment: it simply adds some
> >>>>>XML tags in a document.
> >>>>>
> >>>>>I have declared this new transformer in the main sitemap like:
> >>>>><map:transformer logger="sitemap.transformer.role" name="role"
> >>>>>src="com.itservices.woc.transformation.RoleTransformer"/>
> >>>>>
> >>>>>And I use it in another sitemap:
> >>>>><map:transform type="role">
> >>>>>	<map:parameter name="username" value="{request-param:name}"/>
> >>>>></map:transform>
> >>>>>
> >>>>>But it seems that Cocoon doesn't find it. The error below occurs.
> >>>>>
> >>>>>Do I have forget something?
> >>>>>
> >>>>>Thanks for any help
> >>>>>Sylvain
> >>>>>
> >>>>>**error**
> >>>>>ERROR   (2003-12-04) 12:41.09:390 Lookup of transformer for role
> >>>>>'role' failed.:
> >>>>>org.apache.avalon.framework.component.ComponentException:
> >>>>>transformers: ComponentSelector could not access the Component
> >>>>>for hint [role] (key [role])
> >>>>>	at
> >>>>>org.apache.cocoon.webapps.authentication.components.PipelineAuthen
> >>>>>ticator.authenticate(PipelineAuthenticator.java:199)
> >>>>>	at
> >>>>>org.apache.cocoon.webapps.authentication.components.DefaultAuthent
> >>>>>icationManager.login(DefaultAuthenticationManager.java:238)
> >>>>>etc...
> >>>>>**error**
> >>>>>
> >>>>>
> >>>>
> >>>>------------------------------------------------------------
> >>
> >>---------
> >>
> >>>>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >>>>>For additional commands, e-mail: users-help@cocoon.apache.org
> >>>>>
> >>>>
> >>>>
> >>>>------------------------------------------------------------
> >>
> >>---------
> >>
> >>>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >>>>For additional commands, e-mail: users-help@cocoon.apache.org
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>---------------------------------------------------------------------
> >>
> >>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >>>For additional commands, e-mail: users-help@cocoon.apache.org
> >>>
> >>>
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >>For additional commands, e-mail: users-help@cocoon.apache.org
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


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


Re: RE : RE : error when using my own transformer

Posted by Jorg Heymans <jh...@domek.be>.
I am not sure where you get the parametrize method from, but can't you 
override setup for this (2.0.4)?

	public void setup(
		SourceResolver resolver,
		Map objectModel,
		String src,
		Parameters par)
		throws ProcessingException, SAXException, IOException {

The Parameters object in here has always worked for me.


Sylvain.Thevoz@swisscom.com wrote:

> OK, thanks.
> 
> I have another problem with Parameters.
> I set a parameter when I use my transformer like this:
> 	<map:transform type="role">
> 		<map:parameter name="username" value="myusername"/>
> 	</map:transform>
> 
> But when I execute the parameterize(Parameters parameters) method, the parameters object is empty.
> 
> Have you an idea?
> Thanks
> Sylvain
> 
> My method:
> public void parameterize(Parameters parameters) throws ParameterException {
>   this.usernameEntered = parameters.getParameter("username");
> }
> 
> 
> 
>>-----Original Message-----
>>From: Jorg Heymans [mailto:jh@domek.be] 
>>Sent: Thursday, December 04, 2003 2:12 PM
>>To: users@cocoon.apache.org
>>Subject: Re: RE : error when using my own transformer
>>
>>
>>the uri is the namespace that is attached to the element, if your 
>>element does not use a namespace then this will be empty (or null)
>>
>>
>>Sylvain.Thevoz@swisscom.com wrote:
>>
>>
>>>Hi,
>>>
>>>Yes, you're right.
>>>The problem is when the method below is called, the uri 
>>
>>parameter is empty.
>>
>>>public void startElement(String uri, String name, String 
>>
>>raw, Attributes attr)
>>
>>>Do you know where this parameter comes from?
>>>
>>>Thanks
>>>Sylvain
>>>
>>>
>>>
>>>
>>>>-----Original Message-----
>>>>From: Marco Rolappe [mailto:m_rolappe@web.de] 
>>>>Sent: Thursday, December 04, 2003 1:35 PM
>>>>To: users@cocoon.apache.org
>>>>Subject: AW: error when using my own transformer
>>>>
>>>>
>>>>hi sylvain,
>>>>
>>>>your transformer probably throws an exception in one of the 
>>
>>lifecycle
>>
>>>>methods (setup, initialize, whatever...). quickest way to 
>>>>find out (if not
>>>>obvious from the logs) is to set breakpoints on those methods 
>>>>(and maybe on
>>>>exceptions thown) and see what happens.
>>>>
>>>>
>>>>
>>>>
>>>>>-----Ursprüngliche Nachricht-----
>>>>>Von: users-return-59478-m_rolappe=web.de@cocoon.apache.org
>>>>>
>>>>
>>>>[mailto:users-return-59478-m_rolappe=web.de@cocoon.apache.org]
>>>>Im Auftrag
>>>>
>>>>
>>>>>von Sylvain.Thevoz@swisscom.com
>>>>>Gesendet: Donnerstag, 4. Dezember 2003 12:56
>>>>>An: users@cocoon.apache.org
>>>>>Betreff: error when using my own transformer
>>>>>
>>>>>
>>>>>Hello,
>>>>>
>>>>>I have created a new transformer called "RoleTransformer". It
>>>>>doesn't have lot of features at this moment: it simply adds some
>>>>>XML tags in a document.
>>>>>
>>>>>I have declared this new transformer in the main sitemap like:
>>>>><map:transformer logger="sitemap.transformer.role" name="role"
>>>>>src="com.itservices.woc.transformation.RoleTransformer"/>
>>>>>
>>>>>And I use it in another sitemap:
>>>>><map:transform type="role">
>>>>>	<map:parameter name="username" value="{request-param:name}"/>
>>>>></map:transform>
>>>>>
>>>>>But it seems that Cocoon doesn't find it. The error below occurs.
>>>>>
>>>>>Do I have forget something?
>>>>>
>>>>>Thanks for any help
>>>>>Sylvain
>>>>>
>>>>>**error**
>>>>>ERROR   (2003-12-04) 12:41.09:390 Lookup of transformer for role
>>>>>'role' failed.:
>>>>>org.apache.avalon.framework.component.ComponentException:
>>>>>transformers: ComponentSelector could not access the Component
>>>>>for hint [role] (key [role])
>>>>>	at
>>>>>org.apache.cocoon.webapps.authentication.components.PipelineAuthen
>>>>>ticator.authenticate(PipelineAuthenticator.java:199)
>>>>>	at
>>>>>org.apache.cocoon.webapps.authentication.components.DefaultAuthent
>>>>>icationManager.login(DefaultAuthenticationManager.java:238)
>>>>>etc...
>>>>>**error**
>>>>>
>>>>>
>>>>
>>>>------------------------------------------------------------
>>
>>---------
>>
>>>>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>>>>For additional commands, e-mail: users-help@cocoon.apache.org
>>>>>
>>>>
>>>>
>>>>------------------------------------------------------------
>>
>>---------
>>
>>>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>>>For additional commands, e-mail: users-help@cocoon.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>---------------------------------------------------------------------
>>
>>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>>For additional commands, e-mail: users-help@cocoon.apache.org
>>>
>>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 


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