You are viewing a plain text version of this content. The canonical link for it is here.
Posted to sandesha-dev@ws.apache.org by ch...@apache.org on 2007/04/23 11:55:16 UTC

svn commit: r531400 [11/18] - in /webservices/sandesha/trunk/java/modules: client/ core/ core/src/ core/src/main/ core/src/main/java/ core/src/main/java/org/ core/src/main/java/org/apache/ core/src/main/java/org/apache/sandesha2/ core/src/main/java/org...

Added: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/SenderWorker.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/SenderWorker.java?view=auto&rev=531400
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/SenderWorker.java (added)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/SenderWorker.java Mon Apr 23 02:54:53 2007
@@ -0,0 +1,607 @@
+package org.apache.sandesha2.workers;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ContextFactory;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.engine.Handler.InvocationResponse;
+import org.apache.axis2.transport.RequestResponseTransport;
+import org.apache.axis2.transport.TransportUtils;
+import org.apache.axis2.transport.RequestResponseTransport.RequestResponseTransportStatus;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.wsdl.WSDLConstants;
+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.i18n.SandeshaMessageHelper;
+import org.apache.sandesha2.i18n.SandeshaMessageKeys;
+import org.apache.sandesha2.policy.SandeshaPolicyBean;
+import org.apache.sandesha2.storage.StorageManager;
+import org.apache.sandesha2.storage.Transaction;
+import org.apache.sandesha2.storage.beanmanagers.SenderBeanMgr;
+import org.apache.sandesha2.storage.beans.RMSBean;
+import org.apache.sandesha2.storage.beans.RMSequenceBean;
+import org.apache.sandesha2.storage.beans.SenderBean;
+import org.apache.sandesha2.util.AcknowledgementManager;
+import org.apache.sandesha2.util.MessageRetransmissionAdjuster;
+import org.apache.sandesha2.util.MsgInitializer;
+import org.apache.sandesha2.util.SandeshaUtil;
+import org.apache.sandesha2.util.SpecSpecificConstants;
+import org.apache.sandesha2.util.TerminateManager;
+import org.apache.sandesha2.wsrm.AckRequested;
+import org.apache.sandesha2.wsrm.CloseSequence;
+import org.apache.sandesha2.wsrm.Identifier;
+import org.apache.sandesha2.wsrm.LastMessage;
+import org.apache.sandesha2.wsrm.MessageNumber;
+import org.apache.sandesha2.wsrm.Sequence;
+import org.apache.sandesha2.wsrm.TerminateSequence;
+
+public class SenderWorker extends SandeshaWorker implements Runnable {
+
+  private static final Log log = LogFactory.getLog(SenderWorker.class);
+
+	private ConfigurationContext configurationContext = null;
+	private SenderBean senderBean = null;
+	private RMMsgContext messageToSend = null;
+	
+	public SenderWorker (ConfigurationContext configurationContext, SenderBean senderBean) {
+		this.configurationContext = configurationContext;
+		this.senderBean = senderBean;
+	}
+	
+	public void setMessage(RMMsgContext msg) {
+		this.messageToSend = msg;
+	}
+	
+	public void run () {
+		
+		if (log.isDebugEnabled())
+			log.debug("Enter: SenderWorker::run");
+
+		Transaction transaction = null;
+		
+		try {
+			StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext, configurationContext.getAxisConfiguration());
+			SenderBeanMgr senderBeanMgr = storageManager.getSenderBeanMgr();
+			
+			transaction = storageManager.getTransaction();
+
+			String key = senderBean.getMessageContextRefKey();
+			MessageContext msgCtx = null;
+			RMMsgContext   rmMsgCtx = null;
+			if(messageToSend != null) {
+				msgCtx = messageToSend.getMessageContext();
+				rmMsgCtx = messageToSend;
+			} else {
+				msgCtx = storageManager.retrieveMessageContext(key, configurationContext);
+      
+				if (msgCtx == null) {
+					// This sender bean has already been processed
+					return;
+				}
+      
+				rmMsgCtx = MsgInitializer.initializeMessage(msgCtx);
+			}
+
+			// sender will not send the message if following property is
+			// set and not true.
+			// But it will set if it is not set (null)
+
+			// This is used to make sure that the mesage get passed the
+			// Sandesha2TransportSender.
+
+			String qualifiedForSending = (String) msgCtx.getProperty(Sandesha2Constants.QUALIFIED_FOR_SENDING);
+			if (qualifiedForSending != null && !qualifiedForSending.equals(Sandesha2Constants.VALUE_TRUE)) {
+				if (log.isDebugEnabled())
+					log.debug("Exit: SenderWorker::run, !qualified for sending");
+				return;
+			}
+
+			if (msgCtx == null) {
+				if (log.isDebugEnabled())
+					log.debug(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.sendHasUnavailableMsgEntry));
+				return;			
+			}
+
+			// operation is the lowest level Sandesha2 should be attached
+			ArrayList msgsNotToSend = SandeshaUtil.getPropertyBean(msgCtx.getAxisOperation()).getMsgTypesToDrop();
+
+			if (msgsNotToSend != null && msgsNotToSend.contains(new Integer(rmMsgCtx.getMessageType()))) {
+				if (log.isDebugEnabled())
+					log.debug("Exit: SenderWorker::run, message type to be dropped " + rmMsgCtx.getMessageType());
+				return;	
+			}
+
+			// If we are sending to the anonymous URI then we _must_ have a transport waiting,
+			// or the message can't go anywhere. If there is nothing here then we leave the
+			// message in the sender queue, and a MakeConnection (or a retransmitted request)
+			// will hopefully pick it up soon.
+			RequestResponseTransport t = null;
+			Boolean makeConnection = (Boolean) msgCtx.getProperty(Sandesha2Constants.MAKE_CONNECTION_RESPONSE);
+			EndpointReference toEPR = msgCtx.getTo();
+
+			MessageContext inMsg = null;
+			OperationContext op = msgCtx.getOperationContext();
+			if (op != null)
+				inMsg = op.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+			if (inMsg != null)
+				t = (RequestResponseTransport) inMsg.getProperty(RequestResponseTransport.TRANSPORT_CONTROL);
+
+			// If we are anonymous, and this is not a makeConnection, then we must have a transport waiting
+			if((toEPR==null || toEPR.hasAnonymousAddress()) &&
+			   (makeConnection == null || !makeConnection.booleanValue()) &&
+			   (t == null || !t.getStatus().equals(RequestResponseTransportStatus.WAITING))) {
+				
+				// Mark this sender bean so that we know that the transport is unavailable, if the
+				// bean is still stored.
+				SenderBean bean = senderBeanMgr.retrieve(senderBean.getMessageID());
+				if(bean != null && bean.isTransportAvailable()) {
+					bean.setTransportAvailable(false);
+					senderBeanMgr.update(bean);
+				}
+				
+				if (log.isDebugEnabled())
+					log.debug("Exit: SenderWorker::run, no response transport for anonymous message");
+				return;
+			}
+			
+			boolean continueSending = updateMessage(rmMsgCtx,senderBean,storageManager);
+
+			if (!continueSending) { 
+				if (log.isDebugEnabled())
+					log.debug("Exit: SenderWorker::run, !continueSending");
+				return;
+			}
+
+			int messageType = senderBean.getMessageType();
+			
+			if (isAckPiggybackableMsgType(messageType)) {
+				// Piggyback ack messages based on the 'To' address of the message
+				AcknowledgementManager.piggybackAcksIfPresent(rmMsgCtx, storageManager);
+			}
+
+			// sending the message
+			boolean successfullySent = false;
+
+			// have to commit the transaction before sending. This may
+			// get changed when WS-AT is available.
+			if(transaction != null) {
+				transaction.commit();
+				transaction = null;
+				transaction = storageManager.getTransaction();
+			}
+
+			// Although not actually sent yet, update the send count to indicate an attempt
+			if (senderBean.isReSend()) {
+				SenderBean bean2 = senderBeanMgr.retrieve(senderBean.getMessageID());
+				if (bean2 != null) {
+					bean2.setSentCount(senderBean.getSentCount());
+					senderBeanMgr.update(bean2);
+				}
+			}
+			
+			// have to commit the transaction before sending. This may
+			// get changed when WS-AT is available.
+			if(transaction != null) {
+				transaction.commit();
+				transaction = null;
+			}
+
+			msgCtx.getOptions().setTimeOutInMilliSeconds(1000000);
+			
+			try {
+				AxisEngine engine = new AxisEngine (msgCtx.getConfigurationContext());
+				InvocationResponse response = InvocationResponse.CONTINUE;
+				
+				SandeshaPolicyBean policy = SandeshaUtil.getPropertyBean(msgCtx.getAxisOperation());
+				if(policy.isUseMessageSerialization()) {
+					if(msgCtx.isPaused()) {
+						if (log.isDebugEnabled())
+							log.debug("Resuming a send for message : " + msgCtx.getEnvelope().getHeader());
+						msgCtx.setPaused(false);
+						msgCtx.setProperty(MessageContext.TRANSPORT_NON_BLOCKING, Boolean.FALSE);
+						response = engine.resumeSend(msgCtx);
+					} else {
+						if (log.isDebugEnabled())
+							log.debug("Sending a message : " + msgCtx.getEnvelope().getHeader());
+						msgCtx.setProperty(MessageContext.TRANSPORT_NON_BLOCKING, Boolean.FALSE);
+						engine.send(msgCtx);  // TODO check if this should return an invocation response
+					}
+				} else {
+					// had to fully build the SOAP envelope to support
+					// retransmissions.
+					// Otherwise a 'parserAlreadyAccessed' exception could
+					// get thrown in retransmissions.
+					// But this has a performance reduction.
+					msgCtx.getEnvelope().build();
+	
+					ArrayList retransmittablePhases = (ArrayList) msgCtx.getProperty(Sandesha2Constants.RETRANSMITTABLE_PHASES);
+					if (retransmittablePhases!=null) {
+						msgCtx.setExecutionChain(retransmittablePhases);
+					} else {
+						ArrayList emptyExecutionChain = new ArrayList ();
+						msgCtx.setExecutionChain(emptyExecutionChain);
+					}
+					
+					msgCtx.setCurrentHandlerIndex(0);
+					msgCtx.setCurrentPhaseIndex(0);
+					msgCtx.setPaused(false);
+				
+					if (log.isDebugEnabled())
+						log.debug("Resuming a send for message : " + msgCtx.getEnvelope().getHeader());
+					response = engine.resumeSend(msgCtx);
+				}
+				if(log.isDebugEnabled()) log.debug("Engine resume returned " + response);
+				if(response != InvocationResponse.SUSPEND) {
+					if(t != null) {
+						if(log.isDebugEnabled()) log.debug("Signalling transport in " + t);
+						t.signalResponseReady();
+					}
+				}
+				
+				successfullySent = true;
+			} catch (Exception e) {
+				String message = SandeshaMessageHelper.getMessage(
+						SandeshaMessageKeys.sendMsgError, e.toString());
+				
+				if (log.isErrorEnabled())
+				  log.error(message, e);
+				// Store the Exception as a sequence property to enable the client to lookup the last 
+				// exception time and timestamp.
+				
+				// Create a new Transaction
+				transaction = storageManager.getTransaction();
+			
+				try
+				{
+					
+					// Get the internal sequence id from the context
+					String internalSequenceId = (String)rmMsgCtx.getProperty(Sandesha2Constants.MessageContextProperties.INTERNAL_SEQUENCE_ID);
+					
+					RMSBean bean = SandeshaUtil.getRMSBeanFromInternalSequenceId(storageManager, internalSequenceId);
+					
+					if (bean != null) {						
+						bean.setLastSendError(e);
+						bean.setLastSendErrorTimestamp(System.currentTimeMillis());
+					}
+					
+					// Update the RMSBean
+					storageManager.getRMSBeanMgr().update(bean);
+					
+					// Commit the properties
+					if(transaction != null) {
+						transaction.commit();
+						transaction = null;
+					}
+				}
+				catch (Exception e1)
+				{
+					if (log.isErrorEnabled())
+						log.error(e1);
+					
+					if (transaction != null) {
+						transaction.rollback();
+						transaction = null;
+					}
+				}
+				
+			}
+			// Establish the transaction for post-send processing
+			transaction = storageManager.getTransaction();
+
+			// update or delete only if the object is still present.
+			SenderBean bean1 = senderBeanMgr
+					.retrieve(senderBean.getMessageID());
+			if (bean1 != null) {
+				if (senderBean.isReSend()) {
+					bean1.setTimeToSend(senderBean.getTimeToSend());
+					senderBeanMgr.update(bean1);
+				} else {
+					senderBeanMgr.delete(bean1.getMessageID());
+
+					// removing the message from the storage.
+					String messageStoredKey = bean1.getMessageContextRefKey();
+					storageManager.removeMessageContext(messageStoredKey);
+				}
+			}
+
+			// Commit the transaction to release the SenderBean
+
+			if (transaction!=null)
+				transaction.commit();
+			
+			transaction = null;
+
+			if (successfullySent && !msgCtx.isServerSide()) 
+				checkForSyncResponses(msgCtx);
+			
+			if ((rmMsgCtx.getMessageType() == Sandesha2Constants.MessageTypes.TERMINATE_SEQ)
+					&&
+					 (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(rmMsgCtx.getRMNamespaceValue()))) {
+				transaction = storageManager.getTransaction();
+				//terminate message sent using the SandeshaClient. Since the terminate message will simply get the
+				//InFlow of the reference message get called which could be zero sized (OutOnly operations).
+				
+				// terminate sending side if this is the WSRM 1.0 spec. 
+				// If the WSRM versoion is 1.1 termination will happen in the terminate sequence response message.
+				
+				TerminateSequence terminateSequence = (TerminateSequence) rmMsgCtx
+						.getMessagePart(Sandesha2Constants.MessageParts.TERMINATE_SEQ);
+				String sequenceID = terminateSequence.getIdentifier().getIdentifier();
+
+				RMSBean rmsBean = SandeshaUtil.getRMSBeanFromSequenceId(storageManager, sequenceID);
+				TerminateManager.terminateSendingSide(rmsBean, storageManager);
+				
+				transaction.commit();
+			}
+
+		} catch (Exception e) {
+			if (log.isErrorEnabled()) log.error("Caught exception", e);
+			if (transaction!=null) {
+				transaction.rollback();
+				transaction = null;
+			}
+		} finally {
+			if (transaction!=null) transaction.commit();
+			
+			if (lock!=null && workId!=null) {
+				lock.removeWork(workId);
+			}
+		}
+		
+		if (log.isDebugEnabled())
+			log.debug("Exit: SenderWorker::run");
+	}
+	
+	/**
+	 * Update the message before sending it. We adjust the retransmission intervals and send counts
+	 * for the message. If the message is an application message then we ensure that we have added
+	 * the Sequence header.
+	 */
+	private boolean updateMessage(RMMsgContext rmMsgContext, SenderBean senderBean, StorageManager storageManager) throws AxisFault {
+		
+		// Lock the message to enable retransmission update
+		senderBean = storageManager.getSenderBeanMgr().retrieve(senderBean.getMessageID());
+		
+		boolean continueSending = MessageRetransmissionAdjuster.adjustRetransmittion(
+				rmMsgContext, senderBean, rmMsgContext.getConfigurationContext(), storageManager);
+		if(!continueSending) return false;
+		
+		Identifier id = null;
+
+		if(senderBean.getMessageType() == Sandesha2Constants.MessageTypes.APPLICATION) {
+			RMSequenceBean bean = SandeshaUtil.getRMSBeanFromSequenceId(storageManager, senderBean.getSequenceID());
+			String namespace = SpecSpecificConstants.getRMNamespaceValue(bean.getRMVersion());
+			Sequence sequence = (Sequence) rmMsgContext.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE);
+			if(sequence == null) {
+				sequence = new Sequence(namespace);
+				
+				MessageNumber msgNumber = new MessageNumber(namespace);
+				msgNumber.setMessageNumber(senderBean.getMessageNumber());
+				sequence.setMessageNumber(msgNumber);
+
+				if(senderBean.isLastMessage() &&
+				   SpecSpecificConstants.isLastMessageIndicatorRequired(bean.getRMVersion())) {
+					sequence.setLastMessage(new LastMessage(namespace));
+				}
+				
+				// We just create the id here, we will add the value in later
+				id = new Identifier(namespace);
+				sequence.setIdentifier(id);
+				
+				rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.SEQUENCE, sequence);
+			}
+			
+		} else if(senderBean.getMessageType() == Sandesha2Constants.MessageTypes.TERMINATE_SEQ) {
+			TerminateSequence terminate = (TerminateSequence) rmMsgContext.getMessagePart(Sandesha2Constants.MessageParts.TERMINATE_SEQ);
+			id = terminate.getIdentifier();
+
+		} else if(senderBean.getMessageType() == Sandesha2Constants.MessageTypes.CLOSE_SEQUENCE) {
+			CloseSequence close = (CloseSequence) rmMsgContext.getMessagePart(Sandesha2Constants.MessageParts.CLOSE_SEQUENCE);
+			id = close.getIdentifier();
+		
+		} else if(senderBean.getMessageType() == Sandesha2Constants.MessageTypes.ACK_REQUEST) {
+			// The only time that we can have a message of this type is when we are sending a
+			// stand-alone ack request, and in that case we only expect to find a single ack
+			// request header in the message.
+			Iterator ackRequests = rmMsgContext.getMessageParts(Sandesha2Constants.MessageParts.ACK_REQUEST);
+			AckRequested ackRequest = (AckRequested) ackRequests.next(); 
+			if (ackRequests.hasNext()) {
+				throw new SandeshaException (SandeshaMessageHelper.getMessage(SandeshaMessageKeys.ackRequestMultipleParts));
+			}
+			id = ackRequest.getIdentifier();
+		}
+		
+		// TODO consider adding an extra ack request, as we are about to send the message and we
+		// know which sequence it is associated with.
+
+		if(id != null && !senderBean.getSequenceID().equals(id.getIdentifier())) {
+			id.setIndentifer(senderBean.getSequenceID());
+
+			// Write the changes back into the message context
+			rmMsgContext.addSOAPEnvelope();
+		}
+		
+		return true;
+	}
+	
+	private boolean isAckPiggybackableMsgType(int messageType) {
+		if (log.isDebugEnabled())
+			log.debug("Enter: SenderWorker::isAckPiggybackableMsgType, " + messageType);
+		boolean piggybackable = true;
+
+		if (messageType == Sandesha2Constants.MessageTypes.ACK)
+			piggybackable = false;
+
+		if (log.isDebugEnabled())
+			log.debug("Exit: SenderWorker::isAckPiggybackableMsgType, " + piggybackable);
+		return piggybackable;
+	}
+	
+	private void checkForSyncResponses(MessageContext msgCtx) {
+		if (log.isDebugEnabled())
+			log.debug("Enter: SenderWorker::checkForSyncResponses, " + msgCtx.getEnvelope().getHeader());
+
+		try {
+
+			boolean responsePresent = (msgCtx.getProperty(MessageContext.TRANSPORT_IN) != null);
+			if (!responsePresent) {
+				if(log.isDebugEnabled()) log.debug("Exit: SenderWorker::checkForSyncResponses, no response present");
+				return;
+			}
+
+			// create the responseMessageContext
+
+			MessageContext responseMessageContext = new MessageContext();
+
+			OperationContext requestMsgOpCtx = msgCtx.getOperationContext();
+			responseMessageContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, requestMsgOpCtx
+							.getProperty(Constants.Configuration.CHARACTER_SET_ENCODING));
+			responseMessageContext.setProperty(Constants.Configuration.CONTENT_TYPE, requestMsgOpCtx
+							.getProperty(Constants.Configuration.CONTENT_TYPE));
+			responseMessageContext.setProperty(HTTPConstants.MTOM_RECEIVED_CONTENT_TYPE, requestMsgOpCtx
+					.getProperty(HTTPConstants.MTOM_RECEIVED_CONTENT_TYPE));
+
+            //If the response MsgCtx was not available Axis2 would hv put the transport info into a 
+            //HashMap, getting the data from it.
+			HashMap transportInfoMap = (HashMap) msgCtx.getProperty(Constants.Configuration.TRANSPORT_INFO_MAP);
+			if (transportInfoMap != null) {
+				responseMessageContext.setProperty(Constants.Configuration.CONTENT_TYPE, 
+								transportInfoMap.get(Constants.Configuration.CONTENT_TYPE));
+				responseMessageContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING,
+						transportInfoMap.get(Constants.Configuration.CHARACTER_SET_ENCODING));
+			}
+			
+			//setting the message as serverSide will let it go through the MessageReceiver (may be callback MR).
+			responseMessageContext.setServerSide(true);
+			
+			if (responseMessageContext.getSoapAction()==null) {
+				//if there is no SOAP action in the response message, Axis2 will wrongly identify it as a REST message
+				//This happens because we set serverSide to True in a previous step.
+				//So we have to add a empty SOAPAction here.
+				responseMessageContext.setSoapAction("");
+			}
+			
+			responseMessageContext.setConfigurationContext(msgCtx.getConfigurationContext());
+			responseMessageContext.setTransportIn(msgCtx.getTransportIn());
+			responseMessageContext.setTransportOut(msgCtx.getTransportOut());
+
+			responseMessageContext.setProperty(MessageContext.TRANSPORT_IN, msgCtx
+					.getProperty(MessageContext.TRANSPORT_IN));
+			responseMessageContext.setServiceContext(msgCtx.getServiceContext());
+			responseMessageContext.setServiceGroupContext(msgCtx.getServiceGroupContext());
+
+			responseMessageContext.setProperty(Sandesha2Constants.MessageContextProperties.MAKECONNECTION_ENTRY,
+					msgCtx.getProperty(Sandesha2Constants.MessageContextProperties.MAKECONNECTION_ENTRY));
+
+			// If request is REST we assume the responseMessageContext is REST,
+			// so set the variable
+
+			responseMessageContext.setDoingREST(msgCtx.isDoingREST());
+
+			SOAPEnvelope resenvelope = null;
+			try {
+				// MessageContext is modified in TransportUtils.createSOAPMessage(). It might be used by axis.engine or handler.
+				// To catch the modification and pass it to engine or handler, resenvelope is created by responseMessageContext. 
+				resenvelope = TransportUtils.createSOAPMessage(responseMessageContext);
+			} catch (AxisFault e) {
+				//Cannot find a valid SOAP envelope.
+				if (log.isErrorEnabled() ) {
+					log.error (SandeshaMessageHelper
+							.getMessage(SandeshaMessageKeys.soapEnvNotSet));
+					log.error ("Caught exception", e);
+				}
+				
+				return;
+			}
+
+			if (resenvelope != null) {
+				if (log.isDebugEnabled())
+					log.debug("Response " + resenvelope.getHeader());
+				responseMessageContext.setEnvelope(resenvelope);
+				
+				
+//				//If this message is an RM Control message it should not be assumed as an application message.
+//				//So dispatching etc should happen just like for a new message comming into the system.
+//				RMMsgContext responseRMMsg = MsgInitializer.initializeMessage(responseMessageContext);
+//				if (responseRMMsg.getMessageType()!=Sandesha2Constants.MessageTypes.UNKNOWN &&
+//					responseRMMsg.getMessageType()!=Sandesha2Constants.MessageTypes.APPLICATION	) {
+//					responseMessageContext.setAxisOperation(null);
+//					responseMessageContext.setOperationContext(null);
+//				}
+				
+				//If addressing is disabled we will be adding this message simply as the application response of the request message.
+				Boolean addressingDisabled = (Boolean) msgCtx.getOptions().getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+				if (addressingDisabled!=null && Boolean.TRUE.equals(addressingDisabled)) {
+					// If the AxisOperation object doesn't have a message receiver, it means that this was
+					// an out only op where we have added an ACK to the response.  Set the requestMsgOpCtx to
+					// be the RMIn
+					OperationContext responseMsgOpCtx = requestMsgOpCtx;
+					if (requestMsgOpCtx.getAxisOperation().getMessageReceiver() == null) {
+						// Generate a new RM In Only operation
+
+						ServiceContext serviceCtx = responseMessageContext.getServiceContext();
+						AxisOperation op = msgCtx.getAxisService().getOperation(Sandesha2Constants.RM_IN_ONLY_OPERATION);
+						responseMsgOpCtx = ContextFactory.createOperationContext (op, serviceCtx);					
+
+					}
+					
+					responseMessageContext.setOperationContext(responseMsgOpCtx);
+				}
+				
+				RMMsgContext responseRMMessage = MsgInitializer.initializeMessage(responseMessageContext);
+				if (responseRMMessage.getMessageType()==Sandesha2Constants.MessageTypes.ACK) {
+					responseMessageContext.setAxisOperation(SpecSpecificConstants.getWSRMOperation
+							(Sandesha2Constants.MessageTypes.ACK, responseRMMessage.getRMSpecVersion(), responseMessageContext.getAxisService()));
+					responseMessageContext.setOperationContext(null);
+				}
+				
+				AxisEngine engine = new AxisEngine(msgCtx.getConfigurationContext());
+
+				if (isFaultEnvelope(resenvelope)) {
+					engine.receiveFault(responseMessageContext);
+				} else {
+					engine.receive(responseMessageContext);
+				}
+			}
+
+		} catch (Exception e) {
+			String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.noValidSyncResponse);
+			if (log.isWarnEnabled())
+				log.warn(message, e);
+		}
+		if (log.isDebugEnabled())
+			log.debug("Exit: SenderWorker::checkForSyncResponses");
+	}
+	
+	private boolean isFaultEnvelope(SOAPEnvelope envelope) {
+		if (log.isDebugEnabled())
+			log.debug("Enter: SenderWorker::isFaultEnvelope, " + envelope.getBody().getFault());
+		SOAPFault fault = envelope.getBody().getFault();
+		if (fault != null) {
+			if (log.isDebugEnabled())
+				log.debug("Exit: SenderWorker::isFaultEnvelope, TRUE");
+			return true;
+		}
+
+		if (log.isDebugEnabled())
+			log.debug("Exit: SenderWorker::isFaultEnvelope, FALSE");
+		return false;
+	}
+
+}

Added: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/SequenceEntry.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/SequenceEntry.java?view=auto&rev=531400
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/SequenceEntry.java (added)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/SequenceEntry.java Mon Apr 23 02:54:53 2007
@@ -0,0 +1,59 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ *  
+ */
+package org.apache.sandesha2.workers;
+
+import java.io.Serializable;
+
+public class SequenceEntry implements Serializable {
+	private static final long serialVersionUID = -6823171634616402792L;
+
+	private String  sequenceId;
+	private boolean rmSource;
+	
+	public SequenceEntry(String sequenceId, boolean rmSource) {
+		this.sequenceId = sequenceId;
+		this.rmSource = rmSource;
+	}
+	public boolean isRmSource() {
+		return rmSource;
+	}
+	public String getSequenceId() {
+		return sequenceId;
+	}
+
+
+	public boolean equals(Object o) {
+		if(o == null) return false;
+		if(o == this) return true;
+		if(o.getClass() != getClass()) return false;
+		
+		SequenceEntry other = (SequenceEntry) o;
+		if(sequenceId != null) {
+			if(!sequenceId.equals(other.sequenceId)) return false;
+		} else {
+			if(other.sequenceId != null) return false;
+		}
+		
+		return rmSource == other.rmSource;
+	}
+	public int hashCode() {
+		int result = 1;
+		if(sequenceId != null) result = sequenceId.hashCode();
+		if(rmSource) result = -result;
+		return result;
+	}
+}

Added: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/WorkerLock.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/WorkerLock.java?view=auto&rev=531400
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/WorkerLock.java (added)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/WorkerLock.java Mon Apr 23 02:54:53 2007
@@ -0,0 +1,25 @@
+package org.apache.sandesha2.workers;
+
+import java.util.ArrayList;
+
+public class WorkerLock {
+
+	public ArrayList workList = null;
+	
+	public WorkerLock () {
+		workList = new ArrayList ();
+	}
+	
+	public synchronized void addWork (String work) {
+		workList.add(work);
+	}
+	
+	public synchronized void removeWork (String work) {
+		workList.remove(work);
+	}
+	
+	public synchronized boolean isWorkPresent (String work) {
+		return workList.contains(work);
+	}
+
+}

Added: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Accept.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Accept.java?view=auto&rev=531400
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Accept.java (added)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Accept.java Mon Apr 23 02:54:53 2007
@@ -0,0 +1,117 @@
+/*
+ * Copyright  1999-2004 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.sandesha2.wsrm;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axis2.AxisFault;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.i18n.SandeshaMessageHelper;
+import org.apache.sandesha2.i18n.SandeshaMessageKeys;
+
+/**
+ * Represents the RM Accept element which may come within the 
+ * Create Sequence Response.
+ */
+
+public class Accept implements IOMRMElement {
+
+	private AcksTo acksTo;
+	
+	private String rmNamespaceValue;
+	
+	// Constructor used during parsing
+	public Accept(String rmNamespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(rmNamespaceValue))
+			throw new SandeshaException (SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.unknownNamespace,
+					rmNamespaceValue));
+		
+		this.rmNamespaceValue = rmNamespaceValue;
+	}
+	
+	// Constructor used during writing
+	public Accept(String rmNamespace, AcksTo acksTo) throws SandeshaException {
+		this(rmNamespace);
+		this.acksTo = acksTo;
+	}
+
+	public String getNamespaceValue(){
+		return rmNamespaceValue;
+	}
+	
+	public String getAddressingNamespaceValue() {
+		if(acksTo != null) return acksTo.getAddressingNamespaceValue();
+		return null;
+	}
+	
+	public Object fromOMElement(OMElement element) throws OMException,AxisFault {
+		
+		OMElement acceptPart = element.getFirstChildWithName(new QName(
+				rmNamespaceValue, Sandesha2Constants.WSRM_COMMON.ACCEPT));
+		if (acceptPart == null)
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.noAcceptPartInElement,
+					element.toString()));
+
+		acksTo = new AcksTo(rmNamespaceValue);
+		acksTo.fromOMElement(acceptPart);
+
+		return this;
+	}
+
+	public OMElement toOMElement(OMElement element) throws OMException,AxisFault {
+
+		OMFactory factory = element.getOMFactory();
+		
+		if (acksTo == null)
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.acceptNullAcksTo));
+
+		OMNamespace rmNamespace = factory.createOMNamespace(rmNamespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+		OMElement acceptElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.ACCEPT, rmNamespace);
+		
+		acksTo.toOMElement(acceptElement);
+		element.addChild(acceptElement);
+
+		return element;
+	}
+
+	public void setAcksTo(AcksTo acksTo) {
+		this.acksTo = acksTo;
+	}
+
+	public AcksTo getAcksTo() {
+		return acksTo;
+	}
+	
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		if (Sandesha2Constants.SPEC_2007_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
+	}
+}

Added: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/AckFinal.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/AckFinal.java?view=auto&rev=531400
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/AckFinal.java (added)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/AckFinal.java Mon Apr 23 02:54:53 2007
@@ -0,0 +1,86 @@
+/*
+ * Copyright  1999-2004 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.sandesha2.wsrm;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.i18n.SandeshaMessageHelper;
+import org.apache.sandesha2.i18n.SandeshaMessageKeys;
+
+/**
+ * This represent the wsrm:final element that may be present withing a sequence acknowledgement.
+ */
+public class AckFinal implements IOMRMElement {
+
+	private String namespaceValue = null;
+	
+	public AckFinal(String namespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(namespaceValue))
+			throw new SandeshaException (SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.unknownSpec,
+					namespaceValue));
+		
+		this.namespaceValue = namespaceValue;
+	}
+
+	public String getNamespaceValue(){
+		return namespaceValue;
+	}
+
+	public Object fromOMElement(OMElement element) throws OMException {
+		
+		OMElement finalPart = element.getFirstChildWithName(new QName(
+				namespaceValue, Sandesha2Constants.WSRM_COMMON.FINAL));
+		if (finalPart == null)
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.noFinalPartInElement,
+					element.toString()));
+
+		return this;
+	}
+
+	public OMElement toOMElement(OMElement sequenceAckElement) throws OMException {
+		//soapheaderblock element will be given
+
+		OMFactory factory = sequenceAckElement.getOMFactory();
+		
+		OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+		OMElement finalElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.FINAL, rmNamespace);
+		sequenceAckElement.addChild(finalElement);
+
+		return sequenceAckElement;
+	}
+
+	
+	//this element is only supported in 2005_05_10 spec.
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return false;
+		
+		if (Sandesha2Constants.SPEC_2007_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
+	}
+}

Added: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/AckNone.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/AckNone.java?view=auto&rev=531400
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/AckNone.java (added)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/AckNone.java Mon Apr 23 02:54:53 2007
@@ -0,0 +1,85 @@
+/*
+ * Copyright  1999-2004 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.sandesha2.wsrm;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.i18n.SandeshaMessageHelper;
+import org.apache.sandesha2.i18n.SandeshaMessageKeys;
+
+
+/**
+ * This represent the wsrm:none element that may be present withing a sequence acknowledgement.
+ */
+public class AckNone implements IOMRMElement {
+
+	private String namespaceValue = null;
+	
+	public AckNone(String namespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(namespaceValue))
+			throw new SandeshaException (SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.unknownSpec,
+					namespaceValue));
+		
+		this.namespaceValue = namespaceValue;
+	}
+
+	public String getNamespaceValue(){
+		return namespaceValue;
+	}
+
+	public Object fromOMElement(OMElement element) throws OMException {
+	    
+		OMElement nonePart = element.getFirstChildWithName(new QName(
+				namespaceValue, Sandesha2Constants.WSRM_COMMON.NONE));
+		if (nonePart == null)
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.noNonePartInElement,
+					element.toString()));
+
+		return this;
+	}
+
+	public OMElement toOMElement(OMElement sequenceAckElement) throws OMException {
+		
+		OMFactory factory = sequenceAckElement.getOMFactory();
+	    
+	    OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+	    OMElement noneElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.NONE, rmNamespace);
+
+		sequenceAckElement.addChild(noneElement);
+		return sequenceAckElement;
+	}
+	
+	//this element is only supported in 2005_05_10 spec.
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return false;
+		
+		if (Sandesha2Constants.SPEC_2007_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
+	}
+}

Added: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/AckRequested.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/AckRequested.java?view=auto&rev=531400
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/AckRequested.java (added)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/AckRequested.java Mon Apr 23 02:54:53 2007
@@ -0,0 +1,150 @@
+/*
+ * Copyright  1999-2004 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.sandesha2.wsrm;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.soap.SOAPHeaderBlock;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.i18n.SandeshaMessageHelper;
+import org.apache.sandesha2.i18n.SandeshaMessageKeys;
+
+/**
+ * Represent the AckRequested header block.
+ * The 2005/02 spec includes a 'MessageNumber' part in the ack request, but
+ * the 2006/08 spec does not. As the message number was never used in our
+ * implementation we simply ignore it.
+ */
+
+public class AckRequested implements IOMRMPart {
+	
+	private Identifier identifier;
+	private String namespaceValue = null;
+	private boolean mustUnderstand = false;
+	
+	public AckRequested(String namespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(namespaceValue))
+			throw new SandeshaException (SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.unknownSpec,
+					namespaceValue));
+		
+		this.namespaceValue = namespaceValue;
+	}
+
+	public String getNamespaceValue() {
+		return namespaceValue;
+	}
+
+	public Object fromOMElement(OMElement ackReqElement) throws OMException,SandeshaException {
+
+		identifier = new Identifier(namespaceValue);
+		identifier.fromOMElement(ackReqElement);
+
+		// Indicate that we have processed this SOAPHeaderBlock
+		((SOAPHeaderBlock)ackReqElement).setProcessed();
+
+		return this;
+	}
+
+	public OMElement toOMElement(OMElement header) throws OMException {
+
+		if (header == null || !(header instanceof SOAPHeader))
+			throw new OMException(
+					SandeshaMessageHelper.getMessage(
+							SandeshaMessageKeys.ackRequestedCannotBeAddedToNonHeader));
+
+		if (identifier == null)
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.ackRequestNullID));
+		
+		OMFactory factory = header.getOMFactory();
+		OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+
+		Iterator iter = header.getChildrenWithName(new QName (namespaceValue,Sandesha2Constants.WSRM_COMMON.ACK_REQUESTED));
+		while (iter.hasNext()) {
+			OMElement ackRequestedElement = (OMElement) iter.next();
+			
+			OMElement identifierElement = ackRequestedElement.getFirstChildWithName(new QName (namespaceValue,
+					Sandesha2Constants.WSRM_COMMON.IDENTIFIER));
+			String identifierVal = null;
+			if (identifierElement!=null)
+				identifierVal = identifierElement.getText();
+			
+			if (identifierVal!=null && 
+					(identifierVal.equals(identifier.getIdentifier()) || identifierVal.equals(Sandesha2Constants.TEMP_SEQUENCE_ID)))
+				ackRequestedElement.detach();
+			
+		}
+		
+		SOAPHeader SOAPHdr = (SOAPHeader) header;
+		SOAPHeaderBlock ackReqHdrBlock = SOAPHdr.addHeaderBlock(Sandesha2Constants.WSRM_COMMON.ACK_REQUESTED, rmNamespace);
+		ackReqHdrBlock.setMustUnderstand(isMustUnderstand());
+
+		identifier.toOMElement(ackReqHdrBlock);
+
+		return header;
+	}
+
+	public void setIdentifier(Identifier identifier) {
+		this.identifier = identifier;
+	}
+
+	public Identifier getIdentifier() {
+		return identifier;
+	}
+
+	public void toSOAPEnvelope(SOAPEnvelope envelope) {
+		SOAPHeader header = envelope.getHeader();
+		
+		if (header==null) {
+			SOAPFactory factory = (SOAPFactory)envelope.getOMFactory();
+			header = factory.createSOAPHeader(envelope);
+		}
+		
+		toOMElement(header);
+	}
+	
+	public boolean isMustUnderstand() {
+		return mustUnderstand;
+	}
+
+	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_2007_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
+	}
+	
+}

Added: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/AcknowledgementRange.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/AcknowledgementRange.java?view=auto&rev=531400
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/AcknowledgementRange.java (added)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/AcknowledgementRange.java Mon Apr 23 02:54:53 2007
@@ -0,0 +1,144 @@
+/*
+ * Copyright  1999-2004 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.sandesha2.wsrm;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.i18n.SandeshaMessageHelper;
+import org.apache.sandesha2.i18n.SandeshaMessageKeys;
+
+/**
+ * Represents and AcknowledgementRange element.
+ */
+
+public class AcknowledgementRange implements IOMRMElement {
+	
+	private long upperValue;
+	
+	private long lowerValue;
+	
+	private String namespaceValue = null;
+	
+	public AcknowledgementRange(String namespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(namespaceValue))
+			throw new SandeshaException (SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.unknownSpec,
+					namespaceValue));
+		
+		this.namespaceValue = namespaceValue;
+	}
+
+	public String getNamespaceValue() {
+		return namespaceValue;
+	}
+
+	public Object fromOMElement(OMElement ackRangePart) throws OMException {
+
+		if (ackRangePart == null)
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.nullPassedElement));
+
+		OMAttribute lowerAttrib = ackRangePart.getAttribute(new QName(
+				Sandesha2Constants.WSRM_COMMON.LOWER));
+		OMAttribute upperAttrib = ackRangePart.getAttribute(new QName(
+				Sandesha2Constants.WSRM_COMMON.UPPER));
+
+		if (lowerAttrib == null || upperAttrib == null)
+			throw new OMException(
+					SandeshaMessageHelper.getMessage(
+							SandeshaMessageKeys.noUpperOrLowerAttributesInElement,
+							ackRangePart.toString()));
+
+		try {
+			long lower = Long.parseLong(lowerAttrib.getAttributeValue());
+			long upper = Long.parseLong(upperAttrib.getAttributeValue());
+			upperValue = upper;
+			lowerValue = lower;
+		} catch (Exception ex) {
+			throw new OMException(
+					SandeshaMessageHelper.getMessage(
+							SandeshaMessageKeys.ackRandDoesNotHaveCorrectValues,
+							ackRangePart.toString()));
+		}
+
+		return this;
+	}
+
+	public OMElement toOMElement(OMElement sequenceAckElement)
+			throws OMException {
+
+		if (sequenceAckElement == null)
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.cannotSetAckRangeNullElement));
+
+		if (upperValue <= 0 || lowerValue <= 0 || lowerValue > upperValue)
+			throw new OMException(
+					SandeshaMessageHelper.getMessage(
+							SandeshaMessageKeys.ackRandDoesNotHaveCorrectValues,
+							upperValue + ":" + lowerValue));
+
+		OMFactory factory = sequenceAckElement.getOMFactory();
+		
+		OMAttribute lowerAttrib = factory.createOMAttribute(
+				Sandesha2Constants.WSRM_COMMON.LOWER, null, Long.toString(lowerValue));
+		OMAttribute upperAttrib = factory.createOMAttribute(
+				Sandesha2Constants.WSRM_COMMON.UPPER, null, Long.toString(upperValue));
+
+		OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+		OMElement acknowledgementRangeElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.ACK_RANGE, rmNamespace);
+		
+		acknowledgementRangeElement.addAttribute(lowerAttrib);
+		acknowledgementRangeElement.addAttribute(upperAttrib);
+		sequenceAckElement.addChild(acknowledgementRangeElement);
+
+		return sequenceAckElement;
+	}
+
+	public long getLowerValue() {
+		return lowerValue;
+	}
+
+	public void setLowerValue(long lowerValue) {
+		this.lowerValue = lowerValue;
+	}
+
+	public long getUpperValue() {
+		return upperValue;
+	}
+
+	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_2007_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
+	}
+}

Added: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/AcksTo.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/AcksTo.java?view=auto&rev=531400
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/AcksTo.java (added)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/AcksTo.java Mon Apr 23 02:54:53 2007
@@ -0,0 +1,125 @@
+/*
+ * Copyright  1999-2004 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.sandesha2.wsrm;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.addressing.EndpointReferenceHelper;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.i18n.SandeshaMessageHelper;
+import org.apache.sandesha2.i18n.SandeshaMessageKeys;
+
+/**
+ * Represents an AcksTo element which comes within
+ * Create Sequence messages.
+ */
+
+public class AcksTo implements IOMRMElement {
+
+	private EndpointReference epr;
+	
+	private String rmNamespaceValue = null;
+	
+	private String addressingNamespaceValue = null;
+	
+	// Constructor used while parsing
+	public AcksTo (String rmNamespaceValue) throws AxisFault {
+		if (!isNamespaceSupported(rmNamespaceValue))
+			throw new SandeshaException (SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.unknownSpec,
+					rmNamespaceValue));
+		
+		this.rmNamespaceValue = rmNamespaceValue;
+	}
+	
+	// Constructor used while writing
+	public AcksTo (EndpointReference epr, String rmNamespaceValue, String addressingNamespaceValue) throws AxisFault {
+		this (rmNamespaceValue);
+		this.addressingNamespaceValue = addressingNamespaceValue;
+		this.epr = epr;
+	}
+
+	public String getNamespaceValue() {
+		return rmNamespaceValue;
+	}
+	
+	public String getAddressingNamespaceValue() {
+		return addressingNamespaceValue;
+	}
+
+	public Object fromOMElement(OMElement element) throws OMException,AxisFault {
+		OMElement acksToPart = element.getFirstChildWithName(new QName(
+				rmNamespaceValue, Sandesha2Constants.WSRM_COMMON.ACKS_TO));
+
+		if (acksToPart == null)
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.noAcksToPart,
+					element.toString()));
+
+		epr = EndpointReferenceHelper.fromOM (acksToPart);
+
+		// Sniff the addressing namespace from the Address child of the EPR
+		Iterator children = acksToPart.getChildElements();
+		while(children.hasNext() && addressingNamespaceValue == null) {
+			OMElement child = (OMElement) children.next();
+			if("Address".equals(child.getLocalName())) {
+				addressingNamespaceValue = child.getNamespace().getNamespaceURI();
+			}
+		}
+
+		return this;
+	}
+
+	public OMElement toOMElement(OMElement element) throws OMException,AxisFault {
+
+		if (epr == null)
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.cannotSetAcksTo,
+					null));
+
+		OMFactory factory = element.getOMFactory();
+		
+		QName acksTo = new QName (rmNamespaceValue,Sandesha2Constants.WSRM_COMMON.ACKS_TO, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+	    OMElement endpointElement =	EndpointReferenceHelper.toOM (factory,epr, acksTo ,addressingNamespaceValue);
+		
+		element.addChild(endpointElement);
+		return element;
+	}
+
+	public EndpointReference getEPR() {
+		return epr;
+	}
+
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		if (Sandesha2Constants.SPEC_2007_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
+	}
+}

Added: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Address.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Address.java?view=auto&rev=531400
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Address.java (added)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Address.java Mon Apr 23 02:54:53 2007
@@ -0,0 +1,99 @@
+/*
+ * Copyright  2005-2006 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.sandesha2.wsrm;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.i18n.SandeshaMessageHelper;
+import org.apache.sandesha2.i18n.SandeshaMessageKeys;
+
+/**
+ * Represents an Address element, that is contained within the MakeConnection message.
+ */
+
+public class Address implements IOMRMElement {
+
+	private String address = null;
+	
+	private String rmNamespaceValue = null;
+	
+	public Address(String rmNamespaceValue) {
+		this.rmNamespaceValue = rmNamespaceValue;
+	}
+
+	public Object fromOMElement(OMElement element) throws OMException {
+
+		OMElement addressPart = element.getFirstChildWithName(new QName(
+				rmNamespaceValue, Sandesha2Constants.WSRM_COMMON.ADDRESS));
+		if (addressPart == null)
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.cannotFindAddressElement,
+					element.toString()));
+		
+		String addressText = addressPart.getText();
+		if (addressText == null || "".equals(addressText))
+			throw new OMException(
+					SandeshaMessageHelper.getMessage(
+							SandeshaMessageKeys.cannotFindAddressText,
+							element.toString()));
+
+		this.address = addressText;
+		return this;
+	}
+
+	public String getNamespaceValue(){
+		return rmNamespaceValue;
+	}
+
+	public OMElement toOMElement(OMElement element) throws OMException {
+
+		if (address == null ||  "".equals(address))
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.addressNotValid));
+
+		OMFactory factory = element.getOMFactory();
+		
+		OMNamespace rmNamespace = factory.createOMNamespace(rmNamespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_MC);
+		OMElement addressElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.ADDRESS, rmNamespace);
+		
+		addressElement.setText(address);
+		element.addChild(addressElement);
+
+		return element;
+	}
+
+	public String getAddress() {
+		return address;
+	}
+
+	public void setAddress(String address) {
+		this.address = address;
+	}
+	
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2007_02.MC_NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
+	}
+}

Added: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/CloseSequence.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/CloseSequence.java?view=auto&rev=531400
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/CloseSequence.java (added)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/CloseSequence.java Mon Apr 23 02:54:53 2007
@@ -0,0 +1,128 @@
+/*
+ * Copyright  1999-2004 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.sandesha2.wsrm;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.i18n.SandeshaMessageHelper;
+import org.apache.sandesha2.i18n.SandeshaMessageKeys;
+
+/**
+ * Adds the Close Sequence body part.
+ */
+
+public class CloseSequence implements IOMRMPart {
+
+	private Identifier identifier;
+	
+	private String namespaceValue = null;
+	
+	public CloseSequence(String namespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(namespaceValue))
+			throw new SandeshaException (SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.unknownSpec,
+					namespaceValue));
+		
+		this.namespaceValue = namespaceValue;
+	}
+
+	public String getNamespaceValue() {
+		return namespaceValue;
+	}
+
+	public Object fromOMElement(OMElement body) throws OMException,SandeshaException {
+
+		if (!(body instanceof SOAPBody))
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.closeSeqCannotBeAddedToNonBody));
+
+		OMElement closeSeqPart = body.getFirstChildWithName(new QName(
+				namespaceValue, Sandesha2Constants.WSRM_COMMON.CLOSE_SEQUENCE));
+
+		if (closeSeqPart == null)
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.noCloseSequencePartInElement,
+					body.toString()));
+
+		identifier = new Identifier(namespaceValue);
+		identifier.fromOMElement(closeSeqPart);
+
+		return this;
+	}
+
+	public OMElement toOMElement(OMElement body) throws OMException {
+
+		if (body == null || !(body instanceof SOAPBody))
+			throw new OMException(
+					SandeshaMessageHelper.getMessage(
+							SandeshaMessageKeys.closeSeqCannotBeAddedToNonBody));
+
+		if (identifier == null)
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.closeSeqPartNullID));
+
+		OMFactory factory = body.getOMFactory();
+		
+		OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+		OMElement closeSequenceElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.CLOSE_SEQUENCE, rmNamespace);
+		
+		identifier.toOMElement(closeSequenceElement);
+		body.addChild(closeSequenceElement);
+
+		return body;
+	}
+
+	public Identifier getIdentifier() {
+		return identifier;
+	}
+
+	public void setIdentifier(Identifier identifier) {
+		this.identifier = identifier;
+	}
+
+	public void toSOAPEnvelope(SOAPEnvelope envelope) {
+		SOAPBody body = envelope.getBody();
+		
+		//detach if already exist.
+		OMElement elem = body.getFirstChildWithName(new QName(namespaceValue,
+				Sandesha2Constants.WSRM_COMMON.CLOSE_SEQUENCE));
+		if (elem!=null)
+			elem.detach();
+		
+		toOMElement(body);
+	}
+	
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		if (Sandesha2Constants.SPEC_2007_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
+	}
+
+}

Added: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/CloseSequenceResponse.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/CloseSequenceResponse.java?view=auto&rev=531400
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/CloseSequenceResponse.java (added)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/CloseSequenceResponse.java Mon Apr 23 02:54:53 2007
@@ -0,0 +1,129 @@
+/*
+ * Copyright  1999-2004 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.sandesha2.wsrm;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.i18n.SandeshaMessageHelper;
+import org.apache.sandesha2.i18n.SandeshaMessageKeys;
+
+/**
+ * Adds the Close Sequence Response body part.
+ */
+public class CloseSequenceResponse implements IOMRMPart {
+
+	private Identifier identifier;
+	
+	private String namespaceValue = null;
+	
+	public CloseSequenceResponse(String namespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(namespaceValue))
+			throw new SandeshaException (SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.unknownSpec,
+					namespaceValue));
+		
+		this.namespaceValue = namespaceValue;
+	}
+
+	public String getNamespaceValue() {
+		return namespaceValue;
+	}
+
+	public Object fromOMElement(OMElement body) throws OMException,SandeshaException {
+
+		if (!(body instanceof SOAPBody))
+			throw new OMException(
+					SandeshaMessageHelper.getMessage(
+							SandeshaMessageKeys.closeSeqResponseCannotBeAddedToNonBody));
+
+		OMElement closeSeqResponsePart = body.getFirstChildWithName(new QName(
+				namespaceValue, Sandesha2Constants.WSRM_COMMON.CLOSE_SEQUENCE_RESPONSE));
+
+		if (closeSeqResponsePart == null)
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.noCloseSeqResponsePartInElement,
+					body.toString()));
+
+		identifier = new Identifier(namespaceValue);
+		identifier.fromOMElement(closeSeqResponsePart);
+
+		return this;
+	}
+
+	public OMElement toOMElement(OMElement body) throws OMException {
+
+		if (body == null || !(body instanceof SOAPBody))
+			throw new OMException(
+					SandeshaMessageHelper.getMessage(
+							SandeshaMessageKeys.closeSeqResponseCannotBeAddedToNonBody));
+
+		if (identifier == null)
+			throw new OMException(
+					SandeshaMessageHelper.getMessage(
+							SandeshaMessageKeys.closeSeqResponsePartNullID));
+
+		OMFactory factory = body.getOMFactory();
+		
+		OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+		OMElement closeSequenceResponseElement = factory.createOMElement(
+				Sandesha2Constants.WSRM_COMMON.CLOSE_SEQUENCE_RESPONSE, rmNamespace);
+		identifier.toOMElement(closeSequenceResponseElement);
+		body.addChild(closeSequenceResponseElement);
+
+		return body;
+	}
+
+	public Identifier getIdentifier() {
+		return identifier;
+	}
+
+	public void setIdentifier(Identifier identifier) {
+		this.identifier = identifier;
+	}
+
+	public void toSOAPEnvelope(SOAPEnvelope envelope) {
+		SOAPBody body = envelope.getBody();
+		
+		//detach if already exist.
+		OMElement elem = body.getFirstChildWithName(new QName(namespaceValue,
+				Sandesha2Constants.WSRM_COMMON.CLOSE_SEQUENCE_RESPONSE));
+		if (elem!=null)
+			elem.detach();
+		
+		toOMElement(body);
+	}
+	
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		if (Sandesha2Constants.SPEC_2007_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
+	}
+
+}

Added: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/CreateSequence.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/CreateSequence.java?view=auto&rev=531400
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/CreateSequence.java (added)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/CreateSequence.java Mon Apr 23 02:54:53 2007
@@ -0,0 +1,197 @@
+/*
+ * Copyright  1999-2004 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.sandesha2.wsrm;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axis2.AxisFault;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.i18n.SandeshaMessageHelper;
+import org.apache.sandesha2.i18n.SandeshaMessageKeys;
+import org.apache.sandesha2.util.SpecSpecificConstants;
+
+/**
+ * Represent the CreateSequence body element.
+ */
+
+public class CreateSequence implements IOMRMPart {
+	
+	private AcksTo acksTo = null;
+	
+	private Expires expires = null;
+	
+	private SequenceOffer sequenceOffer = null;
+	
+	private String rmNamespaceValue = null;
+	
+	private String secNamespaceValue = null;
+	
+	private OMElement securityTokenReference = null;
+	
+	// Constructor used while parsing
+	public CreateSequence(String rmNamespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(rmNamespaceValue))
+			throw new SandeshaException (SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.unknownSpec,
+					rmNamespaceValue));
+		
+		this.rmNamespaceValue = rmNamespaceValue;
+		this.secNamespaceValue = SpecSpecificConstants.getSecurityNamespace(rmNamespaceValue);
+	}
+	
+	// Constructor used while writing
+	public CreateSequence (AcksTo acksTo,SOAPFactory factory,String rmNamespaceValue) throws SandeshaException {
+		this (rmNamespaceValue);
+		this.acksTo = acksTo;
+	}
+
+	public String getNamespaceValue() {
+		return rmNamespaceValue;
+	}
+	
+	public String getAddressingNamespaceValue() {
+		if(acksTo != null) return acksTo.getAddressingNamespaceValue();
+		return null;
+	}
+
+	public Object fromOMElement(OMElement bodyElement) throws OMException,AxisFault {
+
+		OMElement createSequencePart = bodyElement
+				.getFirstChildWithName(new QName(rmNamespaceValue,
+						                         Sandesha2Constants.WSRM_COMMON.CREATE_SEQUENCE));
+		if (createSequencePart == null)
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.noCreateSeqPartInElement,
+					bodyElement.toString()));
+		
+		acksTo = new AcksTo(rmNamespaceValue);
+		acksTo.fromOMElement(createSequencePart);
+
+		OMElement offerPart = createSequencePart.getFirstChildWithName(new QName(rmNamespaceValue,
+																	   Sandesha2Constants.WSRM_COMMON.SEQUENCE_OFFER));
+		if (offerPart != null) {
+			sequenceOffer = new SequenceOffer(rmNamespaceValue);
+			sequenceOffer.fromOMElement(createSequencePart);
+		}
+
+		OMElement expiresPart = createSequencePart.getFirstChildWithName(
+						new QName(rmNamespaceValue,
+						Sandesha2Constants.WSRM_COMMON.EXPIRES));
+		if (expiresPart != null) {
+			expires = new Expires(rmNamespaceValue);
+			expires.fromOMElement(createSequencePart);
+		}
+		
+		if(secNamespaceValue != null) {
+			securityTokenReference = createSequencePart.getFirstChildWithName(
+				new QName(secNamespaceValue, "SecurityTokenReference"));
+		}
+		return this;
+	}
+
+	public OMElement toOMElement(OMElement bodyElement) throws OMException, AxisFault {
+
+		if (bodyElement == null || !(bodyElement instanceof SOAPBody))
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.createSeqCannotBeAddedToNonBody));
+
+		if (acksTo == null)
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.createSeqNullAcksTo));
+
+		SOAPBody soapBody = (SOAPBody) bodyElement;
+		
+		OMFactory factory = bodyElement.getOMFactory();
+
+		OMNamespace rmNamespace = factory.createOMNamespace(rmNamespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+		OMElement createSequenceElement = factory.createOMElement(
+				Sandesha2Constants.WSRM_COMMON.CREATE_SEQUENCE, rmNamespace);
+		
+		acksTo.toOMElement(createSequenceElement);
+
+		if (sequenceOffer != null) {
+			sequenceOffer.toOMElement(createSequenceElement);
+		}
+
+		if (expires != null) {
+			expires.toOMElement(createSequenceElement);
+		}
+		
+		if(securityTokenReference != null) {
+			createSequenceElement.addChild(securityTokenReference);
+		}
+
+		soapBody.addChild(createSequenceElement);
+		return soapBody;
+	}
+
+	public void setAcksTo(AcksTo acksTo) {
+		this.acksTo = acksTo;
+	}
+
+	public void setSequenceOffer(SequenceOffer sequenceOffer) {
+		this.sequenceOffer = sequenceOffer;
+	}
+
+	public AcksTo getAcksTo() {
+		return acksTo;
+	}
+
+	public SequenceOffer getSequenceOffer() {
+		return sequenceOffer;
+	}
+
+	public void toSOAPEnvelope(SOAPEnvelope envelope) throws AxisFault {
+		SOAPBody body = envelope.getBody();
+		
+		//detach if already exist.
+		OMElement elem = body.getFirstChildWithName(new QName(rmNamespaceValue,
+				Sandesha2Constants.WSRM_COMMON.CREATE_SEQUENCE));
+		if (elem!=null)
+			elem.detach();
+		
+		toOMElement(body);
+	}
+	
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		if (Sandesha2Constants.SPEC_2007_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
+	}
+	
+	public OMElement getSecurityTokenReference() {
+		return securityTokenReference;
+	}
+
+	public void setSecurityTokenReference(OMElement theSTR) {
+		this.securityTokenReference = theSTR;
+	}
+
+}

Added: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/CreateSequenceResponse.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/CreateSequenceResponse.java?view=auto&rev=531400
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/CreateSequenceResponse.java (added)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/CreateSequenceResponse.java Mon Apr 23 02:54:53 2007
@@ -0,0 +1,183 @@
+/*
+ * Copyright  1999-2004 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.sandesha2.wsrm;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axis2.AxisFault;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.i18n.SandeshaMessageHelper;
+import org.apache.sandesha2.i18n.SandeshaMessageKeys;
+
+/**
+ * Adds the CreateSequenceResponse body part.
+ */
+
+public class CreateSequenceResponse implements IOMRMPart {
+	
+	private Identifier identifier;
+	
+	private Accept accept;
+	
+	private Expires expires;
+	
+	private String rmNamespaceValue = null;
+	
+	public CreateSequenceResponse(String rmNamespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(rmNamespaceValue))
+			throw new SandeshaException (SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.unknownSpec,
+					rmNamespaceValue));
+		
+		this.rmNamespaceValue = rmNamespaceValue;
+	}
+
+	public String getNamespaceValue() {
+		return rmNamespaceValue;
+	}
+
+	public Object fromOMElement(OMElement bodyElement) throws OMException,AxisFault {
+
+		if (bodyElement == null || !(bodyElement instanceof SOAPBody))
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.createSeqResponseCannotBeAddedToNonBody));
+
+		SOAPBody SOAPBody = (SOAPBody) bodyElement;
+
+		OMElement createSeqResponsePart = SOAPBody
+				.getFirstChildWithName(new QName(rmNamespaceValue,Sandesha2Constants.WSRM_COMMON.CREATE_SEQUENCE_RESPONSE));
+		if (createSeqResponsePart == null)
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.noCreateSeqResponsePartInElement,
+					bodyElement.toString()));
+
+		identifier = new Identifier(rmNamespaceValue);
+		identifier.fromOMElement(createSeqResponsePart);
+
+		OMElement expiresPart = createSeqResponsePart.getFirstChildWithName(
+					new QName(rmNamespaceValue,
+					Sandesha2Constants.WSRM_COMMON.EXPIRES));
+		if (expiresPart != null) {
+			expires = new Expires(rmNamespaceValue);
+			expires.fromOMElement(createSeqResponsePart);
+		}
+
+		OMElement acceptPart = createSeqResponsePart.getFirstChildWithName(
+						new QName(rmNamespaceValue,
+						Sandesha2Constants.WSRM_COMMON.ACCEPT));
+		if (acceptPart != null) {
+			accept = new Accept(rmNamespaceValue);
+			accept.fromOMElement(createSeqResponsePart);
+		}
+
+		return this;
+	}
+
+	public OMElement toOMElement(OMElement bodyElement) throws OMException, AxisFault {
+
+		if (bodyElement == null || !(bodyElement instanceof SOAPBody))
+			throw new OMException(
+					SandeshaMessageHelper.getMessage(
+							SandeshaMessageKeys.createSeqResponseCannotBeAddedToNonBody));
+
+		SOAPBody SOAPBody = (SOAPBody) bodyElement;
+
+		if (identifier == null)
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.invalidIdentifier,
+					bodyElement.toString()));
+
+		OMFactory factory = bodyElement.getOMFactory();
+		
+		OMNamespace rmNamespace = factory.createOMNamespace(rmNamespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+		
+		OMElement createSequenceResponseElement = factory.createOMElement(
+				Sandesha2Constants.WSRM_COMMON.CREATE_SEQUENCE_RESPONSE,
+				rmNamespace);
+		
+		identifier.toOMElement(createSequenceResponseElement);
+
+		if (expires != null) {
+			expires.toOMElement(createSequenceResponseElement);
+		}
+
+		if (accept != null) {
+			accept.toOMElement(createSequenceResponseElement);
+		}
+
+		SOAPBody.addChild(createSequenceResponseElement);
+
+		
+
+		return SOAPBody;
+	}
+
+	public void setIdentifier(Identifier identifier) {
+		this.identifier = identifier;
+	}
+
+	public Identifier getIdentifier() {
+		return identifier;
+	}
+
+	public void setAccept(Accept accept) {
+		this.accept = accept;
+	}
+
+	public Accept getAccept() {
+		return accept;
+	}
+
+	public Expires getExpires() {
+		return expires;
+	}
+
+	public void setExpires(Expires expires) {
+		this.expires = expires;
+	}
+
+	public void toSOAPEnvelope(SOAPEnvelope envelope) throws AxisFault {
+		SOAPBody body = envelope.getBody();
+		
+		//detach if already exist.
+		OMElement elem = body.getFirstChildWithName(new QName(rmNamespaceValue,
+				Sandesha2Constants.WSRM_COMMON.CREATE_SEQUENCE_RESPONSE));
+		if (elem!=null)
+			elem.detach();
+		
+		toOMElement(body);
+	}
+	
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		if (Sandesha2Constants.SPEC_2007_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
+	}
+	
+}

Added: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Endpoint.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Endpoint.java?view=auto&rev=531400
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Endpoint.java (added)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Endpoint.java Mon Apr 23 02:54:53 2007
@@ -0,0 +1,85 @@
+package org.apache.sandesha2.wsrm;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.addressing.EndpointReferenceHelper;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.i18n.SandeshaMessageHelper;
+import org.apache.sandesha2.i18n.SandeshaMessageKeys;
+
+public class Endpoint implements IOMRMElement {
+
+	private EndpointReference epr;
+	
+	private String rmNamespaceValue = null;
+	
+	private String addressingNamespaceValue = null;
+
+	// Constructor used while parsing
+	public Endpoint (String rmNamespaceValue) throws AxisFault {
+		if (!isNamespaceSupported(rmNamespaceValue))
+			throw new SandeshaException (SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.unknownSpec,
+					rmNamespaceValue));
+		
+		this.rmNamespaceValue = rmNamespaceValue;
+	}
+	
+	// Constructor used while writing
+	public Endpoint (EndpointReference epr, String rmNamespaceValue, String addressingNamespaceValue) throws AxisFault {
+		this (rmNamespaceValue);
+		this.addressingNamespaceValue = addressingNamespaceValue;
+		this.epr = epr;
+	}
+
+	public String getNamespaceValue(){
+		return rmNamespaceValue;
+	}
+
+	public Object fromOMElement(OMElement endpointElement) throws OMException,AxisFault {
+
+		epr = EndpointReferenceHelper.fromOM (endpointElement);
+		if (epr==null) {
+			String message = SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.invalidElementFoundWithinElement,
+					"EPR",
+					Sandesha2Constants.WSRM_COMMON.ENDPOINT);
+			throw new SandeshaException (message);
+		}
+		
+		return this;
+	}
+
+	public OMElement toOMElement(OMElement element) throws OMException,AxisFault {
+
+		if (epr == null)
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.cannotSetEndpoint,
+					null));
+
+		OMFactory factory = element.getOMFactory();
+		
+		QName endpoint = new QName (rmNamespaceValue,Sandesha2Constants.WSRM_COMMON.ENDPOINT, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+	    OMElement endpointElement =	EndpointReferenceHelper.toOM (factory, epr, endpoint, addressingNamespaceValue);
+		
+		element.addChild(endpointElement);
+		return element;
+	}
+
+	public EndpointReference getEPR() {
+		return epr;
+	}
+
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2007_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
+	}
+}

Added: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Expires.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Expires.java?view=auto&rev=531400
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Expires.java (added)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Expires.java Mon Apr 23 02:54:53 2007
@@ -0,0 +1,105 @@
+/*
+ * Copyright  1999-2004 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.sandesha2.wsrm;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.i18n.SandeshaMessageHelper;
+import org.apache.sandesha2.i18n.SandeshaMessageKeys;
+
+/**
+ * Represents an Expires element.
+ */
+
+public class Expires implements IOMRMElement {
+
+	private String duration = null;
+	
+	private String namespaceValue = null;
+
+	public Expires(String namespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(namespaceValue))
+			throw new SandeshaException (SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.unknownSpec,
+					namespaceValue));
+		
+		this.namespaceValue = namespaceValue;
+	}
+
+	public Object fromOMElement(OMElement element) throws OMException {
+		OMElement expiresPart = element.getFirstChildWithName(new QName(
+				namespaceValue, Sandesha2Constants.WSRM_COMMON.EXPIRES));
+		if (expiresPart == null)
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.noExpiresPartInElement,
+					element.toString()));
+		String expiresText = expiresPart.getText();
+		if (expiresText == null || expiresText == "")
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.cannotProcessExpires));
+
+		duration = expiresText;
+		return element;
+	}
+
+	public String getNamespaceValue() throws OMException {
+		return namespaceValue;
+	}
+
+	public OMElement toOMElement(OMElement element) throws OMException {
+
+		if (duration == null || duration == "")
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.cannotProcessExpires));
+
+		OMFactory factory = element.getOMFactory();
+		
+		OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+		OMElement expiresElement = factory.createOMElement(
+				Sandesha2Constants.WSRM_COMMON.EXPIRES, rmNamespace);
+		
+		expiresElement.setText(duration);
+		element.addChild(expiresElement);
+
+		return element;
+	}
+
+	public String getDuration() {
+		return duration;
+	}
+
+	public void setDuration(String duration) {
+		this.duration = duration;
+	}
+	
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		if (Sandesha2Constants.SPEC_2007_02.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