Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 50A6F461F for ; Sat, 18 Jun 2011 01:51:42 +0000 (UTC) Received: (qmail 69713 invoked by uid 500); 18 Jun 2011 01:51:42 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 69627 invoked by uid 500); 18 Jun 2011 01:51:42 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 69600 invoked by uid 99); 18 Jun 2011 01:51:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 18 Jun 2011 01:51:41 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 18 Jun 2011 01:51:29 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 85E6F23889E1; Sat, 18 Jun 2011 01:51:06 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1137112 [1/7] - in /cxf/trunk: rt/ws/rm/ rt/ws/rm/src/main/build-resources/ rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/ rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/feature/ rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/ rt/ws/rm... Date: Sat, 18 Jun 2011 01:51:04 -0000 To: commits@cxf.apache.org From: dsosnoski@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110618015106.85E6F23889E1@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dsosnoski Date: Sat Jun 18 01:51:01 2011 New Revision: 1137112 URL: http://svn.apache.org/viewvc?rev=1137112&view=rev Log: WS-ReliableMessaging changeover to internal use of WS-RM 1.1 data structures Added: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder10AImpl.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder10Impl.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder11Impl.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RM10Constants.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RM11Constants.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/VersionTransformer.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RM10PolicyUtils.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RM11AssertionBuilder.java cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/wsrmp-1.1-schema-200702.xjb cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/wsrmp-1.1-schema-200702.xsd cxf/trunk/rt/ws/rm/src/main/resources/schemas/wsdl/wsrm-1.0-wsa15.xjb cxf/trunk/rt/ws/rm/src/main/resources/schemas/wsdl/wsrm-1.0-wsa15.xsd cxf/trunk/rt/ws/rm/src/main/resources/schemas/wsdl/wsrm-1.0.xjb cxf/trunk/rt/ws/rm/src/main/resources/schemas/wsdl/wsrm-1.0.xsd cxf/trunk/rt/ws/rm/src/main/resources/schemas/wsdl/wsrm-1.1.xjb cxf/trunk/rt/ws/rm/src/main/resources/schemas/wsdl/wsrm-1.1.xsd Removed: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/PolicyUtils.java Modified: cxf/trunk/rt/ws/rm/pom.xml cxf/trunk/rt/ws/rm/src/main/build-resources/catalog.cat cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/AbstractEndpoint.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/AbstractRMInterceptor.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/AbstractSequence.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/BindingFaultFactory.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Destination.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Messages.properties cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMConstants.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMContextUtils.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java 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/RMOutInterceptor.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMProperties.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMUtils.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RetransmissionCallback.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/SequenceFault.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/SequenceFaultFactory.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/SequenceIdentifierGenerator.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Servant.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Source.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/SourceSequence.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/feature/RMFeature.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/PersistenceUtils.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMStore.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMAssertionBuilder.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/Messages.properties cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/SoapFaultFactory.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/spring/RMFeatureBeanDefinitionParser.java cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/spring/RMManagerBeanDefinitionParser.java cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/wsrm-manager-types.xsd cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/wsrm-manager.xsd cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/wsrm-policy.xjb cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/AbstractEndpointTest.java cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/AbstractRMInterceptorTest.java cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/AbstractSequenceTest.java cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/DestinationSequenceTest.java cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/DestinationTest.java cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMContextUtilsTest.java cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMInInterceptorTest.java cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerConfigurationTest.java cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ServantTest.java cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/SourceSequenceTest.java cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/feature.xml cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/manager-bean.xml cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/PersistenceUtilsTest.java cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStoreTest.java cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/policy/PolicyUtilsTest.java cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptorTest.java cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImplTest.java cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/SoapFaultFactoryTest.java cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTestBase.java cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyTest.java cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyWsdlTest.java cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/CachedOutClientPersistenceTest.java cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/CachedOutMessageTest.java cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/CachedOutServerPersistenceTest.java cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/ClientPersistenceTest.java cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/DeliveryAssuranceOnewayTest.java cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/MessageLossSimulator.java cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/RetransmissionQueueTest.java cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/ServerPersistenceTest.java cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/rminterceptors.xml cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/util/MessageFlow.java Modified: cxf/trunk/rt/ws/rm/pom.xml URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/pom.xml?rev=1137112&r1=1137111&r2=1137112&view=diff ============================================================================== --- cxf/trunk/rt/ws/rm/pom.xml (original) +++ cxf/trunk/rt/ws/rm/pom.xml Sat Jun 18 01:51:01 2011 @@ -112,8 +112,24 @@ ${basedir}/target/generated/src/main/java - ${basedir}/src/main/resources/schemas/wsdl/wsrm.xsd - ${basedir}/src/main/resources/schemas/wsdl/wsrm.xjb + ${basedir}/src/main/resources/schemas/wsdl/wsrm-1.0.xsd + ${basedir}/src/main/resources/schemas/wsdl/wsrm-1.0.xjb + ${basedir}/src/main/build-resources/catalog.cat + + ${basedir}/target/generated/src/main/java/org/apache/cxf/ws/addressing + + + + ${basedir}/src/main/resources/schemas/wsdl/wsrm-1.0-wsa15.xsd + ${basedir}/src/main/resources/schemas/wsdl/wsrm-1.0-wsa15.xjb + ${basedir}/src/main/build-resources/catalog.cat + + ${basedir}/target/generated/src/main/java/org/apache/cxf/ws/addressing + + + + ${basedir}/src/main/resources/schemas/wsdl/wsrm-1.1.xsd + ${basedir}/src/main/resources/schemas/wsdl/wsrm-1.1.xjb ${basedir}/src/main/build-resources/catalog.cat ${basedir}/target/generated/src/main/java/org/apache/cxf/ws/addressing @@ -127,7 +143,16 @@ -Xdv - ` + + + ${basedir}/src/main/resources/schemas/configuration/wsrmp-1.1-schema-200702.xsd + ${basedir}/src/main/resources/schemas/configuration/wsrmp-1.1-schema-200702.xjb + ${basedir}/src/main/build-resources/catalog.cat + true + + -Xdv + + Modified: cxf/trunk/rt/ws/rm/src/main/build-resources/catalog.cat URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/build-resources/catalog.cat?rev=1137112&r1=1137111&r2=1137112&view=diff ============================================================================== --- cxf/trunk/rt/ws/rm/src/main/build-resources/catalog.cat (original) +++ cxf/trunk/rt/ws/rm/src/main/build-resources/catalog.cat Sat Jun 18 01:51:01 2011 @@ -1,24 +1,28 @@ - --- - 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. --- - - -SYSTEM "http://schemas.xmlsoap.org/ws/2004/08/addressing" "../../../../../../api/src/main/resources/schemas/wsdl/addressing.xsd" - -SYSTEM "http://schemas.xmlsoap.org/ws/2005/02/rm/wsrm-policy.xsd" "../resources/schemas/configuration/wsrm-policy.xsd" + +-- + 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. +-- + + +SYSTEM "http://schemas.xmlsoap.org/ws/2004/08/addressing" "../../../../../../api/src/main/resources/schemas/wsdl/addressing.xsd" +SYSTEM "http://www.w3.org/2006/03/addressing/ws-addr.xsd" "../../../../../../api/src/main/resources/schemas/wsdl/ws-addr.xsd" + +SYSTEM "http://docs.oasis-open.org/ws-rx/wsrm/200702" "../resources/schemas/wsdl/wsrm-1.1.xsd" + +SYSTEM "http://schemas.xmlsoap.org/ws/2005/02/rm/wsrm-policy.xsd" "../resources/schemas/configuration/wsrm-policy.xsd" +SYSTEM "http://docs.oasis-open.org/ws-rx/wsrmp/200702" "../resources/schemas/configuration/wsrmp-1.1-schema-200702.xsd" Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/AbstractEndpoint.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/AbstractEndpoint.java?rev=1137112&r1=1137111&r2=1137112&view=diff ============================================================================== --- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/AbstractEndpoint.java (original) +++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/AbstractEndpoint.java Sat Jun 18 01:51:01 2011 @@ -20,6 +20,7 @@ package org.apache.cxf.ws.rm; import org.apache.cxf.endpoint.Endpoint; +import org.apache.cxf.ws.rm.v200702.Identifier; public class AbstractEndpoint { Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/AbstractRMInterceptor.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/AbstractRMInterceptor.java?rev=1137112&r1=1137111&r2=1137112&view=diff ============================================================================== --- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/AbstractRMInterceptor.java (original) +++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/AbstractRMInterceptor.java Sat Jun 18 01:51:01 2011 @@ -33,6 +33,7 @@ import org.apache.cxf.phase.AbstractPhas import org.apache.cxf.phase.Phase; import org.apache.cxf.ws.policy.AssertionInfo; import org.apache.cxf.ws.policy.AssertionInfoMap; +import org.apache.cxf.ws.rm.policy.RM10PolicyUtils; /** * Interceptor responsible for implementing exchange of RM protocol messages, @@ -93,7 +94,7 @@ public abstract class AbstractRMIntercep RMManager m = getManager(); LOG.fine("Manager: " + m); BindingFaultFactory bff = m.getBindingFaultFactory(b); - Fault f = bff.createFault(sf); + Fault f = bff.createFault(sf, msg); LogUtils.log(LOG, Level.SEVERE, "SEQ_FAULT_MSG", bff.toString(f)); throw f; } @@ -111,15 +112,7 @@ public abstract class AbstractRMIntercep */ void assertReliability(Message message) { AssertionInfoMap aim = message.get(AssertionInfoMap.class); - if (null == aim) { - return; - - } - Collection ais = aim.get(RMConstants.getRMAssertionQName()); - if (null == ais || ais.size() == 0) { - return; - } - + Collection ais = RM10PolicyUtils.collectRMAssertions(aim); for (AssertionInfo ai : ais) { ai.setAsserted(true); } Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/AbstractSequence.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/AbstractSequence.java?rev=1137112&r1=1137111&r2=1137112&view=diff ============================================================================== --- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/AbstractSequence.java (original) +++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/AbstractSequence.java Sat Jun 18 01:51:01 2011 @@ -19,8 +19,9 @@ package org.apache.cxf.ws.rm; -import org.apache.cxf.ws.rm.SequenceAcknowledgement.AcknowledgementRange; - +import org.apache.cxf.ws.rm.v200702.Identifier; +import org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement; +import org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement.AcknowledgementRange; public abstract class AbstractSequence { @@ -37,7 +38,7 @@ public abstract class AbstractSequence { public Identifier getIdentifier() { return id; } - + public String toString() { return id.getValue(); } Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/BindingFaultFactory.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/BindingFaultFactory.java?rev=1137112&r1=1137111&r2=1137112&view=diff ============================================================================== --- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/BindingFaultFactory.java (original) +++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/BindingFaultFactory.java Sat Jun 18 01:51:01 2011 @@ -20,13 +20,14 @@ package org.apache.cxf.ws.rm; import org.apache.cxf.interceptor.Fault; +import org.apache.cxf.message.Message; /** * */ public interface BindingFaultFactory { - Fault createFault(SequenceFault sf); + Fault createFault(SequenceFault sf, Message msg); String toString(Fault f); Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Destination.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Destination.java?rev=1137112&r1=1137111&r2=1137112&view=diff ============================================================================== --- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Destination.java (original) +++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Destination.java Sat Jun 18 01:51:01 2011 @@ -37,6 +37,9 @@ import org.apache.cxf.transport.Conduit; import org.apache.cxf.ws.addressing.AddressingPropertiesImpl; import org.apache.cxf.ws.rm.persistence.RMMessage; import org.apache.cxf.ws.rm.persistence.RMStore; +import org.apache.cxf.ws.rm.v200702.AckRequestedType; +import org.apache.cxf.ws.rm.v200702.Identifier; +import org.apache.cxf.ws.rm.v200702.SequenceType; public class Destination extends AbstractEndpoint { @@ -95,7 +98,8 @@ public class Destination extends Abstrac * sequenceType does not exist */ public void acknowledge(Message message) throws SequenceFault, RMException { - SequenceType sequenceType = RMContextUtils.retrieveRMProperties(message, false).getSequence(); + RMProperties rmps = RMContextUtils.retrieveRMProperties(message, false); + SequenceType sequenceType = rmps.getSequence(); if (null == sequenceType) { return; } @@ -106,7 +110,7 @@ public class Destination extends Abstrac if (seq.applyDeliveryAssurance(sequenceType.getMessageNumber(), message)) { seq.acknowledge(message); - if (null != sequenceType.getLastMessage()) { + if (null != rmps.getCloseSequence()) { seq.setLastMessageNumber(sequenceType.getMessageNumber()); ackImmediately(seq, message); } @@ -130,7 +134,8 @@ public class Destination extends Abstrac } } } else { - SequenceFaultFactory sff = new SequenceFaultFactory(); + RMConstants consts = getReliableEndpoint().getEncoderDecoder().getConstants(); + SequenceFaultFactory sff = new SequenceFaultFactory(consts); throw sff.createUnknownSequenceFault(sequenceType.getIdentifier()); } Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java?rev=1137112&r1=1137111&r2=1137112&view=diff ============================================================================== --- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java (original) +++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java Sat Jun 18 01:51:01 2011 @@ -32,15 +32,18 @@ import org.apache.cxf.continuations.Cont import org.apache.cxf.continuations.ContinuationProvider; import org.apache.cxf.continuations.SuspendedInvocationException; import org.apache.cxf.message.Message; -import org.apache.cxf.ws.addressing.v200408.EndpointReferenceType; -import org.apache.cxf.ws.rm.SequenceAcknowledgement.AcknowledgementRange; +import org.apache.cxf.ws.addressing.EndpointReferenceType; import org.apache.cxf.ws.rm.manager.AcksPolicyType; import org.apache.cxf.ws.rm.manager.DeliveryAssuranceType; import org.apache.cxf.ws.rm.persistence.RMStore; -import org.apache.cxf.ws.rm.policy.PolicyUtils; -import org.apache.cxf.ws.rm.policy.RMAssertion; -import org.apache.cxf.ws.rm.policy.RMAssertion.AcknowledgementInterval; -import org.apache.cxf.ws.rm.policy.RMAssertion.InactivityTimeout; +import org.apache.cxf.ws.rm.policy.RM10PolicyUtils; +import org.apache.cxf.ws.rm.v200702.Identifier; +import org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement; +import org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement.AcknowledgementRange; +import org.apache.cxf.ws.rm.v200702.SequenceType; +import org.apache.cxf.ws.rmp.v200502.RMAssertion; +import org.apache.cxf.ws.rmp.v200502.RMAssertion.AcknowledgementInterval; +import org.apache.cxf.ws.rmp.v200502.RMAssertion.InactivityTimeout; public class DestinationSequence extends AbstractSequence { @@ -70,7 +73,7 @@ public class DestinationSequence extends lastMessageNumber = lmn; acknowledgement = ac; if (null == acknowledgement) { - acknowledgement = RMUtils.getWSRMFactory().createSequenceAcknowledgement(); + acknowledgement = new SequenceAcknowledgement(); acknowledgement.setIdentifier(id); } monitor = new SequenceMonitor(); @@ -105,11 +108,14 @@ public class DestinationSequence extends } public void acknowledge(Message message) throws SequenceFault { - SequenceType st = RMContextUtils.retrieveRMProperties(message, false).getSequence(); + RMProperties rmps = RMContextUtils.retrieveRMProperties(message, false); + SequenceType st = rmps.getSequence(); long messageNumber = st.getMessageNumber().longValue(); LOG.fine("Acknowledging message: " + messageNumber); if (0 != lastMessageNumber && messageNumber > lastMessageNumber) { - throw new SequenceFaultFactory().createLastMessageNumberExceededFault(st.getIdentifier()); + RMConstants consts = destination.getReliableEndpoint().getEncoderDecoder().getConstants(); + SequenceFaultFactory sff = new SequenceFaultFactory(consts); + throw sff.createSequenceTerminatedFault(st.getIdentifier(), false); } monitor.acknowledgeMessage(); @@ -123,18 +129,17 @@ public class DestinationSequence extends && r.getUpper().compareTo(messageNumber) >= 0) { done = true; break; - } else { - long diff = r.getLower() - messageNumber; - if (diff == 1) { - r.setLower(messageNumber); - done = true; - } else if (diff > 0) { - break; - } else if (messageNumber - r.getUpper().longValue() == 1) { - r.setUpper(messageNumber); - done = true; - break; - } + } + long diff = r.getLower() - messageNumber; + if (diff == 1) { + r.setLower(messageNumber); + done = true; + } else if (diff > 0) { + break; + } else if (messageNumber - r.getUpper().longValue() == 1) { + r.setUpper(messageNumber); + done = true; + break; } } @@ -148,8 +153,8 @@ public class DestinationSequence extends mergeRanges(); wakeupAll(); } - - RMAssertion rma = PolicyUtils.getRMAssertion(destination.getManager().getRMAssertion(), message); + + RMAssertion rma = RM10PolicyUtils.getRMAssertion(destination.getManager().getRMAssertion(), message); long acknowledgementInterval = 0; AcknowledgementInterval ai = rma.getAcknowledgementInterval(); if (null != ai) { @@ -209,7 +214,7 @@ public class DestinationSequence extends boolean canPiggybackAckOnPartialResponse() { // TODO: should also check if we allow breaking the WI Profile rule by which no headers // can be included in a HTTP response - return getAcksTo().getAddress().getValue().equals(RMConstants.getAnonymousAddress()); + return getAcksTo().getAddress().getValue().equals(RMUtils.getAddressingConstants().getAnonymousURI()); } /** @@ -221,13 +226,13 @@ public class DestinationSequence extends * * @param mn message number * @return true if message processing to continue, false if to be dropped - * @throws Fault if message had already been acknowledged + * @throws RMException if message had already been acknowledged */ boolean applyDeliveryAssurance(long mn, Message message) throws RMException { Continuation cont = getContinuation(message); DeliveryAssuranceType da = destination.getManager().getDeliveryAssurance(); if (cont != null && da.isSetInOrder() && !cont.isNew()) { - return waitInQueue(mn, !(da.isSetAtLeastOnce() || da.isSetExactlyOnce()), + return waitInQueue(mn, da.isSetAtLeastOnce() && da.isSetExactlyOnce(), message, cont); } if ((da.isSetExactlyOnce() || da.isSetAtMostOnce()) && isAcknowledged(mn)) { @@ -485,6 +490,4 @@ public class DestinationSequence extends } } } - - -} +} \ No newline at end of file Added: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder.java?rev=1137112&view=auto ============================================================================== --- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder.java (added) +++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder.java Sat Jun 18 01:51:01 2011 @@ -0,0 +1,196 @@ +/** + * 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; + +import javax.xml.bind.JAXBException; +import javax.xml.namespace.QName; + +import org.w3c.dom.Element; + +import org.apache.cxf.ws.rm.v200702.AckRequestedType; +import org.apache.cxf.ws.rm.v200702.CreateSequenceResponseType; +import org.apache.cxf.ws.rm.v200702.CreateSequenceType; +import org.apache.cxf.ws.rm.v200702.Identifier; +import org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement; +import org.apache.cxf.ws.rm.v200702.SequenceType; +import org.apache.cxf.ws.rm.v200702.TerminateSequenceType; + +/** + * Interface for converting WS-ReliableMessaging structures to and from XML. Implementations of this interface + * provide version-specific encoding and decoding. + */ +public interface EncoderDecoder { + + /** + * Get the WS-ReliableMessaging namespace used by this encoder/decoder. + * + * @return URI + */ + String getWSRMNamespace(); + + /** + * Get the WS-Addressing namespace used by this encoder/decoder. + * + * @return URI + */ + String getWSANamespace(); + + /** + * Get the WS-ReliableMessaging constants used by this encoder/decoder. + * + * @return + */ + RMConstants getConstants(); + + /** + * Get the class used for the CreateSequenceType. + * + * @return class + */ + Class getCreateSequenceType(); + + /** + * Get the class used for the CreateSequenceResponseType. + * + * @return class + */ + Class getCreateSequenceResponseType(); + + /** + * Get the class used for the TerminateSequenceType. + * + * @return class + */ + Class getTerminateSequenceType(); + + /** + * Builds an element containing WS-RM headers. This adds the appropriate WS-RM and WS-A namespace + * declarations to the element, and then adds any WS-RM headers set in the supplied properties as child + * elements. + * + * @param rmps + * @param qname constructed element name + * @return element + */ + Element buildHeaders(RMProperties rmps, QName qname) throws JAXBException; + + /** + * Builds an element containing a WS-RM Fault. This adds the appropriate WS-RM namespace declaration to + * the element, and then adds the Fault as a child element. + * + * @param sf + * @param qname constructed element name + * @return element + */ + Element buildHeaderFault(SequenceFault sf, QName qname) throws JAXBException; + + /** + * Marshals a SequenceAcknowledgement to the appropriate external form. + * + * @param ack + * @return element + * @throws JAXBException + */ + Element encodeSequenceAcknowledgement(SequenceAcknowledgement ack) throws JAXBException; + + /** + * Marshals an Identifier to the appropriate external form. + * + * @param id + * @return element + * @throws JAXBException + */ + Element encodeIdentifier(Identifier id) throws JAXBException; + + /** + * Unmarshals a SequenceType, converting it if necessary to the internal form. + * + * @param elem + * @return + * @throws JAXBException + */ + SequenceType decodeSequenceType(Element elem) throws JAXBException; + + /** + * Unmarshals a SequenceAcknowledgement, converting it if necessary to the internal form. + * + * @param elem + * @return + * @throws JAXBException + */ + SequenceAcknowledgement decodeSequenceAcknowledgement(Element elem) throws JAXBException; + + /** + * Unmarshals a AckRequestedType, converting it if necessary to the internal form. + * + * @param elem + * @return + * @throws JAXBException + */ + AckRequestedType decodeAckRequestedType(Element elem) throws JAXBException; + + /** + * Convert a CreateSequence message to the correct format for transmission. + * + * @param create + * @return converted + */ + Object convertToSend(CreateSequenceType create); + + /** + * Convert a CreateSequenceResponse message to the correct format for transmission. + * + * @param create + * @return converted + */ + Object convertToSend(CreateSequenceResponseType create); + + /** + * Convert a TerminateSequence message to the correct format for transmission. + * + * @param term + * @return converted + */ + Object convertToSend(TerminateSequenceType term); + + /** + * Convert a received TerminateSequence message to internal form. + * + * @param term + * @return converted + */ + TerminateSequenceType convertReceivedTerminateSequence(Object term); + + /** + * Convert a received CreateSequence message to internal form. + * + * @param create + * @return converted + */ + CreateSequenceType convertReceivedCreateSequence(Object create); + + /** + * Convert a received CreateSequenceResponse message to internal form. + * + * @param create + * @return converted + */ + CreateSequenceResponseType convertReceivedCreateSequenceResponse(Object create); +} \ No newline at end of file Added: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder10AImpl.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder10AImpl.java?rev=1137112&view=auto ============================================================================== --- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder10AImpl.java (added) +++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder10AImpl.java Sat Jun 18 01:51:01 2011 @@ -0,0 +1,218 @@ +/** + * 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; + +import java.util.Collection; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import javax.xml.bind.Unmarshaller; +import javax.xml.namespace.QName; + +import org.w3c.dom.Attr; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import org.apache.cxf.common.logging.LogUtils; +import org.apache.cxf.common.util.PackageUtils; +import org.apache.cxf.helpers.DOMUtils; +import org.apache.cxf.ws.addressing.Names; +import org.apache.cxf.ws.rm.v200702.AckRequestedType; +import org.apache.cxf.ws.rm.v200702.CreateSequenceResponseType; +import org.apache.cxf.ws.rm.v200702.CreateSequenceType; +import org.apache.cxf.ws.rm.v200702.Identifier; +import org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement; +import org.apache.cxf.ws.rm.v200702.SequenceFaultType; +import org.apache.cxf.ws.rm.v200702.SequenceType; +import org.apache.cxf.ws.rm.v200702.TerminateSequenceType; + +/** + * WS-ReliableMessaging 1.0 encoding and decoding. This converts between the standard WS-RM objects and the + * 1.0 representation using the WS-Addressing recommendation 200508 namespace. + */ +public final class EncoderDecoder10AImpl implements EncoderDecoder { + + public static final EncoderDecoder10AImpl INSTANCE = new EncoderDecoder10AImpl(); + + private static JAXBContext jaxbContext; + + private static final Logger LOG = LogUtils.getL7dLogger(EncoderDecoder10AImpl.class); + + private EncoderDecoder10AImpl() { + } + + public String getWSRMNamespace() { + return RM10Constants.NAMESPACE_URI; + } + + public String getWSANamespace() { + return Names.WSA_NAMESPACE_NAME; + } + + public RMConstants getConstants() { + return RM10Constants.INSTANCE; + } + + public Class getCreateSequenceType() { + return org.apache.cxf.ws.rm.v200502wsa15.CreateSequenceType.class; + } + + public Class getCreateSequenceResponseType() { + return org.apache.cxf.ws.rm.v200502wsa15.CreateSequenceResponseType.class; + } + + public Class getTerminateSequenceType() { + return org.apache.cxf.ws.rm.v200502wsa15.TerminateSequenceType.class; + } + + private static JAXBContext getContext() throws JAXBException { + synchronized (EncoderDecoder10AImpl.class) { + if (jaxbContext == null) { + Class clas = RMUtils.getWSRM200502WSA200508Factory().getClass(); + jaxbContext = JAXBContext.newInstance(PackageUtils.getPackageName(clas), + clas.getClassLoader()); + } + } + return jaxbContext; + } + + public Element buildHeaders(RMProperties rmps, QName qname) throws JAXBException { + + Document doc = DOMUtils.createDocument(); + Element header = doc.createElementNS(qname.getNamespaceURI(), qname.getLocalPart()); + // add WSRM namespace declaration to header, instead of + // repeating in each individual child node + Attr attr = doc.createAttributeNS("http://www.w3.org/2000/xmlns/", + "xmlns:" + RMConstants.NAMESPACE_PREFIX); + attr.setValue(RM10Constants.NAMESPACE_URI); + header.setAttributeNodeNS(attr); + + Marshaller marshaller = getContext().createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE); + + SequenceType seq = rmps.getSequence(); + if (null != seq) { + LOG.log(Level.FINE, "encoding sequence into RM header"); + org.apache.cxf.ws.rm.v200502wsa15.SequenceType toseq = VersionTransformer.convert200502wsa15(seq); + JAXBElement element = RMUtils.getWSRM200502WSA200508Factory().createSequence(toseq); + marshaller.marshal(element, header); + } + Collection acks = rmps.getAcks(); + if (null != acks) { + LOG.log(Level.FINE, "encoding sequence acknowledgement(s) into RM header"); + for (SequenceAcknowledgement ack : acks) { + marshaller.marshal(VersionTransformer.convert200502wsa15(ack), header); + } + } + Collection reqs = rmps.getAcksRequested(); + if (null != reqs) { + LOG.log(Level.FINE, "encoding acknowledgement request(s) into RM header"); + for (AckRequestedType req : reqs) { + marshaller.marshal(RMUtils.getWSRM200502WSA200508Factory() + .createAckRequested(VersionTransformer.convert200502wsa15(req)), header); + } + } + return header; + } + + public Element buildHeaderFault(SequenceFault sf, QName qname) throws JAXBException { + + Document doc = DOMUtils.createDocument(); + Element header = doc.createElementNS(qname.getNamespaceURI(), qname.getLocalPart()); + // add WSRM namespace declaration to header, instead of + // repeating in each individual child node + + Attr attr = doc.createAttributeNS("http://www.w3.org/2000/xmlns/", + "xmlns:" + RMConstants.NAMESPACE_PREFIX); + attr.setValue(RM10Constants.NAMESPACE_URI); + header.setAttributeNodeNS(attr); + + Marshaller marshaller = getContext().createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE); + QName fqname = RM10Constants.SEQUENCE_FAULT_QNAME; + marshaller.marshal(new JAXBElement(fqname, SequenceFaultType.class, + sf.getSequenceFault()), header); + return header; + } + + public Element encodeSequenceAcknowledgement(SequenceAcknowledgement ack) throws JAXBException { + Document doc = DOMUtils.createDocument(); + Marshaller marshaller = getContext().createMarshaller(); + marshaller.marshal(VersionTransformer.convert200502wsa15(ack), doc); + return (Element)doc.getFirstChild(); + } + + public Element encodeIdentifier(Identifier id) throws JAXBException { + Document doc = DOMUtils.createDocument(); + Marshaller marshaller = getContext().createMarshaller(); + marshaller.marshal(VersionTransformer.convert200502wsa15(id), doc); + return (Element)doc.getFirstChild(); + } + + public SequenceType decodeSequenceType(Element elem) throws JAXBException { + Unmarshaller unmarshaller = getContext().createUnmarshaller(); + JAXBElement jaxbElement + = unmarshaller.unmarshal(elem, org.apache.cxf.ws.rm.v200502wsa15.SequenceType.class); + return VersionTransformer.convert(jaxbElement.getValue()); + } + + public SequenceAcknowledgement decodeSequenceAcknowledgement(Element elem) throws JAXBException { + Unmarshaller unmarshaller = getContext().createUnmarshaller(); + org.apache.cxf.ws.rm.v200502wsa15.SequenceAcknowledgement ack + = (org.apache.cxf.ws.rm.v200502wsa15.SequenceAcknowledgement)unmarshaller.unmarshal(elem); + return VersionTransformer.convert(ack); + } + + public AckRequestedType decodeAckRequestedType(Element elem) throws JAXBException { + Unmarshaller unmarshaller = getContext().createUnmarshaller(); + JAXBElement jaxbElement + = unmarshaller.unmarshal(elem, org.apache.cxf.ws.rm.v200502wsa15.AckRequestedType.class); + return VersionTransformer.convert(jaxbElement.getValue()); + } + + public Object convertToSend(CreateSequenceType create) { + return VersionTransformer.convert200502wsa15(create); + } + + public Object convertToSend(TerminateSequenceType term) { + return VersionTransformer.convert200502wsa15(term); + } + + public Object convertToSend(CreateSequenceResponseType create) { + return VersionTransformer.convert200502wsa15(create); + } + + public CreateSequenceType convertReceivedCreateSequence(Object create) { + return VersionTransformer.convert((org.apache.cxf.ws.rm.v200502wsa15.CreateSequenceType)create); + } + + public CreateSequenceResponseType convertReceivedCreateSequenceResponse(Object response) { + return VersionTransformer. + convert((org.apache.cxf.ws.rm.v200502wsa15.CreateSequenceResponseType)response); + } + + public TerminateSequenceType convertReceivedTerminateSequence(Object term) { + return VersionTransformer.convert((org.apache.cxf.ws.rm.v200502wsa15.TerminateSequenceType)term); + } +} \ No newline at end of file Added: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder10Impl.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder10Impl.java?rev=1137112&view=auto ============================================================================== --- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder10Impl.java (added) +++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder10Impl.java Sat Jun 18 01:51:01 2011 @@ -0,0 +1,217 @@ +/** + * 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; + +import java.util.Collection; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import javax.xml.bind.Unmarshaller; +import javax.xml.namespace.QName; + +import org.w3c.dom.Attr; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import org.apache.cxf.common.logging.LogUtils; +import org.apache.cxf.common.util.PackageUtils; +import org.apache.cxf.helpers.DOMUtils; +import org.apache.cxf.ws.addressing.VersionTransformer.Names200408; +import org.apache.cxf.ws.rm.v200702.AckRequestedType; +import org.apache.cxf.ws.rm.v200702.CreateSequenceResponseType; +import org.apache.cxf.ws.rm.v200702.CreateSequenceType; +import org.apache.cxf.ws.rm.v200702.Identifier; +import org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement; +import org.apache.cxf.ws.rm.v200702.SequenceFaultType; +import org.apache.cxf.ws.rm.v200702.SequenceType; +import org.apache.cxf.ws.rm.v200702.TerminateSequenceType; + +/** + * WS-ReliableMessaging 1.0 encoding and decoding. This converts between the standard WS-RM objects and the + * 1.0 representation using the WS-Addressing 200408 namespace specified in the WS-RM 1.0 recommendation. + */ +public final class EncoderDecoder10Impl implements EncoderDecoder { + + public static final EncoderDecoder10Impl INSTANCE = new EncoderDecoder10Impl(); + + private static JAXBContext jaxbContext; + + private static final Logger LOG = LogUtils.getL7dLogger(EncoderDecoder10Impl.class); + + private EncoderDecoder10Impl() { + } + + public String getWSRMNamespace() { + return RM10Constants.NAMESPACE_URI; + } + + public String getWSANamespace() { + return Names200408.WSA_NAMESPACE_NAME; + } + + public RMConstants getConstants() { + return RM10Constants.INSTANCE; + } + + public Class getCreateSequenceType() { + return org.apache.cxf.ws.rm.v200502.CreateSequenceType.class; + } + + public Class getCreateSequenceResponseType() { + return org.apache.cxf.ws.rm.v200502.CreateSequenceResponseType.class; + } + + public Class getTerminateSequenceType() { + return org.apache.cxf.ws.rm.v200502.TerminateSequenceType.class; + } + + private static JAXBContext getContext() throws JAXBException { + synchronized (EncoderDecoder10Impl.class) { + if (jaxbContext == null) { + Class clas = RMUtils.getWSRM200502Factory().getClass(); + jaxbContext = JAXBContext.newInstance(PackageUtils.getPackageName(clas), + clas.getClassLoader()); + } + } + return jaxbContext; + } + + public Element buildHeaders(RMProperties rmps, QName qname) throws JAXBException { + + Document doc = DOMUtils.createDocument(); + Element header = doc.createElementNS(qname.getNamespaceURI(), qname.getLocalPart()); + // add WSRM namespace declaration to header, instead of + // repeating in each individual child node + Attr attr = doc.createAttributeNS("http://www.w3.org/2000/xmlns/", + "xmlns:" + RMConstants.NAMESPACE_PREFIX); + attr.setValue(RM10Constants.NAMESPACE_URI); + header.setAttributeNodeNS(attr); + + Marshaller marshaller = getContext().createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE); + + SequenceType seq = rmps.getSequence(); + if (null != seq) { + LOG.log(Level.FINE, "encoding sequence into RM header"); + org.apache.cxf.ws.rm.v200502.SequenceType toseq = VersionTransformer.convert200502(seq); + JAXBElement element = RMUtils.getWSRM200502Factory().createSequence(toseq); + marshaller.marshal(element, header); + } + Collection acks = rmps.getAcks(); + if (null != acks) { + LOG.log(Level.FINE, "encoding sequence acknowledgement(s) into RM header"); + for (SequenceAcknowledgement ack : acks) { + marshaller.marshal(VersionTransformer.convert200502(ack), header); + } + } + Collection reqs = rmps.getAcksRequested(); + if (null != reqs) { + LOG.log(Level.FINE, "encoding acknowledgement request(s) into RM header"); + for (AckRequestedType req : reqs) { + marshaller.marshal(RMUtils.getWSRM200502Factory() + .createAckRequested(VersionTransformer.convert200502(req)), header); + } + } + return header; + } + + public Element buildHeaderFault(SequenceFault sf, QName qname) throws JAXBException { + + Document doc = DOMUtils.createDocument(); + Element header = doc.createElementNS(qname.getNamespaceURI(), qname.getLocalPart()); + // add WSRM namespace declaration to header, instead of + // repeating in each individual child node + + Attr attr = doc.createAttributeNS("http://www.w3.org/2000/xmlns/", + "xmlns:" + RMConstants.NAMESPACE_PREFIX); + attr.setValue(RM10Constants.NAMESPACE_URI); + header.setAttributeNodeNS(attr); + + Marshaller marshaller = getContext().createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE); + QName fqname = RM10Constants.SEQUENCE_FAULT_QNAME; + marshaller.marshal(new JAXBElement(fqname, SequenceFaultType.class, + sf.getSequenceFault()), header); + return header; + } + + public Element encodeSequenceAcknowledgement(SequenceAcknowledgement ack) throws JAXBException { + Document doc = DOMUtils.createDocument(); + Marshaller marshaller = getContext().createMarshaller(); + marshaller.marshal(VersionTransformer.convert200502(ack), doc); + return (Element)doc.getFirstChild(); + } + + public Element encodeIdentifier(Identifier id) throws JAXBException { + Document doc = DOMUtils.createDocument(); + Marshaller marshaller = getContext().createMarshaller(); + marshaller.marshal(VersionTransformer.convert200502(id), doc); + return (Element)doc.getFirstChild(); + } + + public SequenceType decodeSequenceType(Element elem) throws JAXBException { + Unmarshaller unmarshaller = getContext().createUnmarshaller(); + JAXBElement jaxbElement + = unmarshaller.unmarshal(elem, org.apache.cxf.ws.rm.v200502.SequenceType.class); + return VersionTransformer.convert(jaxbElement.getValue()); + } + + public SequenceAcknowledgement decodeSequenceAcknowledgement(Element elem) throws JAXBException { + Unmarshaller unmarshaller = getContext().createUnmarshaller(); + org.apache.cxf.ws.rm.v200502.SequenceAcknowledgement ack + = (org.apache.cxf.ws.rm.v200502.SequenceAcknowledgement)unmarshaller.unmarshal(elem); + return VersionTransformer.convert(ack); + } + + public AckRequestedType decodeAckRequestedType(Element elem) throws JAXBException { + Unmarshaller unmarshaller = getContext().createUnmarshaller(); + JAXBElement jaxbElement + = unmarshaller.unmarshal(elem, org.apache.cxf.ws.rm.v200502.AckRequestedType.class); + return VersionTransformer.convert(jaxbElement.getValue()); + } + + public Object convertToSend(CreateSequenceType create) { + return VersionTransformer.convert200502(create); + } + + public Object convertToSend(CreateSequenceResponseType create) { + return VersionTransformer.convert200502(create); + } + + public Object convertToSend(TerminateSequenceType term) { + return VersionTransformer.convert200502(term); + } + + public CreateSequenceType convertReceivedCreateSequence(Object create) { + return VersionTransformer.convert((org.apache.cxf.ws.rm.v200502.CreateSequenceType)create); + } + + public CreateSequenceResponseType convertReceivedCreateSequenceResponse(Object response) { + return VersionTransformer.convert((org.apache.cxf.ws.rm.v200502.CreateSequenceResponseType)response); + } + + public TerminateSequenceType convertReceivedTerminateSequence(Object term) { + return VersionTransformer.convert((org.apache.cxf.ws.rm.v200502.TerminateSequenceType)term); + } +} \ No newline at end of file Added: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder11Impl.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder11Impl.java?rev=1137112&view=auto ============================================================================== --- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder11Impl.java (added) +++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder11Impl.java Sat Jun 18 01:51:01 2011 @@ -0,0 +1,211 @@ +/** + * 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; + +import java.util.Collection; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import javax.xml.bind.Unmarshaller; +import javax.xml.namespace.QName; + +import org.w3c.dom.Attr; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import org.apache.cxf.common.logging.LogUtils; +import org.apache.cxf.common.util.PackageUtils; +import org.apache.cxf.helpers.DOMUtils; +import org.apache.cxf.ws.addressing.Names; +import org.apache.cxf.ws.rm.v200702.AckRequestedType; +import org.apache.cxf.ws.rm.v200702.CreateSequenceResponseType; +import org.apache.cxf.ws.rm.v200702.CreateSequenceType; +import org.apache.cxf.ws.rm.v200702.Identifier; +import org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement; +import org.apache.cxf.ws.rm.v200702.SequenceFaultType; +import org.apache.cxf.ws.rm.v200702.SequenceType; +import org.apache.cxf.ws.rm.v200702.TerminateSequenceType; + +/** + * WS-ReliableMessaging 1.1 encoding and decoding. This just works with the standard internal form of the + * WS-RM data structures. + */ +public final class EncoderDecoder11Impl implements EncoderDecoder { + + public static final EncoderDecoder11Impl INSTANCE = new EncoderDecoder11Impl(); + + private static JAXBContext jaxbContext; + + private static final Logger LOG = LogUtils.getL7dLogger(EncoderDecoder11Impl.class); + + private EncoderDecoder11Impl() { + } + + public String getWSRMNamespace() { + return RM11Constants.NAMESPACE_URI; + } + + public String getWSANamespace() { + return Names.WSA_NAMESPACE_NAME; + } + + public RMConstants getConstants() { + return RM11Constants.INSTANCE; + } + + public Class getCreateSequenceType() { + return org.apache.cxf.ws.rm.v200702.CreateSequenceType.class; + } + + public Class getCreateSequenceResponseType() { + return org.apache.cxf.ws.rm.v200702.CreateSequenceResponseType.class; + } + + public Class getTerminateSequenceType() { + return org.apache.cxf.ws.rm.v200702.TerminateSequenceType.class; + } + + private static JAXBContext getContext() throws JAXBException { + synchronized (EncoderDecoder11Impl.class) { + if (jaxbContext == null) { + Class clas = RMUtils.getWSRMFactory().getClass(); + jaxbContext = JAXBContext.newInstance(PackageUtils.getPackageName(clas), + clas.getClassLoader()); + } + } + return jaxbContext; + } + + public Element buildHeaders(RMProperties rmps, QName qname) throws JAXBException { + + Document doc = DOMUtils.createDocument(); + Element header = doc.createElementNS(qname.getNamespaceURI(), qname.getLocalPart()); + // add WSRM namespace declaration to header, instead of + // repeating in each individual child node + Attr attr = doc.createAttributeNS("http://www.w3.org/2000/xmlns/", + "xmlns:" + RMConstants.NAMESPACE_PREFIX); + attr.setValue(RM10Constants.NAMESPACE_URI); + header.setAttributeNodeNS(attr); + + Marshaller marshaller = getContext().createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE); + + SequenceType seq = rmps.getSequence(); + if (null != seq) { + LOG.log(Level.FINE, "encoding sequence into RM header"); + JAXBElement element = RMUtils.getWSRMFactory().createSequence(seq); + marshaller.marshal(element, header); + } + Collection acks = rmps.getAcks(); + if (null != acks) { + LOG.log(Level.FINE, "encoding sequence acknowledgement(s) into RM header"); + for (SequenceAcknowledgement ack : acks) { + marshaller.marshal(ack, header); + } + } + Collection reqs = rmps.getAcksRequested(); + if (null != reqs) { + LOG.log(Level.FINE, "encoding acknowledgement request(s) into RM header"); + for (AckRequestedType req : reqs) { + marshaller.marshal(RMUtils.getWSRMFactory().createAckRequested(req), header); + } + } + return header; + } + + public Element buildHeaderFault(SequenceFault sf, QName qname) throws JAXBException { + + Document doc = DOMUtils.createDocument(); + Element header = doc.createElementNS(qname.getNamespaceURI(), qname.getLocalPart()); + // add WSRM namespace declaration to header, instead of + // repeating in each individual child node + + Attr attr = doc.createAttributeNS("http://www.w3.org/2000/xmlns/", + "xmlns:" + RMConstants.NAMESPACE_PREFIX); + attr.setValue(RM11Constants.NAMESPACE_URI); + header.setAttributeNodeNS(attr); + + Marshaller marshaller = getContext().createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE); + QName fqname = RM11Constants.SEQUENCE_FAULT_QNAME; + marshaller.marshal(new JAXBElement(fqname, SequenceFaultType.class, + sf.getSequenceFault()), header); + return header; + } + + public Element encodeSequenceAcknowledgement(SequenceAcknowledgement ack) throws JAXBException { + Document doc = DOMUtils.createDocument(); + Marshaller marshaller = getContext().createMarshaller(); + marshaller.marshal(ack, doc); + return (Element)doc.getFirstChild(); + } + + public Element encodeIdentifier(Identifier id) throws JAXBException { + Document doc = DOMUtils.createDocument(); + Marshaller marshaller = getContext().createMarshaller(); + marshaller.marshal(id, doc); + return (Element)doc.getFirstChild(); + } + + public SequenceType decodeSequenceType(Element elem) throws JAXBException { + Unmarshaller unmarshaller = getContext().createUnmarshaller(); + JAXBElement jaxbElement = unmarshaller.unmarshal(elem, SequenceType.class); + return jaxbElement.getValue(); + } + + public SequenceAcknowledgement decodeSequenceAcknowledgement(Element elem) throws JAXBException { + Unmarshaller unmarshaller = getContext().createUnmarshaller(); + return (SequenceAcknowledgement)unmarshaller.unmarshal(elem); + } + + public AckRequestedType decodeAckRequestedType(Element elem) throws JAXBException { + Unmarshaller unmarshaller = getContext().createUnmarshaller(); + JAXBElement jaxbElement = unmarshaller.unmarshal(elem, AckRequestedType.class); + return jaxbElement.getValue(); + } + + public Object convertToSend(CreateSequenceType create) { + return create; + } + + public Object convertToSend(CreateSequenceResponseType create) { + return create; + } + + public Object convertToSend(TerminateSequenceType term) { + return term; + } + + public CreateSequenceType convertReceivedCreateSequence(Object create) { + return (CreateSequenceType)create; + } + + public CreateSequenceResponseType convertReceivedCreateSequenceResponse(Object create) { + return (CreateSequenceResponseType)create; + } + + public TerminateSequenceType convertReceivedTerminateSequence(Object term) { + return (TerminateSequenceType)term; + } +} \ No newline at end of file Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Messages.properties URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Messages.properties?rev=1137112&r1=1137111&r2=1137112&view=diff ============================================================================== --- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Messages.properties (original) +++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Messages.properties Sat Jun 18 01:51:01 2011 @@ -24,8 +24,8 @@ RM_INVOCATION_FAILED = Invocation of RM SEQ_TERMINATION_FAILURE = Failed to terminate sequence {0}. STANDALONE_ANON_ACKS_NOT_SUPPORTED = It is not possible to send out-of-band acknowledgments to the anonymous address.\nAn acknowledgement will be piggybacked on the next response. -STANDALONE_LAST_MESSAGE_NO_TARGET_MSG = No target address to send out-of-band last message to. -STANDALONE_LAST_MESSAGE_ANON_TARGET_MSG = It is not possible to send an out-of-band last message to the anonymous address. +STANDALONE_CLOSE_SEQUENCE_NO_TARGET_MSG = No target address to send out-of-band close sequence to. +STANDALONE_CLOSE_SEQUENCE_ANON_TARGET_MSG = It is not possible to send an out-of-band close sequence to the anonymous address. POLICY_PROVIDER_CREATION_EXC = Failed to create provider for RM assertion. POLICY_REFERENCE_RESOLUTION_EXC = Policy reference {0} cannot be resolved. @@ -34,7 +34,8 @@ SEQ_TERMINATED_EXC = The Sequence has be UNKNOWN_SEQ_EXC = The value of wsrm:Identifier is not a known Sequence identifier. INVALID_ACK_EXC = The SequenceAcknowledgement violates the cumulative acknowledgement invariant. MESSAGE_NR_ROLLOVER_EXC = The maximum value for wsrm:MessageNumber has been exceeded. -LAST_MESSAGE_NUMBER_EXCEEDED_EXC = The value for wsrm:MessageNumber exceeds the value of the MessageNumber accompanying a LastMessage element in this Sequence. +SEQUENCE_CLOSED_EXC = The Sequence has been closed. +WSRM_REQUIRED_EXC = WS-ReliableMessaging is required by this endpoint. CREATE_SEQ_REFUSED = The create sequence request has been refused by the RM destination. SEQ_FAULT_MSG = Interceptor encountered a SequenceFault: {0}. Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java?rev=1137112&r1=1137111&r2=1137112&view=diff ============================================================================== --- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java (original) +++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java Sat Jun 18 01:51:01 2011 @@ -19,7 +19,6 @@ package org.apache.cxf.ws.rm; - import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -43,10 +42,15 @@ import org.apache.cxf.service.model.Inte import org.apache.cxf.service.model.OperationInfo; import org.apache.cxf.transport.Conduit; import org.apache.cxf.ws.addressing.AttributedURIType; +import org.apache.cxf.ws.addressing.EndpointReferenceType; import org.apache.cxf.ws.addressing.RelatesToType; -import org.apache.cxf.ws.addressing.v200408.EndpointReferenceType; import org.apache.cxf.ws.rm.manager.SourcePolicyType; - +import org.apache.cxf.ws.rm.v200702.CreateSequenceResponseType; +import org.apache.cxf.ws.rm.v200702.CreateSequenceType; +import org.apache.cxf.ws.rm.v200702.Expires; +import org.apache.cxf.ws.rm.v200702.Identifier; +import org.apache.cxf.ws.rm.v200702.OfferType; +import org.apache.cxf.ws.rm.v200702.TerminateSequenceType; /** * @@ -69,29 +73,34 @@ public class Proxy { } void acknowledge(DestinationSequence ds) throws RMException { - if (RMConstants.getAnonymousAddress().equals(ds.getAcksTo().getAddress().getValue())) { + String address = ds.getAcksTo().getAddress().getValue(); + if (RMUtils.getAddressingConstants().getAnonymousURI().equals(address)) { LOG.log(Level.WARNING, "STANDALONE_ANON_ACKS_NOT_SUPPORTED"); return; } + RMConstants constants = reliableEndpoint.getEncoderDecoder().getConstants(); OperationInfo oi = reliableEndpoint.getEndpoint().getEndpointInfo().getService().getInterface() - .getOperation(RMConstants.getSequenceAckOperationName()); + .getOperation(constants.getSequenceAckOperationName()); invoke(oi, new Object[] {ds}, null); } void terminate(SourceSequence ss) throws RMException { + RMConstants constants = reliableEndpoint.getEncoderDecoder().getConstants(); OperationInfo oi = reliableEndpoint.getEndpoint().getEndpointInfo().getService().getInterface() - .getOperation(RMConstants.getTerminateSequenceOperationName()); + .getOperation(constants.getTerminateSequenceOperationName()); TerminateSequenceType ts = RMUtils.getWSRMFactory().createTerminateSequenceType(); ts.setIdentifier(ss.getIdentifier()); - invoke(oi, new Object[] {ts}, null); + EncoderDecoder codec = reliableEndpoint.getEncoderDecoder(); + invoke(oi, new Object[] {codec.convertToSend(ts)}, null); } - void createSequenceResponse(final CreateSequenceResponseType createResponse) throws RMException { + void createSequenceResponse(final Object createResponse) throws RMException { LOG.fine("sending CreateSequenceResponse from client side"); + RMConstants constants = reliableEndpoint.getEncoderDecoder().getConstants(); final OperationInfo oi = reliableEndpoint.getEndpoint().getEndpointInfo().getService().getInterface() - .getOperation(RMConstants.getCreateSequenceResponseOnewayOperationName()); + .getOperation(constants.getCreateSequenceResponseOnewayOperationName()); // TODO: need to set relatesTo @@ -105,12 +114,12 @@ public class Proxy { boolean isServer) throws RMException { SourcePolicyType sp = reliableEndpoint.getManager().getSourcePolicy(); - final CreateSequenceType create = RMUtils.getWSRMFactory().createCreateSequenceType(); + CreateSequenceType create = new CreateSequenceType(); String address = sp.getAcksTo(); EndpointReferenceType acksTo = null; if (null != address) { - acksTo = RMUtils.createReference2004(address); + acksTo = RMUtils.createReference(address); } else { acksTo = defaultAcksTo; } @@ -118,16 +127,16 @@ public class Proxy { Duration d = sp.getSequenceExpiration(); if (null != d) { - Expires expires = RMUtils.getWSRMFactory().createExpires(); + Expires expires = new Expires(); expires.setValue(d); create.setExpires(expires); } if (sp.isIncludeOffer()) { - OfferType offer = RMUtils.getWSRMFactory().createOfferType(); + OfferType offer = new OfferType(); d = sp.getOfferedSequenceExpiration(); if (null != d) { - Expires expires = RMUtils.getWSRMFactory().createExpires(); + Expires expires = new Expires(); expires.setValue(d); offer.setExpires(expires); } @@ -138,10 +147,13 @@ public class Proxy { InterfaceInfo ii = reliableEndpoint.getEndpoint().getEndpointInfo().getService().getInterface(); + EncoderDecoder codec = reliableEndpoint.getEncoderDecoder(); + RMConstants constants = codec.getConstants(); final OperationInfo oi = isServer - ? ii.getOperation(RMConstants.getCreateSequenceOnewayOperationName()) - : ii.getOperation(RMConstants.getCreateSequenceOperationName()); - + ? ii.getOperation(constants.getCreateSequenceOnewayOperationName()) + : ii.getOperation(constants.getCreateSequenceOperationName()); + final Object send = codec.convertToSend(create); + // tried using separate thread - did not help either if (isServer) { @@ -149,7 +161,7 @@ public class Proxy { Runnable r = new Runnable() { public void run() { try { - invoke(oi, new Object[] {create}, null); + invoke(oi, new Object[] {send}, null); } catch (RMException ex) { // already logged } @@ -160,11 +172,12 @@ public class Proxy { } - return (CreateSequenceResponseType)invoke(oi, new Object[] {create}, null); + Object resp = invoke(oi, new Object[] {send}, null); + return codec.convertReceivedCreateSequenceResponse(resp); } void lastMessage(SourceSequence s) throws RMException { - org.apache.cxf.ws.addressing.EndpointReferenceType target = s.getTarget(); + EndpointReferenceType target = s.getTarget(); AttributedURIType uri = null; if (null != target) { uri = target.getAddress(); @@ -175,17 +188,18 @@ public class Proxy { } if (addr == null) { - LOG.log(Level.WARNING, "STANDALONE_LAST_MESSAGE_NO_TARGET_MSG"); + LOG.log(Level.WARNING, "STANDALONE_CLOSE_SEQUENCE_NO_TARGET_MSG"); return; } if (RMUtils.getAddressingConstants().getAnonymousURI().equals(addr)) { - LOG.log(Level.WARNING, "STANDALONE_LAST_MESSAGE_ANON_TARGET_MSG"); + LOG.log(Level.WARNING, "STANDALONE_CLOSE_SEQUENCE_ANON_TARGET_MSG"); return; } + RMConstants constants = reliableEndpoint.getEncoderDecoder().getConstants(); OperationInfo oi = reliableEndpoint.getEndpoint().getEndpointInfo().getService().getInterface() - .getOperation(RMConstants.getLastMessageOperationName()); + .getOperation(constants.getCloseSequenceOperationName()); // pass reference to source sequence in invocation context Map context = new HashMap( Collections.singletonMap(SourceSequence.class.getName(), @@ -195,7 +209,7 @@ public class Proxy { } void ackRequested(SourceSequence s) throws RMException { - org.apache.cxf.ws.addressing.EndpointReferenceType target = s.getTarget(); + EndpointReferenceType target = s.getTarget(); AttributedURIType uri = null; if (null != target) { uri = target.getAddress(); @@ -215,8 +229,9 @@ public class Proxy { return; } + RMConstants constants = reliableEndpoint.getEncoderDecoder().getConstants(); OperationInfo oi = reliableEndpoint.getEndpoint().getEndpointInfo().getService().getInterface() - .getOperation(RMConstants.getAckRequestedOperationName()); + .getOperation(constants.getAckRequestedOperationName()); invoke(oi, new Object[] {}, null); } @@ -244,19 +259,16 @@ public class Proxy { Conduit c = reliableEndpoint.getConduit(); Client client = null; if (params.length > 0 && params[0] instanceof DestinationSequence) { - EndpointReferenceType acksTo = - ((DestinationSequence)params[0]).getAcksTo(); + EndpointReferenceType acksTo = ((DestinationSequence)params[0]).getAcksTo(); String acksAddress = acksTo.getAddress().getValue(); - org.apache.cxf.ws.addressing.AttributedURIType attrURIType = - new org.apache.cxf.ws.addressing.AttributedURIType(); + AttributedURIType attrURIType = new AttributedURIType(); attrURIType.setValue(acksAddress); - org.apache.cxf.ws.addressing.EndpointReferenceType acks = - new org.apache.cxf.ws.addressing.EndpointReferenceType(); + EndpointReferenceType acks = new EndpointReferenceType(); acks.setAddress(attrURIType); client = createClient(bus, endpoint, c, acks); params = new Object[] {}; } else { - org.apache.cxf.ws.addressing.EndpointReferenceType replyTo = reliableEndpoint.getReplyTo(); + EndpointReferenceType replyTo = reliableEndpoint.getReplyTo(); client = createClient(bus, endpoint, c, replyTo); } @@ -278,13 +290,13 @@ public class Proxy { } protected Client createClient(Bus bus, Endpoint endpoint, Conduit conduit, - final org.apache.cxf.ws.addressing.EndpointReferenceType address) { + final EndpointReferenceType address) { ConduitSelector cs = new DeferredConduitSelector(conduit) { @Override public synchronized Conduit selectConduit(Message message) { Conduit conduit = null; EndpointInfo endpointInfo = getEndpoint().getEndpointInfo(); - org.apache.cxf.ws.addressing.EndpointReferenceType original = + EndpointReferenceType original = endpointInfo.getTarget(); try { if (null != address) { @@ -318,6 +330,4 @@ public class Proxy { void setReliableEndpoint(RMEndpoint rme) { reliableEndpoint = rme; } - - -} +} \ No newline at end of file Added: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RM10Constants.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RM10Constants.java?rev=1137112&view=auto ============================================================================== --- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RM10Constants.java (added) +++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RM10Constants.java Sat Jun 18 01:51:01 2011 @@ -0,0 +1,246 @@ +/** + * 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; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +import javax.xml.namespace.QName; + +/** + * Holder for names for WS-ReliableMessaging 1.0. + */ +public final class RM10Constants extends RMConstants { + + public static final RM10Constants INSTANCE = new RM10Constants(); + + // namespaces + public static final String NAMESPACE_URI = "http://schemas.xmlsoap.org/ws/2005/02/rm"; + + public static final String WSRMP_NAMESPACE_URI = "http://schemas.xmlsoap.org/ws/2005/02/rm/policy"; + + public static final String WSDL_NAMESPACE_URI = NAMESPACE_URI + "/wsdl"; + + // element and header names + + public static final QName SEQUENCE_QNAME = new QName(NAMESPACE_URI, SEQUENCE_NAME); + + public static final QName SEQUENCE_FAULT_QNAME = new QName(NAMESPACE_URI, SEQUENCE_FAULT_NAME); + + public static final QName SEQUENCE_ACK_QNAME = new QName(NAMESPACE_URI, SEQUENCE_ACK_NAME); + + public static final QName ACK_REQUESTED_QNAME = new QName(NAMESPACE_URI, ACK_REQUESTED_NAME); + + public static final QName WSRMP_RMASSERTION_QNAME = new QName(WSRMP_NAMESPACE_URI, RMASSERTION_NAME); + + // protocol operation names + + public static final QName PORT_NAME = + new QName(WSDL_NAMESPACE_URI, "SequenceAbstractSoapPort"); + + public static final QName CREATE_SEQUENCE_QNAME = new QName(NAMESPACE_URI, "CreateSequence"); + + public static final QName CREATE_SEQUENCE_RESPONSE_QNAME = + new QName(NAMESPACE_URI, "CreateSequenceResponse"); + + public static final QName TERMINATE_SEQUENCE_QNAME = + new QName(NAMESPACE_URI, "TerminateSequence"); + + public static final QName SEQUENCE_ACKNOWLEDGEMENT_QNAME = + new QName(NAMESPACE_URI, "SequenceAcknowledgement"); + + public static final QName CLOSE_SEQUENCE_QNAME = new QName(NAMESPACE_URI, "LastMessage"); + + public static final QName ACK_REQ_QNAME = new QName(NAMESPACE_URI, "AckRequested"); + + public static final QName CREATE_SEQUENCE_ONEWAY_QNAME = + new QName(NAMESPACE_URI, "CreateSequenceOneway"); + + public static final QName CREATE_SEQUENCE_RESPONSE_ONEWAY_QNAME = + new QName(NAMESPACE_URI, "CreateSequenceResponseOneway"); + + public static final QName RMASSERTION_QNAME = new QName(WSRMP_NAMESPACE_URI, RMASSERTION_NAME); + + // actions + + public static final String CREATE_SEQUENCE_ACTION = + NAMESPACE_URI + "/CreateSequence"; + + public static final String CREATE_SEQUENCE_RESPONSE_ACTION = + NAMESPACE_URI + "/CreateSequenceResponse"; + + public static final String TERMINATE_SEQUENCE_ACTION = + NAMESPACE_URI + "/TerminateSequence"; + + public static final String CLOSE_SEQUENCE_ACTION = + NAMESPACE_URI + "/LastMessage"; + + public static final String ACK_REQUESTED_ACTION = + NAMESPACE_URI + "/AckRequested"; + + public static final String SEQUENCE_ACKNOWLEDGMENT_ACTION = + NAMESPACE_URI + "/SequenceAcknowledgement"; + + public static final String SEQUENCE_INFO_ACTION = + NAMESPACE_URI + "/SequenceInfo"; + + public static final Set ACTIONS; + static { + Set actions = new HashSet(); + actions.add(CREATE_SEQUENCE_ACTION); + actions.add(CREATE_SEQUENCE_RESPONSE_ACTION); + actions.add(TERMINATE_SEQUENCE_ACTION); + actions.add(CLOSE_SEQUENCE_ACTION); + actions.add(ACK_REQUESTED_ACTION); + actions.add(SEQUENCE_ACKNOWLEDGMENT_ACTION); + actions.add(SEQUENCE_INFO_ACTION); + ACTIONS = actions; + } + + // fault codes + + public static final QName UNKNOWN_SEQUENCE_FAULT_QNAME = + new QName(NAMESPACE_URI, UNKNOWN_SEQUENCE_FAULT_CODE); + + public static final QName SEQUENCE_TERMINATED_FAULT_QNAME = + new QName(NAMESPACE_URI, SEQUENCE_TERMINATED_FAULT_CODE); + + public static final QName INVALID_ACKNOWLEDGMENT_FAULT_QNAME = + new QName(NAMESPACE_URI, INVALID_ACKNOWLEDGMENT_FAULT_CODE); + + public static final QName MESSAGE_NUMBER_ROLLOVER_FAULT_QNAME = + new QName(NAMESPACE_URI, MESSAGE_NUMBER_ROLLOVER_FAULT_CODE); + + public static final QName CREATE_SEQUENCE_REFUSED_FAULT_QNAME = + new QName(NAMESPACE_URI, CREATE_SEQUENCE_REFUSED_FAULT_CODE); + + // headers + + public static final Set HEADERS; + static { + Set headers = new HashSet(); + headers.add(new QName(NAMESPACE_URI, SEQUENCE_NAME)); + headers.add(new QName(NAMESPACE_URI, SEQUENCE_ACK_NAME)); + headers.add(new QName(NAMESPACE_URI, ACK_REQUESTED_NAME)); + HEADERS = Collections.unmodifiableSet(headers); + } + + private RM10Constants() { + } + + // actions access methods + + public String getCreateSequenceAction() { + return CREATE_SEQUENCE_ACTION; + } + + public String getCreateSequenceResponseAction() { + return CREATE_SEQUENCE_RESPONSE_ACTION; + } + + public String getTerminateSequenceAction() { + return TERMINATE_SEQUENCE_ACTION; + } + + public String getCloseSequenceAction() { + return CLOSE_SEQUENCE_ACTION; + } + + public String getAckRequestedAction() { + return ACK_REQUESTED_ACTION; + } + + public String getSequenceAckAction() { + return SEQUENCE_ACKNOWLEDGMENT_ACTION; + } + + public String getSequenceInfoAction() { + return SEQUENCE_INFO_ACTION; + } + + // service model constants access methods + + public QName getPortName() { + return PORT_NAME; + } + + public QName getCreateSequenceOperationName() { + return CREATE_SEQUENCE_QNAME; + } + + public QName getCreateSequenceResponseOperationName() { + return CREATE_SEQUENCE_RESPONSE_QNAME; + } + + public QName getCreateSequenceOnewayOperationName() { + return CREATE_SEQUENCE_ONEWAY_QNAME; + } + + public QName getCreateSequenceResponseOnewayOperationName() { + return CREATE_SEQUENCE_RESPONSE_ONEWAY_QNAME; + } + + public QName getTerminateSequenceOperationName() { + return TERMINATE_SEQUENCE_QNAME; + } + + public QName getSequenceAckOperationName() { + return SEQUENCE_ACKNOWLEDGEMENT_QNAME; + } + + public QName getCloseSequenceOperationName() { + return CLOSE_SEQUENCE_QNAME; + } + + public QName getAckRequestedOperationName() { + return ACK_REQ_QNAME; + } + + // fault codes access methods + + public QName getUnknownSequenceFaultCode() { + return UNKNOWN_SEQUENCE_FAULT_QNAME; + } + + public QName getSequenceTerminatedFaultCode() { + return SEQUENCE_TERMINATED_FAULT_QNAME; + } + + public QName getInvalidAcknowledgmentFaultCode() { + return INVALID_ACKNOWLEDGMENT_FAULT_QNAME; + } + + public QName getMessageNumberRolloverFaultCode() { + return MESSAGE_NUMBER_ROLLOVER_FAULT_QNAME; + } + + public QName getCreateSequenceRefusedFaultCode() { + return CREATE_SEQUENCE_REFUSED_FAULT_QNAME; + } + + public QName getSequenceClosedFaultCode() { + return null; + } + + public QName getWSRMRequiredFaultCode() { + return null; + } +} \ No newline at end of file