FileDocCategorySizeDatePackage
InterfacePublic.javaAPI DocGlassfish v2 API5221Fri May 04 22:33:54 BST 2007com.sun.enterprise.tools.verifier.tests.ejb.intf

InterfacePublic

public abstract class InterfacePublic extends com.sun.enterprise.tools.verifier.tests.ejb.EjbTest implements com.sun.enterprise.tools.verifier.tests.ejb.EjbCheck
Declare local and remote interfaces as public interfaces test. All enterprise bean local and/or remote interfaces must be declared as public.

Fields Summary
Constructors Summary
Methods Summary
public com.sun.enterprise.tools.verifier.Resultcheck(com.sun.enterprise.deployment.EjbDescriptor descriptor)
Declare local and remote interfaces as public interfaces test. All enterprise bean local and/or interfaces must be declared as public.

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

        Result result = getInitializedResult();
        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        
        if (!(descriptor instanceof EjbSessionDescriptor) &&
                !(descriptor instanceof EjbEntityDescriptor)) { 
            addNaDetails(result, compName);
            result.notApplicable(smh.getLocalString
                    ("com.sun.enterprise.tools.verifier.tests.ejb.homeintf.HomeMethodTest.notApplicable1",
                    "Test apply only to session or entity beans."));
            return result;                
        }
        String assertionClass = "com.sun.enterprise.tools.verifier.tests.ejb.intf.InterfacePublic";

        for (String intfName : getInterfaceNames(descriptor)) {
            try {
                ClassLoader jcl = getVerifierContext().getClassLoader();
                Class c = Class.forName(intfName, false, jcl);
                
                // local and remote interface must be defined as public
                if (!Modifier.isPublic(c.getModifiers())) {
                    addErrorDetails(result, compName);
                    result.failed(smh.getLocalString
                            (assertionClass + ".failed",
                            "Error: [ {0} ] is not defined as a public interface.",
                            new Object[] {intfName}));
                }
            } catch (ClassNotFoundException e) {
                // ignore as it will be caught in EjbArchiveClassesLoadable
                logger.log(Level.FINER,e.getMessage(),e);
            }
        }
        
        if(result.getStatus() != Result.FAILED) {
            addGoodDetails(result, compName);
            result.passed(smh.getLocalString
                            (assertionClass + ".passed",
                            "Valid public interface(s)."));
        }
        return result;
    
protected abstract java.util.SetgetInterfaceNames(com.sun.enterprise.deployment.EjbDescriptor descriptor)
Methods to get the type of interface: local/remote and the name of the class