You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ds...@apache.org on 2013/07/03 10:01:56 UTC
svn commit: r1499243 - in
/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm: RMManager.java
policy/RMPolicyInterceptorProvider.java policy/RMPolicyUtilities.java
policy/RSPAssertionBuilder.java
Author: dsosnoski
Date: Wed Jul 3 08:01:56 2013
New Revision: 1499243
URL: http://svn.apache.org/r1499243
Log:
CXF-5105 implement support for assertion in policy (without enforcement)
Added:
cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RSPAssertionBuilder.java
Modified:
cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyInterceptorProvider.java
cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyUtilities.java
Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java?rev=1499243&r1=1499242&r2=1499243&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java Wed Jul 3 08:01:56 2013
@@ -80,21 +80,26 @@ import org.apache.cxf.ws.rm.v200702.Sequ
*/
public class RMManager {
- /**
- * Message contextual property giving WS-ReliableMessaging namespace.
- */
+ /** Message contextual property giving WS-ReliableMessaging namespace. */
public static final String WSRM_VERSION_PROPERTY = "org.apache.cxf.ws.rm.namespace";
- /**
- * Message contextual property giving addressing namespace to be used by WS-RM implementation.
- */
+ /** Message contextual property giving addressing namespace to be used by WS-RM implementation. */
public static final String WSRM_WSA_VERSION_PROPERTY = "org.apache.cxf.ws.rm.wsa-namespace";
- /**
- * Message contextual property giving the last message.
- */
- public static final String WSRM_LAST_MESSAGE_PROPERTY =
- "org.apache.cxf.ws.rm.last-message";
+ /** Message contextual property giving the last message flag (Boolean). */
+ public static final String WSRM_LAST_MESSAGE_PROPERTY = "org.apache.cxf.ws.rm.last-message";
+
+ /** Message contextual property giving WS-ReliableMessaging inactivity timeout (Long). */
+ public static final String WSRM_INACTIVITY_TIMEOUT_PROPERTY = "org.apache.cxf.ws.rm.inactivity-timeout";
+
+ /** Message contextual property giving WS-ReliableMessaging base retransmission interval (Long). */
+ public static final String WSRM_RETRANSMISSION_INTERVAL_PROPERTY = "org.apache.cxf.ws.rm.retransmission-interval";
+
+ /** Message contextual property giving WS-ReliableMessaging exponential backoff flag (Boolean). */
+ public static final String WSRM_EXPONENTIAL_BACKOFF_PROPERTY = "org.apache.cxf.ws.rm.exponential-backoff";
+
+ /** Message contextual property giving WS-ReliableMessaging acknowledgement interval (Long). */
+ public static final String WSRM_ACKNOWLEDGEMENT_INTERVAL_PROPERTY = "org.apache.cxf.ws.rm.acknowledgement-interval";
private static final Logger LOG = LogUtils.getL7dLogger(RMManager.class);
@@ -339,6 +344,22 @@ public class RMManager {
if (addrUri != null) {
config.setRM10AddressingNamespace(addrUri);
}
+ Long timeout = (Long)message.getContextualProperty(WSRM_INACTIVITY_TIMEOUT_PROPERTY);
+ if (timeout != null) {
+ config.setInactivityTimeout(timeout);
+ }
+ Long interval = (Long)message.getContextualProperty(WSRM_RETRANSMISSION_INTERVAL_PROPERTY);
+ if (interval != null) {
+ config.setBaseRetransmissionInterval(interval);
+ }
+ Boolean exponential = (Boolean)message.getContextualProperty(WSRM_EXPONENTIAL_BACKOFF_PROPERTY);
+ if (exponential != null) {
+ config.setExponentialBackoff(exponential);
+ }
+ interval = (Long)message.getContextualProperty(WSRM_ACKNOWLEDGEMENT_INTERVAL_PROPERTY);
+ if (interval != null) {
+ config.setAcknowledgementInterval(interval);
+ }
RMEndpoint rme = reliableEndpoints.get(endpoint);
if (null == rme) {
rme = createReliableEndpoint(endpoint);
Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyInterceptorProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyInterceptorProvider.java?rev=1499243&r1=1499242&r2=1499243&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyInterceptorProvider.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyInterceptorProvider.java Wed Jul 3 08:01:56 2013
@@ -43,6 +43,7 @@ public class RMPolicyInterceptorProvider
Collection<QName> types = new ArrayList<QName>();
types.add(new QName("http://schemas.xmlsoap.org/ws/2005/02/rm/policy", "RMAssertion"));
types.add(new QName("http://docs.oasis-open.org/ws-rx/wsrmp/200702", "RMAssertion"));
+ types.add(new QName("http://ws-i.org/profiles/rsp/1.0/", "Conformant"));
ASSERTION_TYPES = types;
}
Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyUtilities.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyUtilities.java?rev=1499243&r1=1499242&r2=1499243&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyUtilities.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyUtilities.java Wed Jul 3 08:01:56 2013
@@ -48,6 +48,7 @@ public final class RMPolicyUtilities {
for (QName qn : RM12AssertionBuilder.KNOWN_ELEMENTS) {
ASSERTION_NAMES.add(qn);
}
+ ASSERTION_NAMES.add(RSPAssertionBuilder.CONFORMANT_QNAME);
}
private RMPolicyUtilities() {
@@ -79,7 +80,8 @@ public final class RMPolicyUtilities {
}
/**
- * Collect RMAssertions from map. This checks both namespaces defined for WS-RM policy assertions.
+ * Collect RMAssertions from map. This checks both namespaces defined for WS-RM policy assertions, along with the
+ * WS-I RSP namespace.
*
* @param aim map, may be <code>null</code>
* @return merged collection, never <code>null</code>
Added: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RSPAssertionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RSPAssertionBuilder.java?rev=1499243&view=auto
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RSPAssertionBuilder.java (added)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RSPAssertionBuilder.java Wed Jul 3 08:01:56 2013
@@ -0,0 +1,64 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.ws.rm.policy;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
+import org.apache.neethi.Assertion;
+import org.apache.neethi.AssertionBuilderFactory;
+import org.apache.neethi.builders.AssertionBuilder;
+import org.apache.neethi.builders.xml.XMLPrimitiveAssertionBuilder;
+
+/**
+ * Builds a WS-I RSP Conformant assertion.
+ */
+public class RSPAssertionBuilder implements AssertionBuilder<Element> {
+
+ public static final String CONFORMANT_NAME = "Conformant";
+ public static final String RSP_NAMESPACE = "http://ws-i.org/profiles/rsp/1.0/";
+ public static final QName CONFORMANT_QNAME = new QName(RSP_NAMESPACE, CONFORMANT_NAME);
+
+ public static final QName[] KNOWN_ELEMENTS = {
+ CONFORMANT_QNAME
+ };
+
+ /**
+ * @see org.apache.neethi.builders.AssertionBuilder#getKnownElements()
+ */
+ public QName[] getKnownElements() {
+ return KNOWN_ELEMENTS;
+ }
+
+ /**
+ * @see org.apache.neethi.builders.AssertionBuilder#build(org.w3c.dom.Element,
+ * org.apache.neethi.AssertionBuilderFactory)
+ */
+ public Assertion build(Element elem, AssertionBuilderFactory factory) throws IllegalArgumentException {
+ Assertion assertion = null;
+ if (RSP_NAMESPACE.equals(elem.getNamespaceURI()) && CONFORMANT_NAME.equals(elem.getLocalName())) {
+ boolean optional = XMLPrimitiveAssertionBuilder.isOptional(elem);
+ assertion = new PrimitiveAssertion(CONFORMANT_QNAME, optional);
+ }
+ return assertion;
+ }
+}
\ No newline at end of file