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/02/27 07:49:36 UTC

svn commit: r381274 - in /webservices/sandesha/trunk/src/org/apache/sandesha2: ./ msgprocessors/ util/ wsrm/

Author: chamikara
Date: Sun Feb 26 22:49:27 2006
New Revision: 381274

URL: http://svn.apache.org/viewcvs?rev=381274&view=rev
Log:
scenario 1.1 of the WSRX spec is working.
Added support for TerminateSequenceResponse.

Modified:
    webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/SOAPFaultEnvelopeCreator.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/SpecSpecificConstants.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorFactory.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/util/MsgInitializer.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Accept.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckRequested.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcknowledgementRange.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcksTo.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Address.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequence.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequenceResponse.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Expires.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/FaultCode.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/IOMRMElement.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Identifier.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/LastMessage.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/MessageNumber.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Nack.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/RMElements.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Sequence.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceAcknowledgement.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceFault.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceOffer.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/TerminateSequence.java

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java?rev=381274&r1=381273&r2=381274&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java Sun Feb 26 22:49:27 2006
@@ -19,6 +19,7 @@
 
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.jar.Attributes.Name;
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
@@ -50,6 +51,8 @@
 
 	private String rmNamespaceValue = null;
 	
+	private String rmSpecVersion = null;
+	
 	public RMMsgContext() {
 		rmMessageParts = new HashMap();
 		messageType = Sandesha2Constants.MessageTypes.UNKNOWN;
@@ -246,6 +249,16 @@
 
 	public void setRMNamespaceValue(String rmNamespaceValue) {
 		this.rmNamespaceValue = rmNamespaceValue;
+		
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(rmNamespaceValue)) { 
+			rmSpecVersion = Sandesha2Constants.SPEC_VERSIONS.WSRM;
+		} else if (Sandesha2Constants.SPEC_2005_10.NS_URI.equals(rmNamespaceValue)) {
+			rmSpecVersion = Sandesha2Constants.SPEC_VERSIONS.WSRX;
+		}
+	}
+	
+	public String getRMSpecVersion () {
+		return rmSpecVersion;
 	}
 	
 	public void setFlow (int flow) {

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/SOAPFaultEnvelopeCreator.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/SOAPFaultEnvelopeCreator.java?rev=381274&r1=381273&r2=381274&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/SOAPFaultEnvelopeCreator.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/SOAPFaultEnvelopeCreator.java Sun Feb 26 22:49:27 2006
@@ -108,7 +108,7 @@
 	 */
 	private static void addSequenceFaultHeader(
 			MessageContext faultMessageContext, FaultData faultData,
-			SOAPFactory factory, String rmNamespaceValue) {
+			SOAPFactory factory, String rmNamespaceValue) throws SandeshaException {
 
 		SequenceFault sequenceFault = new SequenceFault(factory, rmNamespaceValue);
 

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java?rev=381274&r1=381273&r2=381274&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java Sun Feb 26 22:49:27 2006
@@ -103,6 +103,8 @@
 
 		String TERMINATE_SEQUENCE = "TerminateSequence";
 
+		String TERMINATE_SEQUENCE_RESPONSE = "TerminateSequenceResponse";
+		
 		String FAULT_CODE = "FaultCode";
 
 		String SEQUENCE_FAULT = "SequenceFault";
@@ -162,8 +164,10 @@
 		int CLOSE_SEQUENCE = 5;
 
 		int TERMINATE_SEQ = 6;
+		
+		int TERMINATE_SEQ_RESPONSE = 7;
 
-		int MAX_MESSAGE_TYPE = 6;
+		int MAX_MESSAGE_TYPE = 7;
 	}
 
 	public interface MessageParts {
@@ -181,7 +185,9 @@
 
 		int TERMINATE_SEQ = 11;
 
-		int ACK_REQUEST = 12;
+		int TERMINATE_SEQ_RESPONSE = 12;
+		
+		int ACK_REQUEST = 13;
 
 		int MAX_MSG_PART_ID = 13;
 	}

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/SpecSpecificConstants.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/SpecSpecificConstants.java?rev=381274&r1=381273&r2=381274&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/SpecSpecificConstants.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/SpecSpecificConstants.java Sun Feb 26 22:49:27 2006
@@ -85,4 +85,12 @@
 			throw new SandeshaException (unknowsSpecErrorMessage);
 	}
 	
+	public static boolean isTerminateSequenceResponseRequired (String specVersion)  throws SandeshaException {
+		if (Sandesha2Constants.SPEC_VERSIONS.WSRM.equals(specVersion)) 
+			return false;
+		else if (Sandesha2Constants.SPEC_VERSIONS.WSRX.equals(specVersion)) 
+			return true;
+		else 
+			throw new SandeshaException (unknowsSpecErrorMessage);
+	}
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorFactory.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorFactory.java?rev=381274&r1=381273&r2=381274&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorFactory.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorFactory.java Sun Feb 26 22:49:27 2006
@@ -33,6 +33,8 @@
 			return new CreateSeqMsgProcessor();
 		case (Sandesha2Constants.MessageTypes.TERMINATE_SEQ):
 			return new TerminateSeqMsgProcessor();
+		case (Sandesha2Constants.MessageTypes.TERMINATE_SEQ_RESPONSE):
+			return new TerminateSeqResponseMsgProcessor();
 		case (Sandesha2Constants.MessageTypes.APPLICATION):
 			return new ApplicationMsgProcessor();
 		case (Sandesha2Constants.MessageTypes.CREATE_SEQ_RESPONSE):

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java?rev=381274&r1=381273&r2=381274&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java Sun Feb 26 22:49:27 2006
@@ -17,20 +17,26 @@
 
 package org.apache.sandesha2.msgprocessors;
 
+import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.util.Utils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.sandesha2.RMMsgContext;
 import org.apache.sandesha2.Sandesha2Constants;
 import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.SpecSpecificConstants;
 import org.apache.sandesha2.TerminateManager;
 import org.apache.sandesha2.storage.StorageManager;
 import org.apache.sandesha2.storage.Transaction;
 import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
 import org.apache.sandesha2.storage.beans.SequencePropertyBean;
+import org.apache.sandesha2.util.RMMsgCreator;
 import org.apache.sandesha2.util.SandeshaUtil;
 import org.apache.sandesha2.util.SequenceManager;
+import org.apache.sandesha2.wsrm.CreateSequenceResponse;
 import org.apache.sandesha2.wsrm.SequenceAcknowledgement;
 import org.apache.sandesha2.wsrm.TerminateSequence;
 
@@ -84,6 +90,12 @@
 		
 		sequencePropertyBeanMgr.insert(terminateReceivedBean);
 		
+		
+		//add the terminate sequence response if required.
+		if (SpecSpecificConstants.isTerminateSequenceResponseRequired (terminateSeqRMMsg.getRMSpecVersion()))
+			addTerminateSequenceResponse (terminateSeqRMMsg);
+		
+		
 		terminateReceivedTransaction.commit();
 		
 		Transaction terminateTransaction = storageManager.getTransaction();
@@ -101,4 +113,30 @@
 		
 		terminateSeqRMMsg.pause();
 	}
+	
+	private void addTerminateSequenceResponse (RMMsgContext terminateSeqRMMsg) throws SandeshaException {
+		
+		MessageContext terminateSeqMsg = terminateSeqRMMsg.getMessageContext();
+		
+		MessageContext outMessage = null;
+		outMessage = Utils.createOutMessageContext(terminateSeqMsg);
+		
+		RMMsgContext terminateSeqResponseRMMsg = RMMsgCreator
+				.createTerminateSeqResponseMsg(terminateSeqRMMsg, outMessage);
+		
+		terminateSeqResponseRMMsg.setFlow(MessageContext.OUT_FLOW);
+		terminateSeqResponseRMMsg.setProperty(Sandesha2Constants.APPLICATION_PROCESSING_DONE,"true");
+
+		outMessage.setResponseWritten(true);
+		
+		AxisEngine engine = new AxisEngine (terminateSeqMsg.getConfigurationContext());
+		
+		try {
+			engine.send(outMessage);
+		} catch (AxisFault e) {
+			String message = "Could not send the terminate sequence response";
+			throw new SandeshaException (message,e);
+		}
+	}
+	
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/MsgInitializer.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/MsgInitializer.java?rev=381274&r1=381273&r2=381274&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/MsgInitializer.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/MsgInitializer.java Sun Feb 26 22:49:27 2006
@@ -32,6 +32,7 @@
 import org.apache.sandesha2.wsrm.Sequence;
 import org.apache.sandesha2.wsrm.SequenceAcknowledgement;
 import org.apache.sandesha2.wsrm.TerminateSequence;
+import org.apache.sandesha2.wsrm.TerminateSequenceResponse;
 
 /**
  * This class is used to create an RMMessageContext out of an MessageContext.
@@ -70,7 +71,7 @@
 	 * @param rmMsgContext
 	 */
 	private static void populateRMMsgContext(MessageContext msgCtx,
-			RMMsgContext rmMsgContext) {
+			RMMsgContext rmMsgContext) throws SandeshaException {
 
 		RMElements elements = new RMElements();
 		elements.fromSOAPEnvelope(msgCtx.getEnvelope(), msgCtx.getWSAAction());
@@ -108,6 +109,12 @@
 					elements.getTerminateSequence());
 			rmNamespace = elements.getTerminateSequence().getOMElement().getNamespace().getName();
 		}
+		
+		if (elements.getTerminateSequenceResponse() != null) {
+			rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.TERMINATE_SEQ_RESPONSE,
+					elements.getTerminateSequenceResponse());
+			rmNamespace = elements.getTerminateSequenceResponse().getOMElement().getNamespace().getName();
+		}
 
 		if (elements.getAckRequested() != null) {
 			rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.ACK_REQUEST,
@@ -140,8 +147,10 @@
 		CreateSequence createSequence = (CreateSequence) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.CREATE_SEQ);
 		CreateSequenceResponse createSequenceResponse = (CreateSequenceResponse) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.CREATE_SEQ_RESPONSE);
 		TerminateSequence terminateSequence = (TerminateSequence) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.TERMINATE_SEQ);
+		TerminateSequenceResponse terminateSequenceResponse = (TerminateSequenceResponse) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.TERMINATE_SEQ_RESPONSE);
 		SequenceAcknowledgement sequenceAcknowledgement = (SequenceAcknowledgement) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);
 		Sequence sequence = (Sequence) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE);
+		
 		//Setting message type.
 		if (createSequence != null) {
 			rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.CREATE_SEQ);
@@ -151,7 +160,10 @@
 		}else if (terminateSequence != null) {
 			rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.TERMINATE_SEQ);
 			sequenceID = terminateSequence.getIdentifier().getIdentifier();
-		} else if (rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE) != null) {
+		}else if (terminateSequenceResponse != null) {
+			rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.TERMINATE_SEQ_RESPONSE);
+			sequenceID = terminateSequenceResponse.getIdentifier().getIdentifier();
+		}else if (rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE) != null) {
 			rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.APPLICATION);
 			sequenceID = sequence.getIdentifier().getIdentifier();
 		} else if (sequenceAcknowledgement != null) {

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=381274&r1=381273&r2=381274&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java Sun Feb 26 22:49:27 2006
@@ -40,6 +40,7 @@
 import org.apache.sandesha2.SandeshaException;
 import org.apache.sandesha2.SpecSpecificConstants;
 import org.apache.sandesha2.client.Sandesha2ClientAPI;
+import org.apache.sandesha2.msgprocessors.TerminateSeqResponseMsgProcessor;
 import org.apache.sandesha2.storage.StorageManager;
 import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
 import org.apache.sandesha2.storage.beans.SequencePropertyBean;
@@ -55,6 +56,7 @@
 import org.apache.sandesha2.wsrm.SequenceAcknowledgement;
 import org.apache.sandesha2.wsrm.SequenceOffer;
 import org.apache.sandesha2.wsrm.TerminateSequence;
+import org.apache.sandesha2.wsrm.TerminateSequenceResponse;
 import org.apache.ws.commons.soap.SOAPEnvelope;
 import org.apache.ws.commons.soap.SOAPFactory;
 
@@ -370,6 +372,22 @@
 				.createNewRelatedMessageContext(referenceRMMessage,
 						terminateOperation);
 
+		OperationContext operationContext = terminateMessage.getOperationContext();
+		configCtx.registerOperationContext(terminateMessage.getMessageID(), operationContext);   //to receive terminate sequence response messages correctly.
+		
+		AxisOperation teferenceMsgOperation = referenceMessage.getAxisOperation();
+		AxisOperation terminateMsgOperation = terminateMessage.getAxisOperation();
+		if (teferenceMsgOperation != null) {
+			terminateMsgOperation.setPhasesOutFlow(teferenceMsgOperation
+					.getPhasesOutFlow());
+			terminateMsgOperation.setPhasesOutFaultFlow(teferenceMsgOperation
+					.getPhasesOutFaultFlow());
+			terminateMsgOperation.setPhasesInFaultFlow(teferenceMsgOperation
+					.getPhasesInFaultFlow());
+			terminateMsgOperation.setRemainingPhasesInFlow(teferenceMsgOperation
+					.getRemainingPhasesInFlow());
+		}
+		
 		String rmVersion = SandeshaUtil.getRMVersion(internalSequenceID,configCtx);
 		if (rmVersion==null)
 			throw new SandeshaException ("Cant find the rmVersion of the given message");
@@ -496,6 +514,43 @@
 
 		return createSeqResponse;
 	}
+	
+	
+	public static RMMsgContext createTerminateSeqResponseMsg (RMMsgContext terminateSeqRMMsg, MessageContext outMessage) throws SandeshaException {
+		
+		RMMsgContext terminateSeqResponseRMMsg = new RMMsgContext (outMessage);
+		ConfigurationContext configurationContext = terminateSeqRMMsg.getMessageContext().getConfigurationContext();
+		
+		SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil
+				.getSOAPVersion(terminateSeqRMMsg.getSOAPEnvelope()));
+		
+		TerminateSequence terminateSequence = (TerminateSequence) terminateSeqRMMsg.getMessagePart(Sandesha2Constants.MessageParts.TERMINATE_SEQ);
+		String sequenceID = terminateSequence.getIdentifier().getIdentifier();
+		
+		String namespace = terminateSeqRMMsg.getRMNamespaceValue();
+		terminateSeqResponseRMMsg.setRMNamespaceValue(namespace);
+		
+		TerminateSequenceResponse terminateSequenceResponse = new TerminateSequenceResponse (factory,namespace);
+		Identifier identifier = new Identifier (factory,namespace);
+		identifier.setIndentifer(sequenceID);
+		terminateSequenceResponse.setIdentifier(identifier);
+		
+		SOAPEnvelope envelope = factory.getDefaultEnvelope();
+		terminateSeqResponseRMMsg.setSOAPEnvelop(envelope);
+		terminateSeqResponseRMMsg.setMessagePart(Sandesha2Constants.MessageParts.TERMINATE_SEQ_RESPONSE,terminateSequenceResponse);
+		
+		outMessage.setWSAAction(SpecSpecificConstants.getCreateSequenceResponseAction(SandeshaUtil.getRMVersion(sequenceID,configurationContext)));
+		outMessage.setSoapAction(SpecSpecificConstants.getCreateSequenceResponseSOAPAction(SandeshaUtil.getRMVersion(sequenceID,configurationContext)));
+
+		initializeCreation(terminateSeqRMMsg.getMessageContext(),outMessage);
+		
+		terminateSeqResponseRMMsg.addSOAPEnvelope();
+		
+		
+		finalizeCreation(terminateSeqRMMsg.getMessageContext(), outMessage);
+		
+		return terminateSeqResponseRMMsg;
+	}
 
 	/**
 	 * Adds an ack message to the given application message.
@@ -568,14 +623,13 @@
 	 */
 	public static RMMsgContext createAckMessage(RMMsgContext applicationRMMsgCtx, String rmNamespaceValue)
 			throws SandeshaException {
+		
 		try {
 			MessageContext applicationMsgCtx = applicationRMMsgCtx
 					.getMessageContext();
 
 			AxisOperation ackOperation = AxisOperationFactory
 					.getAxisOperation(AxisOperationFactory.MEP_CONSTANT_OUT_ONLY);
-
-			
 			
 			MessageContext ackMsgCtx = SandeshaUtil
 					.createNewRelatedMessageContext(applicationRMMsgCtx,

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Accept.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Accept.java?rev=381274&r1=381273&r2=381274&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Accept.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Accept.java Sun Feb 26 22:49:27 2006
@@ -23,6 +23,7 @@
 import org.apache.ws.commons.om.OMNamespace;
 import org.apache.ws.commons.soap.SOAPFactory;
 import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
 
 /**
  * @author Chamikara Jayalath <ch...@gmail.com>
@@ -41,7 +42,10 @@
 	
 	String namespaceValue = null;
 
-	public Accept(SOAPFactory factory, String namespaceValue) {
+	public Accept(SOAPFactory factory, String namespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(namespaceValue))
+			throw new SandeshaException ("Unsupported namespace");
+		
 		this.factory = factory;
 		rmNamespace = factory.createOMNamespace(
 				namespaceValue, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
@@ -54,7 +58,7 @@
 		return acceptElement;
 	}
 
-	public Object fromOMElement(OMElement element) throws OMException {
+	public Object fromOMElement(OMElement element) throws OMException,SandeshaException {
 
 		OMElement acceptPart = element.getFirstChildWithName(new QName(
 				namespaceValue, Sandesha2Constants.WSRM_COMMON.ACCEPT));
@@ -96,5 +100,15 @@
 
 	public AcksTo getAcksTo() {
 		return acksTo;
+	}
+	
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		if (Sandesha2Constants.SPEC_2005_10.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
 	}
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckRequested.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckRequested.java?rev=381274&r1=381273&r2=381274&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckRequested.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckRequested.java Sun Feb 26 22:49:27 2006
@@ -26,6 +26,7 @@
 import org.apache.ws.commons.soap.SOAPHeader;
 import org.apache.ws.commons.soap.SOAPHeaderBlock;
 import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
 
 /**
  * Represent the AckRequested header block.
@@ -45,7 +46,10 @@
 	String namespaceValue = null;
 	private boolean mustUnderstand = true;
 
-	public AckRequested(SOAPFactory factory,String namespaceValue) {
+	public AckRequested(SOAPFactory factory,String namespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(namespaceValue))
+			throw new SandeshaException ("Unsupported namespace");
+		
 		this.factory = factory;
 		this.namespaceValue = namespaceValue;
 		rmNamespace = factory.createOMNamespace(
@@ -58,7 +62,7 @@
 		return ackRequestedElement;
 	}
 
-	public Object fromOMElement(OMElement header) throws OMException {
+	public Object fromOMElement(OMElement header) throws OMException,SandeshaException {
 
 		if (header == null || !(header instanceof SOAPHeader))
 			throw new OMException(
@@ -149,6 +153,16 @@
 
 	public void setMustUnderstand(boolean mustUnderstand) {
 		this.mustUnderstand = mustUnderstand;
+	}
+	
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		if (Sandesha2Constants.SPEC_2005_10.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
 	}
 
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcknowledgementRange.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcknowledgementRange.java?rev=381274&r1=381273&r2=381274&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcknowledgementRange.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcknowledgementRange.java Sun Feb 26 22:49:27 2006
@@ -24,6 +24,7 @@
 import org.apache.ws.commons.om.OMNamespace;
 import org.apache.ws.commons.soap.SOAPFactory;
 import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
 
 /**
  * @author Chamikara Jayalath <ch...@gmail.com>
@@ -40,7 +41,10 @@
 	OMNamespace rmNamespace = null;
 	String namespaceValue = null;
 	
-	public AcknowledgementRange(SOAPFactory factory, String namespaceValue) {
+	public AcknowledgementRange(SOAPFactory factory, String namespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(namespaceValue))
+			throw new SandeshaException ("Unsupported namespace");
+		
 		this.factory = factory;
 		this.namespaceValue = namespaceValue;
 		rmNamespace = factory.createOMNamespace(
@@ -124,5 +128,15 @@
 
 	public void setUpperValue(long upperValue) {
 		this.upperValue = upperValue;
+	}
+	
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		if (Sandesha2Constants.SPEC_2005_10.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
 	}
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcksTo.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcksTo.java?rev=381274&r1=381273&r2=381274&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcksTo.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcksTo.java Sun Feb 26 22:49:27 2006
@@ -23,6 +23,7 @@
 import org.apache.ws.commons.om.OMNamespace;
 import org.apache.ws.commons.soap.SOAPFactory;
 import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
 
 /**
  * @author Chamikara Jayalath <ch...@gmail.com>
@@ -38,7 +39,10 @@
 	OMNamespace rmNamespace = null;
 	String namespaceValue = null;
 
-	public AcksTo(SOAPFactory factory,String namespaceValue) {
+	public AcksTo(SOAPFactory factory,String namespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(namespaceValue))
+			throw new SandeshaException ("Unsupported namespace");
+		
 		this.factory = factory;
 		this.namespaceValue = namespaceValue;
 		rmNamespace = factory.createOMNamespace(
@@ -47,7 +51,7 @@
 				Sandesha2Constants.WSRM_COMMON.ACKS_TO, rmNamespace);
 	}
 	
-	public AcksTo (Address address,SOAPFactory factory,String namespaceValue) {
+	public AcksTo (Address address,SOAPFactory factory,String namespaceValue) throws SandeshaException {
 		this (factory,namespaceValue);
 		this.address = address;
 	}
@@ -56,7 +60,7 @@
 		return acksToElement;
 	}
 
-	public Object fromOMElement(OMElement element) throws OMException {
+	public Object fromOMElement(OMElement element) throws OMException,SandeshaException {
 		OMElement acksToPart = element.getFirstChildWithName(new QName(
 				namespaceValue, Sandesha2Constants.WSRM_COMMON.ACKS_TO));
 
@@ -98,5 +102,15 @@
 
 	public void setAddress(Address address) {
 		this.address = address;
+	}
+	
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		if (Sandesha2Constants.SPEC_2005_10.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
 	}
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Address.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Address.java?rev=381274&r1=381273&r2=381274&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Address.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Address.java Sun Feb 26 22:49:27 2006
@@ -14,6 +14,7 @@
 import org.apache.ws.commons.om.OMNamespace;
 import org.apache.ws.commons.soap.SOAPFactory;
 import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
 
 /**
  * @author Chamikara Jayalath <ch...@gmail.com>
@@ -29,6 +30,7 @@
 	OMNamespace rmNamespace = null;
 
 	public Address(SOAPFactory factory) {
+		
 		this.factory = factory;
 		rmNamespace = factory.createOMNamespace(Sandesha2Constants.WSA.NS_URI_ADDRESSING,
 				Sandesha2Constants.WSA.NS_PREFIX_ADDRESSING);
@@ -89,5 +91,15 @@
 
 	public void setEpr(EndpointReference epr) {
 		this.epr = epr;
+	}
+	
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		if (Sandesha2Constants.SPEC_2005_10.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
 	}
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequence.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequence.java?rev=381274&r1=381273&r2=381274&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequence.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequence.java Sun Feb 26 22:49:27 2006
@@ -25,6 +25,7 @@
 import org.apache.ws.commons.soap.SOAPEnvelope;
 import org.apache.ws.commons.soap.SOAPFactory;
 import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
 
 /**
  * Represent the CreateSequence body element.
@@ -44,7 +45,10 @@
 	OMNamespace rmNamespace = null;
 	String namespaceValue = null;
 
-	public CreateSequence(SOAPFactory factory,String namespaceValue) {
+	public CreateSequence(SOAPFactory factory,String namespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(namespaceValue))
+			throw new SandeshaException ("Unsupported namespace");
+		
 		this.factory = factory;
 		this.namespaceValue = namespaceValue;
 		rmNamespace = factory.createOMNamespace(
@@ -53,7 +57,7 @@
 				Sandesha2Constants.WSRM_COMMON.CREATE_SEQUENCE, rmNamespace);
 	}
 	
-	public CreateSequence (AcksTo acksTo,SOAPFactory factory,String namespaceValue) {
+	public CreateSequence (AcksTo acksTo,SOAPFactory factory,String namespaceValue) throws SandeshaException {
 		this (factory,namespaceValue);
 		this.acksTo = acksTo;
 	}
@@ -62,7 +66,7 @@
 		return createSequenceElement;
 	}
 
-	public Object fromOMElement(OMElement bodyElement) throws OMException {
+	public Object fromOMElement(OMElement bodyElement) throws OMException,SandeshaException {
 
 		OMElement createSequencePart = bodyElement
 				.getFirstChildWithName(new QName(namespaceValue,
@@ -150,5 +154,15 @@
 			elem.detach();
 		
 		toOMElement(body);
+	}
+	
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		if (Sandesha2Constants.SPEC_2005_10.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
 	}
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequenceResponse.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequenceResponse.java?rev=381274&r1=381273&r2=381274&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequenceResponse.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequenceResponse.java Sun Feb 26 22:49:27 2006
@@ -25,6 +25,7 @@
 import org.apache.ws.commons.soap.SOAPEnvelope;
 import org.apache.ws.commons.soap.SOAPFactory;
 import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
 
 /**
  * Adds the CreateSequenceResponse body part.
@@ -44,7 +45,10 @@
 	OMNamespace createSeqResNoNamespace = null;
 	String namespaceValue = null;
 
-	public CreateSequenceResponse(SOAPFactory factory, String namespaceValue) {
+	public CreateSequenceResponse(SOAPFactory factory, String namespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(namespaceValue))
+			throw new SandeshaException ("Unsupported namespace");
+		
 		this.factory = factory;
 		this.namespaceValue = namespaceValue;
 		createSeqResNoNamespace = factory.createOMNamespace(
@@ -58,7 +62,7 @@
 		return createSequenceResponseElement;
 	}
 
-	public Object fromOMElement(OMElement bodyElement) throws OMException {
+	public Object fromOMElement(OMElement bodyElement) throws OMException,SandeshaException {
 
 		if (bodyElement == null || !(bodyElement instanceof SOAPBody))
 			throw new OMException(
@@ -167,5 +171,15 @@
 			elem.detach();
 		
 		toOMElement(body);
+	}
+	
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		if (Sandesha2Constants.SPEC_2005_10.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
 	}
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Expires.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Expires.java?rev=381274&r1=381273&r2=381274&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Expires.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Expires.java Sun Feb 26 22:49:27 2006
@@ -24,6 +24,7 @@
 import org.apache.ws.commons.om.OMNamespace;
 import org.apache.ws.commons.soap.SOAPFactory;
 import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
 
 /**
  * @author Chamikara Jayalath <ch...@gmail.com>
@@ -39,7 +40,10 @@
 	String duration = null;
 	String namespaceValue = null;
 
-	public Expires(SOAPFactory factory,String namespaceValue) {
+	public Expires(SOAPFactory factory,String namespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(namespaceValue))
+			throw new SandeshaException ("Unsupported namespace");
+		
 		this.factory = factory;
 		this.namespaceValue = namespaceValue;
 		rmNamespace = factory.createOMNamespace(
@@ -100,5 +104,15 @@
 
 	public void setExpiresElement(OMElement expiresElement) {
 		this.expiresElement = expiresElement;
+	}
+	
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		if (Sandesha2Constants.SPEC_2005_10.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
 	}
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/FaultCode.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/FaultCode.java?rev=381274&r1=381273&r2=381274&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/FaultCode.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/FaultCode.java Sun Feb 26 22:49:27 2006
@@ -23,6 +23,7 @@
 import org.apache.ws.commons.om.OMNamespace;
 import org.apache.ws.commons.soap.SOAPFactory;
 import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
 
 /**
  * @author Chamikara Jayalath <ch...@gmail.com>
@@ -38,7 +39,10 @@
 	OMNamespace rmNameSpace = null;
 	String namespaceValue = null;
 	
-	public FaultCode(SOAPFactory factory, String namespaceValue) {
+	public FaultCode(SOAPFactory factory, String namespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(namespaceValue))
+			throw new SandeshaException ("Unsupported namespace");
+		
 		this.factory = factory;
 		this.namespaceValue = namespaceValue;
 		rmNameSpace = factory.createOMNamespace(
@@ -102,4 +106,13 @@
         return faultCode;
     }
 
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		if (Sandesha2Constants.SPEC_2005_10.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
+	}
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/IOMRMElement.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/IOMRMElement.java?rev=381274&r1=381273&r2=381274&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/IOMRMElement.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/IOMRMElement.java Sun Feb 26 22:49:27 2006
@@ -24,11 +24,13 @@
  * @author Saminda Abeyruwan  <sa...@opensource.lk>
  */
 
+import org.apache.sandesha2.SandeshaException;
 import org.apache.ws.commons.om.OMElement;
 import org.apache.ws.commons.om.OMException;
 
 public interface IOMRMElement {
 	public OMElement getOMElement() throws OMException;
-	public Object fromOMElement(OMElement element) throws OMException;
-	public OMElement toOMElement(OMElement element) throws OMException;
+	public Object fromOMElement(OMElement element) throws OMException,SandeshaException ;
+	public OMElement toOMElement(OMElement element) throws OMException, SandeshaException ;
+	public boolean isNamespaceSupported (String namespaceName);
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Identifier.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Identifier.java?rev=381274&r1=381273&r2=381274&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Identifier.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Identifier.java Sun Feb 26 22:49:27 2006
@@ -29,6 +29,7 @@
 import org.apache.ws.commons.om.OMNamespace;
 import org.apache.ws.commons.soap.SOAPFactory;
 import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
 
 public class Identifier implements Sandesha2Constants, IOMRMElement {
 
@@ -38,7 +39,10 @@
 	private SOAPFactory factory;
 	String namespaceValue = null;
 	
-	public Identifier(SOAPFactory factory, String namespaceValue) {
+	public Identifier(SOAPFactory factory, String namespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(namespaceValue))
+			throw new SandeshaException ("Unsupported namespace");
+		
 		this.factory = factory;
 		this.namespaceValue = namespaceValue;
 		wsrmNamespace = factory.createOMNamespace(
@@ -99,5 +103,15 @@
 
 	public int hashCode() {
 		return identifier.hashCode();
+	}
+	
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		if (Sandesha2Constants.SPEC_2005_10.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
 	}
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/LastMessage.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/LastMessage.java?rev=381274&r1=381273&r2=381274&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/LastMessage.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/LastMessage.java Sun Feb 26 22:49:27 2006
@@ -23,6 +23,7 @@
 import org.apache.ws.commons.om.OMNamespace;
 import org.apache.ws.commons.soap.SOAPFactory;
 import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
 
 /**
  * @author Chamikara Jayalath <ch...@gmail.com>
@@ -37,7 +38,10 @@
 	SOAPFactory factory;
 	String namespaceValue = null;
 	
-	public LastMessage(SOAPFactory factory,String namespaceValue) {
+	public LastMessage(SOAPFactory factory,String namespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(namespaceValue))
+			throw new SandeshaException ("Unsupported namespace");
+		
 		this.factory = factory;
 		this.namespaceValue = namespaceValue;
 		rmNamespace = factory.createOMNamespace(
@@ -86,5 +90,16 @@
 
 	public boolean isPresent() {
 		return (lastMessageElement != null) ? true : false;
+	}
+	
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		//TODO is this optional or not required.
+		if (Sandesha2Constants.SPEC_2005_10.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
 	}
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/MessageNumber.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/MessageNumber.java?rev=381274&r1=381273&r2=381274&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/MessageNumber.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/MessageNumber.java Sun Feb 26 22:49:27 2006
@@ -23,6 +23,7 @@
 import org.apache.ws.commons.om.OMNamespace;
 import org.apache.ws.commons.soap.SOAPFactory;
 import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
 
 /**
  * @author Chamikara Jayalath <ch...@gmail.com>
@@ -38,7 +39,10 @@
 	SOAPFactory factory;
 	String namespaceValue = null;
 	
-	public MessageNumber(SOAPFactory factory,String namespaceValue){
+	public MessageNumber(SOAPFactory factory,String namespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(namespaceValue))
+			throw new SandeshaException ("Unsupported namespace");
+		
 		this.factory = factory;
 		this.namespaceValue = namespaceValue;
 	    rmNamespace = factory.createOMNamespace(namespaceValue, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
@@ -86,5 +90,14 @@
 		return messageNoElement;
 	}
 
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		if (Sandesha2Constants.SPEC_2005_10.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
+	}
 
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Nack.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Nack.java?rev=381274&r1=381273&r2=381274&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Nack.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Nack.java Sun Feb 26 22:49:27 2006
@@ -21,6 +21,7 @@
 import org.apache.ws.commons.om.OMNamespace;
 import org.apache.ws.commons.soap.SOAPFactory;
 import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
 
 /**
  * @author Chamikara Jayalath <ch...@gmail.com>
@@ -36,7 +37,10 @@
 	OMNamespace rmNamespace = null;
 	String namespaceValue = null;
 		
-	public Nack(SOAPFactory factory,String namespaceValue){
+	public Nack(SOAPFactory factory,String namespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(namespaceValue))
+			throw new SandeshaException ("Unsupported namespace");
+		
 		this.factory = factory;
 		this.namespaceValue = namespaceValue;
 		rmNamespace = factory.createOMNamespace(namespaceValue, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
@@ -94,5 +98,14 @@
 	public void setNackNumber(long nackNumber) {
 		this.nackNumber = nackNumber;
 	}
-	
+
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		if (Sandesha2Constants.SPEC_2005_10.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
+	}
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/RMElements.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/RMElements.java?rev=381274&r1=381273&r2=381274&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/RMElements.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/RMElements.java Sun Feb 26 22:49:27 2006
@@ -21,6 +21,7 @@
 import javax.xml.namespace.QName;
 
 import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
 import org.apache.sandesha2.util.SOAPAbstractFactory;
 import org.apache.ws.commons.om.OMElement;
 import org.apache.ws.commons.om.OMException;
@@ -42,11 +43,12 @@
 	private CreateSequence createSequence = null;
 	private CreateSequenceResponse createSequenceResponse = null;
 	private TerminateSequence terminateSequence = null;
+	private TerminateSequenceResponse terminateSequenceResponse = null;
 	private AckRequested ackRequested = null;
 	private SOAPFactory factory = null;
 	String rmNamespaceValue = null;
 	
-	public void fromSOAPEnvelope(SOAPEnvelope envelope, String action) {
+	public void fromSOAPEnvelope(SOAPEnvelope envelope, String action) throws SandeshaException {
 
 		if (envelope == null)
 			throw new OMException("The passed envelope is null");
@@ -107,6 +109,15 @@
 			terminateSequence = new TerminateSequence(factory,rmNamespaceValue);
 			terminateSequence.fromOMElement(envelope.getBody());
 		}
+		
+		OMElement terminateSeqResponseElement = envelope.getBody()
+				.getFirstChildWithName(
+						new QName(rmNamespaceValue,
+								Sandesha2Constants.WSRM_COMMON.TERMINATE_SEQUENCE_RESPONSE));
+		if (terminateSeqResponseElement != null) {
+				terminateSequenceResponse = new TerminateSequenceResponse (factory,rmNamespaceValue);
+				terminateSequenceResponse.fromOMElement(envelope.getBody());
+		}
 
 		OMElement ackRequestedElement = envelope.getHeader()
 				.getFirstChildWithName(
@@ -159,6 +170,10 @@
 	public TerminateSequence getTerminateSequence() {
 		return terminateSequence;
 	}
+	
+	public TerminateSequenceResponse getTerminateSequenceResponse() {
+		return terminateSequenceResponse;
+	}
 
 	public void setCreateSequence(CreateSequence createSequence) {
 		this.createSequence = createSequence;
@@ -180,6 +195,10 @@
 
 	public void setTerminateSequence(TerminateSequence terminateSequence) {
 		this.terminateSequence = terminateSequence;
+	}
+	
+	public void setTerminateSequenceResponse(TerminateSequenceResponse terminateSequenceResponse) {
+		this.terminateSequenceResponse = terminateSequenceResponse;
 	}
 
 	public AckRequested getAckRequested() {

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Sequence.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Sequence.java?rev=381274&r1=381273&r2=381274&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Sequence.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Sequence.java Sun Feb 26 22:49:27 2006
@@ -26,6 +26,7 @@
 import org.apache.ws.commons.soap.SOAPHeader;
 import org.apache.ws.commons.soap.SOAPHeaderBlock;
 import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
 
 /**
  * @author Chamikara Jayalath <ch...@gmail.com>
@@ -44,7 +45,10 @@
 	private boolean mustUnderstand = true;
 	String namespaceValue = null;
 	
-	public Sequence(SOAPFactory factory,String namespaceValue) {
+	public Sequence(SOAPFactory factory,String namespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(namespaceValue))
+			throw new SandeshaException ("Unsupported namespace");
+		
 		this.factory = factory;
 		this.namespaceValue = namespaceValue;
 		seqNoNamespace = factory.createOMNamespace(
@@ -57,7 +61,7 @@
 		return sequenceElement;
 	}
 
-	public Object fromOMElement(OMElement headerElement) throws OMException {
+	public Object fromOMElement(OMElement headerElement) throws OMException,SandeshaException {
 
 		SOAPHeader header = (SOAPHeader) headerElement;
 		if (header == null)
@@ -178,6 +182,14 @@
 		this.mustUnderstand = mustUnderstand;
 	}
 	
-	
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		if (Sandesha2Constants.SPEC_2005_10.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
+	}
 
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceAcknowledgement.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceAcknowledgement.java?rev=381274&r1=381273&r2=381274&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceAcknowledgement.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceAcknowledgement.java Sun Feb 26 22:49:27 2006
@@ -30,6 +30,7 @@
 import org.apache.ws.commons.soap.SOAPHeader;
 import org.apache.ws.commons.soap.SOAPHeaderBlock;
 import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
 
 /**
  * Adds the SequenceAcknowledgement header block.
@@ -50,7 +51,10 @@
 	String namespaceValue = null;
 	private boolean mustUnderstand = true;
 	
-	public SequenceAcknowledgement(SOAPFactory factory,String namespaceValue) {
+	public SequenceAcknowledgement(SOAPFactory factory,String namespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(namespaceValue))
+			throw new SandeshaException ("Unsupported namespace");
+		
 		this.namespaceValue = namespaceValue;
 		this.factory = factory;
 		rmNamespace = factory.createOMNamespace(
@@ -65,7 +69,7 @@
 		return sequenceAcknowledgementElement;
 	}
 
-	public Object fromOMElement(OMElement element) throws OMException {
+	public Object fromOMElement(OMElement element) throws OMException,SandeshaException {
 
 		if (element == null || !(element instanceof SOAPHeader))
 			throw new OMException(
@@ -206,5 +210,13 @@
 		this.mustUnderstand = mustUnderstand;
 	}
 
-	
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		if (Sandesha2Constants.SPEC_2005_10.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
+	}
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceFault.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceFault.java?rev=381274&r1=381273&r2=381274&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceFault.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceFault.java Sun Feb 26 22:49:27 2006
@@ -24,6 +24,7 @@
 import org.apache.ws.commons.soap.SOAPBody;
 import org.apache.ws.commons.soap.SOAPFactory;
 import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
 
 /**
  * Adds the SequenceFault header block.
@@ -41,7 +42,10 @@
 	OMNamespace rmNamespace = null;
 	String namespaceValue = null;
 
-	public SequenceFault(SOAPFactory factory,String namespaceValue) {
+	public SequenceFault(SOAPFactory factory,String namespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(namespaceValue))
+			throw new SandeshaException ("Unsupported namespace");
+		
 		this.factory = factory;
 		this.namespaceValue = namespaceValue;
 		rmNamespace = factory.createOMNamespace(
@@ -54,7 +58,7 @@
 		return sequenceFaultElement;
 	}
 
-	public Object fromOMElement(OMElement body) throws OMException {
+	public Object fromOMElement(OMElement body) throws OMException,SandeshaException {
 
 		if (body == null || !(body instanceof SOAPBody))
 			throw new OMException(
@@ -118,6 +122,16 @@
 
 	public OMElement getSequenceFaultElement() {
 		return sequenceFaultElement;
+	}
+	
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		if (Sandesha2Constants.SPEC_2005_10.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
 	}
 
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceOffer.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceOffer.java?rev=381274&r1=381273&r2=381274&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceOffer.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceOffer.java Sun Feb 26 22:49:27 2006
@@ -23,6 +23,7 @@
 import org.apache.ws.commons.om.OMNamespace;
 import org.apache.ws.commons.soap.SOAPFactory;
 import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
 
 /**
  * @author Chamikara Jayalath <ch...@gmail.com>
@@ -39,7 +40,10 @@
 	OMNamespace rmNamespace = null; 
 	String namespaceValue = null;
 
-	public SequenceOffer(SOAPFactory factory,String namespaceValue) {
+	public SequenceOffer(SOAPFactory factory,String namespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(namespaceValue))
+			throw new SandeshaException ("Unsupported namespace");
+		
 		this.factory = factory;
 		this.namespaceValue = namespaceValue;
 		rmNamespace = factory.createOMNamespace(
@@ -53,7 +57,7 @@
 	}
 
 	public Object fromOMElement(OMElement createSequenceElement)
-			throws OMException {
+			throws OMException,SandeshaException {
 		OMElement sequenceOfferPart = createSequenceElement
 				.getFirstChildWithName(new QName(namespaceValue,
 						Sandesha2Constants.WSRM_COMMON.SEQUENCE_OFFER));
@@ -107,6 +111,16 @@
 
 	public void setIdentifier(Identifier identifier) {
 		this.identifier = identifier;
+	}
+	
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		if (Sandesha2Constants.SPEC_2005_10.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
 	}
 
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/TerminateSequence.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/TerminateSequence.java?rev=381274&r1=381273&r2=381274&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/TerminateSequence.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/TerminateSequence.java Sun Feb 26 22:49:27 2006
@@ -25,6 +25,7 @@
 import org.apache.ws.commons.soap.SOAPEnvelope;
 import org.apache.ws.commons.soap.SOAPFactory;
 import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
 
 /**
  * Adds the Terminate Sequence body part.
@@ -42,7 +43,10 @@
 	SOAPFactory factory;
 	String namespaceValue = null;
 	
-	public TerminateSequence(SOAPFactory factory, String namespaceValue) {
+	public TerminateSequence(SOAPFactory factory, String namespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(namespaceValue))
+			throw new SandeshaException ("Unsupported namespace");
+		
 		this.factory = factory;
 		this.namespaceValue = namespaceValue;
 		rmNameSpace = factory.createOMNamespace(
@@ -55,7 +59,7 @@
 		return terminateSequenceElement;
 	}
 
-	public Object fromOMElement(OMElement body) throws OMException {
+	public Object fromOMElement(OMElement body) throws OMException,SandeshaException {
 
 		if (!(body instanceof SOAPBody))
 			throw new OMException(
@@ -118,5 +122,15 @@
 			elem.detach();
 		
 		toOMElement(body);
+	}
+	
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		if (Sandesha2Constants.SPEC_2005_10.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
 	}
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org