From: <jue...@we...> - 2003-10-09 17:18:26
|
Matthew, Mike, Hmmm, I'm not always too keen in terms of perception... anyway: Hi = Matthew, I don't think I can to tell you anything about Conductor that = you wouldn't already know ;-) In terms of effort, I expect my XWork proposal to be pretty = straightforward to implement: It's basically just about introducing the = "external-ref" tag and an "ExternalReferenceResolver" interface that the = tag delegates to. A Spring implementation of that interface should be = easy to do too: Load the application context in some init method, and = resolve the references as bean names in the context. The only issue is where to load the application context from: If this = should be possible from the WEB-INF directory, we would need a reference = to the ServletContext in the SpringReferenceResolver implementation. = Else, we could use ClassPathXmlApplicationContext to load the XML file = from the class path: This would not involve anything special at all. So in fact, the interface would need an init method: public interface ExternalReferenceResolver { void init(); Object resolveReference(String name); } A Spring implementation could look as follows: public class SpringReferenceResolver implements = ExternalReferenceResolver { private ApplicationContext applicationContext; public void init() { applicationContext =3D new = ClassPathXmlApplicationContext("/spring-context.xml"); } public Object resolveReference(String name) { return applicationContext.getBean(name); } } It doesn't need to be more complicated than this. We would just need to = introduce such external reference hooks in XWork. I do not consider an = "external-ref" tag as much extra XML; and it's easy to specify = references to specific bean instances with it. What do you think? Juergen -----Original Message----- From: j=FCrgen h=F6ller [werk3AT]=20 Sent: Thursday, October 09, 2003 6:33 PM To: Matthew E. Porter Cc: spr...@li...; spr...@li... Subject: [Springframework-developer] RE: [Springframework-user] Introduction and Hibernate-Spring queries Not yet. Maybe Mike can comment on a timeframe, although Jason might be = the one that actually works on it. Note that this plan is not fixed at = all; currently, XWork has its own enable-interface-centric simple IoC = support. I'm just "consulting" on this issue; Mike, Jason, and the other = XWork guys will have to decide on what to adopt in the end. Juergen -----Original Message----- From: Matthew E. Porter [mailto:ma...@me...] Sent: Thursday, October 09, 2003 6:31 PM To: j=FCrgen h=F6ller [werk3AT] Cc: spr...@li...; spr...@li... Subject: Re: [Springframework-user] Introduction and Hibernate-Spring queries Has any work (i.e. code) been done on this? Cheers, matthew On Thursday, October 9, 2003, at 11:15 AM, j=FCrgen h=F6ller [werk3AT]=20 wrote: > Matthew, everybody, > > My XWork/Spring integration proposal is no secret -- here it is, cut=20 > from a recent mail to Jason and Mike. We've been discussing IoC=20 > options for XWork/Conductor for quite a while, mainly in terms of=20 > PicoContainer vs Spring. > > <quote> > > As far as I see, the XWork config file supports setting bean=20 > properties as parameters on actions like this: > > <action name=3D"Bar" class=3D"com.opensymphony.xwork.SimpleAction"> > <param name=3D"foo">17</param> > <param name=3D"bar">23</param> > </action> > > This is obviously pretty similar to a Spring bean definition, just=20 > specific for a WebWork action. A significant difference is that the=20 > Spring property tag can tag either a value tag or a ref tag within,=20 > i.e. either specify a parameter value or a=B4dependency on another = bean. > > Currently, I see the easiest way of accessing a Spring context from=20 > XWork via a tag that resolves an external component reference, a la: > > <action name=3D"Bar" class=3D"com.opensymphony.xwork.SimpleAction"> > <param name=3D"foo">17</param> > <external-ref name=3D"bar">myDataSource</external-ref> > </action> > > XWork could fetch the Spring context then, look up the bean named=20 > "myDataSource", and set the reference into the "bar" bean property of=20 > the "Bar" action. This would be intuitive, as it works analogously to=20 > setting a parameter value, and flexible, as it allows to reference any = > specific instance. Effectively, you would be accessing beans in a=20 > Spring middle tier context rather than letting Spring touch your=20 > action instances - but that's not a disadvantage, rather a clean=20 > separation of responsibilities. > > Of course, the Spring support for such external references can be=20 > pluggable in XWork, potentially replacing the current ComponentManager = > mechanism with its enabler interfaces. Any such resolver for external=20 > references would simply need to return an object for the given=20 > symbolic name. The interface could look like this: > > public interface ExternalReferenceResolver { > Object resolveReference(String name); > } > > A Spring implementation would grab a reference to the Spring=20 > application context and call getBean with the given name. The=20 > application context itself could get initialized on XWork startup,=20 > initializing its singletons upfront. I consider such an XWork/Spring=20 > integration as pretty simple but very powerful: no enabler interfaces, = > just bean properties with component types, and an external-ref tag in=20 > addition to the param tag. > > </quote> > > Juergen > > > -----Original Message----- > From: Matthew E. Porter [mailto:ma...@me...] > Sent: Thursday, October 09, 2003 4:16 PM > To: j=FCrgen h=F6ller [werk3AT] > Subject: Re: [Springframework-user] Introduction and Hibernate-Spring > queries > > >> >> Throwing in Spring as middle tier glue is a good idea, of course :-) >> Have you already thought about my proposal regarding XWork/Spring >> integration from some days ago? Finally, we're of course open for any >> suggestions and enhancement requests on the Spring side of things! >> > > I this proposal in the public space. I would also like to see > XW/WW2-Spring integration in the near term future. > > > Cheers, > matthew > ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. SourceForge.net hosts over 70,000 Open Source Projects. See the people who have HELPED US provide better services: Click here: http://sourceforge.net/supporters.php _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |