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.policy;
019:
020: import javax.xml.namespace.QName;
021:
022: import org.apache.cxf.extension.BusExtension;
023:
024: /**
025: * Encapsulation of version-specific WS-Policy constants.
026: */
027: public final class PolicyConstants implements BusExtension {
028:
029: public static final String NAMESPACE_XMLSOAP_200409 = "http://schemas.xmlsoap.org/ws/2004/09/policy";
030:
031: public static final String NAMESPACE_W3_200607 = "http://www.w3.org/2006/07/ws-policy";
032:
033: public static final String CLIENT_POLICY_OUT_INTERCEPTOR_ID = "org.apache.cxf.ws.policy.ClientPolicyOutInterceptor";
034: public static final String CLIENT_POLICY_IN_INTERCEPTOR_ID = "org.apache.cxf.ws.policy.ClientPolicyInInterceptor";
035: public static final String CLIENT_POLICY_IN_FAULT_INTERCEPTOR_ID = "org.apache.cxf.ws.policy.ClientPolicyInFaultInterceptor";
036:
037: public static final String SERVER_POLICY_IN_INTERCEPTOR_ID = "org.apache.cxf.ws.policy.ServerPolicyInInterceptor";
038: public static final String SERVER_POLICY_OUT_INTERCEPTOR_ID = "org.apache.cxf.ws.policy.ServerPolicyOutInterceptor";
039: public static final String SERVER_POLICY_OUT_FAULT_INTERCEPTOR_ID = "org.apache.cxf.ws.policy.ServerPolicyOutFaultInterceptor";
040:
041: public static final String CLIENT_OUT_ASSERTIONS = "org.apache.cxf.ws.policy.client.out.assertions";
042: public static final String CLIENT_IN_ASSERTIONS = "org.apache.cxf.ws.policy.client.in.assertions";
043: public static final String CLIENT_INFAULT_ASSERTIONS = "org.apache.cxf.ws.policy.client.infault.assertions";
044:
045: public static final String SERVER_IN_ASSERTIONS = "org.apache.cxf.ws.policy.server.in.assertions";
046: public static final String SERVER_OUT_ASSERTIONS = "org.apache.cxf.ws.policy.server.out.assertions";
047: public static final String SERVER_OUTFAULT_ASSERTIONS = "org.apache.cxf.ws.policy.server.outfault.assertions";
048:
049: private static String namespaceURI;
050:
051: private static final String POLICY_ELEM_NAME = "Policy";
052:
053: private static final String ALL_ELEM_NAME = "All";
054:
055: private static final String EXACTLYONE_ELEM_NAME = "ExactlyOne";
056:
057: private static final String POLICYREFERENCE_ELEM_NAME = "PolicyReference";
058:
059: private static final String POLICYATTACHMENT_ELEM_NAME = "PolicyAttachment";
060:
061: private static final String APPLIESTO_ELEM_NAME = "AppliesTo";
062:
063: private static final String OPTIONAL_ATTR_NAME = "Optional";
064:
065: private static final String POLICYURIS_ATTR_NAME = "PolicyURIs";
066:
067: private static QName policyElemQName;
068:
069: private static QName allElemQName;
070:
071: private static QName exactlyOneElemQName;
072:
073: private static QName policyReferenceElemQName;
074:
075: private static QName policyAttachmentElemQName;
076:
077: private static QName appliesToElemQName;
078:
079: private static QName optionalAttrQName;
080:
081: private static QName policyURIsAttrQName;
082:
083: private static final String WSU_NAMESPACE_URI = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
084:
085: private static final String WSU_ID_ATTR_NAME = "Id";
086:
087: private static final QName WSU_ID_ATTR_QNAME = new QName(
088: WSU_NAMESPACE_URI, WSU_ID_ATTR_NAME);
089:
090: public PolicyConstants() {
091: setNamespace(NAMESPACE_W3_200607);
092: }
093:
094: public Class<?> getRegistrationType() {
095: return PolicyConstants.class;
096: }
097:
098: public void setNamespace(String uri) {
099: namespaceURI = uri;
100:
101: // update qnames
102:
103: policyElemQName = new QName(namespaceURI, POLICY_ELEM_NAME);
104: allElemQName = new QName(namespaceURI, ALL_ELEM_NAME);
105: exactlyOneElemQName = new QName(namespaceURI,
106: EXACTLYONE_ELEM_NAME);
107: policyReferenceElemQName = new QName(namespaceURI,
108: POLICYREFERENCE_ELEM_NAME);
109: policyAttachmentElemQName = new QName(namespaceURI,
110: POLICYATTACHMENT_ELEM_NAME);
111: appliesToElemQName = new QName(namespaceURI,
112: APPLIESTO_ELEM_NAME);
113: optionalAttrQName = new QName(namespaceURI, OPTIONAL_ATTR_NAME);
114: policyURIsAttrQName = new QName(namespaceURI,
115: POLICYURIS_ATTR_NAME);
116:
117: }
118:
119: public String getNamespace() {
120: return namespaceURI;
121: }
122:
123: public String getWSUNamespace() {
124: return WSU_NAMESPACE_URI;
125: }
126:
127: public String getPolicyElemName() {
128: return POLICY_ELEM_NAME;
129: }
130:
131: public String getAllElemName() {
132: return ALL_ELEM_NAME;
133: }
134:
135: public String getExactlyOneElemName() {
136: return EXACTLYONE_ELEM_NAME;
137: }
138:
139: public String getPolicyReferenceElemName() {
140: return POLICYREFERENCE_ELEM_NAME;
141: }
142:
143: public String getPolicyAttachmentElemName() {
144: return POLICYATTACHMENT_ELEM_NAME;
145: }
146:
147: public String getAppliesToElemName() {
148: return APPLIESTO_ELEM_NAME;
149: }
150:
151: public String getOptionalAttrName() {
152: return OPTIONAL_ATTR_NAME;
153: }
154:
155: public String getPolicyURIsAttrName() {
156: return POLICYURIS_ATTR_NAME;
157: }
158:
159: public String getIdAttrName() {
160: return WSU_ID_ATTR_NAME;
161: }
162:
163: public QName getPolicyElemQName() {
164: return policyElemQName;
165: }
166:
167: public QName getAllElemQName() {
168: return allElemQName;
169: }
170:
171: public QName getExactlyOneElemQName() {
172: return exactlyOneElemQName;
173: }
174:
175: public QName getPolicyReferenceElemQName() {
176: return policyReferenceElemQName;
177: }
178:
179: public QName getPolicyAttachmentElemQName() {
180: return policyAttachmentElemQName;
181: }
182:
183: public QName getAppliesToElemQName() {
184: return appliesToElemQName;
185: }
186:
187: public QName getOptionalAttrQName() {
188: return optionalAttrQName;
189: }
190:
191: public QName getPolicyURIsAttrQName() {
192: return policyURIsAttrQName;
193: }
194:
195: public QName getIdAttrQName() {
196: return WSU_ID_ATTR_QNAME;
197: }
198:
199: }
|