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: */package org.apache.cxf.ws.rm;
019:
020: import java.util.Collections;
021: import java.util.HashSet;
022: import java.util.Set;
023:
024: import javax.xml.namespace.QName;
025:
026: /**
027: * Holder for WS-RM names (of headers, namespaces etc.).
028: */
029: public final class RMConstants {
030:
031: // namespaces
032: private static final String WSRM_NAMESPACE_NAME = "http://schemas.xmlsoap.org/ws/2005/02/rm";
033:
034: private static final String WSRMP_NAMESPACE_NAME = "http://schemas.xmlsoap.org/ws/2005/02/rm/policy";
035:
036: private static final String WSA_NAMESPACE_NAME = "http://schemas.xmlsoap.org/ws/2004/08/addressing";
037:
038: private static final String WSRM_NAMESPACE_PREFIX = "wsrm";
039:
040: private static final String WSRM_WSDL_NAMESPACE_NAME = WSRM_NAMESPACE_NAME
041: + "/wsdl";
042:
043: // element and header names
044:
045: private static final String WSRM_SEQUENCE_NAME = "Sequence";
046:
047: private static final QName WSRM_SEQUENCE_QNAME = new QName(
048: WSRM_NAMESPACE_NAME, WSRM_SEQUENCE_NAME);
049:
050: private static final String WSRM_SEQUENCE_FAULT_NAME = "SequenceFault";
051:
052: private static final QName WSRM_SEQUENCE_FAULT_QNAME = new QName(
053: WSRM_NAMESPACE_NAME, WSRM_SEQUENCE_FAULT_NAME);
054:
055: private static final String WSRM_SEQUENCE_ACK_NAME = "SequenceAcknowledgement";
056:
057: private static final QName WSRM_SEQUENCE_ACK_QNAME = new QName(
058: WSRM_NAMESPACE_NAME, WSRM_SEQUENCE_ACK_NAME);
059:
060: private static final String WSRM_ACK_REQUESTED_NAME = "AckRequested";
061:
062: private static final QName WSRM_ACK_REQUESTED_QNAME = new QName(
063: WSRM_NAMESPACE_NAME, WSRM_ACK_REQUESTED_NAME);
064:
065: private static final String WSA_ANONYMOUS_ADDRESS = WSA_NAMESPACE_NAME
066: + "/role/anonymous";
067:
068: private static final String WSA_NONE_ADDRESS = WSA_NAMESPACE_NAME
069: + "/role/none";
070:
071: private static final String RMASSERTION_NAME = "RMAssertion";
072:
073: private static final QName RMASSERTION_QNAME = new QName(
074: WSRMP_NAMESPACE_NAME, RMASSERTION_NAME);
075:
076: private static final Set<QName> HEADERS;
077:
078: // protocol operation names
079:
080: private static final QName WSRM_PORT_NAME = new QName(
081: WSRM_WSDL_NAMESPACE_NAME, "SequenceAbstractSoapPort");
082:
083: private static final QName WSRM_CREATE_SEQUENCE_QNAME = new QName(
084: WSRM_NAMESPACE_NAME, "CreateSequence");
085:
086: private static final QName WSRM_CREATE_SEQUENCE_RESPONSE_QNAME = new QName(
087: WSRM_NAMESPACE_NAME, "CreateSequenceResponse");
088:
089: private static final QName WSRM_CREATE_SEQUENCE_ONEWAY_QNAME = new QName(
090: WSRM_NAMESPACE_NAME, "CreateSequenceOneway");
091:
092: private static final QName WSRM_CREATE_SEQUENCE_RESPONSE_ONEWAY_QNAME = new QName(
093: WSRM_NAMESPACE_NAME, "CreateSequenceResponseOneway");
094:
095: private static final QName WSRM_TERMINATE_SEQUENCE_QNAME = new QName(
096: WSRM_NAMESPACE_NAME, "TerminateSequence");
097:
098: private static final QName WSRM_SEQUENCE_ACKNOWLEDGEMENT_QNAME = new QName(
099: WSRM_NAMESPACE_NAME, "SequenceAcknowledgement");
100:
101: private static final QName WSRM_LAST_MESSAGE_QNAME = new QName(
102: WSRM_NAMESPACE_NAME, "LastMessage");
103:
104: private static final QName WSRM_ACK_REQ_QNAME = new QName(
105: WSRM_NAMESPACE_NAME, "AckRequested");
106:
107: // actions
108:
109: private static final String WSRM_CREATE_SEQUENCE_ACTION = WSRM_NAMESPACE_NAME
110: + "/CreateSequence";
111:
112: private static final String WSRM_CREATE_SEQUENCE_RESPONSE_ACTION = WSRM_NAMESPACE_NAME
113: + "/CreateSequenceResponse";
114:
115: private static final String WSRM_TERMINATE_SEQUENCE_ACTION = WSRM_NAMESPACE_NAME
116: + "/TerminateSequence";
117:
118: private static final String WSRM_SEQUENCE_ACK_ACTION = WSRM_NAMESPACE_NAME
119: + "/SequenceAcknowledgement";
120:
121: private static final String WSRM_LAST_MESSAGE_ACTION = WSRM_NAMESPACE_NAME
122: + "/LastMessage";
123:
124: private static final String WSRM_ACK_REQUESTED_ACTION = WSRM_NAMESPACE_NAME
125: + "/AckRequested";
126:
127: private static final String WSRM_SEQUENCE_ACKNOWLEDGMENT_ACTION = WSRM_NAMESPACE_NAME
128: + "/SequenceAcknowledgement";
129:
130: private static final String WSRM_SEQUENCE_INFO_ACTION = WSRM_NAMESPACE_NAME
131: + "/SequenceInfo";
132:
133: // fault codes
134:
135: private static final String WSRM_UNKNOWN_SEQUENCE_FAULT_CODE = "UnknownSequence";
136:
137: private static final String WSRM_SEQUENCE_TERMINATED_FAULT_CODE = "SequenceTerminated";
138:
139: private static final String WSRM_INVALID_ACKNOWLEDGMENT_FAULT_CODE = "InvalidAcknowledgement";
140:
141: private static final String WSRM_MESSAGE_NUMBER_ROLLOVER_FAULT_CODE = "MessageNumberRollover";
142:
143: private static final String WSRM_CREATE_SEQUENCE_REFUSED_FAULT_CODE = "CreateSequenceRefused";
144:
145: private static final String WSRM_LAST_MESSAGE_NUMBER_EXCEEDED_FAULT_CODE = "LastMessageNumberExceeded";
146:
147: static {
148: Set<QName> headers = new HashSet<QName>();
149: headers.add(WSRM_SEQUENCE_QNAME);
150: headers.add(WSRM_SEQUENCE_ACK_QNAME);
151: headers.add(WSRM_ACK_REQUESTED_QNAME);
152: HEADERS = Collections.unmodifiableSet(headers);
153: }
154:
155: private RMConstants() {
156: }
157:
158: public static Set<QName> getHeaders() {
159: return HEADERS;
160: }
161:
162: // namespaces
163:
164: public static String getNamespace() {
165: return WSRM_NAMESPACE_NAME;
166: }
167:
168: public static String getPolicyNamespace() {
169: return WSRMP_NAMESPACE_NAME;
170: }
171:
172: public static String getAddressingNamespace() {
173: return WSA_NAMESPACE_NAME;
174: }
175:
176: public static String getNamespacePrefix() {
177: return WSRM_NAMESPACE_PREFIX;
178: }
179:
180: public static String getWsdlNamespace() {
181: return WSRM_WSDL_NAMESPACE_NAME;
182: }
183:
184: // schema type constants
185:
186: public static String getSequenceName() {
187: return WSRM_SEQUENCE_NAME;
188: }
189:
190: public static QName getSequenceQName() {
191: return WSRM_SEQUENCE_QNAME;
192: }
193:
194: public static String getSequenceFaultName() {
195: return WSRM_SEQUENCE_FAULT_NAME;
196: }
197:
198: public static QName getSequenceFaultQName() {
199: return WSRM_SEQUENCE_FAULT_QNAME;
200: }
201:
202: public static String getSequenceAckName() {
203: return WSRM_SEQUENCE_ACK_NAME;
204: }
205:
206: public static QName getSequenceAckQName() {
207: return WSRM_SEQUENCE_ACK_QNAME;
208: }
209:
210: public static String getAckRequestedName() {
211: return WSRM_ACK_REQUESTED_NAME;
212: }
213:
214: public static QName getAckRequestedQName() {
215: return WSRM_ACK_REQUESTED_QNAME;
216: }
217:
218: public static String getAnonymousAddress() {
219: return WSA_ANONYMOUS_ADDRESS;
220: }
221:
222: public static String getNoneAddress() {
223: return WSA_NONE_ADDRESS;
224: }
225:
226: // service model constants
227:
228: public static QName getPortName() {
229: return WSRM_PORT_NAME;
230: }
231:
232: public static QName getCreateSequenceOperationName() {
233: return WSRM_CREATE_SEQUENCE_QNAME;
234: }
235:
236: public static QName getCreateSequenceResponseOperationName() {
237: return WSRM_CREATE_SEQUENCE_RESPONSE_QNAME;
238: }
239:
240: public static QName getCreateSequenceOnewayOperationName() {
241: return WSRM_CREATE_SEQUENCE_ONEWAY_QNAME;
242: }
243:
244: public static QName getCreateSequenceResponseOnewayOperationName() {
245: return WSRM_CREATE_SEQUENCE_RESPONSE_ONEWAY_QNAME;
246: }
247:
248: public static QName getTerminateSequenceOperationName() {
249: return WSRM_TERMINATE_SEQUENCE_QNAME;
250: }
251:
252: public static QName getSequenceAckOperationName() {
253: return WSRM_SEQUENCE_ACKNOWLEDGEMENT_QNAME;
254: }
255:
256: public static QName getLastMessageOperationName() {
257: return WSRM_LAST_MESSAGE_QNAME;
258: }
259:
260: public static QName getAckRequestedOperationName() {
261: return WSRM_ACK_REQ_QNAME;
262: }
263:
264: // actions
265:
266: public static String getCreateSequenceAction() {
267: return WSRM_CREATE_SEQUENCE_ACTION;
268: }
269:
270: public static String getCreateSequenceResponseAction() {
271: return WSRM_CREATE_SEQUENCE_RESPONSE_ACTION;
272: }
273:
274: public static String getTerminateSequenceAction() {
275: return WSRM_TERMINATE_SEQUENCE_ACTION;
276: }
277:
278: public static String getSequenceAckAction() {
279: return WSRM_SEQUENCE_ACK_ACTION;
280: }
281:
282: public static String getLastMessageAction() {
283: return WSRM_LAST_MESSAGE_ACTION;
284: }
285:
286: public static String getAckRequestedAction() {
287: return WSRM_ACK_REQUESTED_ACTION;
288: }
289:
290: public static String getSequenceAcknowledgmentAction() {
291: return WSRM_SEQUENCE_ACKNOWLEDGMENT_ACTION;
292: }
293:
294: public static String getSequenceInfoAction() {
295: return WSRM_SEQUENCE_INFO_ACTION;
296: }
297:
298: // fault codes
299:
300: public static QName getUnknownSequenceFaultCode() {
301: return new QName(WSRM_NAMESPACE_NAME,
302: WSRM_UNKNOWN_SEQUENCE_FAULT_CODE);
303: }
304:
305: public static QName getSequenceTerminatedFaultCode() {
306: return new QName(WSRM_NAMESPACE_NAME,
307: WSRM_SEQUENCE_TERMINATED_FAULT_CODE);
308: }
309:
310: public static QName getInvalidAcknowledgmentFaultCode() {
311: return new QName(RMConstants.WSRM_NAMESPACE_NAME,
312: WSRM_INVALID_ACKNOWLEDGMENT_FAULT_CODE);
313: }
314:
315: public static QName getMessageNumberRolloverFaultCode() {
316: return new QName(WSRM_NAMESPACE_NAME,
317: WSRM_MESSAGE_NUMBER_ROLLOVER_FAULT_CODE);
318: }
319:
320: public static QName getCreateSequenceRefusedFaultCode() {
321: return new QName(WSRM_NAMESPACE_NAME,
322: WSRM_CREATE_SEQUENCE_REFUSED_FAULT_CODE);
323: }
324:
325: public static QName getLastMessageNumberExceededFaultCode() {
326: return new QName(WSRM_NAMESPACE_NAME,
327: WSRM_LAST_MESSAGE_NUMBER_EXCEEDED_FAULT_CODE);
328: }
329:
330: // policies
331:
332: public static String getRMAssertionName() {
333: return RMASSERTION_NAME;
334: }
335:
336: public static QName getRMAssertionQName() {
337: return RMASSERTION_QNAME;
338: }
339: }
|