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

MDBInheritsMDB

public class MDBInheritsMDB extends MessageBeanTest
A message-driven bean class must not have a superclass that is itself a message-driven bean class.
author
Vikas Awasthi

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

        try {
            ClassLoader cl = getVerifierContext().getClassLoader();
            Class ejbCls = Class.forName(descriptor.getEjbClassName(), false, cl);
            Set<EjbDescriptor> descrptors = 
                                descriptor.getEjbBundleDescriptor().getEjbs();
            for (EjbDescriptor ejbDescriptor : descrptors) {
                if(!(ejbDescriptor instanceof EjbMessageBeanDescriptor))
                    continue;
                if(descriptor.getEjbClassName().equals(ejbDescriptor.getEjbClassName()))
                    continue;
                Class mdbCls = null;
                try {
                    mdbCls = Class.forName(ejbDescriptor.getEjbClassName(), false, cl);
                } catch (ClassNotFoundException e) {
                    continue; // ignore as this error will be caught by other tests
                }
                if(mdbCls.isAssignableFrom(ejbCls)) {
                    addErrorDetails(result, compName);
                    result.failed(
                            smh.getLocalString(getClass().getName()+".failed",
                            "Message bean [ {0} ] inherits other message bean [ {1} ]",
                            new Object[] {ejbCls.getName(), mdbCls.getName()}));
                }

            }
        } catch (ClassNotFoundException e) {
            //ignore as this error will be caught by other tests
            logger.fine(descriptor.getEjbClassName() + " Not found");
        }

        if(result.getStatus() != Result.FAILED) {
            addGoodDetails(result, compName);
            result.passed(
                    smh.getLocalString(getClass().getName()+".passed",
                            "Valid Message bean [ {0} ]",
                            new Object[] {descriptor.getEjbClassName()}));
        }
        
        return result;