FileDocCategorySizeDatePackage
MessageListenerMethodModifiers.javaAPI DocGlassfish v2 API4363Fri May 04 22:34:04 BST 2007com.sun.enterprise.tools.verifier.tests.ejb.messagebean

MessageListenerMethodModifiers

public class MessageListenerMethodModifiers extends MessageBeanTest
Message listener methods must not be declared as final or static.
author
Vikas Awasthi

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

        Result result = getInitializedResult();
        ComponentNameConstructor compName = 
                            getVerifierContext().getComponentNameConstructor();

        ClassLoader cl = getVerifierContext().getClassLoader();
        try {
            Class intfCls = Class.forName(descriptor.getMessageListenerType(), false, cl);
            Class ejbCls = Class.forName(descriptor.getEjbClassName(), false, cl);
            Method[] intfMethods = intfCls.getMethods();
            for (Method method : intfMethods) {
                for (Method ejbMethod : ejbCls.getMethods()) {
                    // if matching method is found then check the assertion
                    if (MethodUtils.methodEquals(ejbMethod, method)) {
                        if(Modifier.isFinal(ejbMethod.getModifiers()) ||
                                Modifier.isStatic(ejbMethod.getModifiers())) {
                            addErrorDetails(result, compName);
                            result.failed(smh.getLocalString
                                    (getClass().getName() + ".failed",
                                            "Wrong method [ {0} ]",
                                            new Object[]{ejbMethod}));
                        }
                        break;
                    }
                }// another test will report failure if listener method is not found
            }
        } catch (ClassNotFoundException e) {} // will be caught in other tests

        if(result.getStatus() != Result.FAILED) {
            addGoodDetails(result, compName);
            result.passed(smh.getLocalString
                            (getClass().getName() + ".passed",
                            "Valid message listener method(s)."));
        }
        return result;