001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */
019: package javax.xml.ws;
020:
021: import javax.xml.bind.JAXBContext;
022: import javax.xml.namespace.QName;
023: import javax.xml.ws.handler.HandlerResolver;
024: import javax.xml.ws.spi.Provider;
025: import javax.xml.ws.spi.ServiceDelegate;
026: import java.net.URI;
027: import java.net.URL;
028: import java.util.Iterator;
029: import java.util.concurrent.Executor;
030:
031: public class Service {
032: public enum Mode {
033: MESSAGE, PAYLOAD
034: }
035:
036: protected Service(URL wsdlDocumentLocation, QName serviceName) {
037: _delegate = Provider.provider().createServiceDelegate(
038: wsdlDocumentLocation, serviceName, getClass());
039: }
040:
041: public <T> T getPort(QName portName,
042: Class<T> serviceEndpointInterface) {
043: return (T) _delegate
044: .getPort(portName, serviceEndpointInterface);
045: }
046:
047: public <T> T getPort(Class<T> serviceEndpointInterface) {
048: return (T) _delegate.getPort(serviceEndpointInterface);
049: }
050:
051: public void addPort(QName portName, String bindingId,
052: String endpointAddress) {
053: _delegate.addPort(portName, bindingId, endpointAddress);
054: }
055:
056: public <T> Dispatch<T> createDispatch(QName portName,
057: Class<T> type, Mode mode) {
058: return _delegate.createDispatch(portName, type, mode);
059: }
060:
061: public Dispatch<java.lang.Object> createDispatch(QName portName,
062: JAXBContext context, Mode mode) {
063: return _delegate.createDispatch(portName, context, mode);
064: }
065:
066: public QName getServiceName() {
067: return _delegate.getServiceName();
068: }
069:
070: public Iterator<javax.xml.namespace.QName> getPorts() {
071: return _delegate.getPorts();
072: }
073:
074: public URL getWSDLDocumentLocation() {
075: return _delegate.getWSDLDocumentLocation();
076: }
077:
078: public HandlerResolver getHandlerResolver() {
079: return _delegate.getHandlerResolver();
080: }
081:
082: public void setHandlerResolver(HandlerResolver handlerResolver) {
083: _delegate.setHandlerResolver(handlerResolver);
084: }
085:
086: public Executor getExecutor() {
087: return _delegate.getExecutor();
088: }
089:
090: public void setExecutor(Executor executor) {
091: _delegate.setExecutor(executor);
092: }
093:
094: public static Service create(URL wsdlDocumentLocation,
095: QName serviceName) {
096: return new Service(wsdlDocumentLocation, serviceName);
097: }
098:
099: public static Service create(QName serviceName) {
100: return new Service(null, serviceName);
101: }
102:
103: private ServiceDelegate _delegate;
104: }
|