1 23 package com.sun.enterprise.tools.verifier.tests.ejb.beanclass; 24 25 import java.lang.reflect.Modifier ; 26 import com.sun.enterprise.deployment.EjbDescriptor; 27 import com.sun.enterprise.tools.verifier.Result; 28 import com.sun.enterprise.tools.verifier.tests.ejb.EjbTest; 29 import com.sun.enterprise.tools.verifier.tests.*; 30 31 38 public class EjbClassModifiersPublic extends EjbTest { 39 40 41 49 public Result check(EjbDescriptor descriptor) { 50 51 Result result = getInitializedResult(); 52 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 53 54 Class c = loadEjbClass(descriptor, result); 55 if (c!=null) { 56 57 boolean isPublic = false; 58 int modifiers = c.getModifiers(); 59 if (Modifier.isPublic(modifiers)) { 60 isPublic = true; 61 } 62 63 if (isPublic) { 64 result.addGoodDetails(smh.getLocalString 65 ("tests.componentNameConstructor", 66 "For [ {0} ]", 67 new Object [] {compName.toString()})); 68 result.passed(smh.getLocalString 69 (getClass().getName() + ".passed", 70 "[ {0} ] properly declares public class modifier.", 71 new Object [] {descriptor.getEjbClassName()})); 72 } else if (!isPublic) { 73 result.addErrorDetails(smh.getLocalString 74 ("tests.componentNameConstructor", 75 "For [ {0} ]", 76 new Object [] {compName.toString()})); 77 result.failed(smh.getLocalString 78 (getClass().getName() + ".failed", 79 "Error: Ejb Class [ {0} ] was found, but was not declared as public. The class [ {1} ] must be defined as public.", 80 new Object [] {descriptor.getEjbClassName(),descriptor.getEjbClassName()})); 81 } 82 } 83 return result; 84 } 85 } 86 | Popular Tags |