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.api.addressing;
038:
039: import com.sun.xml.ws.api.FeatureConstructor;
040:
041: import javax.xml.ws.WebServiceFeature;
042:
043: /**
044: * Unsupported RI extension to work around an issue in WSIT.
045: *
046: * <p>
047: * <b>This feature is not meant to be used by a common Web service developer</b> as there
048: * is no need to send the above mentioned header for a one-way operation. But these
049: * properties may need to be sent in certain middleware Web services.
050: *
051: * <p>
052: * This feature allows ReplyTo, From and RelatesTo Message Addressing Properties
053: * to be added for all messages that are sent from the port configured with
054: * this annotation. All operations are assumed to be one-way, and
055: * this feature should be used for one-way
056: * operations only.
057: *
058: * If a non-null ReplyTo is specified, then MessageID property is also added.
059: *
060: * @author Arun Gupta
061: */
062: public class OneWayFeature extends WebServiceFeature {
063: /**
064: * Constant value identifying the {@link OneWayFeature}
065: */
066: public static final String ID = "http://java.sun.com/xml/ns/jaxws/addressing/oneway";
067:
068: private WSEndpointReference replyTo;
069: private WSEndpointReference from;
070: private String relatesToID;
071:
072: /**
073: * Create an {@link OneWayFeature}. The instance created will be enabled.
074: */
075: public OneWayFeature() {
076: this .enabled = true;
077: }
078:
079: /**
080: * Create an {@link OneWayFeature}
081: *
082: * @param enabled specifies whether this feature should
083: * be enabled or not.
084: */
085: public OneWayFeature(boolean enabled) {
086: this .enabled = enabled;
087: }
088:
089: /**
090: * Create an {@link OneWayFeature}
091: *
092: * @param enabled specifies whether this feature should be enabled or not.
093: * @param replyTo specifies the {@link WSEndpointReference} of wsa:ReplyTo header.
094: */
095: public OneWayFeature(boolean enabled, WSEndpointReference replyTo) {
096: this .enabled = enabled;
097: this .replyTo = replyTo;
098: }
099:
100: /**
101: * Create an {@link OneWayFeature}
102: *
103: * @param enabled specifies whether this feature should be enabled or not.
104: * @param replyTo specifies the {@link WSEndpointReference} of wsa:ReplyTo header.
105: * @param from specifies the {@link WSEndpointReference} of wsa:From header.
106: * @param relatesTo specifies the MessageID to be used for wsa:RelatesTo header.
107: */
108: @FeatureConstructor({"enabled","replyTo","from","relatesTo"})
109: public OneWayFeature(boolean enabled, WSEndpointReference replyTo,
110: WSEndpointReference from, String relatesTo) {
111: this .enabled = enabled;
112: this .replyTo = replyTo;
113: this .from = from;
114: this .relatesToID = relatesTo;
115: }
116:
117: /**
118: * {@inheritDoc}
119: */
120: public String getID() {
121: return ID;
122: }
123:
124: /**
125: * Getter for wsa:ReplyTo header {@link WSEndpointReference} .
126: *
127: * @return address of the wsa:ReplyTo header
128: */
129: public WSEndpointReference getReplyTo() {
130: return replyTo;
131: }
132:
133: /**
134: * Setter for wsa:ReplyTo header {@link WSEndpointReference}.
135: *
136: * @param address
137: */
138: public void setReplyTo(WSEndpointReference address) {
139: this .replyTo = address;
140: }
141:
142: /**
143: * Getter for wsa:From header {@link WSEndpointReference}.
144: *
145: * @return address of the wsa:From header
146: */
147: public WSEndpointReference getFrom() {
148: return from;
149: }
150:
151: /**
152: * Setter for wsa:From header {@link WSEndpointReference}.
153: *
154: * @param address of the wsa:From header
155: */
156: public void setFrom(WSEndpointReference address) {
157: this .from = address;
158: }
159:
160: /**
161: * Getter for MessageID for wsa:RelatesTo header.
162: *
163: * @return address of the wsa:FaultTo header
164: */
165: public String getRelatesToID() {
166: return relatesToID;
167: }
168:
169: /**
170: * Setter for MessageID for wsa:RelatesTo header.
171: *
172: * @param id
173: */
174: public void setRelatesToID(String id) {
175: this.relatesToID = id;
176: }
177: }
|