Author: richard.opalka(a)jboss.com
Date: 2008-01-29 14:46:13 -0500 (Tue, 29 Jan 2008)
New Revision: 5547
Added:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/policy/RM10PolicyAssertionDeployer.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/policy/RM11PolicyAssertionDeployer.java
Removed:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/policy/RMPolicyAssertionDeployer.java
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/policy/deployer/PolicyDeployer.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMClientSequence.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/common/RMHelper.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/config/RMConfig.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandlerAbstractBase.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/server/RMInvocationHandler.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/server/RMServerSequence.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/spec200502/RMProviderImpl.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/spec200702/RMProviderImpl.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/spi/RMProvider.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/deserialization/RMDeSerializationTestCase.java
Log:
[JBWS-1975] added support for wsrm10
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/policy/deployer/PolicyDeployer.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/policy/deployer/PolicyDeployer.java 2008-01-28
16:30:24 UTC (rev 5546)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/policy/deployer/PolicyDeployer.java 2008-01-29
19:46:13 UTC (rev 5547)
@@ -39,7 +39,8 @@
import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedAlternative;
import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedAssertion;
import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedPolicy;
-import org.jboss.ws.extensions.wsrm.policy.RMPolicyAssertionDeployer;
+import org.jboss.ws.extensions.wsrm.policy.RM10PolicyAssertionDeployer;
+import org.jboss.ws.extensions.wsrm.policy.RM11PolicyAssertionDeployer;
import org.jboss.ws.metadata.umdm.ExtensibleMetaData;
/**
@@ -57,7 +58,8 @@
{
me = new PolicyDeployer();
me.domainDeployerMap.put("http://www.jboss.com/ws-security/schema/jb...;,
WSSecurityAssertionDeployer.class);
-
me.domainDeployerMap.put("http://docs.oasis-open.org/ws-rx/wsrmp/200...;,
RMPolicyAssertionDeployer.class);
+
me.domainDeployerMap.put("http://docs.oasis-open.org/ws-rx/wsrmp/200...;,
RM11PolicyAssertionDeployer.class);
+
me.domainDeployerMap.put("http://schemas.xmlsoap.org/ws/2005/02/rm/p...;,
RM10PolicyAssertionDeployer.class);
}
//hide constructor
@@ -85,6 +87,7 @@
PolicyDeployer instance = new PolicyDeployer();
instance.domainDeployerMap.put("http://www.jboss.com/ws-security/sch...;,
NopAssertionDeployer.class);
instance.domainDeployerMap.put("http://docs.oasis-open.org/ws-rx/wsr...;,
NopAssertionDeployer.class);
+
instance.domainDeployerMap.put("http://schemas.xmlsoap.org/ws/2005/0...;,
NopAssertionDeployer.class);
return instance;
}
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMClientSequence.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMClientSequence.java 2008-01-28
16:30:24 UTC (rev 5546)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMClientSequence.java 2008-01-29
19:46:13 UTC (rev 5547)
@@ -266,17 +266,20 @@
public final void sendCloseMessage()
{
- while (this.isAckRequested())
+ if (RMProvider.get().getMessageFactory().newCloseSequence() != null) // e.g. WS-RM
1.0 doesn't support this protocol message
{
- logger.debug("Waiting till all inbound sequence acknowledgements will be
sent");
- sendSequenceAcknowledgementMessage();
+ while (this.isAckRequested())
+ {
+ logger.debug("Waiting till all inbound sequence acknowledgements will be
sent");
+ sendSequenceAcknowledgementMessage();
+ }
+ Map<String, Object> wsrmReqCtx = new HashMap<String, Object>();
+ wsrmReqCtx.put(RMConstant.ONE_WAY_OPERATION, false);
+ this.getBindingProvider().getRequestContext().put(RMConstant.REQUEST_CONTEXT,
wsrmReqCtx);
+ List msgs = new LinkedList();
+ msgs.add(wsrmConstants.getCloseSequenceQName());
+ sendMessage(RMAddressingConstants.CLOSE_SEQUENCE_WSA_ACTION,
wsrmConstants.getCloseSequenceQName(), msgs);
}
- Map<String, Object> wsrmReqCtx = new HashMap<String, Object>();
- wsrmReqCtx.put(RMConstant.ONE_WAY_OPERATION, false);
- this.getBindingProvider().getRequestContext().put(RMConstant.REQUEST_CONTEXT,
wsrmReqCtx);
- List msgs = new LinkedList();
- msgs.add(wsrmConstants.getCloseSequenceQName());
- sendMessage(RMAddressingConstants.CLOSE_SEQUENCE_WSA_ACTION,
wsrmConstants.getCloseSequenceQName(), msgs);
}
public final void sendTerminateMessage()
@@ -287,6 +290,10 @@
{
msgs.add(wsrmConstants.getSequenceAcknowledgementQName());
}
+ Map<String, Object> wsrmReqCtx = new HashMap<String, Object>();
+ boolean oneWayOperation =
RMProvider.get().getMessageFactory().newTerminateSequenceResponse() == null;
+ wsrmReqCtx.put(RMConstant.ONE_WAY_OPERATION, oneWayOperation);
+ this.getBindingProvider().getRequestContext().put(RMConstant.REQUEST_CONTEXT,
wsrmReqCtx);
sendMessage(RMAddressingConstants.TERMINATE_SEQUENCE_WSA_ACTION,
wsrmConstants.getTerminateSequenceQName(), msgs);
}
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/common/RMHelper.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/common/RMHelper.java 2008-01-28
16:30:24 UTC (rev 5546)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/common/RMHelper.java 2008-01-29
19:46:13 UTC (rev 5547)
@@ -239,26 +239,33 @@
// register operation metadata with endpoint metadata
endpointMD.addOperation(sequenceAcknowledgementMD);
- // register closeSequence method
- QName closeSequenceQName = rmProvider.getConstants().getCloseSequenceQName();
- OperationMetaData closeSequenceMD = new OperationMetaData(endpointMD,
closeSequenceQName, "closeSequence");
- closeSequenceMD.setOneWay(false);
- // setup addressing related data
- AddressingOpMetaExt closeSequenceAddrExt = new AddressingOpMetaExt(new
AddressingPropertiesImpl().getNamespaceURI());
-
closeSequenceAddrExt.setInboundAction(RMAddressingConstants.CLOSE_SEQUENCE_WSA_ACTION);
-
closeSequenceAddrExt.setOutboundAction(RMAddressingConstants.CLOSE_SEQUENCE_RESPONSE_WSA_ACTION);
- closeSequenceMD.addExtension(closeSequenceAddrExt);
- // register operation metadata with endpoint metadata
- endpointMD.addOperation(closeSequenceMD);
+ if (rmProvider.getMessageFactory().newCloseSequence() != null)
+ {
+ // register closeSequence method
+ QName closeSequenceQName = rmProvider.getConstants().getCloseSequenceQName();
+ OperationMetaData closeSequenceMD = new OperationMetaData(endpointMD,
closeSequenceQName, "closeSequence");
+ closeSequenceMD.setOneWay(false);
+ // setup addressing related data
+ AddressingOpMetaExt closeSequenceAddrExt = new AddressingOpMetaExt(new
AddressingPropertiesImpl().getNamespaceURI());
+
closeSequenceAddrExt.setInboundAction(RMAddressingConstants.CLOSE_SEQUENCE_WSA_ACTION);
+
closeSequenceAddrExt.setOutboundAction(RMAddressingConstants.CLOSE_SEQUENCE_RESPONSE_WSA_ACTION);
+ closeSequenceMD.addExtension(closeSequenceAddrExt);
+ // register operation metadata with endpoint metadata
+ endpointMD.addOperation(closeSequenceMD);
+ }
// register terminateSequence method
QName terminateSequenceQName =
rmProvider.getConstants().getTerminateSequenceQName();
OperationMetaData terminateSequenceMD = new OperationMetaData(endpointMD,
terminateSequenceQName, "terminateSequence");
- terminateSequenceMD.setOneWay(false);
+ boolean isOneWay = rmProvider.getMessageFactory().newTerminateSequenceResponse() ==
null;
+ terminateSequenceMD.setOneWay(isOneWay);
// setup addressing related data
AddressingOpMetaExt terminateSequenceAddrExt = new AddressingOpMetaExt(new
AddressingPropertiesImpl().getNamespaceURI());
terminateSequenceAddrExt.setInboundAction(RMAddressingConstants.TERMINATE_SEQUENCE_WSA_ACTION);
-
terminateSequenceAddrExt.setOutboundAction(RMAddressingConstants.TERMINATE_SEQUENCE_RESPONSE_WSA_ACTION);
+ if (!isOneWay)
+ {
+
terminateSequenceAddrExt.setOutboundAction(RMAddressingConstants.TERMINATE_SEQUENCE_RESPONSE_WSA_ACTION);
+ }
terminateSequenceMD.addExtension(terminateSequenceAddrExt);
// register operation metadata with endpoint metadata
endpointMD.addOperation(terminateSequenceMD);
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/config/RMConfig.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/config/RMConfig.java 2008-01-28
16:30:24 UTC (rev 5546)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/config/RMConfig.java 2008-01-29
19:46:13 UTC (rev 5547)
@@ -24,6 +24,8 @@
import java.util.List;
import java.util.LinkedList;
+import org.jboss.ws.extensions.wsrm.spi.RMProvider;
+
/**
* Reliable messaging configuration metadata
*
@@ -70,7 +72,14 @@
public final void setProvider(RMProviderConfig provider)
{
- this.provider = provider;
+ if (provider.getSpecVersion().equals(RMProvider.get().getNamespaceURI()))
+ {
+ this.provider = provider;
+ }
+ else
+ {
+ throw new IllegalArgumentException("RM provider namespace mismatch");
+ }
}
public final RMProviderConfig getProvider()
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandlerAbstractBase.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandlerAbstractBase.java 2008-01-28
16:30:24 UTC (rev 5546)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandlerAbstractBase.java 2008-01-29
19:46:13 UTC (rev 5547)
@@ -67,10 +67,13 @@
try
{
RMSerializable wsrmMsg = RMHandlerHelper.getMessage(msgQN);
- wsrmMsg.deserializeFrom(soapMessage);
- messages.add(msgQN);
- data.put(msgQN, wsrmMsg);
- log.debug(msgQN.getLocalPart() + " WSRM message was deserialized from
payload");
+ if (wsrmMsg != null)
+ {
+ wsrmMsg.deserializeFrom(soapMessage);
+ messages.add(msgQN);
+ data.put(msgQN, wsrmMsg);
+ log.debug(msgQN.getLocalPart() + " WSRM message was deserialized from
payload");
+ }
}
catch (RMException ignore) {}
}
Added:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/policy/RM10PolicyAssertionDeployer.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/policy/RM10PolicyAssertionDeployer.java
(rev 0)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/policy/RM10PolicyAssertionDeployer.java 2008-01-29
19:46:13 UTC (rev 5547)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.extensions.wsrm.policy;
+
+import org.apache.ws.policy.PrimitiveAssertion;
+import org.jboss.ws.extensions.policy.deployer.domainAssertion.AssertionDeployer;
+import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedAssertion;
+import org.jboss.ws.extensions.wsrm.config.RMConfig;
+import org.jboss.ws.extensions.wsrm.config.RMDeliveryAssuranceConfig;
+import org.jboss.ws.extensions.wsrm.config.RMPortConfig;
+import org.jboss.ws.extensions.wsrm.config.RMProviderConfig;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.ExtensibleMetaData;
+
+/**
+ * TODO: Add comment
+ *
+ * @author richard.opalka(a)jboss.com
+ *
+ * @since Jan 29, 2008
+ */
+public final class RM10PolicyAssertionDeployer implements AssertionDeployer
+{
+ private static final String WSRM_NS =
"http://schemas.xmlsoap.org/ws/2005/02/rm";
+
+ /*
+ * @see
org.jboss.ws.extensions.policy.deployer.domainAssertion.AssertionDeployer#deployClientSide(org.apache.ws.policy.PrimitiveAssertion,
org.jboss.ws.metadata.umdm.ExtensibleMetaData)
+ */
+ public void deployClientSide(PrimitiveAssertion assertion, ExtensibleMetaData
extMetaData)
+ throws UnsupportedAssertion
+ {
+ deploy(assertion, extMetaData);
+ }
+
+ /*
+ * @see
org.jboss.ws.extensions.policy.deployer.domainAssertion.AssertionDeployer#deployServerSide(org.apache.ws.policy.PrimitiveAssertion,
org.jboss.ws.metadata.umdm.ExtensibleMetaData)
+ */
+ public void deployServerSide(PrimitiveAssertion assertion, ExtensibleMetaData
extMetaData)
+ throws UnsupportedAssertion
+ {
+ deploy(assertion, extMetaData);
+ }
+
+ private static void deploy(PrimitiveAssertion assertion, ExtensibleMetaData
extMetaData)
+ throws UnsupportedAssertion
+ {
+ if (extMetaData instanceof EndpointMetaData)
+ {
+ EndpointMetaData endpointMD = (EndpointMetaData) extMetaData;
+
+ // prepare wsrm metadata
+ RMConfig rmMD = endpointMD.getConfig().getRMMetaData();
+ if (rmMD == null)
+ {
+ rmMD = new RMConfig();
+ endpointMD.getConfig().setRMMetaData(rmMD);
+ }
+
+ // construct new port metadata
+ RMPortConfig portMD = new RMPortConfig();
+ portMD.setPortName(endpointMD.getPortName());
+ RMDeliveryAssuranceConfig deliveryMD = new RMDeliveryAssuranceConfig();
+ deliveryMD.setInOrder("false");
+ deliveryMD.setQuality("AtMostOnce");
+ portMD.setDeliveryAssurance(deliveryMD);
+
+ // ensure port does not exists yet
+ for (RMPortConfig pMD : rmMD.getPorts())
+ {
+ assert ! pMD.getPortName().equals(portMD.getPortName());
+ }
+
+ // set up port WSRMP metadata
+ rmMD.getPorts().add(portMD);
+ RMProviderConfig providerMD = new RMProviderConfig();
+ providerMD.setSpecVersion(WSRM_NS);
+ rmMD.setProvider(providerMD);
+ }
+ }
+
+}
Property changes on:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/policy/RM10PolicyAssertionDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/policy/RM11PolicyAssertionDeployer.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/policy/RM11PolicyAssertionDeployer.java
(rev 0)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/policy/RM11PolicyAssertionDeployer.java 2008-01-29
19:46:13 UTC (rev 5547)
@@ -0,0 +1,180 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.extensions.wsrm.policy;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.ws.policy.AndCompositeAssertion;
+import org.apache.ws.policy.Policy;
+import org.apache.ws.policy.PrimitiveAssertion;
+import org.apache.ws.policy.XorCompositeAssertion;
+import org.jboss.ws.extensions.policy.deployer.domainAssertion.AssertionDeployer;
+import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedAssertion;
+import org.jboss.ws.extensions.wsrm.config.RMDeliveryAssuranceConfig;
+import org.jboss.ws.extensions.wsrm.config.RMConfig;
+import org.jboss.ws.extensions.wsrm.config.RMPortConfig;
+import org.jboss.ws.extensions.wsrm.config.RMProviderConfig;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.ExtensibleMetaData;
+
+/**
+ * Reliable messaging policy deployer
+ *
+ * @author richard.opalka(a)jboss.com
+ */
+public final class RM11PolicyAssertionDeployer implements AssertionDeployer
+{
+
+ private static final String WSRMP_NS =
"http://docs.oasis-open.org/ws-rx/wsrmp/200702";
+ private static final String WSRM_NS =
"http://docs.oasis-open.org/ws-rx/wsrm/200702";
+ private static final QName EXACTLY_ONCE = new QName(WSRMP_NS,
"ExactlyOnce");
+ private static final QName AT_LEAST_ONCE = new QName(WSRMP_NS,
"AtLeastOnce");
+ private static final QName AT_MOST_ONCE = new QName(WSRMP_NS,
"AtMostOnce");
+ private static final QName IN_ORDER = new QName(WSRMP_NS, "InOrder");
+ private static final String FALSE = "false";
+ private static final String TRUE = "true";
+
+ /*
+ * @see
org.jboss.ws.extensions.policy.deployer.domainAssertion.AssertionDeployer#deployClientSide(org.apache.ws.policy.PrimitiveAssertion,
org.jboss.ws.metadata.umdm.ExtensibleMetaData)
+ */
+ public void deployClientSide(PrimitiveAssertion assertion, ExtensibleMetaData
extMetaData)
+ throws UnsupportedAssertion
+ {
+ deploy(assertion, extMetaData);
+ }
+
+ /*
+ * @see
org.jboss.ws.extensions.policy.deployer.domainAssertion.AssertionDeployer#deployServerSide(org.apache.ws.policy.PrimitiveAssertion,
org.jboss.ws.metadata.umdm.ExtensibleMetaData)
+ */
+ public void deployServerSide(PrimitiveAssertion assertion, ExtensibleMetaData
extMetaData)
+ throws UnsupportedAssertion
+ {
+ deploy(assertion, extMetaData);
+ }
+
+ private static void deploy(PrimitiveAssertion assertion, ExtensibleMetaData
extMetaData)
+ throws UnsupportedAssertion
+ {
+ if (extMetaData instanceof EndpointMetaData)
+ {
+ EndpointMetaData endpointMD = (EndpointMetaData) extMetaData;
+
+ // prepare wsrm metadata
+ RMConfig rmMD = endpointMD.getConfig().getRMMetaData();
+ if (rmMD == null)
+ {
+ rmMD = new RMConfig();
+ endpointMD.getConfig().setRMMetaData(rmMD);
+ }
+
+ // construct new port metadata
+ RMPortConfig portMD = new RMPortConfig();
+ portMD.setPortName(endpointMD.getPortName());
+ List<PrimitiveAssertion> wsrmpAssertions = getWSRMPAssertions(assertion);
+ portMD.setDeliveryAssurance(constructDeliveryAssurance(wsrmpAssertions));
+
+ // ensure port does not exists yet
+ for (RMPortConfig pMD : rmMD.getPorts())
+ {
+ assert ! pMD.getPortName().equals(portMD.getPortName());
+ }
+
+ // set up port WSRMP metadata
+ rmMD.getPorts().add(portMD);
+ RMProviderConfig providerMD = new RMProviderConfig();
+ providerMD.setSpecVersion(WSRM_NS);
+ rmMD.setProvider(providerMD);
+ }
+ }
+
+ private static RMDeliveryAssuranceConfig
constructDeliveryAssurance(List<PrimitiveAssertion> assertions)
+ throws UnsupportedAssertion
+ {
+ if (assertions.size() == 1)
+ {
+ QName assertionQN = assertions.get(0).getName();
+ assertIsWSRMPAssertion(assertionQN);
+
+ RMDeliveryAssuranceConfig deliveryMD = new RMDeliveryAssuranceConfig();
+ deliveryMD.setInOrder(FALSE);
+ deliveryMD.setQuality(assertionQN.getLocalPart());
+ return deliveryMD;
+ }
+ if (assertions.size() == 2)
+ {
+ QName firstAssertionQN = assertions.get(0).getName();
+ assertIsWSRMPAssertion(firstAssertionQN);
+ QName secondAssertionQN = assertions.get(1).getName();
+ assertIsWSRMPAssertion(secondAssertionQN);
+
+ boolean firstIsInOrder = firstAssertionQN.equals(IN_ORDER);
+
+ RMDeliveryAssuranceConfig deliveryMD = new RMDeliveryAssuranceConfig();
+ deliveryMD.setInOrder(TRUE);
+ if (firstIsInOrder)
+ {
+ deliveryMD.setQuality(secondAssertionQN.getLocalPart());
+ }
+ else
+ {
+ deliveryMD.setQuality(firstAssertionQN.getLocalPart());
+ }
+
+ return deliveryMD;
+ }
+
+ throw new IllegalArgumentException();
+ }
+
+ private static void assertIsWSRMPAssertion(QName assertionQN) throws
UnsupportedAssertion
+ {
+ if (assertionQN.equals(EXACTLY_ONCE)
+ || assertionQN.equals(AT_LEAST_ONCE)
+ || assertionQN.equals(AT_MOST_ONCE)
+ || assertionQN.equals(IN_ORDER))
+ {
+ return; // recognized assertion - silently return
+ }
+
+ throw new UnsupportedAssertion();
+ }
+
+ private static List<PrimitiveAssertion> getWSRMPAssertions(PrimitiveAssertion
assertion)
+ {
+ Policy policy = (Policy)assertion.getTerms().get(0);
+ XorCompositeAssertion xor = (XorCompositeAssertion)policy.getTerms().get(0);
+ AndCompositeAssertion and = (AndCompositeAssertion)xor.getTerms().get(0);
+ List<?> primitiveAssertions = and.getTerms();
+
+ List<PrimitiveAssertion> retVal = new
LinkedList<PrimitiveAssertion>();
+ for (int i = 0; i < primitiveAssertions.size(); i++)
+ {
+ retVal.add((PrimitiveAssertion)primitiveAssertions.get(i));
+ }
+
+ return retVal;
+ }
+
+}
Property changes on:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/policy/RM11PolicyAssertionDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/policy/RMPolicyAssertionDeployer.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/policy/RMPolicyAssertionDeployer.java 2008-01-28
16:30:24 UTC (rev 5546)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/policy/RMPolicyAssertionDeployer.java 2008-01-29
19:46:13 UTC (rev 5547)
@@ -1,180 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.extensions.wsrm.policy;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.ws.policy.AndCompositeAssertion;
-import org.apache.ws.policy.Policy;
-import org.apache.ws.policy.PrimitiveAssertion;
-import org.apache.ws.policy.XorCompositeAssertion;
-import org.jboss.ws.extensions.policy.deployer.domainAssertion.AssertionDeployer;
-import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedAssertion;
-import org.jboss.ws.extensions.wsrm.config.RMDeliveryAssuranceConfig;
-import org.jboss.ws.extensions.wsrm.config.RMConfig;
-import org.jboss.ws.extensions.wsrm.config.RMPortConfig;
-import org.jboss.ws.extensions.wsrm.config.RMProviderConfig;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.ExtensibleMetaData;
-
-/**
- * Reliable messaging policy deployer
- *
- * @author richard.opalka(a)jboss.com
- */
-public final class RMPolicyAssertionDeployer implements AssertionDeployer
-{
-
- private static final String WSRMP_NS =
"http://docs.oasis-open.org/ws-rx/wsrmp/200702";
- private static final String WSRM_NS =
"http://docs.oasis-open.org/ws-rx/wsrm/200702";
- private static final QName EXACTLY_ONCE = new QName(WSRMP_NS,
"ExactlyOnce");
- private static final QName AT_LEAST_ONCE = new QName(WSRMP_NS,
"AtLeastOnce");
- private static final QName AT_MOST_ONCE = new QName(WSRMP_NS,
"AtMostOnce");
- private static final QName IN_ORDER = new QName(WSRMP_NS, "InOrder");
- private static final String FALSE = "false";
- private static final String TRUE = "true";
-
- /*
- * @see
org.jboss.ws.extensions.policy.deployer.domainAssertion.AssertionDeployer#deployClientSide(org.apache.ws.policy.PrimitiveAssertion,
org.jboss.ws.metadata.umdm.ExtensibleMetaData)
- */
- public void deployClientSide(PrimitiveAssertion assertion, ExtensibleMetaData
extMetaData)
- throws UnsupportedAssertion
- {
- deploy(assertion, extMetaData);
- }
-
- /*
- * @see
org.jboss.ws.extensions.policy.deployer.domainAssertion.AssertionDeployer#deployServerSide(org.apache.ws.policy.PrimitiveAssertion,
org.jboss.ws.metadata.umdm.ExtensibleMetaData)
- */
- public void deployServerSide(PrimitiveAssertion assertion, ExtensibleMetaData
extMetaData)
- throws UnsupportedAssertion
- {
- deploy(assertion, extMetaData);
- }
-
- private static void deploy(PrimitiveAssertion assertion, ExtensibleMetaData
extMetaData)
- throws UnsupportedAssertion
- {
- if (extMetaData instanceof EndpointMetaData)
- {
- EndpointMetaData endpointMD = (EndpointMetaData) extMetaData;
-
- // prepare wsrm metadata
- RMConfig rmMD = endpointMD.getConfig().getRMMetaData();
- if (rmMD == null)
- {
- rmMD = new RMConfig();
- endpointMD.getConfig().setRMMetaData(rmMD);
- }
-
- // construct new port metadata
- RMPortConfig portMD = new RMPortConfig();
- portMD.setPortName(endpointMD.getPortName());
- List<PrimitiveAssertion> wsrmpAssertions = getWSRMPAssertions(assertion);
- portMD.setDeliveryAssurance(constructDeliveryAssurance(wsrmpAssertions));
-
- // ensure port does not exists yet
- for (RMPortConfig pMD : rmMD.getPorts())
- {
- assert ! pMD.getPortName().equals(portMD.getPortName());
- }
-
- // set up port WSRMP metadata
- rmMD.getPorts().add(portMD);
- RMProviderConfig providerMD = new RMProviderConfig();
- providerMD.setSpecVersion(WSRM_NS);
- rmMD.setProvider(providerMD);
- }
- }
-
- private static RMDeliveryAssuranceConfig
constructDeliveryAssurance(List<PrimitiveAssertion> assertions)
- throws UnsupportedAssertion
- {
- if (assertions.size() == 1)
- {
- QName assertionQN = assertions.get(0).getName();
- assertIsWSRMPAssertion(assertionQN);
-
- RMDeliveryAssuranceConfig deliveryMD = new RMDeliveryAssuranceConfig();
- deliveryMD.setInOrder(FALSE);
- deliveryMD.setQuality(assertionQN.getLocalPart());
- return deliveryMD;
- }
- if (assertions.size() == 2)
- {
- QName firstAssertionQN = assertions.get(0).getName();
- assertIsWSRMPAssertion(firstAssertionQN);
- QName secondAssertionQN = assertions.get(1).getName();
- assertIsWSRMPAssertion(secondAssertionQN);
-
- boolean firstIsInOrder = firstAssertionQN.equals(IN_ORDER);
-
- RMDeliveryAssuranceConfig deliveryMD = new RMDeliveryAssuranceConfig();
- deliveryMD.setInOrder(TRUE);
- if (firstIsInOrder)
- {
- deliveryMD.setQuality(secondAssertionQN.getLocalPart());
- }
- else
- {
- deliveryMD.setQuality(firstAssertionQN.getLocalPart());
- }
-
- return deliveryMD;
- }
-
- throw new IllegalArgumentException();
- }
-
- private static void assertIsWSRMPAssertion(QName assertionQN) throws
UnsupportedAssertion
- {
- if (assertionQN.equals(EXACTLY_ONCE)
- || assertionQN.equals(AT_LEAST_ONCE)
- || assertionQN.equals(AT_MOST_ONCE)
- || assertionQN.equals(IN_ORDER))
- {
- return; // recognized assertion - silently return
- }
-
- throw new UnsupportedAssertion();
- }
-
- private static List<PrimitiveAssertion> getWSRMPAssertions(PrimitiveAssertion
assertion)
- {
- Policy policy = (Policy)assertion.getTerms().get(0);
- XorCompositeAssertion xor = (XorCompositeAssertion)policy.getTerms().get(0);
- AndCompositeAssertion and = (AndCompositeAssertion)xor.getTerms().get(0);
- List<?> primitiveAssertions = and.getTerms();
-
- List<PrimitiveAssertion> retVal = new
LinkedList<PrimitiveAssertion>();
- for (int i = 0; i < primitiveAssertions.size(); i++)
- {
- retVal.add((PrimitiveAssertion)primitiveAssertions.get(i));
- }
-
- return retVal;
- }
-
-}
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/server/RMInvocationHandler.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/server/RMInvocationHandler.java 2008-01-28
16:30:24 UTC (rev 5546)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/server/RMInvocationHandler.java 2008-01-29
19:46:13 UTC (rev 5547)
@@ -114,7 +114,7 @@
rmResponseContext.put(RMConstant.PROTOCOL_MESSAGES, protocolMessages);
msgContext.remove(RMConstant.RESPONSE_CONTEXT);
RMServerSequence sequence = null;
- boolean isSequenceAcknowledgementOnly = true;
+ boolean isOneWayOperation = true;
if (RMHelper.isCreateSequence(rmReqProps))
{
@@ -122,7 +122,7 @@
sequences.add(sequence);
protocolMessages.add(rmConstants.getCreateSequenceResponseQName());
rmResponseContext.put(RMConstant.SEQUENCE_REFERENCE, sequence);
- isSequenceAcknowledgementOnly = false;
+ isOneWayOperation = false;
}
if (RMHelper.isCloseSequence(rmReqProps))
@@ -140,7 +140,7 @@
protocolMessages.add(rmConstants.getCloseSequenceResponseQName());
protocolMessages.add(rmConstants.getSequenceAcknowledgementQName());
rmResponseContext.put(RMConstant.SEQUENCE_REFERENCE, sequence);
- isSequenceAcknowledgementOnly = false;
+ isOneWayOperation = false;
}
if (RMHelper.isSequenceAcknowledgement(rmReqProps))
@@ -175,10 +175,17 @@
}
sequences.remove(sequence);
- protocolMessages.add(rmConstants.getTerminateSequenceResponseQName());
- protocolMessages.add(rmConstants.getSequenceAcknowledgementQName());
- rmResponseContext.put(RMConstant.SEQUENCE_REFERENCE, sequence);
- isSequenceAcknowledgementOnly = false;
+ if (RMProvider.get().getMessageFactory().newTerminateSequenceResponse() !=
null)
+ {
+ protocolMessages.add(rmConstants.getTerminateSequenceResponseQName());
+ protocolMessages.add(rmConstants.getSequenceAcknowledgementQName());
+ rmResponseContext.put(RMConstant.SEQUENCE_REFERENCE, sequence);
+ isOneWayOperation = false;
+ }
+ else
+ {
+ return null; // no WS-RM context propagated
+ }
}
if (RMHelper.isSequence(rmReqProps))
@@ -217,10 +224,10 @@
}
rmResponseContext.put(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND,
addressingProps);
}
- isSequenceAcknowledgementOnly = false;
+ isOneWayOperation = false;
}
- rmResponseContext.put(RMConstant.ONE_WAY_OPERATION,
isSequenceAcknowledgementOnly);
+ rmResponseContext.put(RMConstant.ONE_WAY_OPERATION, isOneWayOperation);
return rmResponseContext;
}
@@ -245,9 +252,12 @@
private void setupResponseContext(Map<String, Object> rmResponseContext)
{
- CommonMessageContext msgCtx = MessageContextAssociation.peekMessageContext();
- msgCtx.put(RMConstant.RESPONSE_CONTEXT, rmResponseContext);
- msgCtx.put(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND,
rmResponseContext.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND));
+ if (rmResponseContext != null)
+ {
+ CommonMessageContext msgCtx = MessageContextAssociation.peekMessageContext();
+ msgCtx.put(RMConstant.RESPONSE_CONTEXT, rmResponseContext);
+ msgCtx.put(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND,
rmResponseContext.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND));
+ }
}
public final InvocationHandler getDelegate()
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/server/RMServerSequence.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/server/RMServerSequence.java 2008-01-28
16:30:24 UTC (rev 5546)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/server/RMServerSequence.java 2008-01-29
19:46:13 UTC (rev 5547)
@@ -114,5 +114,10 @@
{
this.closed = true;
}
+
+ public String toString()
+ {
+ return this.inboundId + " - " + this.outboundId;
+ }
}
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/spec200502/RMProviderImpl.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/spec200502/RMProviderImpl.java 2008-01-28
16:30:24 UTC (rev 5546)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/spec200502/RMProviderImpl.java 2008-01-29
19:46:13 UTC (rev 5547)
@@ -33,11 +33,11 @@
public final class RMProviderImpl extends RMProvider
{
- private static final String IMPLEMENTATION_VERSION =
"http://schemas.xmlsoap.org/ws/2005/02/rm";
+ public static final String IMPLEMENTATION_VERSION =
"http://schemas.xmlsoap.org/ws/2005/02/rm";
private static final RMConstants CONSTANTS = new RMConstantsImpl("wsrm10",
IMPLEMENTATION_VERSION);
private static final RMProvider INSTANCE = new RMProviderImpl();
- private RMProviderImpl()
+ public RMProviderImpl()
{
// forbidden inheritance
}
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/spec200702/RMProviderImpl.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/spec200702/RMProviderImpl.java 2008-01-28
16:30:24 UTC (rev 5546)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/spec200702/RMProviderImpl.java 2008-01-29
19:46:13 UTC (rev 5547)
@@ -33,11 +33,11 @@
public final class RMProviderImpl extends RMProvider
{
- private static final String IMPLEMENTATION_VERSION =
"http://docs.oasis-open.org/ws-rx/wsrm/200702";
+ public static final String IMPLEMENTATION_VERSION =
"http://docs.oasis-open.org/ws-rx/wsrm/200702";
private static final RMConstants CONSTANTS = new
RMConstantsImpl("wsrm11",IMPLEMENTATION_VERSION);
private static final RMProvider INSTANCE = new RMProviderImpl();
- private RMProviderImpl()
+ public RMProviderImpl()
{
// forbidden inheritance
}
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/spi/RMProvider.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/spi/RMProvider.java 2008-01-28
16:30:24 UTC (rev 5546)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/spi/RMProvider.java 2008-01-29
19:46:13 UTC (rev 5547)
@@ -21,8 +21,7 @@
*/
package org.jboss.ws.extensions.wsrm.spi;
-import java.util.Map;
-import java.util.HashMap;
+import org.jboss.wsf.spi.util.ServiceLoader;
/**
* WS-RM Provider SPI facade. Each WS-RM provider must override this class.
@@ -32,20 +31,10 @@
public abstract class RMProvider
{
- private static final Map<String, RMProvider> REGISTERED_PROVIDERS = new
HashMap<String, RMProvider>();
-
- static
- {
- REGISTERED_PROVIDERS.put(
-
org.jboss.ws.extensions.wsrm.spec200702.RMProviderImpl.getInstance().getNamespaceURI(),
- org.jboss.ws.extensions.wsrm.spec200702.RMProviderImpl.getInstance()
- );
- REGISTERED_PROVIDERS.put(
-
org.jboss.ws.extensions.wsrm.spec200502.RMProviderImpl.getInstance().getNamespaceURI(),
- org.jboss.ws.extensions.wsrm.spec200502.RMProviderImpl.getInstance()
- );
- }
-
+ private static final RMProvider rmProviderImpl = (RMProvider)
ServiceLoader.loadService(
+ RMProvider.class.getName(),
+ org.jboss.ws.extensions.wsrm.spec200702.RMProviderImpl.class.getName());
+
/**
* Must be overriden in subclasses
* @param targetNamespace
@@ -72,23 +61,9 @@
*/
public abstract RMConstants getConstants();
- /**
- * Gets WS-RM provider by <b>wsrmNamespace</b>
- * @param namespace associated with the WS-RM provider
- * @return WS-RM provider instance
- * @throws IllegalArgumentException if specified <b>wsrmNamespace</b> has
no associated WS-RM provider
- */
- public static final RMProvider getInstance(String wsrmNamespace)
- {
- if (!REGISTERED_PROVIDERS.keySet().contains(wsrmNamespace))
- throw new IllegalArgumentException("No WS-RM provider registered for
namespace " + wsrmNamespace);
-
- return REGISTERED_PROVIDERS.get(wsrmNamespace);
- }
-
public static final RMProvider get()
{
- return org.jboss.ws.extensions.wsrm.spec200702.RMProviderImpl.getInstance();
+ return rmProviderImpl;
}
}
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/deserialization/RMDeSerializationTestCase.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/deserialization/RMDeSerializationTestCase.java 2008-01-28
16:30:24 UTC (rev 5546)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/deserialization/RMDeSerializationTestCase.java 2008-01-29
19:46:13 UTC (rev 5547)
@@ -48,8 +48,7 @@
*/
public final class RMDeSerializationTestCase extends JBossWSTest
{
- private static final String WSRM_200702_NS =
"http://docs.oasis-open.org/ws-rx/wsrm/200702";
- private static final RMMessageFactory WSRM_200702_FACTORY =
RMProvider.getInstance(WSRM_200702_NS).getMessageFactory();
+ private static final RMMessageFactory WSRM_200702_FACTORY =
RMProvider.get().getMessageFactory();
private static final String CREATE_SEQUENCE_MESSAGE
= "<soap:Envelope "