FileDocCategorySizeDatePackage
EjbRefNamePrefixed.javaAPI DocGlassfish v2 API4331Fri May 04 22:33:32 BST 2007com.sun.enterprise.tools.verifier.tests.ejb

EjbRefNamePrefixed

public class EjbRefNamePrefixed extends EjbTest implements EjbCheck
The ejb-ref-name element contains the name of an EJB reference. The EJB reference is an entry in the enterprise bean's environment. It is recommended that name is prefixed with "ejb/".

Fields Summary
Constructors Summary
Methods Summary
public com.sun.enterprise.tools.verifier.Resultcheck(com.sun.enterprise.deployment.EjbDescriptor descriptor)
The ejb-ref-name element contains the name of an EJB reference. The EJB reference is an entry in the enterprise bean's environment. It is recommended that name is prefixed with "ejb/".

param
descriptor the Enterprise Java Bean deployment descriptor
return
Result the results for this assertion


        Result result = getInitializedResult();
        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();

        if (!descriptor.getEjbReferenceDescriptors().isEmpty()) {
            for (Iterator itr = descriptor.getEjbReferenceDescriptors().iterator();
                 itr.hasNext();) {
                EjbReferenceDescriptor nextEjbReference = (EjbReferenceDescriptor) itr.next();
                String ejbRefName = nextEjbReference.getName();
                if (!ejbRefName.startsWith("ejb/")) {
                    addWarningDetails(result, compName);
                    result.addWarningDetails(smh.getLocalString
                            (getClass().getName() + ".warning",
                            "Warning: [ {0} ] is not prefixed with recommended string " +
                            "ejb/ within bean [ {1} ]",
                            new Object[] {ejbRefName,descriptor.getName()}));
                }
            }
        }
        if (result.getStatus() != Result.WARNING) {
            addGoodDetails(result, compName);
            result.passed(smh.getLocalString
                    (getClass().getName() + ".passed",
                    "ejb-ref-name is properly defined within bean [ {0} ]",
                    new Object[] {descriptor.getName()}));
        }
        return result;