FileDocCategorySizeDatePackage
ValidBusinessInterface.javaAPI DocGlassfish v2 API3904Fri May 04 22:33:34 BST 2007com.sun.enterprise.tools.verifier.tests.ejb.ejb30

ValidBusinessInterface

public class ValidBusinessInterface extends com.sun.enterprise.tools.verifier.tests.ejb.EjbTest
Business interface of an enterprise bean must be an interface and must not be defined as a class.
author
Vikas Awasthi

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

        Result result = getInitializedResult();
        ComponentNameConstructor compName =
                            getVerifierContext().getComponentNameConstructor();
        Set<String> remoteAndLocalIntfs = descriptor.getRemoteBusinessClassNames();
        remoteAndLocalIntfs.addAll(descriptor.getLocalBusinessClassNames());

        for (String remoteOrLocalIntf : remoteAndLocalIntfs) {
            try {
                ClassLoader classLoader = getVerifierContext().getClassLoader();
                Class c = Class.forName(remoteOrLocalIntf, false, classLoader);
                if(!c.isInterface()) {
                    addErrorDetails(result, compName);
                    result.failed(smh.getLocalString
                            (getClass().getName() + ".failed",
                            "[ {0} ] is defined as a class. It should be an interface.",
                            new Object[] {c}));
                }
            } catch (ClassNotFoundException e) {
                // ignore as it will be caught in other tests
            }
        }
        
        if(result.getStatus() != Result.FAILED) {
            addGoodDetails(result, compName);
            result.passed(smh.getLocalString
                            (getClass().getName() + ".passed",
                            "Business Interface(s) are valid."));
        }

        return result;