View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements. See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership. The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License. You may obtain a copy of the License at
9    *
10   * http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied. See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  
20  package javax.xml.ws;
21  
22  import javax.xml.bind.JAXBContext;
23  import javax.xml.namespace.QName;
24  import javax.xml.ws.handler.HandlerResolver;
25  import javax.xml.ws.spi.Provider;
26  import javax.xml.ws.spi.ServiceDelegate;
27  import java.net.URL;
28  import java.util.Iterator;
29  import java.util.concurrent.Executor;
30  
31  public class Service {
32      public enum Mode {
33          MESSAGE, PAYLOAD }
34  
35      protected Service(URL wsdlDocumentLocation, QName serviceName) {
36          delegate = Provider.provider().createServiceDelegate(wsdlDocumentLocation, serviceName, getClass());
37      }
38  
39      public <T> T getPort(QName portName, Class<T> serviceEndpointInterface) {
40          return (T) delegate.getPort(portName, serviceEndpointInterface);
41      }
42  
43      public <T> T getPort(Class<T> serviceEndpointInterface) {
44          return (T) delegate.getPort(serviceEndpointInterface);
45      }
46  
47      public <T> T getPort(QName portName, Class<T> serviceEndpointInterface, WebServiceFeature... features) {
48          return (T) delegate.getPort(portName, serviceEndpointInterface, features);
49      }
50      
51      public <T> T getPort(Class<T> serviceEndpointInterface, WebServiceFeature... features) {
52          return (T) delegate.getPort(serviceEndpointInterface, features);
53      }
54      
55      public <T> T getPort(EndpointReference endpointReference, Class<T> serviceEndpointInterface, WebServiceFeature... features) {
56          return (T) delegate.getPort(endpointReference, serviceEndpointInterface, features);
57      }
58      
59      public void addPort(QName portName, String bindingId, String endpointAddress) {
60          delegate.addPort(portName, bindingId, endpointAddress);
61      }
62  
63      public <T>Dispatch<T> createDispatch(QName portName, Class<T> type, Mode mode) {
64          return delegate.createDispatch(portName, type, mode);
65      }
66  
67      public Dispatch<Object> createDispatch(QName portName, JAXBContext context, Mode mode) {
68          return delegate.createDispatch(portName, context, mode);
69      }
70  
71      public <T> Dispatch<T> createDispatch(QName portName, Class<T> type, Service.Mode mode, WebServiceFeature... features) {
72          return delegate.createDispatch(portName, type, mode, features);
73      }
74      
75      public <T> Dispatch<T> createDispatch(EndpointReference endpointReference, Class<T> type, Service.Mode mode, WebServiceFeature... features) {
76          return delegate.createDispatch(endpointReference, type, mode, features);
77      }
78      
79      public Dispatch<Object> createDispatch(QName portName, JAXBContext context, Service.Mode mode, WebServiceFeature... features) {
80          return delegate.createDispatch(portName, context, mode, features);
81      }
82      
83      public Dispatch<Object> createDispatch(EndpointReference endpointReference, JAXBContext context, Service.Mode mode, WebServiceFeature... features) {
84          return delegate.createDispatch(endpointReference, context, mode, features);
85      }
86      
87      public QName getServiceName() {
88          return delegate.getServiceName();
89      }
90  
91      public Iterator<QName> getPorts() {
92          return delegate.getPorts();
93      }
94  
95      public URL getWSDLDocumentLocation() {
96          return delegate.getWSDLDocumentLocation();
97      }
98  
99      public HandlerResolver getHandlerResolver() {
100         return delegate.getHandlerResolver();
101     }
102 
103     public void setHandlerResolver(HandlerResolver handlerResolver) {
104         delegate.setHandlerResolver(handlerResolver);
105     }
106 
107     public Executor getExecutor() {
108         return delegate.getExecutor();
109     }
110 
111     public void setExecutor(Executor executor) {
112         delegate.setExecutor(executor);
113     }
114 
115     public static Service create(URL wsdlDocumentLocation, QName serviceName) {
116         return new Service(wsdlDocumentLocation, serviceName);
117     }
118 
119     public static Service create(QName serviceName) {
120         return new Service(null, serviceName);
121     }
122 
123     private ServiceDelegate delegate;
124 }