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 34 35 43 public class JAXRPCEndpointIsServletClassCheck extends WSTest implements WSCheck { 44 45 49 public Result check (WebServiceEndpoint wsdescriptor) { 50 51 Result result = getInitializedResult(); 52 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 53 54 ClassLoader loader = getVerifierContext().getClassLoader(); 55 56 if (wsdescriptor.implementedByWebComponent()) { 57 WebBundleDescriptor webBundle = (WebBundleDescriptor)wsdescriptor.getBundleDescriptor(); 58 WebComponentDescriptor webComponent = 59 (WebComponentDescriptor) webBundle. 60 getWebComponentByCanonicalName(wsdescriptor.getWebComponentLink()); 61 if( webComponent != null && webComponent.isServlet()) { 62 String servletClass = wsdescriptor.getWebComponentImpl(). 63 getWebComponentImplementation(); 64 if ((servletClass == null) || (!wsdescriptor.getWebComponentImpl().isServlet())) { 65 result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor", 67 "For [ {0} ]", new Object [] {compName.toString()})); 68 result.failed(smh.getLocalString 69 ("com.sun.enterprise.tools.verifier.tests.webservices.failed", "[{0}]", 70 new Object [] {"The WebComponent implementation for this JAX-RPC endpoint is not a servlet"})); 71 72 } 73 else { 74 try { 76 Class cl = Class.forName(servletClass, false, getVerifierContext().getClassLoader()); 77 result.addGoodDetails(smh.getLocalString ("tests.componentNameConstructor", 79 "For [ {0} ]", new Object [] {compName.toString()})); 80 result.passed(smh.getLocalString ( 81 "com.sun.enterprise.tools.verifier.tests.webservices.clpassed", 82 "The [{0}] Class [{1}] exists and was loaded successfully.", 83 new Object [] {"Servlet Class", servletClass})); 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 [] {"Servlet Class", servletClass})); 93 94 } 95 } 96 } 97 else { 98 result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor", 100 "For [ {0} ]", new Object [] {compName.toString()})); 101 result.failed(smh.getLocalString 102 ("com.sun.enterprise.tools.verifier.tests.webservices.failed", "[{0}]", 103 new Object [] {"The servlet-link for this JAX-RPC Endpoint could not be resolved"})); 104 105 } 106 } 107 else { 108 result.addNaDetails(smh.getLocalString 110 ("tests.componentNameConstructor", "For [ {0} ]", 111 new Object [] {compName.toString()})); 112 result.notApplicable(smh.getLocalString 113 ("com.sun.enterprise.tools.verifier.tests.webservices.notapp", 114 "[{0}]", new Object [] {"Not Applicable since this is NOT a JAX-RPC Service Endpoint"})); 115 116 } 117 118 return result; 119 } 120 } 121 122 | Popular Tags |