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

EjbHasLocalorRemoteorBothInterfaces

public class EjbHasLocalorRemoteorBothInterfaces extends EjbTest implements EjbCheck
Bean interface type test. The bean provider must provide either Local or Remote or Both interfaces
author
Sheetal Vartak

Fields Summary
Constructors Summary
Methods Summary
public com.sun.enterprise.tools.verifier.Resultcheck(com.sun.enterprise.deployment.EjbDescriptor descriptor)
Bean interface type test. The bean provider must provide either Local or Remote or Both interfaces

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.intf.InterfaceClassExist.notApplicable1",
                            "Test apply only to session or entity beans."));
            return result;
        }
        if ((descriptor.getRemoteClassName() == null || "".equals(descriptor.getRemoteClassName()))&&
                (descriptor.getLocalClassName() == null || "".equals(descriptor.getLocalClassName()))) {

            if (implementsEndpoints(descriptor)) {
                addNaDetails(result, compName);
                result.notApplicable(smh.getLocalString
                        ("com.sun.enterprise.tools.verifier.tests.ejb.webservice.notapp",
                                "Not Applicable because, EJB [ {0} ] implements a Service Endpoint Interface.",
                                new Object[] {compName.toString()}));
                return result;
            }
            else {
                addErrorDetails(result, compName);
                result.failed(smh.getLocalString
                        (getClass().getName() + ".failed",
                                "Ejb [ {0} ] does not have local or remote interfaces",
                                new Object[] {descriptor.getEjbClassName()}));
                return result;
            }
        }
        else {
            addGoodDetails(result, compName);
            result.passed(smh.getLocalString
                    (getClass().getName() + ".passed",
                            "Ejb [ {0} ] does have valid local and/or remote interfaces",
                            new Object[] {descriptor.getEjbClassName()}));
            return result;
        }