001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common Development
008: * and Distribution License("CDDL") (collectively, the "License"). You
009: * may not use this file except in compliance with the License. You can obtain
010: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
011: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
012: * language governing permissions and limitations under the License.
013: *
014: * When distributing the software, include this License Header Notice in each
015: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
016: * Sun designates this particular file as subject to the "Classpath" exception
017: * as provided by Sun in the GPL Version 2 section of the License file that
018: * accompanied this code. If applicable, add the following below the License
019: * Header, with the fields enclosed by brackets [] replaced by your own
020: * identifying information: "Portions Copyrighted [year]
021: * [name of copyright owner]"
022: *
023: * Contributor(s):
024: *
025: * If you wish your version of this file to be governed by only the CDDL or
026: * only the GPL Version 2, indicate your decision by adding "[Contributor]
027: * elects to include this software in this distribution under the [CDDL or GPL
028: * Version 2] license." If you don't indicate a single choice of license, a
029: * recipient has the option to distribute your version of this file under
030: * either the CDDL, the GPL Version 2 or to extend the choice of license to
031: * its licensees as provided above. However, if you add GPL Version 2 code
032: * and therefore, elected the GPL Version 2 license, then the option applies
033: * only if the new code is made subject to such option by the copyright
034: * holder.
035: */
036:
037: package com.sun.xml.ws.developer;
038:
039: import com.sun.xml.ws.api.message.Header;
040: import com.sun.xml.ws.api.message.Headers;
041:
042: import javax.xml.bind.JAXBContext;
043: import javax.xml.namespace.QName;
044: import javax.xml.ws.BindingProvider;
045: import javax.xml.ws.Dispatch;
046: import javax.xml.ws.Service;
047: import javax.xml.ws.Service.Mode;
048: import java.util.List;
049: import java.io.Closeable;
050:
051: /**
052: * {@link BindingProvider} with JAX-WS RI's extension methods.
053: *
054: * @author Kohsuke Kawaguchi
055: * @author Jitendra Kotamraju
056: * @since 2.1EA3
057: */
058: public interface WSBindingProvider extends BindingProvider, Closeable {
059: /**
060: * Sets the out-bound headers to be added to messages sent from
061: * this {@link BindingProvider}.
062: *
063: * <p>
064: * Calling this method would discard any out-bound headers
065: * that were previously set.
066: *
067: * <p>
068: * A new {@link Header} object can be created by using
069: * one of the methods on {@link Headers}.
070: *
071: * @param headers
072: * The headers to be added to the future request messages.
073: * To clear the outbound headers, pass in either null
074: * or empty list.
075: * @throws IllegalArgumentException
076: * if the list contains null item.
077: */
078: void setOutboundHeaders(List<Header> headers);
079:
080: /**
081: * Sets the out-bound headers to be added to messages sent from
082: * this {@link BindingProvider}.
083: *
084: * <p>
085: * Works like {@link #setOutboundHeaders(List)} except
086: * that it accepts a var arg array.
087: *
088: * @param headers
089: * Can be null or empty.
090: */
091: void setOutboundHeaders(Header... headers);
092:
093: /**
094: * Sets the out-bound headers to be added to messages sent from
095: * this {@link BindingProvider}.
096: *
097: * <p>
098: * Each object must be a JAXB-bound object that is understood
099: * by the {@link JAXBContext} object known by this {@link WSBindingProvider}
100: * (that is, if this is a {@link Dispatch} with JAXB, then
101: * {@link JAXBContext} given to {@link Service#createDispatch(QName,JAXBContext,Mode)}
102: * and if this is a typed proxy, then {@link JAXBContext}
103: * implicitly created by the JAX-WS RI.)
104: *
105: * @param headers
106: * Can be null or empty.
107: * @throws UnsupportedOperationException
108: * If this {@lini WSBindingProvider} is a {@link Dispatch}
109: * that does not use JAXB.
110: */
111: void setOutboundHeaders(Object... headers);
112:
113: List<Header> getInboundHeaders();
114:
115: /**
116: * Sets the endpoint address for all the invocations that happen
117: * from {@link BindingProvider}. Instead of doing the following
118: *
119: * <p>
120: * ((BindingProvider)proxy).getRequestContext().put(
121: * BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "...")
122: * <p>
123: * you could do this:
124: *
125: * <p>
126: * ((WSBindingProvider)proxy).setAddress("...");
127: *
128: * @param address Address of the service
129: */
130: void setAddress(String address);
131: }
|