ws-sandesha-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jal...@apache.org
Subject svn commit: r227347 - in /webservices/sandesha/trunk/src/org: ./ apache/ apache/sandesha2/ apache/sandesha2/wsrm/
Date Thu, 04 Aug 2005 11:22:28 GMT
Author: jaliya
Date: Thu Aug  4 04:21:44 2005
New Revision: 227347

URL: http://svn.apache.org/viewcvs?rev=227347&view=rev
Log:
Applied the patch sent by Saminda

Added:
    webservices/sandesha/trunk/src/org/
    webservices/sandesha/trunk/src/org/apache/
    webservices/sandesha/trunk/src/org/apache/sandesha2/
    webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/
    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/CreateSequence.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequenceResponse.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

Added: webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java?rev=227347&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java Thu Aug  4 04:21:44 2005
@@ -0,0 +1,61 @@
+/*
+ * 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;
+
+/**
+ * @author Saminda
+ *
+ */
+public interface Constants {
+
+	public interface WSRM{
+		public static final String NS_PREFIX_RM = "wsrm";
+        public static final String NS_URI_RM = "http://schemas.xmlsoap.org/ws/2005/02/rm";
+        public static final String MSG_NUMBER = "MessageaNumber";
+        public static final String LAST_MSG = "LastMessage";
+        public static final String SEQUENCE = "Sequence";
+        public static final String SEQUENCE_OFFER = "Offer";
+        public static final String TERMINATE_SEQUENCE = "TerminateSequence";
+        public static final String FAULT_CODE = "FaultCode";
+        public static final String SEQUENCE_FAULT = "SequenceFault";
+        public static final String ACKS_TO = "AcksTo";
+        public static final String CREATE_SEQUENCE = "CreateSequence";
+        public static final String CREATE_SEQUENCE_RESPONSE = "CreateSequenceResponse";
+        public static final String ACK_REQUESTED = "AckRequested";
+        public static final String ACK_RANGE = "AcknowledgementRange";
+        public static final String UPPER = "Upper";
+        public static final String LOWER = "Lower";
+        public static final String NACK = "Nack";
+        public static final String SEQUENCE_ACK = "SequenceAcknowledgement";
+        public static final String IDENTIFIER = "Identifier";
+        public static final String ACCEPT = "Accept";
+    }
+
+      String RM_HEADERS="rmHeaders";
+      String SEQUENCE="sequence";
+      String MESSAGE_NUMBER="messageNumber";
+
+      String MESSAGE_TYPE ="messageType";
+
+      String CREATE_SEQ_REQ="createSequenceReq";
+      String CREATE_SEQ_RES="createSequenceRes";
+      String ACKNOWLEDGEMENT="acknowledgement";
+      String IN_MESSAGE="inMessage";
+      String OUT_MESSAGE="outMessage";
+      String FAULT_MESSAGE="faultMessage";
+
+}

Added: 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=227347&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Accept.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Accept.java Thu Aug  4 04:21:44 2005
@@ -0,0 +1,63 @@
+/*
+ * 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 org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.sandesha2.Constants;
+
+/**
+ * @author Saminda
+ */
+public class Accept implements IOMRMElement {
+	private OMElement acceptElement;
+	private AcksTo acksTo;
+	OMNamespace acceptNamespace =
+		OMAbstractFactory.getSOAP11Factory().createOMNamespace(Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+	public Accept(){
+		acceptElement = OMAbstractFactory.getSOAP11Factory().createOMElement(
+				Constants.WSRM.ACCEPT,acceptNamespace);
+	}
+	public OMElement getSOAPElement() throws OMException {
+		acceptElement.addChild(acksTo.getSOAPElement());
+		return acceptElement;
+	}
+	
+	public Object fromSOAPEnvelope(SOAPEnvelope envelope) throws OMException {
+		acksTo = new AcksTo(new EndpointReference("",""));
+		acksTo.fromSOAPEnvelope(envelope);
+		return this;
+	}
+
+	public OMElement toSOAPEnvelope(OMElement messageElement) throws OMException {
+		if (acksTo != null){
+			acksTo.toSOAPEnvelope(acceptElement);
+		}
+		messageElement.addChild(acceptElement);
+		return messageElement;
+	}
+	public void setAcksTo(AcksTo acksTo){
+		this.acksTo = acksTo;
+	}
+	public AcksTo getAcksTo(){
+		return acksTo;
+	}
+}

Added: 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=227347&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckRequested.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckRequested.java Thu Aug  4 04:21:44 2005
@@ -0,0 +1,87 @@
+/*
+ * 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 org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPHeader;
+import org.apache.axis2.soap.SOAPHeaderBlock;
+import org.apache.sandesha2.Constants;
+
+/**
+ * @author Saminda
+ *
+ */
+public class AckRequested implements IOMRMElement {
+	private OMElement ackRequestedElement;
+	private Identifier identifier;
+	private MessageNumber messageNumber;
+	OMNamespace ackReqNoNamespace =
+		OMAbstractFactory.getSOAP11Factory().createOMNamespace(Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+	public AckRequested(){
+		ackRequestedElement = OMAbstractFactory.getSOAP11Factory().createOMElement(
+				Constants.WSRM.ACK_REQUESTED,ackReqNoNamespace);
+	}
+	public OMElement getSOAPElement() throws OMException {
+		ackRequestedElement.addChild(identifier.getSOAPElement());
+		ackRequestedElement.addChild(messageNumber.getSOAPElement());
+		return ackRequestedElement;
+	}
+
+	public Object fromSOAPEnvelope(SOAPEnvelope envelope) throws OMException {
+		identifier = new Identifier();
+		messageNumber = new MessageNumber();
+		identifier.fromSOAPEnvelope(envelope);
+		messageNumber.fromSOAPEnvelope(envelope);
+		return this;
+	}
+
+	public OMElement toSOAPEnvelope(OMElement envelope) throws OMException {
+		SOAPEnvelope soapEnvelope = (SOAPEnvelope)envelope;
+		SOAPHeader soapHeader = soapEnvelope.getHeader();
+		SOAPHeaderBlock soapHeaderBlock = soapHeader.addHeaderBlock(
+				Constants.WSRM.ACK_REQUESTED,ackReqNoNamespace);
+		soapHeaderBlock.setMustUnderstand(true);
+		if( identifier != null){
+			identifier.toSOAPEnvelope(soapHeaderBlock);
+		}
+		if ( messageNumber != null){
+			messageNumber.toSOAPEnvelope(soapHeaderBlock);
+		}
+		
+		return envelope;
+	}
+	public void setIdentifier(Identifier identifier){
+		this.identifier = identifier;
+	}
+	public void setMessageNumber(MessageNumber messageNumber){
+		this.messageNumber = messageNumber;
+	}
+	public Identifier getIdentifier(){
+		return identifier;
+	}
+	public MessageNumber getMessageNumber(){
+		return messageNumber;
+	}
+	public void addChildElement(OMElement element){
+		ackRequestedElement.addChild(element);
+	}
+
+}

Added: 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=227347&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcknowledgementRange.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcknowledgementRange.java Thu Aug  4 04:21:44 2005
@@ -0,0 +1,118 @@
+/*
+ * 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 org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMAttribute;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.om.OMNode;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.sandesha2.Constants;
+
+/**
+ * @author Saminda
+ */
+public class AcknowledgementRange implements IOMRMElement {
+	private OMElement acknowledgementRangeElement;
+	private long maxValue;
+	private long minValue;
+	OMNamespace ackRangeNamespace = 
+        OMAbstractFactory.getSOAP11Factory().createOMNamespace(Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+	public AcknowledgementRange(){
+		acknowledgementRangeElement = OMAbstractFactory.getSOAP11Factory().createOMElement(
+				Constants.WSRM.ACK_RANGE,ackRangeNamespace);
+	}
+	public OMElement getSOAPElement() throws OMException {
+		acknowledgementRangeElement.addAttribute(Constants.WSRM.LOWER,
+				new Long(minValue).toString(),ackRangeNamespace);
+		acknowledgementRangeElement.addAttribute(Constants.WSRM.UPPER,
+				new Long(maxValue).toString(),ackRangeNamespace);
+		return acknowledgementRangeElement;
+	}
+
+	private boolean readACKRangeElement(OMElement element){
+		Iterator iterator = element.getChildren();
+		while(iterator.hasNext()){
+			OMNode omNode = (OMNode)iterator.next();
+			if(omNode.getType() != OMNode.ELEMENT_NODE){
+				continue;
+			}
+			OMElement childElement = (OMElement)omNode;
+			if(childElement.getLocalName().equals(Constants.WSRM.ACK_RANGE)){
+				Iterator ite = childElement.getAttributes();
+				while(ite.hasNext()){
+					OMAttribute attr = (OMAttribute)ite.next();
+					if (attr.getLocalName().equals(Constants.WSRM.LOWER)){
+						minValue = Long.parseLong(attr.getValue());
+					}
+					else{										
+						maxValue = Long.parseLong(attr.getValue());
+						return true;
+					}
+				}
+			}else{
+				readACKRangeElement(childElement);
+			}
+		}
+		return false;
+	}
+	//this fromSOAPEnvelope(OMElement element) for the purpose of making the coming iteration easier
+	public Object fromSOAPEnvelope(OMElement element) throws OMException{
+		Iterator iterator = element.getAttributes();
+		while(iterator.hasNext()){
+			OMAttribute attr = (OMAttribute)iterator.next();
+			if (attr.getLocalName().equals(Constants.WSRM.LOWER)){
+				minValue = Long.parseLong(attr.getValue());
+			}
+			else{										
+				maxValue = Long.parseLong(attr.getValue());
+			}
+		}
+		return this;
+	} 		
+	
+	public Object fromSOAPEnvelope(SOAPEnvelope envelope) throws OMException {
+		readACKRangeElement(envelope);
+		return this;
+	}
+
+	public OMElement toSOAPEnvelope(OMElement messageElement) throws OMException {
+		acknowledgementRangeElement.addAttribute(Constants.WSRM.LOWER,
+				new Long(minValue).toString(),ackRangeNamespace);
+		acknowledgementRangeElement.addAttribute(Constants.WSRM.UPPER,
+				new Long(maxValue).toString(),ackRangeNamespace);
+		messageElement.addChild(acknowledgementRangeElement);
+		return messageElement;
+	}
+	public void setMinValue(long minValue){
+		this.minValue = minValue;
+	}
+	public void setMaxValue(long maxValue){
+		this.maxValue = maxValue;		
+	}
+	public long getMinValue(){
+		return minValue;
+	}
+	public long getMaxValue(){
+		return maxValue;
+	}
+
+}

Added: 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=227347&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcksTo.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcksTo.java Thu Aug  4 04:21:44 2005
@@ -0,0 +1,87 @@
+/*
+ * 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 org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.om.OMNode;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.sandesha2.Constants;
+/**
+ * @author Saminda
+ *
+ */
+public class AcksTo implements IOMRMElement{
+	private EndpointReference EPR;
+	private OMElement acksToElement;
+	
+	OMNamespace acksToNameSpace = 
+		OMAbstractFactory.getSOAP11Factory().createOMNamespace(
+				Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+	public AcksTo(EndpointReference EPR){
+		acksToElement = OMAbstractFactory.getSOAP11Factory().createOMElement(
+				Constants.WSRM.ACKS_TO,acksToNameSpace);
+		this.EPR = EPR;
+	}
+	public OMElement getSOAPElement() throws OMException {
+		acksToElement.addChild(OMAbstractFactory.getSOAP12Factory()
+				.createText(EPR.getAddress()));
+		return acksToElement;
+	}
+
+	public boolean readEPRElement(OMElement element){
+		Iterator iterator = element.getChildren();
+		while(iterator.hasNext()){
+			OMNode omNode = (OMNode)iterator.next();
+			if(omNode.getType() != OMNode.ELEMENT_NODE){
+				continue;
+			}else{
+				OMElement omElement = (OMElement)omNode;
+				if (omElement.getLocalName().equals(Constants.WSRM.ACKS_TO)){
+					String uri = omElement.getText();
+					EPR = new EndpointReference("",uri);
+					return true;
+				}else{
+					readEPRElement(omElement);
+				}
+			}			
+		}
+		return false;
+	}
+	public Object fromSOAPEnvelope(SOAPEnvelope envelope) throws OMException {
+		readEPRElement(envelope);
+		return this;
+	}
+	public OMElement toSOAPEnvelope(OMElement messageElement) throws OMException {
+		acksToElement.addChild(OMAbstractFactory.getSOAP11Factory().createText(
+				EPR.getAddress()));
+		messageElement.addChild(acksToElement);
+		return messageElement;
+	}
+	public EndpointReference getEndPointReference(){
+		return EPR;
+	}
+	public void setEndPointReference(EndpointReference EPR){
+		this.EPR = EPR;
+	}
+	
+}

Added: 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=227347&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequence.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequence.java Thu Aug  4 04:21:44 2005
@@ -0,0 +1,82 @@
+/*
+ * 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 org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAPBody;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.sandesha2.Constants;
+
+/**
+ * @author Saminda
+ *
+ */
+public class CreateSequence implements IOMRMElement {
+	private OMElement createSequenceElement;
+	private AcksTo acksTo;
+	private SequenceOffer sequenceOffer;
+	
+	OMNamespace createSeqNoNamespace =
+		OMAbstractFactory.getSOAP11Factory().createOMNamespace(Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+	public CreateSequence(){
+		createSequenceElement = OMAbstractFactory.getSOAP11Factory().createOMElement(Constants.WSRM.CREATE_SEQUENCE,
+				createSeqNoNamespace);
+	}
+	public OMElement getSOAPElement() throws OMException {
+		createSequenceElement.addChild(sequenceOffer.getSOAPElement());
+		createSequenceElement.addChild(acksTo.getSOAPElement());
+		return createSequenceElement;
+	}
+
+	public Object fromSOAPEnvelope(SOAPEnvelope envelope) throws OMException {
+		sequenceOffer = new SequenceOffer();
+		acksTo = new AcksTo(new EndpointReference("",""));
+		sequenceOffer.fromSOAPEnvelope(envelope);
+		acksTo.fromSOAPEnvelope(envelope);		
+		return this;
+	}
+
+	public OMElement toSOAPEnvelope(OMElement envelope) throws OMException {
+		SOAPEnvelope soapEnvelope = (SOAPEnvelope)envelope;
+		SOAPBody soapBody = soapEnvelope.getBody();
+		soapBody.addChild(createSequenceElement);
+		if(sequenceOffer != null){
+			sequenceOffer.toSOAPEnvelope(createSequenceElement);
+		}
+		if (acksTo != null){
+			acksTo.toSOAPEnvelope(createSequenceElement);
+		}
+		return envelope;
+	}
+	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;
+	}
+
+}

Added: 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=227347&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequenceResponse.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequenceResponse.java Thu Aug  4 04:21:44 2005
@@ -0,0 +1,81 @@
+/*
+ * 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 org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAPBody;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.sandesha2.Constants;
+
+/**
+ * @author Saminda
+ *
+ */
+public class CreateSequenceResponse implements IOMRMElement {
+	private OMElement createSequenceResponseElement;
+	private Identifier identifier;
+	private Accept accept;
+	OMNamespace createSeqResNoNamespace =
+		OMAbstractFactory.getSOAP11Factory().createOMNamespace(Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+	public CreateSequenceResponse(){
+		createSequenceResponseElement = OMAbstractFactory.getSOAP11Factory().createOMElement(
+				Constants.WSRM.CREATE_SEQUENCE_RESPONSE,createSeqResNoNamespace);
+	}
+	public OMElement getSOAPElement() throws OMException {
+		return createSequenceResponseElement;
+	}
+
+	public Object fromSOAPEnvelope(SOAPEnvelope envelope) throws OMException {
+		identifier = new Identifier();
+		accept = new Accept();
+		identifier.fromSOAPEnvelope(envelope);
+		accept.fromSOAPEnvelope(envelope);
+		return this;
+	}
+
+	public OMElement toSOAPEnvelope(OMElement envelope) throws OMException {
+		SOAPEnvelope soapEnvelope = (SOAPEnvelope)envelope;
+		SOAPBody soapBody = soapEnvelope.getBody();
+		soapBody.addChild(createSequenceResponseElement);
+		if( identifier != null ){
+			identifier.toSOAPEnvelope(createSequenceResponseElement);
+		}
+		if( accept != null){
+			accept.toSOAPEnvelope(createSequenceResponseElement);
+		}
+		return envelope;
+	}
+	public void addChildElement(OMElement element){
+		createSequenceResponseElement.addChild(element);
+	}
+	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;
+	}
+
+}

Added: 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=227347&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/FaultCode.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/FaultCode.java Thu Aug  4 04:21:44 2005
@@ -0,0 +1,58 @@
+/*
+ * 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 org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.sandesha2.Constants;
+
+/**
+ * @author Saminda
+ *
+ */
+public class FaultCode implements IOMRMElement {
+	
+	private OMElement faultCodeElement;
+	OMNamespace faultCodeNameSpace = 
+		OMAbstractFactory.getSOAP11Factory().createOMNamespace(
+				Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+	public FaultCode(){
+		faultCodeElement = OMAbstractFactory.getSOAP11Factory().createOMElement(
+				Constants.WSRM.FAULT_CODE,faultCodeNameSpace);
+	}
+	public OMElement getSOAPElement() throws OMException {
+		return faultCodeElement;
+	}
+
+	public Object fromSOAPEnvelope(SOAPEnvelope envelope) throws OMException {
+		return this;
+	}
+
+	public OMElement toSOAPEnvelope(OMElement messageElement) throws OMException {
+		messageElement.addChild(faultCodeElement);
+		return messageElement;
+	}
+	public void setFaultCode(OMElement faultCode){
+		faultCodeElement = faultCode;
+	}
+	public OMElement getFaultCode(){
+		return faultCodeElement;
+	}
+}

Added: 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=227347&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/IOMRMElement.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/IOMRMElement.java Thu Aug  4 04:21:44 2005
@@ -0,0 +1,32 @@
+/*
+ * 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;
+
+/**
+ * @author Saminda
+ *
+ */
+
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.soap.SOAPEnvelope;
+
+public interface IOMRMElement {
+	public OMElement getSOAPElement() throws OMException;
+	public Object fromSOAPEnvelope(SOAPEnvelope envelope) throws OMException;
+	public OMElement toSOAPEnvelope(OMElement messageElement) throws OMException;
+}

Added: 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=227347&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Identifier.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Identifier.java Thu Aug  4 04:21:44 2005
@@ -0,0 +1,121 @@
+/*
+ * 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;
+
+/**
+ * @author Saminda
+ *
+ */
+import java.util.Iterator;
+
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.om.OMNode;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.sandesha2.Constants;
+
+public class Identifier implements Constants, IOMRMElement {
+	private OMElement identifierElement;
+
+	private String identifier;
+
+	OMNamespace wsuNamespace = OMAbstractFactory.getSOAP11Factory().createOMNamespace(
+			Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+
+	public Identifier() {
+
+		identifierElement = OMAbstractFactory.getSOAP11Factory().createOMElement(
+				Constants.WSRM.IDENTIFIER, wsuNamespace);
+	}
+
+	public void setURI(String uri) throws OMException {
+		identifierElement.addChild(OMAbstractFactory.getSOAP11Factory().createText(uri));
+	}
+
+	public void setIndentifer(String identifier) {
+		this.identifier = identifier;
+	}
+
+	public String getIdentifier() {
+		return identifier;
+	}
+
+	public OMElement getSOAPElement() throws OMException {
+		identifierElement.addChild(OMAbstractFactory.getSOAP11Factory().createText(
+				identifier));
+		return identifierElement;
+	}
+
+	private boolean readElement(OMElement element) {
+		Iterator iterator = element.getChildren();
+		while (iterator.hasNext()) {
+			OMNode omnode = (OMNode)iterator.next();
+			if(omnode.getType() != OMNode.ELEMENT_NODE){
+				continue ;
+			}				
+			OMElement childElement = (OMElement)omnode ;
+			if (childElement.getLocalName().equals(Constants.WSRM.IDENTIFIER)) {
+				identifier = childElement.getText();
+				return true;
+			}else {
+			   readElement(childElement);	
+			}
+		}
+		return false;
+	}
+
+	public Object fromSOAPEnvelope(SOAPEnvelope envelope) throws OMException {
+		readElement(envelope);
+		return this;
+	}
+
+	public OMElement toSOAPEnvelope(OMElement messageElement)
+			throws OMException {
+		//soapheaderblock will be given or anyother block reference to the requirment
+		if (identifier == null || identifier == "") {
+			throw new OMException("Set Identifier");
+		}
+		identifierElement.addChild(OMAbstractFactory.getSOAP11Factory().createText(
+				identifier));
+		messageElement.addChild(identifierElement);
+		return messageElement;
+	}
+
+	public String toString() {
+		return identifier;
+	}
+
+	public boolean equals(Object obj) {
+
+		if (obj instanceof Identifier) {
+			if (this.identifier == ((String) (((Identifier) obj)
+					.getIdentifier()))) {
+				return true;
+			} else {
+				return false;
+			}
+		} else {
+			return false;
+		}
+	}
+
+	public int hashCode() {
+		return identifier.hashCode();
+	}
+}
\ No newline at end of file

Added: 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=227347&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/LastMessage.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/LastMessage.java Thu Aug  4 04:21:44 2005
@@ -0,0 +1,84 @@
+/*
+ * 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 org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.om.OMNode;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.sandesha2.Constants;
+
+/**
+ * @author Saminda
+ *
+ */
+public class LastMessage implements IOMRMElement {
+
+	private OMElement lastMessageElement;
+	OMNamespace lastMsgNamespace =
+		OMAbstractFactory.getSOAP11Factory().createOMNamespace(Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+	public LastMessage(){
+		lastMessageElement = OMAbstractFactory.getSOAP11Factory().createOMElement(Constants.WSRM.LAST_MSG,lastMsgNamespace);	
+	}
+	public OMElement getSOAPElement() throws OMException {
+		return lastMessageElement;
+	}
+
+	private boolean readMNElement(OMElement element){
+		Iterator iterator = element.getChildren();
+		while(iterator.hasNext()){
+			OMNode omNode = (OMNode)iterator.next();
+			if( omNode.getType() != OMNode.ELEMENT_NODE){
+				continue;
+			}
+			OMElement childElement = (OMElement)omNode;
+			if (childElement.getLocalName().equals(Constants.WSRM.LAST_MSG)){
+				lastMessageElement = childElement;
+				return true;
+			}else{
+				readMNElement(childElement);
+			}
+		}
+		return false;
+	}
+	public Object fromSOAPEnvelope(SOAPEnvelope envelope) throws OMException {
+		readMNElement(envelope);
+		return this;
+	}
+
+	
+	public OMElement toSOAPEnvelope(OMElement messageElement) throws OMException {
+		//soapheaderblock element will be given
+		messageElement.addChild(lastMessageElement);
+		return messageElement;
+	}
+	public void setLastMessageElement(OMElement lastMsgElement){
+		lastMessageElement = lastMsgElement;
+	}
+	public OMElement getLastMessageElement(){
+		return lastMessageElement;
+	}
+	public boolean isPresent(){
+		return (lastMessageElement != null) ? true:false;
+	}
+	
+
+}

Added: 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=227347&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/MessageNumber.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/MessageNumber.java Thu Aug  4 04:21:44 2005
@@ -0,0 +1,97 @@
+/*
+ * 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 org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.om.OMNode;
+import org.apache.axis2.soap.SOAPEnvelope;
+
+import org.apache.sandesha2.Constants;
+
+/**
+ * @author Saminda
+ *
+ */
+public class MessageNumber implements IOMRMElement {
+	
+	private long messageNumber;
+	private OMElement messageNoElement;
+	
+	OMNamespace msgNoNamespace =
+		OMAbstractFactory.getSOAP11Factory().createOMNamespace(Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);	
+	public MessageNumber(){
+		messageNoElement = OMAbstractFactory.getSOAP11Factory().createOMElement(Constants.WSRM.MSG_NUMBER,msgNoNamespace);
+	}
+	
+	public long getMessageNumber(){
+		return messageNumber;
+	}
+	public void setMessageNumber(long messageNumber){
+		this.messageNumber = messageNumber;
+	}
+	private boolean readMNElement(OMElement element) {
+		Iterator iterator = element.getChildren();
+		while (iterator.hasNext()) {
+			OMNode omnode = (OMNode)iterator.next();
+			if(omnode.getType() != OMNode.ELEMENT_NODE){
+				continue ;
+			}				
+			OMElement childElement = (OMElement)omnode ;
+			if (childElement.getLocalName().equals(Constants.WSRM.MSG_NUMBER)) {
+				messageNumber = Long.parseLong(childElement.getText());
+				return true;
+			}else {
+			   readMNElement(childElement);	
+			}
+		}
+		return false;
+	}
+	
+	public Object fromSOAPEnvelope(SOAPEnvelope envelope) throws OMException {
+		readMNElement(envelope);
+		return this;
+	}
+	public OMElement toSOAPEnvelope(OMElement messageElement) throws OMException {
+		//soapheaderblock element will be given. 
+		long msgNo = getMessageNumber();
+		if (msgNo <= 0 ){
+			throw new OMException("Set A Valid Message Number");
+		}
+		messageNoElement.addChild(OMAbstractFactory.getSOAP11Factory().createText(
+				new Long(msgNo).toString()));
+		messageElement.addChild(messageNoElement);
+		
+		return messageElement;
+	}
+	public OMElement getSOAPElement() throws OMException {
+		long msgNo = getMessageNumber();
+		messageNoElement.addChild(OMAbstractFactory.getSOAP11Factory().createText(new 
+					Long(msgNo).toString()));
+		
+		return messageNoElement;
+	}
+	public OMElement getMessageNumberElement(){
+		return messageNoElement;
+	}
+
+
+}

Added: 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=227347&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Nack.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Nack.java Thu Aug  4 04:21:44 2005
@@ -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 java.util.Iterator;
+
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.om.OMNode;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.sandesha2.Constants;
+
+/**
+ * @author Saminda
+ *
+ */
+public class Nack implements IOMRMElement {
+	private OMElement nackElement;
+	private long notAckNumber;
+	OMNamespace nackNamespace =
+		OMAbstractFactory.getSOAP11Factory().createOMNamespace(Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+	public Nack(){
+		nackElement = OMAbstractFactory.getSOAP11Factory().createOMElement(
+				Constants.WSRM.NACK,nackNamespace);
+	}
+	public OMElement getSOAPElement() throws OMException {
+		nackElement.addChild(OMAbstractFactory.getSOAP11Factory().createText(
+				new Long(notAckNumber).toString()));
+		return nackElement;
+	}
+	private boolean readNackElement(OMElement element){
+		Iterator iterator = element.getChildren();
+		while(iterator.hasNext()){
+			OMNode omNode = (OMNode)iterator.next();
+			if(omNode.getType() != OMNode.ELEMENT_NODE){
+				continue;
+			}
+			OMElement childElement = (OMElement)omNode;
+			if(childElement.getLocalName().equals(Constants.WSRM.NACK)){
+				notAckNumber = Long.parseLong(childElement.getText());
+				return true;
+			}else{
+				readNackElement(childElement);
+			}
+		}
+		return false;	
+	}
+	//duplicate method for the purpose of using comming iteration easily
+	public Object fromSOAPEnvelope(OMElement element) throws OMException{
+		notAckNumber = Long.parseLong(element.getText());
+		return this;
+	} 
+	public Object fromSOAPEnvelope(SOAPEnvelope envelope) throws OMException {
+		readNackElement(envelope);
+		return this;
+	}
+	public OMElement toSOAPEnvelope(OMElement messageElement) throws OMException {
+		nackElement.addChild(OMAbstractFactory.getSOAP11Factory().createText(
+				new Long(notAckNumber).toString()));
+		messageElement.addChild(nackElement);
+		return messageElement;
+	}
+	public void setNackNumber(long notAckNumber){
+		this.notAckNumber = notAckNumber;
+	}
+	public long getNackNumber(){
+		return notAckNumber;
+	}
+
+}

Added: 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=227347&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/RMElements.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/RMElements.java Thu Aug  4 04:21:44 2005
@@ -0,0 +1,126 @@
+/*
+ * 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 org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPHeader;
+import org.apache.axis2.soap.SOAPHeaderBlock;
+import org.apache.sandesha2.Constants;
+
+/**
+ * @author Saminda
+ *
+ */
+public class RMElements{
+	private Sequence sequenceElement;
+	private SequenceAcknowledgement sequenceAcknowledgementElement;
+	
+	private CreateSequence createSequenceElement;
+	private CreateSequenceResponse createSequenceResponseElement;
+	private TerminateSequence terminateSequenceElement;
+
+	public OMElement getSOAPElement() throws OMException {
+		//this mehod has no significant in the code
+		return null;
+	}
+	
+	public Object fromSOAPEnvelope(SOAPEnvelope envelope) throws OMException {
+		SOAPHeader soapHeader = envelope.getHeader();
+		Iterator iterator = soapHeader.examineAllHeaderBlocks();
+		while (iterator.hasNext()){
+			SOAPHeaderBlock childBlock = (SOAPHeaderBlock)iterator.next();
+			if (childBlock.getLocalName().equals(Constants.WSRM.SEQUENCE)){
+				sequenceElement = new Sequence();
+				childBlock.setMustUnderstand(false);
+				childBlock.setComplete(true);
+				sequenceElement.fromSOAPEnvelope(envelope);
+				
+			}
+			if (childBlock.getLocalName().equals(Constants.WSRM.SEQUENCE_ACK)){
+				sequenceAcknowledgementElement = new SequenceAcknowledgement();
+				childBlock.setMustUnderstand(false);
+				childBlock.setComplete(true);
+				sequenceAcknowledgementElement.fromSOAPEnvelope(envelope);
+			}
+		}
+		createSequenceElement = new CreateSequence();
+		createSequenceResponseElement = new CreateSequenceResponse();
+		terminateSequenceElement = new TerminateSequence();
+		
+		createSequenceElement.fromSOAPEnvelope(envelope);
+		createSequenceResponseElement.fromSOAPEnvelope(envelope);
+		terminateSequenceElement.fromSOAPEnvelope(envelope);
+		return this;
+	}
+
+	public SOAPEnvelope toSOAPEnvelope(SOAPEnvelope envelope) throws OMException {
+		
+		
+		if(sequenceElement != null){
+			sequenceElement.toSOAPEnvelope(envelope);
+		}
+		if ( sequenceAcknowledgementElement != null) {
+			sequenceAcknowledgementElement.toSOAPEnvelope(envelope);
+		}
+		if ( createSequenceElement != null){
+			createSequenceElement.toSOAPEnvelope(envelope);
+		}
+		if (createSequenceResponseElement != null){
+			createSequenceResponseElement.toSOAPEnvelope(envelope);
+		}
+		if (terminateSequenceElement != null){
+			terminateSequenceElement.toSOAPEnvelope(envelope);
+		}
+		return envelope;
+	}
+	public CreateSequence getCreateSequence(){
+		return createSequenceElement;
+	}
+	public CreateSequenceResponse getCreateSequenceResponse(){
+		return createSequenceResponseElement;
+	}
+	public Sequence getSequence(){
+		return sequenceElement;
+	}
+	public SequenceAcknowledgement getSequenceAcknowledgement(){
+		return sequenceAcknowledgementElement;
+	}
+	public TerminateSequence getTerminateSequence(){
+		return terminateSequenceElement;
+	}
+	public void setCreateSequence(CreateSequence createSequence){
+		createSequenceElement = createSequence;
+	}
+	public void setCreateSequenceResponse(CreateSequenceResponse createSequenceResponse){
+		createSequenceResponseElement = createSequenceResponse;
+	}
+	public void setSequence(Sequence sequence){
+		sequenceElement = sequence;
+	}
+	public void setSequenceAcknowledgement(SequenceAcknowledgement sequenceAcknowledgement){
+		sequenceAcknowledgementElement = sequenceAcknowledgement;
+	}
+	public void setTerminateSequence(TerminateSequence terminateSequence){
+		terminateSequenceElement = terminateSequence;
+	}
+	
+	
+}

Added: 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=227347&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Sequence.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Sequence.java Thu Aug  4 04:21:44 2005
@@ -0,0 +1,109 @@
+/*
+ * 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 org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPHeader;
+import org.apache.axis2.soap.SOAPHeaderBlock;
+import org.apache.sandesha2.Constants;
+
+/**
+ * @author Saminda
+ *
+ */
+
+public class Sequence implements IOMRMElement {
+
+	private OMElement sequenceElement;
+	private Identifier identifier;
+	private MessageNumber messageNumber;
+	private LastMessage lastMessage;
+	
+	OMNamespace seqNoNamespace =
+		OMAbstractFactory.getSOAP11Factory().createOMNamespace(Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+	public Sequence(){
+		sequenceElement = OMAbstractFactory.getSOAP11Factory().createOMElement(Constants.WSRM.SEQUENCE,seqNoNamespace);
+	}
+	public OMElement getSOAPElement() throws OMException {
+		sequenceElement.addChild(identifier.getSOAPElement());
+		sequenceElement.addChild(messageNumber.getSOAPElement());
+		sequenceElement.addChild(lastMessage.getSOAPElement());
+		return sequenceElement;
+	}
+
+	public Object fromSOAPEnvelope(SOAPEnvelope envelope) throws OMException {
+		identifier = new Identifier();
+		lastMessage = new LastMessage();
+		messageNumber = new MessageNumber();
+		identifier.fromSOAPEnvelope(envelope);
+		messageNumber.fromSOAPEnvelope(envelope);
+		lastMessage.fromSOAPEnvelope(envelope);
+		return this;
+	}
+	
+	public OMElement toSOAPEnvelope(OMElement envelope) throws OMException {
+		//soapelevement will be given here. 
+		SOAPEnvelope soapEnvelope = (SOAPEnvelope)envelope;
+		
+		SOAPHeader soapHeader = soapEnvelope.getHeader();
+		SOAPHeaderBlock soapHeaderBlock = soapHeader.addHeaderBlock(
+				Constants.WSRM.SEQUENCE,seqNoNamespace);
+		soapHeaderBlock.setMustUnderstand(true);
+		
+		if (lastMessage != null) {
+            lastMessage.toSOAPEnvelope(soapHeaderBlock);
+        }
+
+        if (identifier != null) {
+            identifier.toSOAPEnvelope(soapHeaderBlock);
+        }
+
+        if (messageNumber != null) {
+            messageNumber.toSOAPEnvelope(soapHeaderBlock);
+        }
+		
+		return envelope;
+	}
+	public void addChildElement(OMElement element) throws OMException{
+		sequenceElement.addChild(element);
+	}
+	
+	public Identifier getIdentifier(){
+		return identifier;
+	}
+	public LastMessage getLastMessage(){
+		return lastMessage;
+	}
+	public MessageNumber getMessageNumber(){
+		return messageNumber;
+	}
+	public void setIdentifier(Identifier identifier){
+		this.identifier = identifier;
+	}
+	public void setLastMessage(LastMessage lastMessage){
+		this.lastMessage = lastMessage;
+	}
+	public void setMessageNumber(MessageNumber messageNumber){
+		this.messageNumber = messageNumber;
+	}
+	
+
+}

Added: 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=227347&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceAcknowledgement.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceAcknowledgement.java Thu Aug  4 04:21:44 2005
@@ -0,0 +1,147 @@
+/*
+ * 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 java.util.LinkedList;
+import java.util.List;
+
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPHeader;
+import org.apache.axis2.soap.SOAPHeaderBlock;
+import org.apache.sandesha2.Constants;
+
+/**
+ * @author Saminda
+ *
+ */
+public class SequenceAcknowledgement implements IOMRMElement {
+	private OMElement sequenceAcknowledgementElement;
+	private Identifier identifier;
+	private List acknowledgementRanges;
+	private List nackList;
+	OMNamespace seqAcksNamespace =
+		OMAbstractFactory.getSOAP11Factory().createOMNamespace(Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+	public SequenceAcknowledgement(){
+		sequenceAcknowledgementElement = OMAbstractFactory.getSOAP11Factory().createOMElement(
+				Constants.WSRM.SEQUENCE_ACK,seqAcksNamespace);
+		acknowledgementRanges = new LinkedList();
+		nackList = new LinkedList();
+	}
+	public OMElement getSOAPElement() throws OMException {
+		Iterator iterator = acknowledgementRanges.iterator();
+		while(iterator.hasNext()){
+			AcknowledgementRange range = (AcknowledgementRange)iterator.next();
+			sequenceAcknowledgementElement.addChild(
+					range.getSOAPElement());
+			
+		}
+		iterator = nackList.iterator();
+		while(iterator.hasNext()){
+			Nack nack = (Nack)iterator.next();
+			sequenceAcknowledgementElement.addChild(
+					nack.getSOAPElement());
+		}
+		sequenceAcknowledgementElement.addChild(identifier.getSOAPElement());
+		return sequenceAcknowledgementElement;
+	}
+
+	public Object fromSOAPEnvelope(SOAPEnvelope envelope) throws OMException {
+		identifier = new Identifier();
+		SOAPHeader soapHeader = envelope.getHeader();
+		Iterator iterator = soapHeader.getChildren();
+		while (iterator.hasNext()){
+			OMElement omElement = (OMElement)iterator.next();
+			if (omElement.getLocalName().equals(Constants.WSRM.SEQUENCE_ACK)){
+				Iterator childIterator = omElement.getChildren();
+				while (childIterator.hasNext()){
+					OMElement childElement = (OMElement)childIterator.next();
+					if (childElement.getLocalName().equals(Constants.WSRM.ACK_RANGE)){
+						AcknowledgementRange ackRange = new AcknowledgementRange();
+						ackRange.fromSOAPEnvelope(childElement);
+						acknowledgementRanges.add(ackRange);
+					}
+					if (childElement.getLocalName().equals(Constants.WSRM.NACK)){
+						Nack nack = new Nack();	
+						nack.fromSOAPEnvelope(childElement);
+						nackList.add(nack);
+					}
+					if ( childElement.getLocalName().equals(Constants.WSRM.IDENTIFIER)){
+						identifier = new Identifier();
+						identifier.fromSOAPEnvelope(envelope);
+					}
+				}
+			}
+		}
+		
+		return this;
+	}
+
+	public OMElement toSOAPEnvelope(OMElement envelope) throws OMException {
+		SOAPEnvelope soapEnvelope = (SOAPEnvelope)envelope;
+		SOAPHeader soapHeader = soapEnvelope.getHeader();
+		SOAPHeaderBlock soapHeaderBlock = soapHeader.addHeaderBlock(
+				Constants.WSRM.SEQUENCE_ACK,seqAcksNamespace);
+		soapHeaderBlock.setMustUnderstand(true);
+		//adding ackRanges
+		Iterator iterator = acknowledgementRanges.iterator();
+		while(iterator.hasNext()){
+			AcknowledgementRange ackRange = (AcknowledgementRange)iterator.next();
+			ackRange.toSOAPEnvelope(soapHeaderBlock);
+		}
+		iterator = nackList.iterator();
+		while(iterator.hasNext()){
+			Nack nack = (Nack)iterator.next();
+			nack.toSOAPEnvelope(soapHeaderBlock);
+		}
+		if ( identifier != null){
+			identifier.toSOAPEnvelope(soapHeaderBlock);
+		}
+		return envelope;
+	}
+	public void setIdentifier(Identifier identifier){
+		this.identifier = identifier;
+	}
+	public void setAckRanges(List acknowledgementRagngesList){
+		acknowledgementRanges = acknowledgementRagngesList;
+	}
+	public Nack addNackRangges(Nack nack){
+		nackList.add(nack);
+		return nack;
+	}
+	public AcknowledgementRange addAcknowledgementRanges(AcknowledgementRange ackRange){
+		acknowledgementRanges.add(ackRange);
+		return ackRange;
+	}
+	public Identifier getIdentifier(){
+		return identifier;
+	}
+	public List getAcknowledgementRanges(){
+		return acknowledgementRanges;
+	}
+	public List getNackList(){
+		return nackList;
+	}
+	public void addChildElement(OMElement element){
+		acknowledgementRanges.add(element);
+	}
+
+}

Added: 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=227347&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceFault.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceFault.java Thu Aug  4 04:21:44 2005
@@ -0,0 +1,104 @@
+/*
+ * 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 org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPHeader;
+import org.apache.axis2.soap.SOAPHeaderBlock;
+import org.apache.sandesha2.Constants;
+
+/**
+ * @author Saminda
+ *
+ */
+public class SequenceFault implements IOMRMElement {
+	private OMElement sequenceFaultElement;
+	private FaultCode faultCode;
+	
+	OMNamespace sequenceFaultNameSpace = 
+		OMAbstractFactory.getSOAP11Factory().createOMNamespace(
+				Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+	public SequenceFault(){
+		sequenceFaultElement = OMAbstractFactory.getSOAP11Factory().createOMElement(
+				Constants.WSRM.SEQUENCE_FAULT,sequenceFaultNameSpace);
+	}
+	public OMElement getSOAPElement() throws OMException {
+		sequenceFaultElement.addChild(faultCode.getSOAPElement());
+		return sequenceFaultElement;
+	}
+
+	public Object fromSOAPEnvelope(SOAPEnvelope envelope) throws OMException {
+		//only for fault thus not intereated in refactoring
+		Iterator iterator = envelope.getChildren();
+		OMElement childElement;
+		OMElement siblings;
+		OMElement grandSiblings;
+		while(iterator.hasNext()){
+			childElement = (OMElement)iterator.next();
+			Iterator iteSib1 = childElement.getChildren();
+			while(iteSib1.hasNext()){
+				siblings = (OMElement)iteSib1.next();
+				Iterator iteSib2 = siblings.getChildren(); 
+				while(iteSib2.hasNext()){
+					grandSiblings = (OMElement)iteSib2.next();
+					if(grandSiblings.getLocalName().equals(Constants.WSRM.SEQUENCE_FAULT)){
+						faultCode = new FaultCode();
+						faultCode.fromSOAPEnvelope(envelope);
+					}
+				}
+			}
+		}
+		return this;
+	}
+
+	public OMElement toSOAPEnvelope(OMElement envelope) throws OMException {
+//		soapelevement will be given here. 
+		SOAPEnvelope soapEnvelope = (SOAPEnvelope)envelope;
+		
+		SOAPHeader soapHeader = soapEnvelope.getHeader();
+		SOAPHeaderBlock soapHeaderBlock = soapHeader.addHeaderBlock(
+				Constants.WSRM.SEQUENCE_FAULT,sequenceFaultNameSpace);
+		soapHeaderBlock.setMustUnderstand(true);
+		
+		
+        if (faultCode != null) {
+            faultCode.toSOAPEnvelope(soapHeaderBlock);
+        }
+		
+		return envelope;
+		
+	}
+	public void setFaultCode(FaultCode faultCode){
+		this.faultCode = faultCode;
+	}
+	public FaultCode getFaultCode(){
+		return faultCode;
+	}
+	public void setSequenceFaultElement(OMElement sequenceFault){
+		sequenceFaultElement = sequenceFault;
+	}
+	public OMElement getSequenceFaultElement(){
+		return sequenceFaultElement;
+	}
+
+}

Added: 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=227347&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceOffer.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceOffer.java Thu Aug  4 04:21:44 2005
@@ -0,0 +1,71 @@
+/*
+ * 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 org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.sandesha2.Constants;
+
+/**
+ * @author Saminda
+ *
+ */
+public class SequenceOffer implements IOMRMElement {
+	private OMElement sequenceOfferElement;
+	private Identifier identifier;
+	
+	OMNamespace sequenceOfferNameSpace = 
+		OMAbstractFactory.getSOAP11Factory().createOMNamespace(
+				Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+	public SequenceOffer(){
+		sequenceOfferElement = OMAbstractFactory.getSOAP11Factory().createOMElement(
+				Constants.WSRM.SEQUENCE_OFFER,sequenceOfferNameSpace);
+	}
+	public void addChildElement(OMElement element) throws OMException{
+		sequenceOfferElement.addChild(element);
+	}
+	
+	public OMElement getSOAPElement() throws OMException {
+		sequenceOfferElement.addChild(identifier.getSOAPElement());
+		return sequenceOfferElement;
+	}
+
+	public Object fromSOAPEnvelope(SOAPEnvelope envelope) throws OMException {
+		identifier = new Identifier();
+		identifier.fromSOAPEnvelope(envelope);
+		return this;
+	}
+
+	public OMElement toSOAPEnvelope(OMElement messageElement) throws OMException {
+		if (identifier != null){
+			identifier.toSOAPEnvelope(sequenceOfferElement);
+		}
+		messageElement.addChild(sequenceOfferElement);
+		return messageElement;
+	}
+	public Identifier getIdentifer(){
+		return identifier;
+	}
+	public void setIdentifier(Identifier identifier){
+		this.identifier = identifier;		
+	}
+	
+
+}

Added: 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=227347&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/TerminateSequence.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/TerminateSequence.java Thu Aug  4 04:21:44 2005
@@ -0,0 +1,70 @@
+/*
+ * 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 org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAPBody;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.sandesha2.Constants;
+
+/**
+ * @author Saminda
+ *
+ */
+public class TerminateSequence implements IOMRMElement {
+	private OMElement terminateSequenceElement;
+	private Identifier identifier;
+	
+	OMNamespace terminateSequenceNameSpace = 
+		OMAbstractFactory.getSOAP11Factory().createOMNamespace(
+				Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+	public TerminateSequence(){
+		terminateSequenceElement = OMAbstractFactory.getSOAP11Factory().createOMElement(
+				Constants.WSRM.TERMINATE_SEQUENCE,terminateSequenceNameSpace);
+	}
+	public OMElement getSOAPElement() throws OMException {
+		terminateSequenceElement.addChild(identifier.getSOAPElement());
+		return terminateSequenceElement;
+	}
+	public void addChild(OMElement element){
+		terminateSequenceElement.addChild(element);
+	}
+	public Object fromSOAPEnvelope(SOAPEnvelope envelope) throws OMException {
+		identifier = new Identifier();
+		identifier.fromSOAPEnvelope(envelope);
+		return this;
+	}
+	public OMElement toSOAPEnvelope(OMElement envelope) throws OMException {
+		SOAPEnvelope soapEnvelope = (SOAPEnvelope)envelope;
+		SOAPBody soapBody = soapEnvelope.getBody();
+		if (identifier != null){
+			identifier.toSOAPEnvelope(terminateSequenceElement);
+		}
+		soapBody.addChild(terminateSequenceElement);
+		return envelope;
+	}
+	public Identifier getIdentifier(){
+		return identifier;
+	}
+	public void setIdentifier(Identifier identifier){
+		this.identifier = identifier;
+	}
+
+}



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


Mime
View raw message