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

EjbClassModifiersPublic

public class EjbClassModifiersPublic extends com.sun.enterprise.tools.verifier.tests.ejb.EjbTest
Enterprise Java Bean class modifiers test. The class must be defined as public.
author
Jerome Dochez
version

Fields Summary
Constructors Summary
Methods Summary
public com.sun.enterprise.tools.verifier.Resultcheck(com.sun.enterprise.deployment.EjbDescriptor descriptor)
Enterprise Java Bean class modifiers test. The class must be defined as public.

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


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

        Class c = loadEjbClass(descriptor, result);
        if (c!=null) {  

            boolean isPublic = false;
            int modifiers = c.getModifiers();
            if (Modifier.isPublic(modifiers)) {
                isPublic = true;
            }

            if (isPublic) {
		result.addGoodDetails(smh.getLocalString
				      ("tests.componentNameConstructor",
				       "For [ {0} ]",
				       new Object[] {compName.toString()}));
                result.passed(smh.getLocalString
			      (getClass().getName() + ".passed",
			       "[ {0} ] properly declares public class modifier.",
			       new Object[] {descriptor.getEjbClassName()}));
            } else if (!isPublic) {
		result.addErrorDetails(smh.getLocalString
				       ("tests.componentNameConstructor",
					"For [ {0} ]",
					new Object[] {compName.toString()}));
                result.failed(smh.getLocalString
			      (getClass().getName() + ".failed",
			       "Error: Ejb Class [ {0} ] was found, but was not declared as public.  The class  [ {1} ] must be defined as public.",
			       new Object[] {descriptor.getEjbClassName(),descriptor.getEjbClassName()}));
            }
        }
        return result;