1 23 package com.sun.enterprise.tools.verifier.tests.webservices; 24 25 import com.sun.enterprise.deployment.*; 26 import com.sun.enterprise.tools.verifier.*; 27 import java.util.*; 28 import com.sun.enterprise.tools.verifier.tests.*; 29 import java.lang.reflect.*; 30 31 35 36 44 public class HandlerClassCheck extends WSTest implements WSCheck { 45 46 50 public Result check (WebServiceEndpoint descriptor) { 51 52 Result result = getInitializedResult(); 53 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 54 boolean pass = true; 55 56 if (descriptor.hasHandlers()) { 57 List handlers = descriptor.getHandlers(); 58 for (Iterator it = handlers.iterator(); it.hasNext();) { 59 String hClass = ((WebServiceHandler)it.next()).getHandlerClass(); 60 Class cl = null; 61 try { 62 cl = Class.forName(hClass, false, getVerifierContext().getClassLoader()); 63 if ((cl != null) && ((javax.xml.rpc.handler.Handler .class).isAssignableFrom(cl))) { 64 result.addGoodDetails(smh.getLocalString 66 ("tests.componentNameConstructor", 67 "For [ {0} ]", 68 new Object [] {compName.toString()})); 69 result.passed(smh.getLocalString (getClass().getName() + ".passed", 70 "The Handler Class [{0}] exists and implements the javax.xml.rpc.handler.Handler Interface.", 71 new Object [] {hClass})); 72 73 } 74 else { 75 result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor", 77 "For [ {0} ]", new Object [] {compName.toString()})); 78 result.failed(smh.getLocalString (getClass().getName() + ".failed", 79 "Handler Class [{0}] does not implement javax.xml.rpc.handler.Handler", 80 new Object [] {hClass})); 81 pass = false; 82 83 } 84 } 85 catch (ClassNotFoundException e) { 86 result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor", 88 "For [ {0} ]", new Object [] {compName.toString()})); 89 result.failed(smh.getLocalString ( 90 "com.sun.enterprise.tools.verifier.tests.webservices.clfailed", 91 "The [{0}] Class [{1}] could not be Loaded", 92 new Object [] {"Handler Class", hClass})); 93 } 94 } 95 } 96 else { 97 result.addNaDetails(smh.getLocalString 98 ("tests.componentNameConstructor", "For [ {0} ]", 99 new Object [] {compName.toString()})); 100 result.notApplicable(smh.getLocalString 101 ( getClass().getName() + ".notapp", 102 "Not Applicable since No handlers defined in this WebService")); 103 104 } 105 106 return result; 107 } 108 } 109 110 | Popular Tags |