FileDocCategorySizeDatePackage
HandlerChainClassCheck.javaAPI DocGlassfish v2 API4534Fri May 04 22:34:16 BST 2007com.sun.enterprise.tools.verifier.tests.webservices

HandlerChainClassCheck

public class HandlerChainClassCheck extends WSTest implements WSCheck
author
Sudipto Ghosh

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


        Result result = getInitializedResult();
        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        //Handler chains are applicable only in the context of JAX-WS 2.0. So
        // version check for this test is not required.
        List handlerChain = descriptor.getHandlerChain();
        for (Iterator it = handlerChain.iterator(); it.hasNext();) {
            List handlers = ((WebServiceHandlerChain)it.next()).getHandlers();
            for(Iterator itr = handlers.iterator(); itr.hasNext();) {
                String hClass =  ((WebServiceHandler)itr.next()).getHandlerClass();
                try {
                    Class cl = Class.forName(hClass, false, getVerifierContext().getClassLoader());
                    if (!((javax.xml.ws.handler.Handler.class).isAssignableFrom(cl))) {
                        addErrorDetails(result, compName);
                        result.failed(smh.getLocalString (getClass().getName() + ".failed",
                                "Handler Class [{0}] does not implement " +
                                "javax.xml.ws.handler.Handler Interface",
                                new Object[] {hClass}));
                    }
                } catch (ClassNotFoundException e) {
                    // result.fail, handler class not found
                    addErrorDetails(result, compName);
                    result.failed(smh.getLocalString (
                            "com.sun.enterprise.tools.verifier.tests.webservices.clfailed",
                            "The [{0}] Class [{1}] could not be Loaded",
                            new Object[] {"Handler Class", hClass}));
                }
            }
        }
        if (result.getStatus() != Result.FAILED) {
            addGoodDetails(result, compName);
            result.passed(smh.getLocalString (getClass().getName() + ".passed1",
                    "Handler chains, if any, are defined properly"));
        }
        return result;