* ejb which are elligible to have a particular transaction setting.
*/
public Collection getTransactionalMethodsFor(com.sun.enterprise.deployment.EjbDescriptor desc, ClassLoader loader)
throws ClassNotFoundException, NoSuchMethodException
{
EjbDescriptor ejbDescriptor = (EjbDescriptor) desc;
// only set if desc is a stateful session bean. NOTE that
// !statefulSessionBean does not imply stateless session bean
boolean statefulSessionBean = false;
Vector methods = new Vector();
if (ejbDescriptor instanceof EjbSessionDescriptor) {
statefulSessionBean =
((EjbSessionDescriptor) ejbDescriptor).isStateful();
boolean singletonSessionBean =
((EjbSessionDescriptor) ejbDescriptor).isSingleton();
// Session Beans
if (ejbDescriptor.isRemoteInterfacesSupported()) {
Collection disallowedMethods = extractDisallowedMethodsFor(javax.ejb.EJBObject.class, sessionBeanMethodsDisallowed);
Collection potentials = getTransactionMethodsFor(loader, ejbDescriptor.getRemoteClassName() , disallowedMethods);
transformAndAdd(potentials, MethodDescriptor.EJB_REMOTE, methods);
}
if( ejbDescriptor.isRemoteBusinessInterfacesSupported() ) {
for(String intfName :
ejbDescriptor.getRemoteBusinessClassNames() ) {
Class businessIntf = loader.loadClass(intfName);
Method[] busIntfMethods = businessIntf.getMethods();
for (Method next : busIntfMethods ) {
methods.add(new MethodDescriptor
(next, MethodDescriptor.EJB_REMOTE));
}
}
}
if (ejbDescriptor.isLocalInterfacesSupported()) {
Collection disallowedMethods = extractDisallowedMethodsFor(javax.ejb.EJBLocalObject.class, sessionLocalBeanMethodsDisallowed);
Collection potentials = getTransactionMethodsFor(loader, ejbDescriptor.getLocalClassName() , disallowedMethods);
transformAndAdd(potentials, MethodDescriptor.EJB_LOCAL, methods);
}
if( ejbDescriptor.isLocalBusinessInterfacesSupported() ) {
for(String intfName :
ejbDescriptor.getLocalBusinessClassNames() ) {
Class businessIntf = loader.loadClass(intfName);
Method[] busIntfMethods = businessIntf.getMethods();
for (Method next : busIntfMethods ) {
methods.add(new MethodDescriptor
(next, MethodDescriptor.EJB_LOCAL));
}
}
}
if( ejbDescriptor.isLocalBean() ) {
String intfName = ejbDescriptor.getEjbClassName();
Class businessIntf = loader.loadClass(intfName);
Method[] busIntfMethods = businessIntf.getMethods();
for (Method next : busIntfMethods ) {
methods.add(new MethodDescriptor
(next, MethodDescriptor.EJB_LOCAL));
}
}
if (ejbDescriptor.hasWebServiceEndpointInterface()) {
Class webServiceClass = loader.loadClass
(ejbDescriptor.getWebServiceEndpointInterfaceName());
Method[] webMethods = webServiceClass.getMethods();
for (int i=0;i<webMethods.length;i++) {
methods.add(new MethodDescriptor(webMethods[i],
MethodDescriptor.EJB_WEB_SERVICE));
}
}
// SFSB and Singleton can have lifecycle callbacks transactional
if (statefulSessionBean || singletonSessionBean) {
Set<LifecycleCallbackDescriptor> lcds = ejbDescriptor.getLifecycleCallbackDescriptors();
for(LifecycleCallbackDescriptor lcd : lcds) {
try {
Method m = lcd.getLifecycleCallbackMethodObject(loader);
MethodDescriptor md = new MethodDescriptor(m, MethodDescriptor.LIFECYCLE_CALLBACK);
methods.add(md);
} catch(Exception e) {
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE,
"Lifecycle callback processing error", e);
}
}
}
}
} else {
// entity beans local interfaces
String homeIntf = ejbDescriptor.getHomeClassName();
if (homeIntf!=null) {
Class home = loader.loadClass(homeIntf);
Collection potentials = getTransactionMethodsFor(javax.ejb.EJBHome.class, home);
transformAndAdd(potentials, MethodDescriptor.EJB_HOME, methods);
String remoteIntf = ejbDescriptor.getRemoteClassName();
Class remote = loader.loadClass(remoteIntf);
potentials = getTransactionMethodsFor(javax.ejb.EJBObject.class, remote);
transformAndAdd(potentials, MethodDescriptor.EJB_REMOTE, methods);
}
// enity beans remote interfaces
String localHomeIntf = ejbDescriptor.getLocalHomeClassName();
if (localHomeIntf!=null) {
Class home = loader.loadClass(localHomeIntf);
Collection potentials = getTransactionMethodsFor(javax.ejb.EJBLocalHome.class, home);
transformAndAdd(potentials, MethodDescriptor.EJB_LOCALHOME, methods);
String remoteIntf = ejbDescriptor.getLocalClassName();
Class remote = loader.loadClass(remoteIntf);
potentials = getTransactionMethodsFor(javax.ejb.EJBLocalObject.class, remote);
transformAndAdd(potentials, MethodDescriptor.EJB_LOCAL, methods);
}
}
if( !statefulSessionBean ) {
if( ejbDescriptor.isTimedObject() ) {
if( ejbDescriptor.getEjbTimeoutMethod() != null) {
methods.add(ejbDescriptor.getEjbTimeoutMethod());
}
for (ScheduledTimerDescriptor schd : ejbDescriptor.getScheduledTimerDescriptors()) {
methods.add(schd.getTimeoutMethod());
}
}
}