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 di...@apache.org on 2007/08/09 02:58:01 UTC

svn commit: r564063 [9/16] - in /webservices/sandesha/trunk/java: ./ modules/client/ modules/core/ modules/core/src/main/java/org/apache/sandesha2/ modules/core/src/main/java/org/apache/sandesha2/client/ modules/core/src/main/java/org/apache/sandesha2/...

Modified: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Identifier.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Identifier.java?view=diff&rev=564063&r1=564062&r2=564063
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Identifier.java (original)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Identifier.java Wed Aug  8 17:57:51 2007
@@ -1,117 +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;
-
-/**
- * Represents an Identifier element.
- */
-
-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;
-
-public class Identifier implements Sandesha2Constants, IOMRMElement {
-
-	private String identifier = null;
-	
-	private String namespaceValue = null;
-	
-	public Identifier(String namespaceValue) throws SandeshaException {
-		if (!isNamespaceSupported(namespaceValue))
-			throw new SandeshaException (SandeshaMessageHelper.getMessage(
-					SandeshaMessageKeys.unknownSpec,
-					namespaceValue));
-		
-		this.namespaceValue = namespaceValue;
-	}
-
-	public void setIndentifer(String identifier) {
-		this.identifier = identifier;
-	}
-
-	public String getIdentifier() {
-		return identifier;
-	}
-
-	public String getNamespaceValue() throws OMException {
-		return namespaceValue;
-	}
-
-	public Object fromOMElement(OMElement element) throws OMException {
-		
-		OMElement identifierPart = element.getFirstChildWithName(new QName(
-				namespaceValue, Sandesha2Constants.WSRM_COMMON.IDENTIFIER));
-		if (identifierPart == null)
-			throw new OMException(SandeshaMessageHelper.getMessage(
-					SandeshaMessageKeys.invalidIdentifier,
-					element.toString()));
-		
-		String identifierText = identifierPart.getText();
-		if (identifierText == null || identifierText == "")
-			throw new OMException(SandeshaMessageHelper.getMessage(
-					SandeshaMessageKeys.invalidIdentifier,
-					element.toString()));
-
-		identifier = identifierText;
-		return this;
-	}
-
-	public OMElement toOMElement(OMElement element) throws OMException {
-
-		if (identifier == null || identifier == "") {
-			throw new OMException(SandeshaMessageHelper.getMessage(
-					SandeshaMessageKeys.invalidIdentifier,
-					element.toString()));
-		}
-		
-		OMFactory factory = element.getOMFactory();
-			
-		OMNamespace wsrmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
-		OMElement identifierElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.IDENTIFIER, wsrmNamespace);
-
-		identifierElement.setText(identifier);
-		element.addChild(identifierElement);
-
-		return element;
-	}
-
-	public String toString() {
-		return identifier;
-	}
-
-	public int hashCode() {
-		return identifier.hashCode();
-	}
-	
-	public boolean isNamespaceSupported (String namespaceName) {
-		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
-			return true;
-		
-		if (Sandesha2Constants.SPEC_2007_02.NS_URI.equals(namespaceName))
-			return true;
-		
-		return false;
-	}
-}
+/*
+ * 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;
+
+/**
+ * Represents an Identifier element.
+ */
+
+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;
+
+public class Identifier implements Sandesha2Constants, IOMRMElement {
+
+	private String identifier = null;
+	
+	private String namespaceValue = null;
+	
+	public Identifier(String namespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(namespaceValue))
+			throw new SandeshaException (SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.unknownSpec,
+					namespaceValue));
+		
+		this.namespaceValue = namespaceValue;
+	}
+
+	public void setIndentifer(String identifier) {
+		this.identifier = identifier;
+	}
+
+	public String getIdentifier() {
+		return identifier;
+	}
+
+	public String getNamespaceValue() throws OMException {
+		return namespaceValue;
+	}
+
+	public Object fromOMElement(OMElement element) throws OMException {
+		
+		OMElement identifierPart = element.getFirstChildWithName(new QName(
+				namespaceValue, Sandesha2Constants.WSRM_COMMON.IDENTIFIER));
+		if (identifierPart == null)
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.invalidIdentifier,
+					element.toString()));
+		
+		String identifierText = identifierPart.getText();
+		if (identifierText == null || identifierText == "")
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.invalidIdentifier,
+					element.toString()));
+
+		identifier = identifierText;
+		return this;
+	}
+
+	public OMElement toOMElement(OMElement element) throws OMException {
+
+		if (identifier == null || identifier == "") {
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.invalidIdentifier,
+					element.toString()));
+		}
+		
+		OMFactory factory = element.getOMFactory();
+			
+		OMNamespace wsrmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+		OMElement identifierElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.IDENTIFIER, wsrmNamespace);
+
+		identifierElement.setText(identifier);
+		element.addChild(identifierElement);
+
+		return element;
+	}
+
+	public String toString() {
+		return identifier;
+	}
+
+	public int hashCode() {
+		return identifier.hashCode();
+	}
+	
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		if (Sandesha2Constants.SPEC_2007_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
+	}
+}

Propchange: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Identifier.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/LastMessage.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/LastMessage.java?view=diff&rev=564063&r1=564062&r2=564063
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/LastMessage.java (original)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/LastMessage.java Wed Aug  8 17:57:51 2007
@@ -1,85 +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;
-
-/**
- * Represent the LastMessage element defined by the WSRM 1.0 epecification.
- */
-
-public class LastMessage implements IOMRMElement {
-
-	private String namespaceValue = null;
-	
-	public LastMessage(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 lastMessagePart = element.getFirstChildWithName(new QName(
-				namespaceValue, Sandesha2Constants.WSRM_COMMON.LAST_MSG));
-		if (lastMessagePart == null)
-			throw new OMException(SandeshaMessageHelper.getMessage(
-					SandeshaMessageKeys.noLastMessagePartInElement,
-					element.toString()));
-
-		return this;
-	}
-
-	public OMElement toOMElement(OMElement sequenceElement) throws OMException {
-
-		OMFactory factory = sequenceElement.getOMFactory();
-		
-		OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
-		OMElement lastMessageElement = factory.createOMElement(
-				Sandesha2Constants.WSRM_COMMON.LAST_MSG, rmNamespace);
-		
-		sequenceElement.addChild(lastMessageElement);
-		return sequenceElement;
-	}
-	
-	public boolean isNamespaceSupported (String namespaceName) {
-		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
-			return true;
-		
-		//TODO is this optional or not required.
-		if (Sandesha2Constants.SPEC_2007_02.NS_URI.equals(namespaceName))
-			return true;
-		
-		return false;
-	}
-}
+/*
+ * 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;
+
+/**
+ * Represent the LastMessage element defined by the WSRM 1.0 epecification.
+ */
+
+public class LastMessage implements IOMRMElement {
+
+	private String namespaceValue = null;
+	
+	public LastMessage(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 lastMessagePart = element.getFirstChildWithName(new QName(
+				namespaceValue, Sandesha2Constants.WSRM_COMMON.LAST_MSG));
+		if (lastMessagePart == null)
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.noLastMessagePartInElement,
+					element.toString()));
+
+		return this;
+	}
+
+	public OMElement toOMElement(OMElement sequenceElement) throws OMException {
+
+		OMFactory factory = sequenceElement.getOMFactory();
+		
+		OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+		OMElement lastMessageElement = factory.createOMElement(
+				Sandesha2Constants.WSRM_COMMON.LAST_MSG, rmNamespace);
+		
+		sequenceElement.addChild(lastMessageElement);
+		return sequenceElement;
+	}
+	
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		//TODO is this optional or not required.
+		if (Sandesha2Constants.SPEC_2007_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
+	}
+}

Propchange: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/LastMessage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/MakeConnection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/MessageNumber.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/MessageNumber.java?view=diff&rev=564063&r1=564062&r2=564063
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/MessageNumber.java (original)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/MessageNumber.java Wed Aug  8 17:57:51 2007
@@ -1,101 +1,101 @@
-/*
- * 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 MessageNumber element.
- */
-
-public class MessageNumber implements IOMRMElement {
-	
-	private long messageNumber;
-	
-	private String namespaceValue = null;
-	
-	public MessageNumber(String namespaceValue) throws SandeshaException {
-		if (!isNamespaceSupported(namespaceValue))
-			throw new SandeshaException (SandeshaMessageHelper.getMessage(
-					SandeshaMessageKeys.unknownSpec,
-					namespaceValue));
-		
-		this.namespaceValue = namespaceValue;
-	}
-	
-	public long getMessageNumber(){
-		return messageNumber;
-	}
-	public void setMessageNumber(long messageNumber){
-		this.messageNumber = messageNumber;
-	}
-	
-	public Object fromOMElement(OMElement sequenceElement) throws OMException {
-		OMElement msgNumberPart = sequenceElement.getFirstChildWithName( 
-				new QName (namespaceValue,Sandesha2Constants.WSRM_COMMON.MSG_NUMBER));
-		if (msgNumberPart==null)
-			throw new OMException (SandeshaMessageHelper.getMessage(
-					SandeshaMessageKeys.noMessageNumberPartInElement,
-					sequenceElement.toString()));
-		
-		String msgNoStr = msgNumberPart.getText();
-		messageNumber = Long.parseLong(msgNoStr);
-		return this;
-	}
-	
-	public OMElement toOMElement(OMElement element) throws OMException {
-		if (messageNumber <= 0 ){
-			throw new OMException(SandeshaMessageHelper.getMessage(
-					SandeshaMessageKeys.setAValidMsgNumber,
-					Long.toString(messageNumber)));
-		}
-		
-		OMFactory factory = element.getOMFactory();
-		
-		OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
-		OMElement messageNoElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.MSG_NUMBER,rmNamespace);
-		messageNoElement.setText(Long.toString(messageNumber));
-		element.addChild(messageNoElement);
-		
-		return element;
-	}
-	
-	public String getNamespaceValue() throws OMException {
-		return namespaceValue;
-	}
-
-	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;
-	}
-
-}
+/*
+ * 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 MessageNumber element.
+ */
+
+public class MessageNumber implements IOMRMElement {
+	
+	private long messageNumber;
+	
+	private String namespaceValue = null;
+	
+	public MessageNumber(String namespaceValue) throws SandeshaException {
+		if (!isNamespaceSupported(namespaceValue))
+			throw new SandeshaException (SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.unknownSpec,
+					namespaceValue));
+		
+		this.namespaceValue = namespaceValue;
+	}
+	
+	public long getMessageNumber(){
+		return messageNumber;
+	}
+	public void setMessageNumber(long messageNumber){
+		this.messageNumber = messageNumber;
+	}
+	
+	public Object fromOMElement(OMElement sequenceElement) throws OMException {
+		OMElement msgNumberPart = sequenceElement.getFirstChildWithName( 
+				new QName (namespaceValue,Sandesha2Constants.WSRM_COMMON.MSG_NUMBER));
+		if (msgNumberPart==null)
+			throw new OMException (SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.noMessageNumberPartInElement,
+					sequenceElement.toString()));
+		
+		String msgNoStr = msgNumberPart.getText();
+		messageNumber = Long.parseLong(msgNoStr);
+		return this;
+	}
+	
+	public OMElement toOMElement(OMElement element) throws OMException {
+		if (messageNumber <= 0 ){
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.setAValidMsgNumber,
+					Long.toString(messageNumber)));
+		}
+		
+		OMFactory factory = element.getOMFactory();
+		
+		OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+		OMElement messageNoElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.MSG_NUMBER,rmNamespace);
+		messageNoElement.setText(Long.toString(messageNumber));
+		element.addChild(messageNoElement);
+		
+		return element;
+	}
+	
+	public String getNamespaceValue() throws OMException {
+		return namespaceValue;
+	}
+
+	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;
+	}
+
+}

Propchange: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/MessageNumber.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/MessagePending.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Nack.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Nack.java?view=diff&rev=564063&r1=564062&r2=564063
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Nack.java (original)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Nack.java Wed Aug  8 17:57:51 2007
@@ -1,105 +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 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 Nack element.
- */
-
-public class Nack implements IOMRMElement {
-	
-	private long nackNumber;
-	
-	private String namespaceValue = null;
-		
-	public Nack(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 nackElement) throws OMException{
-		
-		if (nackElement==null)
-			throw new OMException (SandeshaMessageHelper.getMessage(
-					SandeshaMessageKeys.nullPassedElement));
-		
-		try {
-			nackNumber = Long.parseLong(nackElement.getText());
-		}catch (Exception ex ) {
-			throw new OMException (SandeshaMessageHelper.getMessage(
-					SandeshaMessageKeys.nackDoesNotContainValidLongValue));
-		}
-		
-		return this;
-	} 
-	
-	public OMElement toOMElement(OMElement sequenceAckElement) throws OMException {
-		if (sequenceAckElement==null)
-			throw new OMException (SandeshaMessageHelper.getMessage(
-					SandeshaMessageKeys.noNackInSeqAckPart));
-		
-		if (nackNumber<=0)
-			throw new OMException (SandeshaMessageHelper.getMessage(
-					SandeshaMessageKeys.nackDoesNotContainValidLongValue));
-		
-		OMFactory factory = sequenceAckElement.getOMFactory();
-		
-		OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
-		OMElement nackElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.NACK,rmNamespace);
-		nackElement.setText(Long.toString(nackNumber));
-		sequenceAckElement.addChild(nackElement);
-		
-		return sequenceAckElement;
-	}
-
-	public long getNackNumber() {
-		return nackNumber;
-	}
-
-	public void setNackNumber(long nackNumber) {
-		this.nackNumber = nackNumber;
-	}
-
-	public boolean isNamespaceSupported (String namespaceName) {
-		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
-			return true;
-		
-		if (Sandesha2Constants.SPEC_2007_02.NS_URI.equals(namespaceName))
-			return true;
-		
-		return false;
-	}
-}
+/*
+ * 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.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 Nack element.
+ */
+
+public class Nack implements IOMRMElement {
+	
+	private long nackNumber;
+	
+	private String namespaceValue = null;
+		
+	public Nack(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 nackElement) throws OMException{
+		
+		if (nackElement==null)
+			throw new OMException (SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.nullPassedElement));
+		
+		try {
+			nackNumber = Long.parseLong(nackElement.getText());
+		}catch (Exception ex ) {
+			throw new OMException (SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.nackDoesNotContainValidLongValue));
+		}
+		
+		return this;
+	} 
+	
+	public OMElement toOMElement(OMElement sequenceAckElement) throws OMException {
+		if (sequenceAckElement==null)
+			throw new OMException (SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.noNackInSeqAckPart));
+		
+		if (nackNumber<=0)
+			throw new OMException (SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.nackDoesNotContainValidLongValue));
+		
+		OMFactory factory = sequenceAckElement.getOMFactory();
+		
+		OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+		OMElement nackElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.NACK,rmNamespace);
+		nackElement.setText(Long.toString(nackNumber));
+		sequenceAckElement.addChild(nackElement);
+		
+		return sequenceAckElement;
+	}
+
+	public long getNackNumber() {
+		return nackNumber;
+	}
+
+	public void setNackNumber(long nackNumber) {
+		this.nackNumber = nackNumber;
+	}
+
+	public boolean isNamespaceSupported (String namespaceName) {
+		if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		if (Sandesha2Constants.SPEC_2007_02.NS_URI.equals(namespaceName))
+			return true;
+		
+		return false;
+	}
+}

Propchange: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Nack.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/RMElements.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/RMElements.java?view=diff&rev=564063&r1=564062&r2=564063
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/RMElements.java (original)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/RMElements.java Wed Aug  8 17:57:51 2007
@@ -1,365 +1,365 @@
-/*
- * 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.ArrayList;
-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.soap.SOAP11Constants;
-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.i18n.SandeshaMessageHelper;
-import org.apache.sandesha2.i18n.SandeshaMessageKeys;
-import org.apache.sandesha2.util.SOAPAbstractFactory;
-
-/**
- * All RM model classes should implement this.
- * RM model classes include all the class that represent the elements 
- * defined by RM specification. 
- */
-
-public class RMElements {
-
-	private Sequence sequence = null;
-	
-	//there can be more than one sequence ack or ack request in a single message.
-	private ArrayList sequenceAcknowledgements = null;
-	private ArrayList ackRequests = null;
-	
-	private CreateSequence createSequence = null;
-	private CreateSequenceResponse createSequenceResponse = null;
-	private TerminateSequence terminateSequence = null;
-	private TerminateSequenceResponse terminateSequenceResponse = null;
-	private CloseSequence closeSequence = null;
-	private CloseSequenceResponse closeSequenceResponse = null;
-	private UsesSequenceSTR usesSequenceSTR = null;
-	private MessagePending messagePending = null;
-	private MakeConnection makeConnection = null;
-	private SequenceFault sequenceFault = null;
-	
-	public RMElements () {
-		sequenceAcknowledgements = new ArrayList ();
-		ackRequests = new ArrayList();
-	}
-	
-	public RMElements (String addressingNamespace) {
-		this ();
-	}
-	
-	public void fromSOAPEnvelope(SOAPEnvelope envelope, String action) throws AxisFault {
-
-		if (envelope == null)
-			throw new OMException(SandeshaMessageHelper.getMessage(
-					SandeshaMessageKeys.nullPassedElement));
-
-		SOAPFactory factory;
-
-		//Yep, I know. Could hv done it directly :D (just to make it consistent)
-		if (envelope.getNamespace().getNamespaceURI().equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI))
-			factory = SOAPAbstractFactory.getSOAPFactory(Sandesha2Constants.SOAPVersion.v1_1);
-		else
-			factory = SOAPAbstractFactory.getSOAPFactory(Sandesha2Constants.SOAPVersion.v1_2);
-		
-		// Check for RM defined elements, using either spec version
-		OMElement header = envelope.getHeader();
-		OMElement body = envelope.getBody();
-
-		// The sequence header
-		OMElement element = null;
-		if(header!=null)
-		{
-			element = header.getFirstChildWithName(Sandesha2Constants.SPEC_2007_02.QNames.Sequence);
-			if(element == null) {
-				element = envelope.getHeader().getFirstChildWithName(Sandesha2Constants.SPEC_2005_02.QNames.Sequence);
-			}
-			if (element != null) {
-				sequence = new Sequence(element.getNamespace().getNamespaceURI());
-				sequence.fromOMElement(envelope.getHeader());
-			}			
-		}
-
-
-		// The body messages
-		OMElement firstBodyElement = body.getFirstElement();
-		if(firstBodyElement != null) {
-			QName firstBodyQName = firstBodyElement.getQName();
-			
-			if(Sandesha2Constants.SPEC_2007_02.QNames.CreateSequence.equals(firstBodyQName)) {
-				createSequence = new CreateSequence(firstBodyQName.getNamespaceURI());
-				createSequence.fromOMElement(body);
-			} else if(Sandesha2Constants.SPEC_2005_02.QNames.CreateSequence.equals(firstBodyQName)) {
-				createSequence = new CreateSequence(firstBodyQName.getNamespaceURI());
-				createSequence.fromOMElement(body);
-
-			} else if(Sandesha2Constants.SPEC_2007_02.QNames.CreateSequenceResponse.equals(firstBodyQName)) {
-				createSequenceResponse = new CreateSequenceResponse(firstBodyQName.getNamespaceURI());
-				createSequenceResponse.fromOMElement(body);
-			} else if(Sandesha2Constants.SPEC_2005_02.QNames.CreateSequenceResponse.equals(firstBodyQName)) {
-				createSequenceResponse = new CreateSequenceResponse(firstBodyQName.getNamespaceURI());
-				createSequenceResponse.fromOMElement(body);
-
-			} else if(Sandesha2Constants.SPEC_2007_02.QNames.CloseSequence.equals(firstBodyQName)) {
-				closeSequence = new CloseSequence(firstBodyQName.getNamespaceURI());
-				closeSequence.fromOMElement(body);
-			} else if(Sandesha2Constants.SPEC_2005_02.QNames.CloseSequence.equals(firstBodyQName)) {
-				closeSequence = new CloseSequence(firstBodyQName.getNamespaceURI());
-				closeSequence.fromOMElement(body);
-
-			} else if(Sandesha2Constants.SPEC_2007_02.QNames.CloseSequenceResponse.equals(firstBodyQName)) {
-				closeSequenceResponse = new CloseSequenceResponse(firstBodyQName.getNamespaceURI());
-				closeSequenceResponse.fromOMElement(body);
-			} else if(Sandesha2Constants.SPEC_2005_02.QNames.CloseSequenceResponse.equals(firstBodyQName)) {
-				closeSequenceResponse = new CloseSequenceResponse(firstBodyQName.getNamespaceURI());
-				closeSequenceResponse.fromOMElement(body);
-
-			} else if(Sandesha2Constants.SPEC_2007_02.QNames.TerminateSequence.equals(firstBodyQName)) {
-				terminateSequence = new TerminateSequence(firstBodyQName.getNamespaceURI());
-				terminateSequence.fromOMElement(body);
-			} else if(Sandesha2Constants.SPEC_2005_02.QNames.TerminateSequence.equals(firstBodyQName)) {
-				terminateSequence = new TerminateSequence(firstBodyQName.getNamespaceURI());
-				terminateSequence.fromOMElement(body);
-
-			} else if(Sandesha2Constants.SPEC_2007_02.QNames.TerminateSequenceResponse.equals(firstBodyQName)) {
-				terminateSequenceResponse = new TerminateSequenceResponse(firstBodyQName.getNamespaceURI());
-				terminateSequenceResponse.fromOMElement(body);
-			} else if(Sandesha2Constants.SPEC_2005_02.QNames.TerminateSequenceResponse.equals(firstBodyQName)) {
-				terminateSequenceResponse = new TerminateSequenceResponse(firstBodyQName.getNamespaceURI());
-				terminateSequenceResponse.fromOMElement(body);
-
-			} else if(Sandesha2Constants.SPEC_2007_02.QNames.MakeConnection.equals(firstBodyQName)) {
-				makeConnection = new MakeConnection(firstBodyQName.getNamespaceURI());
-				makeConnection.fromOMElement(firstBodyElement);
-			}
-		}
-		
-		// The other headers
-		if(header!=null)
-		{
-			Iterator headers = header.getChildrenWithName(Sandesha2Constants.SPEC_2007_02.QNames.SequenceAck);
-			while (headers.hasNext()) {
-				OMElement sequenceAckElement = (OMElement) headers.next();
-				SequenceAcknowledgement sequenceAcknowledgement = new SequenceAcknowledgement(Sandesha2Constants.SPEC_2007_02.NS_URI);
-				sequenceAcknowledgement.fromOMElement(sequenceAckElement);
-				sequenceAcknowledgements.add(sequenceAcknowledgement);
-			}
-			headers = header.getChildrenWithName(Sandesha2Constants.SPEC_2005_02.QNames.SequenceAck);
-			while (headers.hasNext()) {
-				OMElement sequenceAckElement = (OMElement) headers.next();
-				SequenceAcknowledgement sequenceAcknowledgement = new SequenceAcknowledgement(Sandesha2Constants.SPEC_2005_02.NS_URI);
-				sequenceAcknowledgement.fromOMElement(sequenceAckElement);
-				sequenceAcknowledgements.add(sequenceAcknowledgement);
-			}
-
-			headers = header.getChildrenWithName(Sandesha2Constants.SPEC_2007_02.QNames.AckRequest);
-			while (headers.hasNext()) {
-				OMElement ackRequestElement = (OMElement) headers.next();
-				AckRequested ackRequest = new AckRequested(Sandesha2Constants.SPEC_2007_02.NS_URI);
-				ackRequest.fromOMElement(ackRequestElement);
-				ackRequests.add(ackRequest);
-			}
-			headers = header.getChildrenWithName(Sandesha2Constants.SPEC_2005_02.QNames.AckRequest);
-			while (headers.hasNext()) {
-				OMElement ackRequestElement = (OMElement) headers.next();
-				AckRequested ackRequest = new AckRequested(Sandesha2Constants.SPEC_2005_02.NS_URI);
-				ackRequest.fromOMElement(ackRequestElement);
-				ackRequests.add(ackRequest);
-			}
-			
-			element = header.getFirstChildWithName(Sandesha2Constants.SPEC_2007_02.QNames.UsesSequenceSTR);
-			if (element != null) {
-				usesSequenceSTR = new UsesSequenceSTR(factory, Sandesha2Constants.SPEC_2007_02.NS_URI);
-				usesSequenceSTR.fromOMElement(element);
-			}
-			
-			element = header.getFirstChildWithName(Sandesha2Constants.SPEC_2007_02.QNames.MessagePending);
-			if (element != null) {
-				messagePending = new MessagePending(Sandesha2Constants.SPEC_2007_02.MC_NS_URI);
-				messagePending.fromOMElement(element);
-			}
-			
-			element = header.getFirstChildWithName(Sandesha2Constants.SPEC_2007_02.QNames.SequenceFault);
-			if(element == null) {
-				element = header.getFirstChildWithName(Sandesha2Constants.SPEC_2005_02.QNames.SequenceFault);
-			}
-			if (element !=null) {
-				sequenceFault = new SequenceFault(element.getNamespace().getNamespaceURI());
-				sequenceFault.fromOMElement(element);
-			}
-		}
-	}
-
-	public SOAPEnvelope toSOAPEnvelope(SOAPEnvelope envelope) throws AxisFault  {
-		if (sequence != null) {
-			sequence.toOMElement(envelope.getHeader());
-		}
-		for (Iterator iter=sequenceAcknowledgements.iterator();iter.hasNext();) {
-			SequenceAcknowledgement sequenceAck = (SequenceAcknowledgement) iter.next();
-			sequenceAck.toOMElement(envelope.getHeader());
-		}
-		for (Iterator iter=ackRequests.iterator();iter.hasNext();) {
-			AckRequested ackReq = (AckRequested) iter.next();
-			ackReq.toOMElement(envelope.getHeader());
-		}
-		if (createSequence != null) {
-			createSequence.toOMElement(envelope.getBody());
-		}
-		if (createSequenceResponse != null) {
-			createSequenceResponse.toOMElement(envelope.getBody());
-		}
-		if (terminateSequence != null) {
-			terminateSequence.toOMElement(envelope.getBody());
-		}
-		if (terminateSequenceResponse != null) {
-			terminateSequenceResponse.toOMElement(envelope.getBody());
-		}
-		
-		if (closeSequence != null) {
-			closeSequence.toOMElement(envelope.getBody());
-		}
-		
-		if (closeSequenceResponse != null) {
-			closeSequenceResponse.toOMElement(envelope.getBody());
-		}
-		
-		if (makeConnection!=null) {
-			makeConnection.toOMElement(envelope.getBody());
-		}
-		
-		if (messagePending!=null) {
-			messagePending.toOMElement(envelope.getHeader());
-		}
-		
-		return envelope;
-	}
-
-	public CreateSequence getCreateSequence() {
-		return createSequence;
-	}
-
-	public CreateSequenceResponse getCreateSequenceResponse() {
-		return createSequenceResponse;
-	}
-
-	public Sequence getSequence() {
-		return sequence;
-	}
-
-	public Iterator getSequenceAcknowledgements() {
-		return sequenceAcknowledgements.iterator();
-	}
-
-	public TerminateSequence getTerminateSequence() {
-		return terminateSequence;
-	}
-	
-	public TerminateSequenceResponse getTerminateSequenceResponse() {
-		return terminateSequenceResponse;
-	}
-
-	public void setCreateSequence(CreateSequence createSequence) {
-		this.createSequence = createSequence;
-	}
-
-	public void setCreateSequenceResponse(
-			CreateSequenceResponse createSequenceResponse) {
-		this.createSequenceResponse = createSequenceResponse;
-	}
-
-	public void setSequence(Sequence sequence) {
-		this.sequence = sequence;
-	}
-
-	public void setSequenceAcknowledgements(
-			ArrayList sequenceAcknowledgements) {
-		this.sequenceAcknowledgements = sequenceAcknowledgements;
-	}
-	
-	public void addSequenceAcknowledgement (SequenceAcknowledgement sequenceAcknowledgement) {
-		sequenceAcknowledgements.add(sequenceAcknowledgement);
-	}
-
-	public void setTerminateSequence(TerminateSequence terminateSequence) {
-		this.terminateSequence = terminateSequence;
-	}
-	
-	public void setTerminateSequenceResponse(TerminateSequenceResponse terminateSequenceResponse) {
-		this.terminateSequenceResponse = terminateSequenceResponse;
-	}
-
-	public Iterator getAckRequests() {
-		return ackRequests.iterator();
-	}
-
-	public void setAckRequested(ArrayList ackRequests) {
-		this.ackRequests = ackRequests;
-	}
-	
-	public void addAckRequested(AckRequested ackRequested) {
-		ackRequests.add(ackRequested);
-	}
-	
-	public void setMakeConnection(MakeConnection makeConnection) {
-		this.makeConnection = makeConnection;
-	}
-	
-	public void setMessagePending(MessagePending messagePending) {
-		this.messagePending = messagePending;
-	}
-	
-	public CloseSequence getCloseSequence() {
-		return closeSequence;
-	}
-
-	public void setCloseSequence(CloseSequence closeSequence) {
-		this.closeSequence = closeSequence;
-	}
-
-	public CloseSequenceResponse getCloseSequenceResponse() {
-		return closeSequenceResponse;
-	}
-
-	public void setCloseSequenceResponse(CloseSequenceResponse closeSequenceResponse) {
-		this.closeSequenceResponse = closeSequenceResponse;
-	}
-	
-	public UsesSequenceSTR getUsesSequenceSTR() {
-		return usesSequenceSTR;
-	}
-	
-	public void setUsesSequenceSTR(UsesSequenceSTR header) {
-		usesSequenceSTR = header;
-	}
-
-	public MakeConnection getMakeConnection() {
-		return makeConnection;
-	}
-
-	public MessagePending getMessagePending() {
-		return messagePending;
-	}
-	
-	public SequenceFault getSequenceFault() {
-		return sequenceFault;
-	}
-}
+/*
+ * 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.ArrayList;
+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.soap.SOAP11Constants;
+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.i18n.SandeshaMessageHelper;
+import org.apache.sandesha2.i18n.SandeshaMessageKeys;
+import org.apache.sandesha2.util.SOAPAbstractFactory;
+
+/**
+ * All RM model classes should implement this.
+ * RM model classes include all the class that represent the elements 
+ * defined by RM specification. 
+ */
+
+public class RMElements {
+
+	private Sequence sequence = null;
+	
+	//there can be more than one sequence ack or ack request in a single message.
+	private ArrayList sequenceAcknowledgements = null;
+	private ArrayList ackRequests = null;
+	
+	private CreateSequence createSequence = null;
+	private CreateSequenceResponse createSequenceResponse = null;
+	private TerminateSequence terminateSequence = null;
+	private TerminateSequenceResponse terminateSequenceResponse = null;
+	private CloseSequence closeSequence = null;
+	private CloseSequenceResponse closeSequenceResponse = null;
+	private UsesSequenceSTR usesSequenceSTR = null;
+	private MessagePending messagePending = null;
+	private MakeConnection makeConnection = null;
+	private SequenceFault sequenceFault = null;
+	
+	public RMElements () {
+		sequenceAcknowledgements = new ArrayList ();
+		ackRequests = new ArrayList();
+	}
+	
+	public RMElements (String addressingNamespace) {
+		this ();
+	}
+	
+	public void fromSOAPEnvelope(SOAPEnvelope envelope, String action) throws AxisFault {
+
+		if (envelope == null)
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.nullPassedElement));
+
+		SOAPFactory factory;
+
+		//Yep, I know. Could hv done it directly :D (just to make it consistent)
+		if (envelope.getNamespace().getNamespaceURI().equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI))
+			factory = SOAPAbstractFactory.getSOAPFactory(Sandesha2Constants.SOAPVersion.v1_1);
+		else
+			factory = SOAPAbstractFactory.getSOAPFactory(Sandesha2Constants.SOAPVersion.v1_2);
+		
+		// Check for RM defined elements, using either spec version
+		OMElement header = envelope.getHeader();
+		OMElement body = envelope.getBody();
+
+		// The sequence header
+		OMElement element = null;
+		if(header!=null)
+		{
+			element = header.getFirstChildWithName(Sandesha2Constants.SPEC_2007_02.QNames.Sequence);
+			if(element == null) {
+				element = envelope.getHeader().getFirstChildWithName(Sandesha2Constants.SPEC_2005_02.QNames.Sequence);
+			}
+			if (element != null) {
+				sequence = new Sequence(element.getNamespace().getNamespaceURI());
+				sequence.fromOMElement(envelope.getHeader());
+			}			
+		}
+
+
+		// The body messages
+		OMElement firstBodyElement = body.getFirstElement();
+		if(firstBodyElement != null) {
+			QName firstBodyQName = firstBodyElement.getQName();
+			
+			if(Sandesha2Constants.SPEC_2007_02.QNames.CreateSequence.equals(firstBodyQName)) {
+				createSequence = new CreateSequence(firstBodyQName.getNamespaceURI());
+				createSequence.fromOMElement(body);
+			} else if(Sandesha2Constants.SPEC_2005_02.QNames.CreateSequence.equals(firstBodyQName)) {
+				createSequence = new CreateSequence(firstBodyQName.getNamespaceURI());
+				createSequence.fromOMElement(body);
+
+			} else if(Sandesha2Constants.SPEC_2007_02.QNames.CreateSequenceResponse.equals(firstBodyQName)) {
+				createSequenceResponse = new CreateSequenceResponse(firstBodyQName.getNamespaceURI());
+				createSequenceResponse.fromOMElement(body);
+			} else if(Sandesha2Constants.SPEC_2005_02.QNames.CreateSequenceResponse.equals(firstBodyQName)) {
+				createSequenceResponse = new CreateSequenceResponse(firstBodyQName.getNamespaceURI());
+				createSequenceResponse.fromOMElement(body);
+
+			} else if(Sandesha2Constants.SPEC_2007_02.QNames.CloseSequence.equals(firstBodyQName)) {
+				closeSequence = new CloseSequence(firstBodyQName.getNamespaceURI());
+				closeSequence.fromOMElement(body);
+			} else if(Sandesha2Constants.SPEC_2005_02.QNames.CloseSequence.equals(firstBodyQName)) {
+				closeSequence = new CloseSequence(firstBodyQName.getNamespaceURI());
+				closeSequence.fromOMElement(body);
+
+			} else if(Sandesha2Constants.SPEC_2007_02.QNames.CloseSequenceResponse.equals(firstBodyQName)) {
+				closeSequenceResponse = new CloseSequenceResponse(firstBodyQName.getNamespaceURI());
+				closeSequenceResponse.fromOMElement(body);
+			} else if(Sandesha2Constants.SPEC_2005_02.QNames.CloseSequenceResponse.equals(firstBodyQName)) {
+				closeSequenceResponse = new CloseSequenceResponse(firstBodyQName.getNamespaceURI());
+				closeSequenceResponse.fromOMElement(body);
+
+			} else if(Sandesha2Constants.SPEC_2007_02.QNames.TerminateSequence.equals(firstBodyQName)) {
+				terminateSequence = new TerminateSequence(firstBodyQName.getNamespaceURI());
+				terminateSequence.fromOMElement(body);
+			} else if(Sandesha2Constants.SPEC_2005_02.QNames.TerminateSequence.equals(firstBodyQName)) {
+				terminateSequence = new TerminateSequence(firstBodyQName.getNamespaceURI());
+				terminateSequence.fromOMElement(body);
+
+			} else if(Sandesha2Constants.SPEC_2007_02.QNames.TerminateSequenceResponse.equals(firstBodyQName)) {
+				terminateSequenceResponse = new TerminateSequenceResponse(firstBodyQName.getNamespaceURI());
+				terminateSequenceResponse.fromOMElement(body);
+			} else if(Sandesha2Constants.SPEC_2005_02.QNames.TerminateSequenceResponse.equals(firstBodyQName)) {
+				terminateSequenceResponse = new TerminateSequenceResponse(firstBodyQName.getNamespaceURI());
+				terminateSequenceResponse.fromOMElement(body);
+
+			} else if(Sandesha2Constants.SPEC_2007_02.QNames.MakeConnection.equals(firstBodyQName)) {
+				makeConnection = new MakeConnection(firstBodyQName.getNamespaceURI());
+				makeConnection.fromOMElement(firstBodyElement);
+			}
+		}
+		
+		// The other headers
+		if(header!=null)
+		{
+			Iterator headers = header.getChildrenWithName(Sandesha2Constants.SPEC_2007_02.QNames.SequenceAck);
+			while (headers.hasNext()) {
+				OMElement sequenceAckElement = (OMElement) headers.next();
+				SequenceAcknowledgement sequenceAcknowledgement = new SequenceAcknowledgement(Sandesha2Constants.SPEC_2007_02.NS_URI);
+				sequenceAcknowledgement.fromOMElement(sequenceAckElement);
+				sequenceAcknowledgements.add(sequenceAcknowledgement);
+			}
+			headers = header.getChildrenWithName(Sandesha2Constants.SPEC_2005_02.QNames.SequenceAck);
+			while (headers.hasNext()) {
+				OMElement sequenceAckElement = (OMElement) headers.next();
+				SequenceAcknowledgement sequenceAcknowledgement = new SequenceAcknowledgement(Sandesha2Constants.SPEC_2005_02.NS_URI);
+				sequenceAcknowledgement.fromOMElement(sequenceAckElement);
+				sequenceAcknowledgements.add(sequenceAcknowledgement);
+			}
+
+			headers = header.getChildrenWithName(Sandesha2Constants.SPEC_2007_02.QNames.AckRequest);
+			while (headers.hasNext()) {
+				OMElement ackRequestElement = (OMElement) headers.next();
+				AckRequested ackRequest = new AckRequested(Sandesha2Constants.SPEC_2007_02.NS_URI);
+				ackRequest.fromOMElement(ackRequestElement);
+				ackRequests.add(ackRequest);
+			}
+			headers = header.getChildrenWithName(Sandesha2Constants.SPEC_2005_02.QNames.AckRequest);
+			while (headers.hasNext()) {
+				OMElement ackRequestElement = (OMElement) headers.next();
+				AckRequested ackRequest = new AckRequested(Sandesha2Constants.SPEC_2005_02.NS_URI);
+				ackRequest.fromOMElement(ackRequestElement);
+				ackRequests.add(ackRequest);
+			}
+			
+			element = header.getFirstChildWithName(Sandesha2Constants.SPEC_2007_02.QNames.UsesSequenceSTR);
+			if (element != null) {
+				usesSequenceSTR = new UsesSequenceSTR(factory, Sandesha2Constants.SPEC_2007_02.NS_URI);
+				usesSequenceSTR.fromOMElement(element);
+			}
+			
+			element = header.getFirstChildWithName(Sandesha2Constants.SPEC_2007_02.QNames.MessagePending);
+			if (element != null) {
+				messagePending = new MessagePending(Sandesha2Constants.SPEC_2007_02.MC_NS_URI);
+				messagePending.fromOMElement(element);
+			}
+			
+			element = header.getFirstChildWithName(Sandesha2Constants.SPEC_2007_02.QNames.SequenceFault);
+			if(element == null) {
+				element = header.getFirstChildWithName(Sandesha2Constants.SPEC_2005_02.QNames.SequenceFault);
+			}
+			if (element !=null) {
+				sequenceFault = new SequenceFault(element.getNamespace().getNamespaceURI());
+				sequenceFault.fromOMElement(element);
+			}
+		}
+	}
+
+	public SOAPEnvelope toSOAPEnvelope(SOAPEnvelope envelope) throws AxisFault  {
+		if (sequence != null) {
+			sequence.toOMElement(envelope.getHeader());
+		}
+		for (Iterator iter=sequenceAcknowledgements.iterator();iter.hasNext();) {
+			SequenceAcknowledgement sequenceAck = (SequenceAcknowledgement) iter.next();
+			sequenceAck.toOMElement(envelope.getHeader());
+		}
+		for (Iterator iter=ackRequests.iterator();iter.hasNext();) {
+			AckRequested ackReq = (AckRequested) iter.next();
+			ackReq.toOMElement(envelope.getHeader());
+		}
+		if (createSequence != null) {
+			createSequence.toOMElement(envelope.getBody());
+		}
+		if (createSequenceResponse != null) {
+			createSequenceResponse.toOMElement(envelope.getBody());
+		}
+		if (terminateSequence != null) {
+			terminateSequence.toOMElement(envelope.getBody());
+		}
+		if (terminateSequenceResponse != null) {
+			terminateSequenceResponse.toOMElement(envelope.getBody());
+		}
+		
+		if (closeSequence != null) {
+			closeSequence.toOMElement(envelope.getBody());
+		}
+		
+		if (closeSequenceResponse != null) {
+			closeSequenceResponse.toOMElement(envelope.getBody());
+		}
+		
+		if (makeConnection!=null) {
+			makeConnection.toOMElement(envelope.getBody());
+		}
+		
+		if (messagePending!=null) {
+			messagePending.toOMElement(envelope.getHeader());
+		}
+		
+		return envelope;
+	}
+
+	public CreateSequence getCreateSequence() {
+		return createSequence;
+	}
+
+	public CreateSequenceResponse getCreateSequenceResponse() {
+		return createSequenceResponse;
+	}
+
+	public Sequence getSequence() {
+		return sequence;
+	}
+
+	public Iterator getSequenceAcknowledgements() {
+		return sequenceAcknowledgements.iterator();
+	}
+
+	public TerminateSequence getTerminateSequence() {
+		return terminateSequence;
+	}
+	
+	public TerminateSequenceResponse getTerminateSequenceResponse() {
+		return terminateSequenceResponse;
+	}
+
+	public void setCreateSequence(CreateSequence createSequence) {
+		this.createSequence = createSequence;
+	}
+
+	public void setCreateSequenceResponse(
+			CreateSequenceResponse createSequenceResponse) {
+		this.createSequenceResponse = createSequenceResponse;
+	}
+
+	public void setSequence(Sequence sequence) {
+		this.sequence = sequence;
+	}
+
+	public void setSequenceAcknowledgements(
+			ArrayList sequenceAcknowledgements) {
+		this.sequenceAcknowledgements = sequenceAcknowledgements;
+	}
+	
+	public void addSequenceAcknowledgement (SequenceAcknowledgement sequenceAcknowledgement) {
+		sequenceAcknowledgements.add(sequenceAcknowledgement);
+	}
+
+	public void setTerminateSequence(TerminateSequence terminateSequence) {
+		this.terminateSequence = terminateSequence;
+	}
+	
+	public void setTerminateSequenceResponse(TerminateSequenceResponse terminateSequenceResponse) {
+		this.terminateSequenceResponse = terminateSequenceResponse;
+	}
+
+	public Iterator getAckRequests() {
+		return ackRequests.iterator();
+	}
+
+	public void setAckRequested(ArrayList ackRequests) {
+		this.ackRequests = ackRequests;
+	}
+	
+	public void addAckRequested(AckRequested ackRequested) {
+		ackRequests.add(ackRequested);
+	}
+	
+	public void setMakeConnection(MakeConnection makeConnection) {
+		this.makeConnection = makeConnection;
+	}
+	
+	public void setMessagePending(MessagePending messagePending) {
+		this.messagePending = messagePending;
+	}
+	
+	public CloseSequence getCloseSequence() {
+		return closeSequence;
+	}
+
+	public void setCloseSequence(CloseSequence closeSequence) {
+		this.closeSequence = closeSequence;
+	}
+
+	public CloseSequenceResponse getCloseSequenceResponse() {
+		return closeSequenceResponse;
+	}
+
+	public void setCloseSequenceResponse(CloseSequenceResponse closeSequenceResponse) {
+		this.closeSequenceResponse = closeSequenceResponse;
+	}
+	
+	public UsesSequenceSTR getUsesSequenceSTR() {
+		return usesSequenceSTR;
+	}
+	
+	public void setUsesSequenceSTR(UsesSequenceSTR header) {
+		usesSequenceSTR = header;
+	}
+
+	public MakeConnection getMakeConnection() {
+		return makeConnection;
+	}
+
+	public MessagePending getMessagePending() {
+		return messagePending;
+	}
+	
+	public SequenceFault getSequenceFault() {
+		return sequenceFault;
+	}
+}

Propchange: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/RMElements.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Sequence.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Sequence.java?view=diff&rev=564063&r1=564062&r2=564063
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Sequence.java (original)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Sequence.java Wed Aug  8 17:57:51 2007
@@ -1,177 +1,177 @@
-/*
- * 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.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;
-
-/**
- * Represents a Sequence element which get carried within a RM application 
- * message.
- */
-
-public class Sequence implements IOMRMPart {
-
-	private Identifier identifier;
-	private MessageNumber messageNumber;
-	private LastMessage lastMessage = null;
-	private String namespaceValue = null;
-	
-	public Sequence(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 headerElement) throws OMException,SandeshaException {
-
-		SOAPHeader header = (SOAPHeader) headerElement;
-		if (header == null)
-			throw new OMException(
-					SandeshaMessageHelper.getMessage(
-							SandeshaMessageKeys.seqElementCannotBeAddedToNonHeader));
-
-		OMElement sequencePart = headerElement.getFirstChildWithName(new QName(namespaceValue,
-						Sandesha2Constants.WSRM_COMMON.SEQUENCE));
-		if (sequencePart == null)
-			throw new OMException(SandeshaMessageHelper.getMessage(
-					SandeshaMessageKeys.noSequencePartInElement,
-					headerElement.toString()));
-		
-		identifier = new Identifier(namespaceValue);
-		messageNumber = new MessageNumber(namespaceValue);
-		identifier.fromOMElement(sequencePart);
-		messageNumber.fromOMElement(sequencePart);
-
-		OMElement lastMessageElement = sequencePart
-				.getFirstChildWithName(new QName(namespaceValue,Sandesha2Constants.WSRM_COMMON.LAST_MSG));
-
-		if (lastMessageElement != null) {
-			lastMessage = new LastMessage(namespaceValue);
-			lastMessage.fromOMElement(sequencePart);
-		}
-
-    // Indicate that we have processed this part of the message.
-    ((SOAPHeaderBlock)sequencePart).setProcessed();
-    
-		return this;
-	}
-
-	public OMElement toOMElement(OMElement headerElement) throws OMException {
-
-		if (headerElement == null || !(headerElement instanceof SOAPHeader))
-			throw new OMException(SandeshaMessageHelper.getMessage(
-					SandeshaMessageKeys.seqElementCannotBeAddedToNonHeader));
-
-		SOAPHeader soapHeader = (SOAPHeader) headerElement;
-
-		if (identifier == null)
-			throw new OMException(SandeshaMessageHelper.getMessage(
-					SandeshaMessageKeys.nullMsgId));
-		if (messageNumber == null)
-			throw new OMException(SandeshaMessageHelper.getMessage(
-					SandeshaMessageKeys.seqPartIsNull));
-
-		OMFactory factory = headerElement.getOMFactory();
-
-		OMNamespace rmNamespace = factory.createOMNamespace(
-				namespaceValue, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
-		SOAPHeaderBlock sequenceHeaderBlock = soapHeader.addHeaderBlock(
-				Sandesha2Constants.WSRM_COMMON.SEQUENCE, rmNamespace);
-		
-    // Always set the MustUnderstand to true for Sequence messages 
-		sequenceHeaderBlock.setMustUnderstand(true);
-		identifier.toOMElement(sequenceHeaderBlock);
-		messageNumber.toOMElement(sequenceHeaderBlock);
-		if (lastMessage != null)
-			lastMessage.toOMElement(sequenceHeaderBlock);
-
-		return headerElement;
-	}
-
-	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;
-	}
-
-	public void toSOAPEnvelope(SOAPEnvelope envelope) {
-		SOAPHeader header = envelope.getHeader();
-		
-		if (header==null) {
-			SOAPFactory factory = (SOAPFactory)envelope.getOMFactory();
-			header = factory.createSOAPHeader(envelope);
-		}
-		
-		//detach if already exist.
-		OMElement elem = header.getFirstChildWithName(new QName(namespaceValue,
-				Sandesha2Constants.WSRM_COMMON.SEQUENCE));
-		if (elem!=null)
-			elem.detach();
-		
-		toOMElement(header);
-	}
-	
-	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;
-	}
-
-}
+/*
+ * 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.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;
+
+/**
+ * Represents a Sequence element which get carried within a RM application 
+ * message.
+ */
+
+public class Sequence implements IOMRMPart {
+
+	private Identifier identifier;
+	private MessageNumber messageNumber;
+	private LastMessage lastMessage = null;
+	private String namespaceValue = null;
+	
+	public Sequence(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 headerElement) throws OMException,SandeshaException {
+
+		SOAPHeader header = (SOAPHeader) headerElement;
+		if (header == null)
+			throw new OMException(
+					SandeshaMessageHelper.getMessage(
+							SandeshaMessageKeys.seqElementCannotBeAddedToNonHeader));
+
+		OMElement sequencePart = headerElement.getFirstChildWithName(new QName(namespaceValue,
+						Sandesha2Constants.WSRM_COMMON.SEQUENCE));
+		if (sequencePart == null)
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.noSequencePartInElement,
+					headerElement.toString()));
+		
+		identifier = new Identifier(namespaceValue);
+		messageNumber = new MessageNumber(namespaceValue);
+		identifier.fromOMElement(sequencePart);
+		messageNumber.fromOMElement(sequencePart);
+
+		OMElement lastMessageElement = sequencePart
+				.getFirstChildWithName(new QName(namespaceValue,Sandesha2Constants.WSRM_COMMON.LAST_MSG));
+
+		if (lastMessageElement != null) {
+			lastMessage = new LastMessage(namespaceValue);
+			lastMessage.fromOMElement(sequencePart);
+		}
+
+    // Indicate that we have processed this part of the message.
+    ((SOAPHeaderBlock)sequencePart).setProcessed();
+    
+		return this;
+	}
+
+	public OMElement toOMElement(OMElement headerElement) throws OMException {
+
+		if (headerElement == null || !(headerElement instanceof SOAPHeader))
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.seqElementCannotBeAddedToNonHeader));
+
+		SOAPHeader soapHeader = (SOAPHeader) headerElement;
+
+		if (identifier == null)
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.nullMsgId));
+		if (messageNumber == null)
+			throw new OMException(SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.seqPartIsNull));
+
+		OMFactory factory = headerElement.getOMFactory();
+
+		OMNamespace rmNamespace = factory.createOMNamespace(
+				namespaceValue, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+		SOAPHeaderBlock sequenceHeaderBlock = soapHeader.addHeaderBlock(
+				Sandesha2Constants.WSRM_COMMON.SEQUENCE, rmNamespace);
+		
+    // Always set the MustUnderstand to true for Sequence messages 
+		sequenceHeaderBlock.setMustUnderstand(true);
+		identifier.toOMElement(sequenceHeaderBlock);
+		messageNumber.toOMElement(sequenceHeaderBlock);
+		if (lastMessage != null)
+			lastMessage.toOMElement(sequenceHeaderBlock);
+
+		return headerElement;
+	}
+
+	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;
+	}
+
+	public void toSOAPEnvelope(SOAPEnvelope envelope) {
+		SOAPHeader header = envelope.getHeader();
+		
+		if (header==null) {
+			SOAPFactory factory = (SOAPFactory)envelope.getOMFactory();
+			header = factory.createSOAPHeader(envelope);
+		}
+		
+		//detach if already exist.
+		OMElement elem = header.getFirstChildWithName(new QName(namespaceValue,
+				Sandesha2Constants.WSRM_COMMON.SEQUENCE));
+		if (elem!=null)
+			elem.detach();
+		
+		toOMElement(header);
+	}
+	
+	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;
+	}
+
+}

Propchange: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/wsrm/Sequence.java
------------------------------------------------------------------------------
    svn:eol-style = native



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