Author: chamikara
Date: Mon Nov 21 23:28:24 2005
New Revision: 348116
URL: http://svn.apache.org/viewcvs?rev=348116&view=rev
Log:
Removed copy methods of SandeshaUtil (shallowCopy, deepCopy). (These were
buggy).
Added a new method createNewRelatedMessageContext instead.
Modified:
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java
webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java
Modified:
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
URL:
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java?rev=348116&r1=348115&r2=348116&view=diff
==============================================================================
---
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
(original)
+++
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
Mon Nov 21 23:28:24 2005
@@ -314,44 +314,11 @@
if (rmMsgCtx.getMessageId() == null) {
rmMsgCtx.setMessageId(messageId1);
}
- //OperationContext opCtx = msgCtx.getOperationContext();
- //
msgCtx.getSystemContext().registerOperationContext(messageId,
- // opCtx);
if (serverSide) {
- //FIXME - do not copy application messages. Coz
u loose
- // properties etc.
- RMMsgContext newRMMsgCtx =
SandeshaUtil.deepCopy(rmMsgCtx);
- MessageContext newMsgCtx =
newRMMsgCtx.getMessageContext();
-
- //setting contexts
- newMsgCtx.setServiceGroupContext(msgCtx
- .getServiceGroupContext());
- newMsgCtx.setServiceGroupContextId(msgCtx
- .getServiceGroupContextId());
-
newMsgCtx.setServiceContext(msgCtx.getServiceContext());
-
newMsgCtx.setServiceContextID(msgCtx.getServiceContextID());
- OperationContext newOpContext = new
OperationContext(newMsgCtx
- .getAxisOperation());
-
- //if server side add request message
- if (msgCtx.isServerSide()) {
- MessageContext reqMsgCtx =
msgCtx.getOperationContext()
- .getMessageContext(
-
WSDLConstants.MESSAGE_LABEL_IN_VALUE);
-
newOpContext.addMessageContext(reqMsgCtx);
- }
-
- newOpContext.addMessageContext(newMsgCtx);
- newMsgCtx.setOperationContext(newOpContext);
-
- //Thid does not have to be processed again by
RMHandlers
-
newMsgCtx.setProperty(Constants.APPLICATION_PROCESSING_DONE,
- "true");
-
//processing the response
- processResponseMessage(newRMMsgCtx,
tempSequenceId,
+ processResponseMessage(rmMsgCtx, tempSequenceId,
messageNumber);
MessageContext reqMsgCtx = msgCtx
Modified:
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java
URL:
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java?rev=348116&r1=348115&r2=348116&view=diff
==============================================================================
---
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java
(original)
+++
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java
Mon Nov 21 23:28:24 2005
@@ -45,10 +45,6 @@
public void processMessage(RMMsgContext rmMsgCtx) throws
SandeshaException {
- // boolean b = true;
- // if (b)
- // return;
-
SequenceAcknowledgement sequenceAck = (SequenceAcknowledgement)
rmMsgCtx
.getMessagePart(Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);
if (sequenceAck == null)
@@ -152,9 +148,6 @@
//stopping the progress of the message further.
rmMsgCtx.getMessageContext().setPausedTrue(
new QName(Constants.IN_HANDLER_NAME));
-
- //return;
- //}
}
int i = 1;
Modified:
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
URL:
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java?rev=348116&r1=348115&r2=348116&view=diff
==============================================================================
---
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
(original)
+++
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
Mon Nov 21 23:28:24 2005
@@ -51,6 +51,7 @@
import org.apache.sandesha2.storage.beans.RetransmitterBean;
import org.apache.sandesha2.storage.beans.SequencePropertyBean;
import org.apache.sandesha2.storage.beans.StorageMapBean;
+import org.apache.sandesha2.util.MsgInitializer;
import org.apache.sandesha2.util.RMMsgCreator;
import org.apache.sandesha2.util.SOAPAbstractFactory;
import org.apache.sandesha2.util.SandeshaUtil;
@@ -300,51 +301,30 @@
return;
}
}
-
- AxisConfiguration axisConfig = configCtx.getAxisConfiguration();
- AxisServiceGroup serviceGroup = new
AxisServiceGroup(axisConfig);
- AxisService service = new AxisService(new
QName("RMClientService")); // This
- // is a
- // dummy
- // service.
- ServiceGroupContext serviceGroupContext = new
ServiceGroupContext(
- configCtx, serviceGroup);
- ServiceContext serviceContext = new ServiceContext(service,
- serviceGroupContext);
-
- RMMsgContext ackRMMsgCtx = SandeshaUtil.deepCopy(rmMsgCtx);
- MessageContext ackMsgCtx = ackRMMsgCtx.getMessageContext();
-
- ackMsgCtx.setMessageID(SandeshaUtil.getUUID());
-
- ackMsgCtx.setAxisServiceGroup(serviceGroup);
- ackMsgCtx.setServiceGroupContext(serviceGroupContext);
- ackMsgCtx.setAxisService(service);
- ackMsgCtx.setServiceContext(serviceContext);
+ AxisOperation ackOperation = null;
try {
- AxisOperation ackOperation = AxisOperationFactory
+ ackOperation = AxisOperationFactory
.getOperetionDescription(AxisOperationFactory.MEP_URI_IN_ONLY);
+ } catch (AxisFault e) {
+ throw new SandeshaException("Could not create the
Operation");
+ }
- AxisOperation rmMsgOperation =
rmMsgCtx.getMessageContext()
- .getAxisOperation();
- if (rmMsgOperation != null) {
- ArrayList outFlow =
rmMsgOperation.getPhasesOutFlow();
- if (outFlow != null) {
- ackOperation.setPhasesOutFlow(outFlow);
-
ackOperation.setPhasesOutFaultFlow(outFlow);
- }
+ AxisOperation rmMsgOperation = rmMsgCtx.getMessageContext()
+ .getAxisOperation();
+ if (rmMsgOperation != null) {
+ ArrayList outFlow = rmMsgOperation.getPhasesOutFlow();
+ if (outFlow != null) {
+ ackOperation.setPhasesOutFlow(outFlow);
+ ackOperation.setPhasesOutFaultFlow(outFlow);
}
+ }
- OperationContext ackOpContext = new
OperationContext(ackOperation);
- ackMsgCtx.setAxisOperation(ackOperation);
- ackMsgCtx.setOperationContext(ackOpContext);
- ackOpContext.addMessageContext(ackMsgCtx);
- ackMsgCtx.setOperationContext(ackOpContext);
+ MessageContext ackMsgCtx =
SandeshaUtil.createNewRelatedMessageContext(
+ rmMsgCtx, ackOperation);
+ RMMsgContext ackRMMsgCtx =
MsgInitializer.initializeMessage(ackMsgCtx);
- } catch (AxisFault e) {
- throw new SandeshaException(e.getMessage());
- }
+ ackMsgCtx.setMessageID(SandeshaUtil.getUUID());
//Set new envelope
SOAPEnvelope envelope = factory.getDefaultEnvelope();
@@ -357,9 +337,6 @@
ackMsgCtx.setTo(acksTo);
ackMsgCtx.setReplyTo(msgCtx.getTo());
RMMsgCreator.addAckMessage(ackRMMsgCtx, sequenceId);
-
- // Object obj =
- //
rmMsgCtx.getMessageContext().getOperationContext().getProperty(org.apache.axis2.Constants.RESPONSE_WRITTEN);
if (Constants.WSA.NS_URI_ANONYMOUS.equals(acksTo.getAddress()))
{
Modified:
webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java
URL:
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java?rev=348116&r1=348115&r2=348116&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java
(original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java
Mon Nov 21 23:28:24 2005
@@ -91,69 +91,42 @@
try {
//creating by copying common contents. (this will not
set contexts
// except for configCtx).
- createSeqmsgContext = SandeshaUtil
- .shallowCopy(applicationMsgContext);
- } catch (SandeshaException e) {
+ AxisOperation createSequenceOperation =
AxisOperationFactory
+
.getAxisOperation(AxisOperation.MEP_CONSTANT_OUT_IN);
+
+ createSeqmsgContext =
SandeshaUtil.createNewRelatedMessageContext(
+ applicationRMMsg,
createSequenceOperation);
+ OperationContext createSeqOpCtx = createSeqmsgContext
+ .getOperationContext();
+ String createSeqMsgId = SandeshaUtil.getUUID();
+ createSeqmsgContext.setMessageID(createSeqMsgId);
+ context.registerOperationContext(createSeqMsgId,
createSeqOpCtx);
+
+ } catch (AxisFault e) {
throw new SandeshaException(e.getMessage());
}
- //setting contexts
- createSeqmsgContext.setServiceGroupContext(applicationMsgContext
- .getServiceGroupContext());
-
createSeqmsgContext.setServiceGroupContextId(applicationMsgContext
- .getServiceGroupContextId());
- createSeqmsgContext.setServiceContext(applicationMsgContext
- .getServiceContext());
- createSeqmsgContext.setServiceContextID(applicationMsgContext
- .getServiceContextID());
-
setUpMessage(createSeqmsgContext);
- String createSeqMsgId = SandeshaUtil.getUUID();
- try {
- AxisOperation appMsgOperationDesc =
applicationMsgContext
- .getAxisOperation();
- AxisOperation createSeqOperationDesc =
AxisOperationFactory
-
.getOperetionDescription(AxisOperationFactory.MEP_URI_OUT_IN);
-
- createSeqOperationDesc
- .setName(new
QName("CreateSequenceOperation"));
- if (appMsgOperationDesc != null) {
-
createSeqOperationDesc.setPhasesOutFlow(appMsgOperationDesc
- .getPhasesOutFlow());
- createSeqOperationDesc
-
.setPhasesOutFaultFlow(appMsgOperationDesc
-
.getPhasesOutFaultFlow());
-
createSeqOperationDesc.setPhasesInFaultFlow(appMsgOperationDesc
- .getPhasesInFaultFlow());
- createSeqOperationDesc
-
.setRemainingPhasesInFlow(appMsgOperationDesc
-
.getRemainingPhasesInFlow());
- }
+ AxisOperation appMsgOperationDesc = applicationMsgContext
+ .getAxisOperation();
-
createSeqmsgContext.setAxisOperation(createSeqOperationDesc);
- //TODO set a suitable ope. description
- OperationContext createSeqOpContext = new
OperationContext(
- createSeqmsgContext.getAxisOperation());
-
-
createSeqmsgContext.setOperationContext(createSeqOpContext);
-
createSeqOpContext.addMessageContext(createSeqmsgContext);
- //registering opearion context
- context
-
.registerOperationContext(createSeqMsgId,
- createSeqOpContext);
-
- //Setting a new SOAP Envelop.
-
- SOAPEnvelope envelope = factory.getDefaultEnvelope();
-
- createSeqmsgContext.setEnvelope(envelope);
- //
createSeqOpContext.addMessageContext(createSeqmsgContext);
- //
createSeqmsgContext.setOperationContext(createSeqOpContext);
- } catch (AxisFault e2) {
- throw new SandeshaException(e2.getMessage());
+ AxisOperation createSeqOperation = createSeqmsgContext
+ .getAxisOperation();
+ createSeqOperation.setName(new
QName("CreateSequenceOperation"));
+ if (appMsgOperationDesc != null) {
+ createSeqOperation.setPhasesOutFlow(appMsgOperationDesc
+ .getPhasesOutFlow());
+
createSeqOperation.setPhasesOutFaultFlow(appMsgOperationDesc
+ .getPhasesOutFaultFlow());
+
createSeqOperation.setPhasesInFaultFlow(appMsgOperationDesc
+ .getPhasesInFaultFlow());
+
createSeqOperation.setRemainingPhasesInFlow(appMsgOperationDesc
+ .getRemainingPhasesInFlow());
}
+ createSeqmsgContext.setAxisOperation(createSeqOperation);
+
createSeqmsgContext.setTo(applicationRMMsg.getTo());
createSeqmsgContext.setReplyTo(applicationRMMsg.getReplyTo());
@@ -189,14 +162,6 @@
EndpointReference replyToEPR = null;
EndpointReference acksToEPR = null;
- //AcksTo value is replyto value (if set). Otherwise anonymous.
- // if (replyToBean==null ||
replyToBean.getValue()==null){
- // if (acksTo==null)
- // acksToEPR = new EndpointReference
(Constants.WSA.NS_URI_ANONYMOUS);
- // }else {
- // acksToEPR = (EndpointReference)
replyToBean.getValue();
- // }
-
if (acksTo == null || "".equals(acksTo))
acksTo = Constants.WSA.NS_URI_ANONYMOUS;
@@ -227,16 +192,6 @@
createSeqRMMsg.setAction(Constants.WSRM.Actions.ACTION_CREATE_SEQUENCE);
createSeqRMMsg
.setSOAPAction(Constants.WSRM.Actions.SOAP_ACTION_CREATE_SEQUENCE);
- createSeqRMMsg.setMessageId(createSeqMsgId);
-
- MessageContext createSeqMsg =
createSeqRMMsg.getMessageContext();
- MessageContext applicationMsg =
applicationRMMsg.getMessageContext();
- createSeqMsg.setServiceGroupContext(applicationMsg
- .getServiceGroupContext());
- createSeqMsg.setServiceGroupContextId(applicationMsg
- .getServiceGroupContextId());
-
createSeqMsg.setServiceContext(applicationMsg.getServiceContext());
-
createSeqMsg.setServiceContextID(applicationMsg.getServiceContextID());
return createSeqRMMsg;
}
@@ -249,10 +204,24 @@
if (referenceMessage == null)
throw new SandeshaException("MessageContext is null");
- RMMsgContext terminateRMMessage = SandeshaUtil
- .shallowCopy(referenceRMMessage);
- MessageContext terminateMessage = terminateRMMessage
- .getMessageContext();
+ AxisOperation terminateOperation = null;
+
+ try {
+ terminateOperation = AxisOperationFactory
+
.getAxisOperation(AxisOperationFactory.MEP_CONSTANT_OUT_ONLY);
+ } catch (AxisFault e1) {
+ throw new SandeshaException(e1.getMessage());
+ }
+
+ if (terminateOperation == null)
+ throw new SandeshaException("Terminate Operation was
null");
+
+ MessageContext terminateMessage = SandeshaUtil
+
.createNewRelatedMessageContext(referenceRMMessage,
+ terminateOperation);
+ RMMsgContext terminateRMMessage = MsgInitializer
+ .initializeMessage(terminateMessage);
+
if (terminateMessage == null)
throw new SandeshaException("MessageContext is null");
@@ -269,44 +238,14 @@
if (configCtx == null)
throw new SandeshaException("Configuration Context is
null");
- AxisConfiguration axisConfig = configCtx.getAxisConfiguration();
- AxisServiceGroup serviceGroup = new
AxisServiceGroup(axisConfig);
- AxisService service = new AxisService(new
QName("RMClientService")); // This
- // is a
- // dummy
- // service.
- ServiceGroupContext serviceGroupContext = new
ServiceGroupContext(
- configCtx, serviceGroup);
- ServiceContext serviceContext = new ServiceContext(service,
- serviceGroupContext);
-
- terminateMessage.setAxisServiceGroup(serviceGroup);
- terminateMessage.setServiceGroupContext(serviceGroupContext);
- terminateMessage.setAxisService(service);
- terminateMessage.setServiceContext(serviceContext);
-
- try {
- AxisOperation terminateOperaiton = AxisOperationFactory
-
.getOperetionDescription(AxisOperationFactory.MEP_URI_IN_ONLY);
- AxisOperation referenceMsgOperation = referenceMessage
- .getAxisOperation();
- if (referenceMsgOperation != null) {
- ArrayList outPhases =
referenceMsgOperation.getPhasesOutFlow();
- if (outPhases != null) {
-
terminateOperaiton.setPhasesOutFlow(outPhases);
-
terminateOperaiton.setPhasesOutFaultFlow(outPhases);
- }
+ AxisOperation referenceMsgOperation = referenceMessage
+ .getAxisOperation();
+ if (referenceMsgOperation != null) {
+ ArrayList outPhases =
referenceMsgOperation.getPhasesOutFlow();
+ if (outPhases != null) {
+ terminateOperation.setPhasesOutFlow(outPhases);
+
terminateOperation.setPhasesOutFaultFlow(outPhases);
}
-
- OperationContext terminateOpContext = new
OperationContext(
- terminateOperaiton);
- terminateMessage.setAxisOperation(terminateOperaiton);
-
terminateMessage.setOperationContext(terminateOpContext);
- terminateOpContext.addMessageContext(terminateMessage);
-
terminateMessage.setOperationContext(terminateOpContext);
-
- } catch (AxisFault e) {
- throw new SandeshaException(e.getMessage());
}
SOAPEnvelope envelope = factory.getDefaultEnvelope();
@@ -436,27 +375,17 @@
try {
MessageContext applicationMsgCtx = applicationRMMsgCtx
.getMessageContext();
- MessageContext ackMsgCtx = SandeshaUtil
- .shallowCopy(applicationMsgCtx);
- ackMsgCtx.setServiceGroupContext(applicationMsgCtx
- .getServiceGroupContext());
- ackMsgCtx.setServiceGroupContextId(applicationMsgCtx
- .getServiceGroupContextId());
-
ackMsgCtx.setServiceContext(applicationMsgCtx.getServiceContext());
- ackMsgCtx.setServiceContextID(applicationMsgCtx
- .getServiceContextID());
-
- RMMsgContext ackRMMsgCtx = new RMMsgContext(ackMsgCtx);
-
- //TODO set a suitable description
- OperationContext ackOpCtx = new
OperationContext(applicationMsgCtx
- .getAxisOperation());
- ackMsgCtx.setOperationContext(ackOpCtx);
+ AxisOperation ackOperation = AxisOperationFactory
+
.getAxisOperation(AxisOperationFactory.MEP_CONSTANT_OUT_ONLY);
- setUpMessage(ackMsgCtx);
+ MessageContext ackMsgCtx = SandeshaUtil
+
.createNewRelatedMessageContext(applicationRMMsgCtx,
+ ackOperation);
+ RMMsgContext ackRMMsgCtx = MsgInitializer
+ .initializeMessage(ackMsgCtx);
- ackOpCtx.addMessageContext(ackMsgCtx);
+ setUpMessage(ackMsgCtx);
Sequence reqSequence = (Sequence) applicationRMMsgCtx
.getMessagePart(Constants.MessageParts.SEQUENCE);
@@ -472,4 +401,5 @@
throw new SandeshaException(e.getMessage());
}
}
+
}
Modified:
webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java
URL:
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java?rev=348116&r1=348115&r2=348116&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java
(original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java
Mon Nov 21 23:28:24 2005
@@ -31,6 +31,8 @@
import org.apache.axis2.addressing.MessageInformationHeaders;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.TransportInDescription;
import org.apache.axis2.description.TransportOutDescription;
import org.apache.axis2.i18n.Messages;
@@ -174,133 +176,6 @@
return (MessageContext) storedMsgContexts.get(key);
}
- // public static void main (String[] args) {
- // String msgList = "13,2,6,4,4,1,999,12,3";
- // getAckRangeArray( msgList);
- //
- // }
-
- public static MessageContext deepCopy(MessageContext msgCtx)
- throws SandeshaException {
-
- try {
- MessageContext newMessageContext = shallowCopy(msgCtx);
- newMessageContext.setDoingMTOM(msgCtx.isDoingMTOM());
- newMessageContext.setDoingREST(msgCtx.isDoingREST());
- newMessageContext.setMessageID(msgCtx.getMessageID());
-
newMessageContext.setOutPutWritten(msgCtx.isOutPutWritten());
- newMessageContext.setParent(msgCtx.getParent());
-
newMessageContext.setPausedPhaseName(msgCtx.getPausedPhaseName());
-
newMessageContext.setProcessingFault(msgCtx.isProcessingFault());
-
newMessageContext.setResponseWritten(msgCtx.isResponseWritten());
-
newMessageContext.setRestThroughPOST(msgCtx.isRestThroughPOST());
- if (msgCtx.getAxisOperation() != null)
-
newMessageContext.setAxisOperation(msgCtx.getAxisOperation());
-
- if (msgCtx.getEnvelope() != null)
-
newMessageContext.setEnvelope(msgCtx.getEnvelope());
-
- //copying transport info. TODO remove http specific
ness.
-
newMessageContext.setProperty(MessageContext.TRANSPORT_OUT, msgCtx
-
.getProperty(MessageContext.TRANSPORT_OUT));
-
newMessageContext.setProperty(HTTPConstants.HTTPOutTransportInfo,
-
msgCtx.getProperty(HTTPConstants.HTTPOutTransportInfo));
- return newMessageContext;
-
- } catch (AxisFault e) {
- throw new SandeshaException("Cannot copy message");
- }
- }
-
- public static MessageContext shallowCopy(MessageContext msgCtx)
- throws SandeshaException {
- ConfigurationContext configCtx = msgCtx.getSystemContext();
- TransportInDescription transportIn = msgCtx.getTransportIn();
- TransportOutDescription transportOut = msgCtx.getTransportOut();
- MessageInformationHeaders msgInfoHeaders1 = new
MessageInformationHeaders();
- MessageInformationHeaders oldMsgInfoHeaders = msgCtx
- .getMessageInformationHeaders();
-
- msgInfoHeaders1.setTo(oldMsgInfoHeaders.getTo());
- msgInfoHeaders1.setFrom(oldMsgInfoHeaders.getFrom());
- msgInfoHeaders1.setReplyTo(oldMsgInfoHeaders.getReplyTo());
- msgInfoHeaders1.setFaultTo(oldMsgInfoHeaders.getFaultTo());
- msgInfoHeaders1.setMessageId(getUUID());
- msgInfoHeaders1.setRelatesTo(oldMsgInfoHeaders.getRelatesTo());
- msgInfoHeaders1.setAction(oldMsgInfoHeaders.getAction());
- msgInfoHeaders1.setReferenceParameters(oldMsgInfoHeaders
- .getReferenceParameters());
-
- try {
-
- MessageContext newMessageContext = new
MessageContext(configCtx);
- newMessageContext.setTransportIn(transportIn);
- newMessageContext.setTransportOut(transportOut);
-
-
newMessageContext.setProperty(MessageContext.TRANSPORT_OUT, msgCtx
-
.getProperty(MessageContext.TRANSPORT_OUT));
-
newMessageContext.setProperty(HTTPConstants.HTTPOutTransportInfo,
-
msgCtx.getProperty(HTTPConstants.HTTPOutTransportInfo));
-
- //Setting the charater set encoding
- Object charSetEncoding = msgCtx
-
.getProperty(MessageContext.CHARACTER_SET_ENCODING);
-
- //TODO - this is required due to a bug in axis2. Remove
this when
- // it get fixed
- //BUG - Commons HTTP transport sender sets a
NameValuepair to as
- // the CHAR_SET_ENCODING
- //instead of a String
- if (charSetEncoding instanceof NameValuePair)
- charSetEncoding = ((NameValuePair)
charSetEncoding).getValue();
-
- newMessageContext.setProperty(
- MessageContext.CHARACTER_SET_ENCODING,
charSetEncoding);
-
-
newMessageContext.setMessageInformationHeaders(msgInfoHeaders1);
-
newMessageContext.setAxisService(msgCtx.getAxisService());
- if (msgCtx.getAxisServiceGroup() != null)
- newMessageContext.setAxisServiceGroup(msgCtx
- .getAxisServiceGroup());
-
- newMessageContext.setSoapAction(msgCtx.getSoapAction());
- newMessageContext.setWSAAction(msgCtx.getWSAAction());
-
- newMessageContext.setServerSide(msgCtx.isServerSide());
- return newMessageContext;
-
- } catch (AxisFault e) {
- throw new SandeshaException("Cannot copy message");
- }
-
- }
-
- public static RMMsgContext deepCopy(RMMsgContext rmMsgContext)
- throws SandeshaException {
- MessageContext msgCtx = null;
- if (rmMsgContext.getMessageContext() != null)
- msgCtx = deepCopy(rmMsgContext.getMessageContext());
-
- RMMsgContext newRMMsgCtx = new RMMsgContext();
- if (msgCtx != null)
- newRMMsgCtx.setMessageContext(msgCtx);
-
- return newRMMsgCtx;
- }
-
- public static RMMsgContext shallowCopy(RMMsgContext rmMsgContext)
- throws SandeshaException {
- MessageContext msgCtx = null;
- if (rmMsgContext.getMessageContext() != null)
- msgCtx = shallowCopy(rmMsgContext.getMessageContext());
-
- RMMsgContext newRMMsgCtx = new RMMsgContext();
- if (msgCtx != null)
- newRMMsgCtx.setMessageContext(msgCtx);
-
- return newRMMsgCtx;
- }
-
public static void startSenderIfStopped(ConfigurationContext context) {
if (!sender.isSenderStarted()) {
sender.start(context);
@@ -554,6 +429,58 @@
} catch (AxisFault e) {
throw new SandeshaException(e.getMessage());
}
+ }
+
+ public static MessageContext createNewRelatedMessageContext(
+ RMMsgContext referenceRMMessage, AxisOperation
operation)
+ throws SandeshaException {
+ try {
+ MessageContext referenceMessage = referenceRMMessage
+ .getMessageContext();
+ ConfigurationContext configContext = referenceMessage
+ .getSystemContext();
+ MessageContext newMessageContext = new
MessageContext(configContext);
+
+ newMessageContext.setAxisServiceGroup(referenceMessage
+ .getAxisServiceGroup());
+
newMessageContext.setAxisService(referenceMessage.getAxisService());
+ newMessageContext.setAxisOperation(operation);
+
newMessageContext.setServiceGroupContext(referenceMessage
+ .getServiceGroupContext());
+
newMessageContext.setServiceGroupContextId(referenceMessage
+ .getServiceGroupContextId());
+ newMessageContext.setServiceContext(referenceMessage
+ .getServiceContext());
+ newMessageContext.setServiceContextID(referenceMessage
+ .getServiceContextID());
+
+ OperationContext operationContext = new
OperationContext(operation);
+ newMessageContext.setOperationContext(operationContext);
+ operationContext.addMessageContext(newMessageContext);
+
+ //adding a blank envelope
+ SOAPFactory factory = SOAPAbstractFactory
+ .getSOAPFactory(SandeshaUtil
+
.getSOAPVersion(referenceMessage.getEnvelope()));
+
newMessageContext.setEnvelope(factory.getDefaultEnvelope());
+
+
newMessageContext.setTransportIn(referenceMessage.getTransportIn());
+ newMessageContext.setTransportOut(referenceMessage
+ .getTransportOut());
+
+ //copying transport info. TODO remove http specific
ness.
+
newMessageContext.setProperty(MessageContext.TRANSPORT_OUT,
+
referenceMessage.getProperty(MessageContext.TRANSPORT_OUT));
+
newMessageContext.setProperty(HTTPConstants.HTTPOutTransportInfo,
+ referenceMessage
+
.getProperty(HTTPConstants.HTTPOutTransportInfo));
+
+ return newMessageContext;
+
+ } catch (AxisFault e) {
+ throw new SandeshaException(e.getMessage());
+ }
+
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]