2010/6/9 David Blevins <[email protected]> > 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. :) >
Actually that is what I did in the beginning, but after thinking it for a while, it might not work. a. AnnotationDeployer will not be invoked while META-COMPLETE is with value true, but we still need to configure those three methods, that is why I add the AppModulePreProssor class. b. Currently, we treat the session synchronization methods the same way as other lifecycle methods, but it has a little different, as in the past, we usually implment an interface if we intertested in those callbacks. So I would think that the bean class implment the SessionSynchronization interface should have the high priority IMO. > > 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 Will check it soon ! > > > > 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. > Just not sure whether it will break current spec definition, will add it. > > > Thanks so much for such a great patch! > > > -David > > -- Ivan
