I was thinking about this whole issue yesterday. Everyone seems to want to write "pure" business objects that have no dependencies on their framework. This is a good thing. This often translates to people wanting to write objects that don't know they will be used in a framework. This seems impossible if you actually want your objects to work with the features of the framework.
For instance it is likely that any reference you have to something supplied by the framework should be marked transient. Your code has to declare that - it can't be managed by the framework. To integrate this with a framework you'd need a decorator object that handles the initialization in a framework dependent way and overrides (perhaps) readObject to refresh the framework supplied values. A simple way to do this is with xDoclet (another dependency !) e.g. package com.mycompany.business; /** Implements some business rules * @ioc.framework.configurationMethod setDataSource(DataSource) public class BusinessObject implements Serializable{ private transient DataSource frameworkDataSource; ... public void nonIOCMethod(); } Running xDoclet on this source file would produce something like: package org.frameworkorg.com.mycompany.business; public class BusinessObjectWrapper extends com.mycompany.business.BusinessObject { BusinessObject obj; public BusinessObjectFrameworkWrapper { obj = new BusinessObject(); // calling the ioc methods here removes the need to extend readObject() obj.setDataSource(framework.getDataSource()); } // public void nonIOCMethod(){ obj.nonIOCMethod(); } } The framework could check to see if an XXXFrameworkWrapper class is available and, if it is, it would instantiate, configure and return that. Using xDoclet to generate the necessary classes means that the class should be able to be adapated to run under any IoC framework - "only" the code generation boilerplate would need to be changed. For scoped objects the framework would generate an XXXFrameworkWrapper and store that in the requested scope. One of the issues being discussed on this point is the need to re-set the object into the session in a distributed situation. This should be trivial to accomplish: e.g. public void nonIOCMethod(){ obj.nonIOCMethod(); if(framework.getSession().containsValue(this)) framework.getSession().put(framework.getSessionKey(this), this); //watch performance on key lookup. } The framework specific decorator doesn't, of course, need to go into another package when it's being generated by xDoclet. When you don't have access to the original source you should be able to generate a suitable decorator by other means. e.g. make a config file that specifies the class and nominates the configuration methods. These examples are trivial. Any XXXFrameworkWrapper only extends its base class. It may be desirable to apply the same configuration to a subclass of BusinessObject. If this is the case then the code generator could use java.lang.reflect.Proxy to return an object of the desired type while still overriding the correct methods in a framework specific way. Does this seem worth pursuing? Brett Knights > -----Original Message----- > From: Jason Carreira [mailto:[EMAIL PROTECTED] > Sent: Wednesday, July 09, 2003 11:24 AM > To: [EMAIL PROTECTED] > Subject: RE: [OS-webwork] updated release date estimates? > > > Except you still can't re-initialize component dependencies... So I > don't know what will happen if you serialize it and deserialize it. > > > -----Original Message----- > > From: Pat Lightbody [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, July 09, 2003 1:24 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [OS-webwork] updated release date estimates? > > > > > > Well, it looks like Pico now supports both constructors and > > bean properties, so I think we'll get the best of both worlds. > > > > -Pat > > > > ----- Original Message ----- > > From: "Matthew E. Porter" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Wednesday, July 09, 2003 8:33 AM > > Subject: Re: [OS-webwork] updated release date estimates? > > > > > > > What implementation of IoC will be in them? > > > > > > > > > Cheers, > > > matthew > > > > > > > > > On Wednesday, July 9, 2003, at 10:03 AM, Pat Lightbody wrote: > > > > > > > Matt and I were talking about releasing initial alphas > maybe this > > > > week? Matt, does that sound about right? > > > > > > > > -Pat > > > > > > > > ----- Original Message ----- > > > > From: "Francisco Hernandez" <[EMAIL PROTECTED]> > > > > To: <[EMAIL PROTECTED]> > > > > Sent: Wednesday, July 09, 2003 1:53 AM > > > > Subject: [OS-webwork] updated release date estimates? > > > > > > > > > > > >> anyone have any better estimates as far as release dates > > for xwork > > > >> and webwork2? > > > >> > > > >> > > > >> > > > >> ------------------------------------------------------- > > > >> This SF.Net email sponsored by: Parasoft > > > >> Error proof Web apps, automate testing & more. > > > >> Download & eval WebKing and get a free book. > > > >> www.parasoft.com/bulletproofapps > > > >> _______________________________________________ > > > >> Opensymphony-webwork mailing list > > > >> [EMAIL PROTECTED] > > > >> > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > This SF.Net email sponsored by: Parasoft > > > > Error proof Web apps, automate testing & more. > > > > Download & eval WebKing and get a free book. > > > > www.parasoft.com/bulletproofapps > > > > _______________________________________________ > > > > Opensymphony-webwork mailing list > > > > [EMAIL PROTECTED] > > > > > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork > > > > > > > > > > > > ------------------------------------------------------- > > > This SF.Net email sponsored by: Parasoft > > > Error proof Web apps, automate testing & more. > > > Download & eval WebKing and get a free book. > > > www.parasoft.com/bulletproofapps > > > _______________________________________________ > > > Opensymphony-webwork mailing list > > > [EMAIL PROTECTED] > > > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork > > > > > > > > ------------------------------------------------------- > > This SF.Net email sponsored by: Parasoft > > Error proof Web apps, automate testing & more. > > Download & eval WebKing and get a free book. > > www.parasoft.com/bulletproofapps > > _______________________________________________ > > Opensymphony-webwork mailing list > > [EMAIL PROTECTED] > > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork > > > > > ------------------------------------------------------- > This SF.Net email sponsored by: Parasoft > Error proof Web apps, automate testing & more. > Download & eval WebKing and get a free book. > www.parasoft.com/bulletproofapps > _______________________________________________ > Opensymphony-webwork mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork > ------------------------------------------------------- This SF.Net email sponsored by: Parasoft Error proof Web apps, automate testing & more. Download & eval WebKing and get a free book. www.parasoft.com/bulletproofapps _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork