001: /*
002: * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003: *
004: * This file is part of Resin(R) Open Source
005: *
006: * Each copy or derived work must preserve the copyright notice and this
007: * notice unmodified.
008: *
009: * Resin Open Source is free software; you can redistribute it and/or modify
010: * it under the terms of the GNU General Public License as published by
011: * the Free Software Foundation; either version 2 of the License, or
012: * (at your option) any later version.
013: *
014: * Resin Open Source is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017: * of NON-INFRINGEMENT. See the GNU General Public License for more
018: * details.
019: *
020: * You should have received a copy of the GNU General Public License
021: * along with Resin Open Source; if not, write to the
022: *
023: * Free Software Foundation, Inc.
024: * 59 Temple Place, Suite 330
025: * Boston, MA 02111-1307 USA
026: *
027: * @author Scott Ferguson
028: */
029:
030: package javax.xml.ws;
031:
032: import javax.xml.bind.JAXBContext;
033: import javax.xml.namespace.QName;
034: import javax.xml.ws.handler.HandlerResolver;
035: import javax.xml.ws.spi.Provider;
036: import javax.xml.ws.spi.ServiceDelegate;
037: import java.net.URL;
038: import java.util.Iterator;
039: import java.util.concurrent.Executor;
040:
041: public class Service {
042: private final transient ServiceDelegate _delegate;
043:
044: protected Service(URL wsdl, QName serviceName) {
045: Provider provider = Provider.provider();
046:
047: _delegate = provider.createServiceDelegate(wsdl, serviceName,
048: getClass());
049: }
050:
051: public void addPort(QName portName, String bindingId,
052: String endpointAddress) {
053: _delegate.addPort(portName, bindingId, endpointAddress);
054: }
055:
056: public static Service create(QName serviceName) {
057: return new Service(null, serviceName);
058: }
059:
060: public static Service create(URL wsdlDocumentLocation,
061: QName serviceName) {
062: return new Service(wsdlDocumentLocation, serviceName);
063: }
064:
065: public <T> Dispatch<T> createDispatch(QName portName,
066: Class<T> type, Mode mode) {
067: return _delegate.createDispatch(portName, type, mode);
068: }
069:
070: public Dispatch<Object> createDispatch(QName portName,
071: JAXBContext context, Mode mode) {
072: return _delegate.createDispatch(portName, context, mode);
073: }
074:
075: public Executor getExecutor() {
076: return _delegate.getExecutor();
077: }
078:
079: public HandlerResolver getHandlerResolver() {
080: return _delegate.getHandlerResolver();
081: }
082:
083: public <T> T getPort(Class<T> serviceEndpointName) {
084: return _delegate.getPort(serviceEndpointName);
085: }
086:
087: public <T> T getPort(QName portName, Class<T> serviceEndpointName) {
088: return _delegate.getPort(portName, serviceEndpointName);
089: }
090:
091: public Iterator<QName> getPorts() {
092: return _delegate.getPorts();
093: }
094:
095: public QName getServiceName() {
096: return _delegate.getServiceName();
097: }
098:
099: public URL getWSDLDocumentLocation() {
100: return _delegate.getWSDLDocumentLocation();
101: }
102:
103: public void setExecutor(Executor executor) {
104: _delegate.setExecutor(executor);
105: }
106:
107: public void setHandlerResolver(HandlerResolver handlerResolver) {
108: _delegate.setHandlerResolver(handlerResolver);
109: }
110:
111: public static enum Mode {
112: MESSAGE, PAYLOAD;
113: }
114: }
|