1 23 24 25 package com.sun.enterprise.tools.verifier.tests.web; 26 27 import com.sun.enterprise.deployment.EjbDescriptor; 28 import com.sun.enterprise.deployment.EjbReferenceDescriptor; 29 import com.sun.enterprise.deployment.EjbSessionDescriptor; 30 import com.sun.enterprise.deployment.InjectionTarget; 31 import com.sun.enterprise.tools.verifier.Result; 32 import com.sun.enterprise.deployment.WebBundleDescriptor; 33 import java.util.Set ; 34 35 42 public class StatefulSessionBeanInjection extends WebTest implements WebCheck { 43 44 final static String className = StatefulSessionBeanInjection.class.getName(); 45 46 public Result check(WebBundleDescriptor descriptor) { 47 Result result = getInitializedResult(); 49 addWarningDetails(result, 50 getVerifierContext().getComponentNameConstructor()); 51 result.setStatus(Result.PASSED); 53 Set <EjbReferenceDescriptor> s = descriptor.getEjbReferenceDescriptors(); 54 if (s == null) return result; 55 56 for(EjbReferenceDescriptor ejbRefDesc : s) { 57 EjbDescriptor ejbDescriptor = ejbRefDesc.getEjbDescriptor(); 58 if (ejbDescriptor instanceof EjbSessionDescriptor) { String stateType = ((EjbSessionDescriptor)ejbDescriptor).getSessionType(); 60 if(EjbSessionDescriptor.STATEFUL.equals(stateType)) { 61 Set <InjectionTarget> injectionTargets = ejbRefDesc.getInjectionTargets(); 62 if(injectionTargets != null) { 63 for(InjectionTarget it : injectionTargets) { 64 String itClassName = it.getClassName(); 65 result.warning(smh.getLocalString(className + ".warning", 66 "Found a stateful session bean [ {0} ] injected into [ {1} ].", 67 new Object []{ejbDescriptor.getEjbClassName(), itClassName})); 68 } 69 } 70 } 71 } 72 } 73 return result; 74 } 75 76 } 77 | Popular Tags |