I would like to use this pattern to turn pojo's into session beans:
Start with:
// not abstract
// doesn't implement anything
public class WorkerBean
{
public void DoSomething(String s){
...
}
public String DoSomethingElse(String s){
...
}
}
And have xdoclet gen something like this:
public class WorkerEJB extends WorkerBean implements implements SessionBean
{
private SessionContext sessionContext;
public void DoSomething(String s){
try{
super.DoSomething(s);
}
catch(Exception e) { throw new EJBException(e); }
}
public String DoSomethingElse(String s){
try{
return super.DoSomethingElse(s);
}
catch(Exception e) { throw new EJBException(e); } }
public void setSessionContext(SessionContext context){this.sessionContext = context;}
public void ejbRemove(){}
public void ejbActivate(){}
public void ejbPassivate(){}
}
...along with the remote interface and the home stuff, etc.
Can I do this now with xdoclet? If not, how hard would it be for me to change it? Could I do this with just a custom merge file, or by subclassing some of the tasks?
I like to use this pattern because it allows me to unit test the business logic within the regular beans outside the app server context. Any criticism of this way of writing EJBs would also be very welcome.
Thanks,
Jim Hughes
RIA
