You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Lieven Doclo <ld...@schaubroeck.be> on 2007/10/10 16:23:45 UTC

problem creating generator - parameters

Hi,

I'm trying to build a generator that does the following:

call a remote method on a server (using spring remoting)
drag the result through an XML mapper (currently XMLBeans)
deliver XML SAX events to cocoon

All in all not a big issue, were it not for the fact that I can't seem 
to find information on configuring a generator.

I'd like to define the generator as this:

<map:generator name="remoteGenerator" src="x.y.RemoteSpringGenerator>
     <spring-config>/x/y/remote-spring-config.xml</spring-config>
</map:generator>


where the xml file contains my remote servicebeans, like:

<bean id="myService" 
class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
	<property name="serviceUrl" value="rmi://localhost:6666/MyService"/>
	<property name="serviceInterface" value="x.y.MyService"/>
</bean>

Is the above possible?

I've cooked up a solution by hard-coding the xml location into the 
RemoteSpringGenerator (using a 'magic' location), but I'd like to reuse 
the class in other projects.

I can also use:

<map:match pattern="myRemoteMethod.xml">
   <map:generate type="remoteGenerator">
     <map:parameter name="remoteServiceName" value="myService" />
     <map:parameter name="methodName" value="myRemoteMethod" />
     <map:parameter name="argTypes" value="Integer" />
     <map:parameter name="argNames" value="id" />
     <map:parameter name="spring-config" 
value="/x/y/remote-spring-config.xml" />
   </map:generate>
   <map:serialize type="xml"/>
</map:match>

but this means a lot of copy-paste and the need to constantly build the 
Spring container (although I could create it only the first time and 
reuse it, but still)...

In any case, I'd call it through http://.../myRemoteMethod.xml?id=3

TIA!

Lieven






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


Re: problem creating generator - parameters

Posted by Joerg Heinicke <jo...@gmx.de>.
On 10.10.2007 10:23 Uhr, Lieven Doclo wrote:

> I'd like to define the generator as this:
> 
> <map:generator name="remoteGenerator" src="x.y.RemoteSpringGenerator>
>     <spring-config>/x/y/remote-spring-config.xml</spring-config>
> </map:generator>
> 
> 
> where the xml file contains my remote servicebeans, like:
> 
> <bean id="myService" 
> class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
>     <property name="serviceUrl" value="rmi://localhost:6666/MyService"/>
>     <property name="serviceInterface" value="x.y.MyService"/>
> </bean>
> 
> Is the above possible?

I don't see any problem with this. You have to implement the 
Configurable or the Parameterizable interface. The spring-config 
parameter is NOT passed to setup() if that's what you expected.

If you only started the project recently you might consider using Cocoon 
2.2 which is based on Spring and so makes the integration of both much 
easier.

Joerg

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