FileDocCategorySizeDatePackage
ASEjbPrincipal.javaAPI DocGlassfish v2 API4587Fri May 04 22:34:04 BST 2007com.sun.enterprise.tools.verifier.tests.ejb.runtime

ASEjbPrincipal

public class ASEjbPrincipal extends com.sun.enterprise.tools.verifier.tests.ejb.EjbTest implements com.sun.enterprise.tools.verifier.tests.ejb.EjbCheck
ejb [0,n] principal ? name [String] The principal tag defines a username on the platform
author
Irfan Ahmed

Fields Summary
Constructors Summary
Methods Summary
public Resultcheck(com.sun.enterprise.deployment.EjbDescriptor descriptor)

	Result result = getInitializedResult();
        
	ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        
        boolean oneFailed = false;
        try{
            if (descriptor.getUsesCallerIdentity() == false){
                RunAsIdentityDescriptor runAsIdDesc = descriptor.getRunAsIdentity();
                if (runAsIdDesc != null){
                    String principal = runAsIdDesc.getPrincipal();
                    if (principal == null){
                        addNaDetails(result, compName);
                        result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable",
                        "NOT APPLICABLE [AS-EJB ejb] : principal element not defined"));
                    }else{
                        if(principal.length()==0){
                            addErrorDetails(result, compName);
                            result.failed(smh.getLocalString(getClass().getName()+".failed",
                            "FAILED [AS-EJB principal] : name cannot be an empty String"));
                        }else{
                            addGoodDetails(result, compName);
                            result.passed(smh.getLocalString(getClass().getName()+".passed",
                            "PASSED [AS-EJB principal] : name is {0}", new Object[]{principal}));
                        }
                    }
                }
            }else{
                addNaDetails(result, compName);
                result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable",
                    "NOT APPLICABLE [AS-EJB ejb] run-as Element is not defined"));
            }
        }catch(Exception ex){
            addErrorDetails(result, compName);
            result.addErrorDetails(smh.getLocalString
                 (getClass().getName() + ".notRun",
                  "NOT RUN [AS-EJB] : Could not create an SunEjbJar object"));
        }

        return result;