On Jun 7, 2010, at 4:40 PM, Ivan wrote:

> Thanks for the comment, I attach another patch to the JIRA, if any problem,
> please let me know :-)

Wow.  Wonderful patch, Ivan!  Doesn't really get any better than that :)  Very 
thorough test case as well. 

I closed these JIRAs and marked them completed by you:

  OPENEJB-1147 javax.ejb.AfterBegin
  OPENEJB-1148 javax.ejb.AfterCompletion
  OPENEJB-1149 javax.ejb.BeforeCompletion
  OPENEJB-1215 <after-begin-method> element
  OPENEJB-1216 <before-completion-method> element
  OPENEJB-1217 <after-completion-method> element
  OPENEJB-1218 @AfterBegin overriding via <after-begin-method>
  OPENEJB-1219 @AfterCompletion overriding via <after-completion-method>
  OPENEJB-1220 @BeforeCompletion overriding via <before-completion-method>


A few more fun things we can tinker with:

We can probably get rid of AppModulePreProcessor.  This chunk of code can go 
right into the AnnotationDeployer next to the related annotation:

    if (SessionSynchronization.class.isAssignableFrom(clazz)) {
        sessionBean.getAfterBegin().add(new LifecycleCallback(clazz.getName(), 
"afterBegin"));
        sessionBean.getBeforeCompletion().add(new 
LifecycleCallback(clazz.getName(), "beforeCompletion"));
        sessionBean.getAfterCompletion().add(new 
LifecycleCallback(clazz.getName(), "afterCompletion"));
    } else {

And this little chunk we can cleverly move into the SessionBean jaxb class:

    if (sessionBean.getAfterBeginMethod() != null) {
        sessionBean.getAfterBegin().add(new LifecycleCallback(clazz.getName(), 
sessionBean.getAfterBeginMethod().getMethodName()));
    }
    if (sessionBean.getBeforeCompletionMethod() != null) {
        sessionBean.getBeforeCompletion().add(new 
LifecycleCallback(clazz.getName(), 
sessionBean.getBeforeCompletionMethod().getMethodName()));
    }
    if (sessionBean.getAfterCompletionMethod() != null) {
        sessionBean.getAfterCompletion().add(new 
LifecycleCallback(clazz.getName(), 
sessionBean.getAfterCompletionMethod().getMethodName()));
    }

Take a look at the sneaky little trick we use in the MessageDrivenBean jaxb 
class for handling the deprecated message-selector and acknowledge-mode. :)


On the validation front, let's expand the CheckInvalidCallbacksTest test to 
cover the new checks we do.  That test could really be expanded in general, so 
feel free to have as much fun with it as you want.  You can attach that one to 
this JIRA:
  
  https://issues.apache.org/jira/browse/OPENEJB-1295


On our getParameters() TODO looks like we can expand that if block to check if 
the operation is AFTER_COMPLETION and not throw the IllegalArgumentException.


Thanks so much for such a great patch!


-David

Reply via email to