FileDocCategorySizeDatePackage
ASWebEjbRef.javaAPI DocGlassfish v2 API5352Fri May 04 22:34:16 BST 2007com.sun.enterprise.tools.verifier.tests.web.runtime

ASWebEjbRef

public class ASWebEjbRef extends com.sun.enterprise.tools.verifier.tests.web.WebTest implements com.sun.enterprise.tools.verifier.tests.web.WebCheck

Fields Summary
Constructors Summary
Methods Summary
public com.sun.enterprise.tools.verifier.Resultcheck(com.sun.enterprise.deployment.WebBundleDescriptor descriptor)

        Result result = getInitializedResult();
        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        boolean oneFailed = false;
        String refName;
        EjbRef[] ejbRefs = (descriptor.getSunDescriptor()).getEjbRef();
        if (ejbRefs!=null && ejbRefs.length > 0) {
            for (int rep=0; rep<ejbRefs.length; rep++ ) {
                refName = ejbRefs[rep].getEjbRefName();
                if (validEjbRefName(refName,descriptor)) {
                    addGoodDetails(result, compName);
                    result.passed(smh.getLocalString
                            (getClass().getName() + ".passed",
                                    "PASSED [AS-WEB ejb-ref] ejb-ref-name [ {0} ] properly defined in the war file.",
                                    new Object[] {refName}));
                } else {
                    oneFailed = true;
                    addErrorDetails(result, compName);
                    result.failed(smh.getLocalString
                            (getClass().getName() + ".failed",
                                    "FAILED [AS-WEB ejb-ref] ejb-ref-name [ {0} ] is not valid, either empty or not defined in web.xml.",
                                    new Object[] {refName}));
                }
            }
        } else {
            addNaDetails(result, compName);
            result.notApplicable(smh.getLocalString
                    (getClass().getName() + ".notApplicable",
                            "NOT APPLICABLE [AS-WEB sun-web-app] ejb-ref element(s) not defined in the web archive [ {0} ].",
                            new Object[] {descriptor.getName()}));
            return result;
        }
        if (oneFailed)
        {
            result.setStatus(Result.FAILED);
        } else {
            addGoodDetails(result, compName);
            result.passed
                    (smh.getLocalString
                    (getClass().getName() + ".passed2",
                            "PASSED [AS-WEB sun-web-app] ejb-ref element(s) defined are valid within the web archive [ {0} ].",
                            new Object[] {descriptor.getName()} ));
        }
        return result;
    
booleanvalidEjbRefName(java.lang.String name, com.sun.enterprise.deployment.WebBundleDescriptor descriptor)

        boolean valid =true;
        if(name !=null && name.length()!=0) {
            try{
                descriptor.getEjbReferenceByName(name);
            }
            catch(IllegalArgumentException e){
                valid=false;
            }
        }else{
            valid=false;
        }
        return valid;