1 23 package com.sun.enterprise.tools.verifier.tests.ejb; 24 25 import java.util.Iterator ; 26 27 import com.sun.enterprise.deployment.EjbDescriptor; 28 import com.sun.enterprise.deployment.EjbReferenceDescriptor; 29 import com.sun.enterprise.tools.verifier.Result; 30 import com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor; 31 32 37 public class EjbRefNamePrefixed extends EjbTest implements EjbCheck { 38 39 48 public Result check(EjbDescriptor descriptor) { 49 50 Result result = getInitializedResult(); 51 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 52 53 if (!descriptor.getEjbReferenceDescriptors().isEmpty()) { 54 for (Iterator itr = descriptor.getEjbReferenceDescriptors().iterator(); 55 itr.hasNext();) { 56 EjbReferenceDescriptor nextEjbReference = (EjbReferenceDescriptor) itr.next(); 57 String ejbRefName = nextEjbReference.getName(); 58 if (!ejbRefName.startsWith("ejb/")) { 59 addWarningDetails(result, compName); 60 result.addWarningDetails(smh.getLocalString 61 (getClass().getName() + ".warning", 62 "Warning: [ {0} ] is not prefixed with recommended string " + 63 "ejb/ within bean [ {1} ]", 64 new Object [] {ejbRefName,descriptor.getName()})); 65 } 66 } 67 } 68 if (result.getStatus() != Result.WARNING) { 69 addGoodDetails(result, compName); 70 result.passed(smh.getLocalString 71 (getClass().getName() + ".passed", 72 "ejb-ref-name is properly defined within bean [ {0} ]", 73 new Object [] {descriptor.getName()})); 74 } 75 return result; 76 } 77 } 78 | Popular Tags |