You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by ch...@apache.org on 2006/12/02 15:40:55 UTC
svn commit: r481565 - in
/webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2:
i18n/SandeshaMessageKeys.java i18n/resource.properties
storage/inmemory/InMemoryStorageManager.java
Author: chamikara
Date: Sat Dec 2 06:40:53 2006
New Revision: 481565
URL: http://svn.apache.org/viewvc?view=rev&rev=481565
Log:
Changed the InMemory storge manager to keep the SOAPEnvelope in a different map and to pass a cloned version every
time the Message is retrieved. This gives the correct behaviour in scenarios where retransmitting the message through
the same handler could cause problems. For e.g. when composing with security.
Modified:
webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/i18n/SandeshaMessageKeys.java
webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/i18n/resource.properties
webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/storage/inmemory/InMemoryStorageManager.java
Modified: webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/i18n/SandeshaMessageKeys.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/i18n/SandeshaMessageKeys.java?view=diff&rev=481565&r1=481564&r2=481565
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/i18n/SandeshaMessageKeys.java (original)
+++ webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/i18n/SandeshaMessageKeys.java Sat Dec 2 06:40:53 2006
@@ -244,6 +244,7 @@
public static final String maximumRetransmissionCountProcessor="maximumRetransmissionCountProcessor";
public static final String nullMsgId="nullMsgId";
public static final String storageMapNotPresent="storageMapNotPresent";
+ public static final String envelopeMapNotPresent="envelopeMapNotPresent";
public static final String entryNotPresentForUpdating="entryNotPresentForUpdating";
public static final String appMsgIsNull="appMsgIsNull";
public static final String terminateOpperationIsNull="terminateOpperationIsNull";
Modified: webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/i18n/resource.properties
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/i18n/resource.properties?view=diff&rev=481565&r1=481564&r2=481565
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/i18n/resource.properties (original)
+++ webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/i18n/resource.properties Sat Dec 2 06:40:53 2006
@@ -255,6 +255,7 @@
maximumRetransmissionCountProcessor=MaximumRetransmissionCountProcessor:doAcknowledgementInterval
nullMsgId=Key (MessageId) is null. Cannot insert.
storageMapNotPresent=Error: storage Map not present
+envelopeMapNotPresent=Error: envelope Map not present
entryNotPresentForUpdating=Entry is not present for updating
appMsgIsNull=Application message is null
terminateOpperationIsNull=Terminate Operation was null
Modified: webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/storage/inmemory/InMemoryStorageManager.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/storage/inmemory/InMemoryStorageManager.java?view=diff&rev=481565&r1=481564&r2=481565
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/storage/inmemory/InMemoryStorageManager.java (original)
+++ webservices/sandesha/branches/sandesha2/java/1_1/src/org/apache/sandesha2/storage/inmemory/InMemoryStorageManager.java Sat Dec 2 06:40:53 2006
@@ -19,10 +19,14 @@
import java.util.HashMap;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.AxisModule;
import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
import org.apache.sandesha2.i18n.SandeshaMessageHelper;
import org.apache.sandesha2.i18n.SandeshaMessageKeys;
import org.apache.sandesha2.storage.SandeshaStorageException;
@@ -39,6 +43,7 @@
private static InMemoryStorageManager instance = null;
private final String MESSAGE_MAP_KEY = "Sandesha2MessageMap";
+ private final String ENVELOPE_MAP_KEY = "Sandesha2EnvelopeMap";
private RMSBeanMgr rmsBeanMgr = null;
private RMDBeanMgr nextMsgBeanMgr = null;
private SequencePropertyBeanMgr sequencePropertyBeanMgr = null;
@@ -91,12 +96,34 @@
return instance;
}
- public MessageContext retrieveMessageContext(String key,ConfigurationContext context) {
+ public MessageContext retrieveMessageContext(String key,ConfigurationContext context) throws SandeshaStorageException {
HashMap storageMap = (HashMap) getContext().getProperty(MESSAGE_MAP_KEY);
if (storageMap==null)
return null;
- return (MessageContext) storageMap.get(key);
+ MessageContext messageContext = (MessageContext) storageMap.get(key);
+
+ HashMap envMap = (HashMap) getContext().getProperty(ENVELOPE_MAP_KEY);
+ if(envMap==null) {
+ return null;
+ }
+
+ //Get hold of the original SOAP envelope
+ SOAPEnvelope envelope = (SOAPEnvelope)envMap.get(key);
+
+ //Now clone the env and set it in the message context
+ if (envelope!=null) {
+ envelope.build();
+ XMLStreamReader streamReader = envelope.cloneOMElement().getXMLStreamReader();
+ SOAPEnvelope clonedEnvelope = new StAXSOAPModelBuilder(streamReader, null).getSOAPEnvelope();
+ try {
+ messageContext.setEnvelope(clonedEnvelope);
+ } catch (AxisFault e) {
+ throw new SandeshaStorageException (e);
+ }
+ }
+
+ return messageContext;
}
public void storeMessageContext(String key,MessageContext msgContext) {
@@ -111,6 +138,17 @@
key = SandeshaUtil.getUUID();
storageMap.put(key,msgContext);
+
+ //Now get hold of the SOAP envelope and store it in the env map
+ HashMap envMap = (HashMap) getContext().getProperty(ENVELOPE_MAP_KEY);
+
+ if(envMap==null) {
+ envMap = new HashMap ();
+ getContext().setProperty(ENVELOPE_MAP_KEY, envMap);
+ }
+
+ envMap.put(key, msgContext.getEnvelope());
+
}
public void updateMessageContext(String key,MessageContext msgContext) throws SandeshaStorageException {
@@ -125,6 +163,21 @@
if (oldEntry==null)
throw new SandeshaStorageException (SandeshaMessageHelper.getMessage(
SandeshaMessageKeys.entryNotPresentForUpdating));
+
+ HashMap envMap = (HashMap) getContext().getProperty(ENVELOPE_MAP_KEY);
+
+ if(envMap==null) {
+ throw new SandeshaStorageException (SandeshaMessageHelper.getMessage(
+ SandeshaMessageKeys.envelopeMapNotPresent));
+ }
+
+ oldEntry = envMap.get(key);
+ if (oldEntry==null)
+ throw new SandeshaStorageException (SandeshaMessageHelper.getMessage(
+ SandeshaMessageKeys.entryNotPresentForUpdating));
+
+ envMap.remove(key);
+ envMap.put(key, msgContext.getEnvelope());
storeMessageContext(key,msgContext);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org