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

ExtendsRightInterface

public abstract class ExtendsRightInterface extends com.sun.enterprise.tools.verifier.tests.ejb.EjbTest implements com.sun.enterprise.tools.verifier.tests.ejb.EjbCheck
Remote interfaces extend the EJBObject interface test. Local interfaces extend the EJBLocalObject interface test. All enterprise beans remote interfaces must extend the EJBObject interface and/or local interfaces must extend the EJBLocalObject interface.
author
Sheetal Vartak

Fields Summary
Constructors Summary
Methods Summary
public com.sun.enterprise.tools.verifier.Resultcheck(com.sun.enterprise.deployment.EjbDescriptor descriptor)
local interfaces extend the EJBLocalObject interface and remote interfaces extend the EJBObject interface test. All enterprise beans remote interfaces must extend the EJBObject interface and/or local interfaces must extend the EJBLocalObject interface.

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

        
        Result result = getInitializedResult();
        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        String str = null;
        
        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;
        }
        
        if(getInterfaceName(descriptor) == null || "".equals(getInterfaceName(descriptor))) {
            addNaDetails(result, compName);
            result.notApplicable(smh.getLocalString
                    ("com.sun.enterprise.tools.verifier.tests.ejb.intf.InterfaceTest.notApplicable",
                    "Not Applicable because, EJB [ {0} ] does not have {1} Interface.",
                    new Object[] {descriptor.getEjbClassName(), getInterfaceType()}));
            return result;
        }
        
        try {
            ClassLoader jcl = getVerifierContext().getClassLoader();	   
            Class c = Class.forName(getClassName(descriptor), false, jcl);
            str = getSuperInterface();
            
            if (isImplementorOf(c, str)) {
                addGoodDetails(result, compName);	
                result.passed(smh.getLocalString
                        (getClass().getName() + ".passed",
                        "[ {0} ] " + getInterfaceType() +" interface properly extends the" + str + " interface.",
                        new Object[] {getClassName(descriptor)}));
            } else {
                addErrorDetails(result, compName);
                result.failed(smh.getLocalString
                        (getClass().getName() + ".failed",
                        "Error: [ {0} ] does not properly extend the EJBObject interface. "+
                        " All enterprise bean" + getInterfaceType() + " interfaces must extend the" + str + "  interface."+
                        " [ {1} ] is not a valid "+ getInterfaceType() + "interface within bean [ {2} ]",
                        new Object[] {getClassName(descriptor),getClassName(descriptor),descriptor.getName()}));
            }
        } catch (ClassNotFoundException e) {
            Verifier.debug(e);
            addErrorDetails(result, compName);
            result.failed(smh.getLocalString
                    (getClass().getName() + ".failedException",
                    "Error: [ {0} ] class not found.",
                    new Object[] {getClassName(descriptor)}));
        }
        return result;
    
private java.lang.StringgetClassName(com.sun.enterprise.deployment.EjbDescriptor descriptor)

        return getInterfaceName(descriptor);
    
protected abstract java.lang.StringgetInterfaceName(com.sun.enterprise.deployment.EjbDescriptor descriptor)
Following 3 methods are used to determine whether this method is being called by local/remote interface.

protected abstract java.lang.StringgetInterfaceType()

protected abstract java.lang.StringgetSuperInterface()