Cameron,

I played around with doing something similar to this with Bebop, which is my
own spiffy cool component container.  I think integration with Spring would
be fairly comparable.

Basically, the ActionProxy needs an ActionConfig.  So, you can either:

specify enough in your xwork.xml so that Xwork can build a useful
ActionConfig object (which means, you need to repeat yourself... since at
the very least the action element requires a class attribute)

or

create and populate your own ActionConfig object manually (which gets tricky
when you try to deal with interceptors and results that are defined at the
package level).

So that's the first problem.

Then... do you want the component container to only provide Actions, or
Results and Interceptors as well?

If so, you can basically avoid xwork.xml entirely by defining your own
action configurations in the component container.  Just create an
ActionEntry bean (or whatever you want to call it) with the following
properties:

Action action;
Map    results;
List   interceptors;

This will work, and all the semantics representing the event processing will
be consolidated.  But it won't feel very much like Xwork at that point.

So I dunno... it just never seemed to fit together as nicely as I would have
hoped.

In the case of Bebop, we decided to simply use an interceptor to configure
Xwork Actions... which is a much shallower integration, but seems to fit
more cleanly into the Xwork way of doing things.

Maybe you'll have better luck with it.  Lemme know if I can be any help.

-Tim
 http://bebop.dev.java.net




----- Original Message ----- 
From: "Cameron Braid" <[EMAIL PROTECTED]>
To: "Opensymphony-Webwork" <[EMAIL PROTECTED]>
Sent: Friday, October 31, 2003 11:02 PM
Subject: [OS-webwork] Anyone working on Spring Framework Integration?


> Is anyone working on integration between Xwork and the Spring Framework.
>
> I have managed to create a webwork interceptor that allows a xwork
> action to make use of any spring bean by creating a simple mapping.
>
> However, I would like a better soloution that uses spring as the action
> facory.. And I would like to do this without duplication of
> configuration in both xwork.xml and applicationContext.xml
>
> One main reason that I want to use spring is to take advantage of its
> AOP framework, and most specifically the Hibernate Transaction
Interceptor.
>
> Therefore I would like to declare the transactional attributes for the
> action methods within spring, with a refrence to the xwork action.
>
> I woule like to still use WebWork's interceptors as normal - timing,
> logging, params, chain, etc.. because they have different semantics to
> spring.
>
> One way that I think this is possible is to create :
>
> Spring Objects :
>    a spring action factory bean, configured with the action namespace
> and name and the transactional attributes
>    this factory would lookup the action config for the classname and
> construct the action, wrap it in a proxy, attaching the interceptors.
>
> WebWork Objects
>    SpringServletDispatcher - to call ActionProxyFactory.setFactory(new
> SpringActionProxyFactory())
>    SpringActionProxyFactory - to override createActionInvocation to use
> a SpringActionInvocation
>    SpringActionInvocation -  to override createAction - to delegate to
>
WebApplicationContextUtils.getWebApplicationContext(servletContext).getBean(
beanName)
> to use the factory within spring to contruct this action.
>
> This way the xwork.xml file remains untouched and all that is needed is
> a bean entry in applicationContext.xml that defines each action's
> transactional attributes.
>
> Something like :
>
>     <bean id="defaultActionTransactionAttributes"
> class="com.datacodex.spring.beans.PropertiesFactoryBean">
>         <property name="properties">
>             <props>
>                 <prop key="execute">PROPAGATION_REQUIRED</prop>
>             </props>
>         </property>
>     </bean>
>
>     <bean id="admin.SpringAction" class="WebworkActionFactoryBean">
>         <property
> name="action"><value>/admin/SpringAction</value></property>
>         <property name="transactionManager"><ref
> local="transactionManager"/></property>
>         <property name="transactionAttributes"><ref
> local="defaultActionTransactionAttributes"/></property>
>     </bean>
>
> I am open to suggestions for other ways to do this.
>
> Anyone have any thoughts / ideas ?
>
> Cameron
>
> -- 
> Any damn fool can write code that a computer can understand...
> The trick is to write code that humans can understand.
> [Martin Fowler
http://www.martinfowler.com/distributedComputing/refactoring.pdf]
>
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: SF.net Giveback Program.
> Does SourceForge.net help you be more productive?  Does it
> help you create better code?   SHARE THE LOVE, and help us help
> YOU!  Click Here: http://sourceforge.net/donate/
> _______________________________________________
> Opensymphony-webwork mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to