1 6 7 package javax.xml.ws.spi; 8 9 import java.net.URL ; 10 import java.util.List ; 11 import javax.xml.ws.Endpoint; 12 import javax.xml.ws.WebServiceException; 13 import javax.xml.ws.WebServiceFeature; 14 import javax.xml.namespace.QName ; 15 import javax.xml.ws.EndpointReference; 16 import javax.xml.ws.wsaddressing.W3CEndpointReference; 17 18 import org.w3c.dom.Element ; 19 20 27 public abstract class Provider { 28 29 34 static public final String JAXWSPROVIDER_PROPERTY 35 = "javax.xml.ws.spi.Provider"; 36 37 41 static private final String DEFAULT_JAXWSPROVIDER 42 = "com.sun.xml.internal.ws.spi.ProviderImpl"; 43 44 45 48 protected Provider() { 49 } 50 51 81 public static Provider provider() { 82 try { 83 Object provider = 84 FactoryFinder.find(JAXWSPROVIDER_PROPERTY, 85 DEFAULT_JAXWSPROVIDER); 86 if (!(provider instanceof Provider)) { 87 Class pClass = Provider.class; 88 String classnameAsResource = pClass.getName().replace('.', '/') + ".class"; 89 ClassLoader loader = pClass.getClassLoader(); 90 if(loader == null) { 91 loader = ClassLoader.getSystemClassLoader(); 92 } 93 URL targetTypeURL = loader.getResource(classnameAsResource); 94 throw new LinkageError ("ClassCastException: attempting to cast" + 95 provider.getClass().getClassLoader().getResource(classnameAsResource) + 96 "to" + targetTypeURL.toString() ); 97 } 98 return (Provider) provider; 99 } catch (WebServiceException ex) { 100 throw ex; 101 } catch (Exception ex) { 102 throw new WebServiceException("Unable to createEndpointReference Provider", ex); 103 } 104 } 105 106 116 public abstract ServiceDelegate createServiceDelegate( 117 java.net.URL wsdlDocumentLocation, 118 QName serviceName, Class serviceClass); 119 120 121 133 public abstract Endpoint createEndpoint(String bindingId, 134 Object implementor); 135 136 137 151 public abstract Endpoint createAndPublishEndpoint(String address, 152 Object implementor); 153 168 public abstract EndpointReference readEndpointReference(javax.xml.transform.Source eprInfoset); 169 170 171 221 public abstract <T> T getPort(EndpointReference endpointReference, 222 Class <T> serviceEndpointInterface, 223 WebServiceFeature... features); 224 225 283 public abstract W3CEndpointReference createW3CEndpointReference(String address, QName serviceName, QName portName, 284 List <Element > metadata, String wsdlDocumentLocation, List <Element > referenceParameters); 285 } 286 | Popular Tags |