You are viewing a plain text version of this content. The canonical link for it is here.
Posted to sandesha-dev@ws.apache.org by ch...@apache.org on 2006/04/16 07:03:31 UTC
svn commit: r394435 [1/2] - in
/webservices/sandesha/trunk/src/org/apache/sandesha2: client/ util/ wsrm/
Author: chamikara
Date: Sat Apr 15 22:03:29 2006
New Revision: 394435
URL: http://svn.apache.org/viewcvs?rev=394435&view=rev
Log:
Sandesha2 model elements used to hold pre-created OMNamespaces and OMElements as instance variables. But this was buggy. So changed to dynamically create these using the factory of the element passed in to the toOMElement method.
Modified:
webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaClient.java
webservices/sandesha/trunk/src/org/apache/sandesha2/util/FaultManager.java
webservices/sandesha/trunk/src/org/apache/sandesha2/util/MsgInitializer.java
webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Accept.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckFinal.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckNone.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckRequested.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcknowledgementRange.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcksTo.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Address.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CloseSequence.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CloseSequenceResponse.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequence.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequenceResponse.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Expires.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/FaultCode.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/IOMRMElement.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Identifier.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/LastMessage.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/MessageNumber.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Nack.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/RMElements.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Sequence.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceAcknowledgement.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceFault.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceOffer.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/TerminateSequence.java
webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/TerminateSequenceResponse.java
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaClient.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaClient.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaClient.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaClient.java Sat Apr 15 22:03:29 2006
@@ -583,6 +583,11 @@
return dummyEnvelope;
}
+ public static SequenceReport getOutgoingSequenceReport (String to,String sequenceKey,ConfigurationContext configurationContext) throws SandeshaException {
+ String internalSequenceID = SandeshaUtil.getInternalSequenceID(to,sequenceKey);
+ return getOutgoingSequenceReport(internalSequenceID,configurationContext);
+ }
+
private static SequenceReport getOutgoingSequenceReport (String internalSequenceID,ConfigurationContext configurationContext) throws SandeshaException {
SequenceReport sequenceReport = new SequenceReport ();
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/FaultManager.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/FaultManager.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/FaultManager.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/FaultManager.java Sat Apr 15 22:03:29 2006
@@ -272,10 +272,13 @@
data.setSubcode(Sandesha2Constants.SOAPFaults.Subcodes.UNKNOWN_SEQUENCE);
SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SOAPVersion);
- Identifier identifier = new Identifier(factory,rmNamespaceValue);
- identifier.setIndentifer(sequenceID);
- OMElement identifierOMElem = identifier.getOMElement();
- data.setDetail(identifierOMElem);
+// Identifier identifier = new Identifier(factory,rmNamespaceValue);
+// identifier.setIndentifer(sequenceID);
+// OMElement identifierOMElem = identifier.getOMElement();
+
+ OMElement identifierElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.IDENTIFIER,rmNamespaceValue, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+ data.setDetail(identifierElement);
+
data.setReason("A sequence with the given sequenceID has NOT been established");
return getFault(rmMessageContext, data,rmMessageContext.getAddressingNamespaceValue());
@@ -332,7 +335,14 @@
data.setSubcode(Sandesha2Constants.SOAPFaults.Subcodes.INVALID_ACKNOWLEDGEMENT);
data.setReason(reason);
- data.setDetail(sequenceAcknowledgement.getOMElement());
+
+ SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SOAPVersion);
+ OMElement dummyElement = factory.createOMElement("dummyElem",null);
+ sequenceAcknowledgement.toOMElement(dummyElement);
+
+ OMElement sequenceAckElement = dummyElement.getFirstChildWithName(
+ new QName (Sandesha2Constants.WSRM_COMMON.SEQUENCE_ACK));
+ data.setDetail(sequenceAckElement);
return getFault(ackRMMessageContext, data,ackRMMessageContext.getAddressingNamespaceValue());
}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/MsgInitializer.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/MsgInitializer.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/MsgInitializer.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/MsgInitializer.java Sat Apr 15 22:03:29 2006
@@ -84,57 +84,57 @@
if (elements.getCreateSequence() != null) {
rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.CREATE_SEQ,
elements.getCreateSequence());
- rmNamespace = elements.getCreateSequence().getOMElement().getNamespace().getName();
+ rmNamespace = elements.getCreateSequence().getNamespaceValue();
}
if (elements.getCreateSequenceResponse() != null) {
rmMsgContext.setMessagePart(
Sandesha2Constants.MessageParts.CREATE_SEQ_RESPONSE, elements
.getCreateSequenceResponse());
- rmNamespace = elements.getCreateSequenceResponse().getOMElement().getNamespace().getName();
+ rmNamespace = elements.getCreateSequenceResponse().getNamespaceValue();
}
if (elements.getSequence() != null) {
rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.SEQUENCE,
elements.getSequence());
- rmNamespace = elements.getSequence().getOMElement().getNamespace().getName();
+ rmNamespace = elements.getSequence().getNamespaceValue();
}
if (elements.getSequenceAcknowledgement() != null) {
rmMsgContext.setMessagePart(
Sandesha2Constants.MessageParts.SEQ_ACKNOWLEDGEMENT, elements
.getSequenceAcknowledgement());
- rmNamespace = elements.getSequenceAcknowledgement().getOMElement().getNamespace().getName();
+ rmNamespace = elements.getSequenceAcknowledgement().getNamespaceValue();
}
if (elements.getTerminateSequence() != null) {
rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.TERMINATE_SEQ,
elements.getTerminateSequence());
- rmNamespace = elements.getTerminateSequence().getOMElement().getNamespace().getName();
+ rmNamespace = elements.getTerminateSequence().getNamespaceValue();
}
if (elements.getTerminateSequenceResponse() != null) {
rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.TERMINATE_SEQ_RESPONSE,
elements.getTerminateSequenceResponse());
- rmNamespace = elements.getTerminateSequenceResponse().getOMElement().getNamespace().getName();
+ rmNamespace = elements.getTerminateSequenceResponse().getNamespaceValue();
}
if (elements.getAckRequested() != null) {
rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.ACK_REQUEST,
elements.getAckRequested());
- rmNamespace = elements.getAckRequested().getOMElement().getNamespace().getName();
+ rmNamespace = elements.getAckRequested().getNamespaceValue();
}
if (elements.getCloseSequence() != null) {
rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.CLOSE_SEQUENCE,
elements.getCloseSequence());
- rmNamespace = elements.getCloseSequence().getOMElement().getNamespace().getName();
+ rmNamespace = elements.getCloseSequence().getNamespaceValue();
}
if (elements.getCloseSequenceResponse() != null) {
rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.CLOSE_SEQUENCE_RESPONSE,
elements.getCloseSequenceResponse());
- rmNamespace = elements.getCloseSequenceResponse().getOMElement().getNamespace().getName();
+ rmNamespace = elements.getCloseSequenceResponse().getNamespaceValue();
}
rmMsgContext.setRMNamespaceValue(rmNamespace);
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java Sat Apr 15 22:03:29 2006
@@ -140,7 +140,7 @@
if (createSequenceMsgAction==null)
throw new SandeshaException ("Create sequence message does not have the WSA:Action value");
- String messageRMNamespace = createSequence.getOMElement().getNamespace().getName();
+ String messageRMNamespace = createSequence.getNamespaceValue();
String specVersion = null;
if (Sandesha2Constants.SPEC_2005_02.NS_URI.equals(messageRMNamespace)) {
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Accept.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Accept.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Accept.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Accept.java Sat Apr 15 22:03:29 2006
@@ -20,6 +20,7 @@
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.SOAPFactory;
import org.apache.sandesha2.Sandesha2Constants;
@@ -32,65 +33,60 @@
*/
public class Accept implements IOMRMElement {
- private OMElement acceptElement;
private AcksTo acksTo;
- private SOAPFactory factory;
-
- OMNamespace rmNamespace = null;
+ private OMFactory defaultFactory;
+
+ private String rmNamespaceValue;
- OMNamespace addressingNamespace = null;
+ private String addressingNamespaceValue;
+
- public Accept(SOAPFactory factory, String rmNamespaceValue, String addressingNamespaceValue) throws SandeshaException {
+ public Accept(OMFactory factory, String rmNamespaceValue, String addressingNamespaceValue) throws SandeshaException {
if (!isNamespaceSupported(rmNamespaceValue))
throw new SandeshaException ("Unsupported namespace");
- this.factory = factory;
- rmNamespace = factory.createOMNamespace(
- rmNamespaceValue , Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
- addressingNamespace = factory.createOMNamespace(
- addressingNamespaceValue , Sandesha2Constants.WSA.NS_PREFIX_ADDRESSING);
- acceptElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.ACCEPT, rmNamespace);
+ this.defaultFactory = factory;
+ this.addressingNamespaceValue = addressingNamespaceValue;
+ this.rmNamespaceValue = rmNamespaceValue;
}
- public OMElement getOMElement() throws OMException {
- return acceptElement;
+ public String getNamespaceValue(){
+ return rmNamespaceValue;
}
public Object fromOMElement(OMElement element) throws OMException,SandeshaException {
+ OMFactory factory = element.getOMFactory();
+ if (factory==null)
+ factory = defaultFactory;
+
OMElement acceptPart = element.getFirstChildWithName(new QName(
- rmNamespace.getName(), Sandesha2Constants.WSRM_COMMON.ACCEPT));
+ rmNamespaceValue, Sandesha2Constants.WSRM_COMMON.ACCEPT));
if (acceptPart == null)
- throw new OMException(
- "Passed element does not contain an Accept part");
+ throw new OMException("Passed element does not contain an Accept part");
- acksTo = new AcksTo(factory,rmNamespace.getName(),addressingNamespace.getName());
+ acksTo = new AcksTo(defaultFactory,rmNamespaceValue,addressingNamespaceValue);
acksTo.fromOMElement(acceptPart);
- acceptElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.ACCEPT, rmNamespace);
-
return this;
}
public OMElement toOMElement(OMElement element) throws OMException {
- if (acceptElement == null)
- throw new OMException(
- "Cant add Accept part since the internal element is null");
-
+ OMFactory factory = element.getOMFactory();
+ if (factory==null)
+ factory = defaultFactory;
+
if (acksTo == null)
- throw new OMException(
- "Cant add Accept part since AcksTo object is null");
+ throw new OMException("Cant add Accept part since AcksTo object is null");
+ OMNamespace rmNamespace = factory.createOMNamespace(rmNamespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+ OMElement acceptElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.ACCEPT, rmNamespace);
+
acksTo.toOMElement(acceptElement);
element.addChild(acceptElement);
-
- acceptElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.ACCEPT, rmNamespace);
return element;
}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckFinal.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckFinal.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckFinal.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckFinal.java Sat Apr 15 22:03:29 2006
@@ -23,6 +23,7 @@
import org.apache.sandesha2.SandeshaException;
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.SOAPFactory;
@@ -31,66 +32,52 @@
*
* This represent the wsrm:final element that may be present withing a sequence acknowledgement.
*/
-public class AckFinal {
+public class AckFinal implements IOMRMElement {
- private OMElement finalElement = null;
- OMNamespace rmNamespace = null;
- SOAPFactory factory;
- String namespaceValue = null;
+ private OMFactory defaultfactory;
- public AckFinal(SOAPFactory factory,String namespaceValue) throws SandeshaException {
+ private String namespaceValue = null;
+
+ public AckFinal(OMFactory factory,String namespaceValue) throws SandeshaException {
if (!isNamespaceSupported(namespaceValue))
throw new SandeshaException ("Unsupported namespace");
- this.factory = factory;
+ this.defaultfactory = factory;
this.namespaceValue = namespaceValue;
- rmNamespace = factory.createOMNamespace(
- namespaceValue, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
- finalElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.FINAL, rmNamespace);
}
- public OMElement getOMElement() throws OMException {
- return finalElement;
+ public String getNamespaceValue(){
+ return namespaceValue;
}
public Object fromOMElement(OMElement element) throws OMException {
- OMElement nonePart = element.getFirstChildWithName(new QName(
+
+ OMFactory factory = element.getOMFactory();
+ if (factory==null)
+ factory = defaultfactory;
+
+ OMElement finalPart = element.getFirstChildWithName(new QName(
namespaceValue, Sandesha2Constants.WSRM_COMMON.FINAL));
- if (nonePart == null)
- throw new OMException(
- "The passed element does not contain a 'Final' part");
-
- finalElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.FINAL, rmNamespace);
+ if (finalPart == null)
+ throw new OMException("The passed element does not contain a 'Final' part");
return this;
}
public OMElement toOMElement(OMElement sequenceAckElement) throws OMException {
//soapheaderblock element will be given
- if (finalElement == null)
- throw new OMException("Cant set 'Final' element. It is null");
+ OMFactory factory = sequenceAckElement.getOMFactory();
+ if (factory==null)
+ factory = defaultfactory;
+
+ OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+ OMElement finalElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.FINAL, rmNamespace);
sequenceAckElement.addChild(finalElement);
- finalElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.FINAL, rmNamespace);
-
return sequenceAckElement;
}
- public void setLastMessageElement(OMElement noneElement) {
- this.finalElement = noneElement;
- }
-
- public OMElement getLastMessageElement() {
- return finalElement;
- }
-
- public boolean isPresent() {
- return (finalElement != null) ? true : false;
- }
//this element is only supported in 2005_05_10 spec.
public boolean isNamespaceSupported (String namespaceName) {
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckNone.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckNone.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckNone.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckNone.java Sat Apr 15 22:03:29 2006
@@ -23,6 +23,7 @@
import org.apache.sandesha2.SandeshaException;
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.SOAPFactory;
@@ -32,65 +33,47 @@
*
* This represent the wsrm:none element that may be present withing a sequence acknowledgement.
*/
-public class AckNone {
+public class AckNone implements IOMRMElement {
- private OMElement noneElement = null;
- OMNamespace rmNamespace = null;
- SOAPFactory factory;
- String namespaceValue = null;
+ private OMNamespace rmNamespace = null;
- public AckNone(SOAPFactory factory,String namespaceValue) throws SandeshaException {
+ private OMFactory defaultFactory;
+
+ private String namespaceValue = null;
+
+ public AckNone(OMFactory factory,String namespaceValue) throws SandeshaException {
if (!isNamespaceSupported(namespaceValue))
throw new SandeshaException ("Unsupported namespace");
- this.factory = factory;
+ this.defaultFactory = factory;
this.namespaceValue = namespaceValue;
- rmNamespace = factory.createOMNamespace(
- namespaceValue, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
- noneElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.NONE, rmNamespace);
}
- public OMElement getOMElement() throws OMException {
- return noneElement;
+ public String getNamespaceValue(){
+ return namespaceValue;
}
public Object fromOMElement(OMElement element) throws OMException {
+
OMElement nonePart = element.getFirstChildWithName(new QName(
namespaceValue, Sandesha2Constants.WSRM_COMMON.NONE));
if (nonePart == null)
- throw new OMException(
- "The passed element does not contain a 'None' part");
-
- noneElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.NONE, rmNamespace);
+ throw new OMException("The passed element does not contain a 'None' part");
return this;
}
public OMElement toOMElement(OMElement sequenceAckElement) throws OMException {
- //soapheaderblock element will be given
- if (noneElement == null)
- throw new OMException("Cant set 'None' element. It is null");
+
+ OMFactory factory = sequenceAckElement.getOMFactory();
+ if (factory==null)
+ factory = defaultFactory;
+
+ OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+ OMElement noneElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.NONE, rmNamespace);
sequenceAckElement.addChild(noneElement);
-
- noneElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.NONE, rmNamespace);
-
return sequenceAckElement;
- }
-
- public void setLastMessageElement(OMElement noneElement) {
- this.noneElement = noneElement;
- }
-
- public OMElement getLastMessageElement() {
- return noneElement;
- }
-
- public boolean isPresent() {
- return (noneElement != null) ? true : false;
}
//this element is only supported in 2005_05_10 spec.
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckRequested.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckRequested.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckRequested.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckRequested.java Sat Apr 15 22:03:29 2006
@@ -20,6 +20,7 @@
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;
@@ -38,57 +39,49 @@
public class AckRequested implements IOMRMPart {
- private OMElement ackRequestedElement;
private Identifier identifier;
+
private MessageNumber messageNumber;
- private SOAPFactory factory;
- OMNamespace rmNamespace = null;
- String namespaceValue = null;
+
+ private OMFactory defaultFactory;
+
+ private String namespaceValue = null;
+
private boolean mustUnderstand = false;
- public AckRequested(SOAPFactory factory,String namespaceValue) throws SandeshaException {
+ public AckRequested(OMFactory factory,String namespaceValue) throws SandeshaException {
if (!isNamespaceSupported(namespaceValue))
throw new SandeshaException ("Unsupported namespace");
- this.factory = factory;
+ this.defaultFactory = factory;
this.namespaceValue = namespaceValue;
- rmNamespace = factory.createOMNamespace(
- namespaceValue, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
- ackRequestedElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.ACK_REQUESTED, rmNamespace);
}
- public OMElement getOMElement() throws OMException {
- return ackRequestedElement;
+ public String getNamespaceValue() {
+ return namespaceValue;
}
public Object fromOMElement(OMElement header) throws OMException,SandeshaException {
if (header == null || !(header instanceof SOAPHeader))
- throw new OMException(
- "Cant add the Ack Requested part to a non-header element");
+ throw new OMException("Cant add the Ack Requested part to a non-header element");
- OMElement ackReqPart = header.getFirstChildWithName(new QName(
- namespaceValue, Sandesha2Constants.WSRM_COMMON.ACK_REQUESTED));
+ OMElement ackReqPart = header.getFirstChildWithName(new QName(namespaceValue, Sandesha2Constants.WSRM_COMMON.ACK_REQUESTED));
if (ackReqPart == null)
- throw new OMException(
- "the passed element does not contain an ack requested part");
+ throw new OMException("the passed element does not contain an ack requested part");
- identifier = new Identifier(factory,namespaceValue);
+ identifier = new Identifier(defaultFactory,namespaceValue);
identifier.fromOMElement(ackReqPart);
OMElement msgNoPart = ackReqPart.getFirstChildWithName(new QName(
namespaceValue, Sandesha2Constants.WSRM_COMMON.MSG_NUMBER));
if (msgNoPart != null) {
- messageNumber = new MessageNumber(factory,namespaceValue);
+ messageNumber = new MessageNumber(defaultFactory,namespaceValue);
messageNumber.fromOMElement(ackReqPart);
}
- ackRequestedElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.ACK_REQUESTED, rmNamespace);
-
return this;
}
@@ -99,12 +92,13 @@
"Cant add the Ack Requested part to a non-header element");
if (identifier == null)
- throw new OMException(
- "Cant add ack Req block since the identifier is null");
+ throw new OMException("Cant add ack Req block since the identifier is null");
+
+ OMFactory factory = header.getOMFactory();
+ OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
SOAPHeader SOAPHdr = (SOAPHeader) header;
- SOAPHeaderBlock ackReqHdrBlock = SOAPHdr.addHeaderBlock(
- Sandesha2Constants.WSRM_COMMON.ACK_REQUESTED, rmNamespace);
+ SOAPHeaderBlock ackReqHdrBlock = SOAPHdr.addHeaderBlock(Sandesha2Constants.WSRM_COMMON.ACK_REQUESTED, rmNamespace);
ackReqHdrBlock.setMustUnderstand(isMustUnderstand());
identifier.toOMElement(ackReqHdrBlock);
@@ -113,9 +107,6 @@
messageNumber.toOMElement(ackReqHdrBlock);
}
- ackRequestedElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.ACK_REQUESTED, rmNamespace);
-
return header;
}
@@ -164,5 +155,4 @@
return false;
}
-
}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcknowledgementRange.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcknowledgementRange.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcknowledgementRange.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcknowledgementRange.java Sat Apr 15 22:03:29 2006
@@ -21,6 +21,7 @@
import org.apache.axiom.om.OMAttribute;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.soap.SOAPFactory;
import org.apache.sandesha2.Sandesha2Constants;
@@ -34,27 +35,24 @@
public class AcknowledgementRange implements IOMRMElement {
- private OMElement acknowledgementRangeElement;
private long upperValue;
+
private long lowerValue;
- private SOAPFactory factory;
- OMNamespace rmNamespace = null;
- String namespaceValue = null;
- public AcknowledgementRange(SOAPFactory factory, String namespaceValue) throws SandeshaException {
+ private OMFactory defaultFactory;
+
+ private String namespaceValue = null;
+
+ public AcknowledgementRange(OMFactory factory, String namespaceValue) throws SandeshaException {
if (!isNamespaceSupported(namespaceValue))
throw new SandeshaException ("Unsupported namespace");
- this.factory = factory;
+ this.defaultFactory = factory;
this.namespaceValue = namespaceValue;
- rmNamespace = factory.createOMNamespace(
- namespaceValue, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
- acknowledgementRangeElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.ACK_RANGE, rmNamespace);
}
- public OMElement getOMElement() throws OMException {
- return acknowledgementRangeElement;
+ public String getNamespaceValue() {
+ return namespaceValue;
}
public Object fromOMElement(OMElement ackRangePart) throws OMException {
@@ -81,9 +79,6 @@
"The ack range does not have proper long values for Upper and Lower attributes");
}
- acknowledgementRangeElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.ACK_RANGE, rmNamespace);
-
return this;
}
@@ -91,25 +86,27 @@
throws OMException {
if (sequenceAckElement == null)
- throw new OMException(
- "Cant set Ack Range part since element is null");
+ throw new OMException("Cant set Ack Range part since element is null");
if (upperValue <= 0 || lowerValue <= 0 || lowerValue > upperValue)
throw new OMException(
"Cant set Ack Range part since Upper or Lower is not set to the correct value");
+ OMFactory factory = sequenceAckElement.getOMFactory();
+ if (factory==null)
+ factory = defaultFactory;
+
OMAttribute lowerAttrib = factory.createOMAttribute(
Sandesha2Constants.WSRM_COMMON.LOWER, null, Long.toString(lowerValue));
OMAttribute upperAttrib = factory.createOMAttribute(
Sandesha2Constants.WSRM_COMMON.UPPER, null, Long.toString(upperValue));
+ OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+ OMElement acknowledgementRangeElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.ACK_RANGE, rmNamespace);
+
acknowledgementRangeElement.addAttribute(lowerAttrib);
acknowledgementRangeElement.addAttribute(upperAttrib);
-
sequenceAckElement.addChild(acknowledgementRangeElement);
-
- acknowledgementRangeElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.ACK_RANGE, rmNamespace);
return sequenceAckElement;
}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcksTo.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcksTo.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcksTo.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcksTo.java Sat Apr 15 22:03:29 2006
@@ -20,6 +20,7 @@
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.SOAPFactory;
import org.apache.sandesha2.Sandesha2Constants;
@@ -34,23 +35,20 @@
public class AcksTo implements IOMRMElement {
private Address address;
- private OMElement acksToElement;
- private SOAPFactory factory;
- OMNamespace rmNamespace = null;
- OMNamespace addressingNamespace = null;
-// String namespaceValue = null;
+
+ private OMFactory defaultFactory;
+
+ private String rmNamespaceValue = null;
+
+ private String addressingNamespaceValue = null;
- public AcksTo(SOAPFactory factory,String rmNamespaceValue,String addressingNamespaceValue) throws SandeshaException {
+ public AcksTo(OMFactory factory,String rmNamespaceValue,String addressingNamespaceValue) throws SandeshaException {
if (!isNamespaceSupported(rmNamespaceValue))
throw new SandeshaException ("Unsupported namespace");
- this.factory = factory;
- rmNamespace = factory.createOMNamespace(
- rmNamespaceValue, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
- addressingNamespace = factory.createOMNamespace(
- addressingNamespaceValue, Sandesha2Constants.WSA.NS_PREFIX_ADDRESSING);
- acksToElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.ACKS_TO, rmNamespace);
+ this.defaultFactory = factory;
+ this.rmNamespaceValue = rmNamespaceValue;
+ this.addressingNamespaceValue = addressingNamespaceValue;
}
public AcksTo (Address address,SOAPFactory factory,String rmNamespaceValue, String addressingNamespaceValue) throws SandeshaException {
@@ -58,43 +56,38 @@
this.address = address;
}
- public OMElement getOMElement() throws OMException {
- return acksToElement;
+ public String getNamespaceValue(){
+ return rmNamespaceValue;
}
public Object fromOMElement(OMElement element) throws OMException,SandeshaException {
OMElement acksToPart = element.getFirstChildWithName(new QName(
- rmNamespace.getName(), Sandesha2Constants.WSRM_COMMON.ACKS_TO));
+ rmNamespaceValue, Sandesha2Constants.WSRM_COMMON.ACKS_TO));
if (acksToPart == null)
- throw new OMException(
- "Passed element does not contain an acksTo part");
+ throw new OMException("Passed element does not contain an acksTo part");
- address = new Address(factory,addressingNamespace.getName());
+ address = new Address(defaultFactory,addressingNamespaceValue);
address.fromOMElement(acksToPart);
- acksToElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.ACKS_TO, rmNamespace);
-
return this;
}
public OMElement toOMElement(OMElement element) throws OMException {
- if (acksToElement == null)
- throw new OMException("Cant set AcksTo. AcksTo element is null");
if (address == null)
- throw new OMException("Cant set AcksTo. Address is null");
-
- OMElement acksToPart = element.getFirstChildWithName(new QName(
- rmNamespace.getName(), Sandesha2Constants.WSRM_COMMON.ACKS_TO));
+ throw new OMException("Cannot set AcksTo. Address is null");
+ OMFactory factory = element.getOMFactory();
+ if (factory==null)
+ factory = defaultFactory;
+
+ OMNamespace rmNamespace = factory.createOMNamespace(rmNamespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+ OMElement acksToElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.ACKS_TO, rmNamespace);
+
address.toOMElement(acksToElement);
+
element.addChild(acksToElement);
-
- acksToElement =factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.ACKS_TO, rmNamespace);
-
return element;
}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Address.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Address.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Address.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Address.java Sat Apr 15 22:03:29 2006
@@ -11,6 +11,7 @@
import org.apache.axis2.addressing.EndpointReference;
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.SOAPFactory;
import org.apache.sandesha2.Sandesha2Constants;
@@ -24,21 +25,18 @@
public class Address implements IOMRMElement {
- EndpointReference epr = null;
- OMElement addressElement;
- SOAPFactory factory;
- OMNamespace addressingNamespace = null;
-
- public Address(SOAPFactory factory, String addressingNamespaceValue) {
-
- this.factory = factory;
- addressingNamespace = factory.createOMNamespace(addressingNamespaceValue,
- Sandesha2Constants.WSA.NS_PREFIX_ADDRESSING);
- addressElement = factory.createOMElement(
- Sandesha2Constants.WSA.ADDRESS, addressingNamespace);
+ private EndpointReference epr = null;
+
+ private OMFactory defaultFactory;
+
+ private String addressingNamespaceValue = null;
+
+ public Address(OMFactory factory, String addressingNamespaceValue) {
+ this.defaultFactory = factory;
+ this.addressingNamespaceValue = addressingNamespaceValue;
}
- public Address (EndpointReference epr,SOAPFactory factory,String addressingNamespaceValue) {
+ public Address (EndpointReference epr,OMFactory factory,String addressingNamespaceValue) {
this(factory,addressingNamespaceValue);
this.epr = epr;
}
@@ -46,41 +44,36 @@
public Object fromOMElement(OMElement element) throws OMException {
OMElement addressPart = element.getFirstChildWithName(new QName(
- addressingNamespace.getName(), Sandesha2Constants.WSA.ADDRESS));
+ addressingNamespaceValue, Sandesha2Constants.WSA.ADDRESS));
if (addressPart == null)
- throw new OMException(
- "Cant find an Address element in the given part");
+ throw new OMException("Cant find an Address element in the given part");
String addressText = addressPart.getText();
if (addressText == null || addressText == "")
throw new OMException(
"Passed element does not have a valid address text");
- addressElement = addressPart;
epr = new EndpointReference(addressText);
- addressElement = factory.createOMElement(
- Sandesha2Constants.WSA.ADDRESS, addressingNamespace);
return this;
-
}
- public OMElement getOMElement() throws OMException {
- return addressElement;
+ public String getNamespaceValue(){
+ return addressingNamespaceValue;
}
public OMElement toOMElement(OMElement element) throws OMException {
- if (addressElement == null)
- throw new OMException(
- "Cant set Address. The address element is null");
if (epr == null || epr.getAddress() == null || epr.getAddress() == "")
- throw new OMException(
- "cant set the address. The address value is not valid");
+ throw new OMException("cant set the address. The address value is not valid");
+ OMFactory factory = element.getOMFactory();
+ if (factory==null)
+ factory = defaultFactory;
+
+ OMNamespace addressingNamespace = factory.createOMNamespace(addressingNamespaceValue,Sandesha2Constants.WSA.NS_PREFIX_ADDRESSING);
+ OMElement addressElement = factory.createOMElement(Sandesha2Constants.WSA.ADDRESS, addressingNamespace);
+
addressElement.setText(epr.getAddress());
element.addChild(addressElement);
-
- addressElement = factory.createOMElement(
- Sandesha2Constants.WSA.ADDRESS, addressingNamespace);
return element;
}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CloseSequence.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CloseSequence.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CloseSequence.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CloseSequence.java Sat Apr 15 22:03:29 2006
@@ -23,6 +23,7 @@
import org.apache.sandesha2.SandeshaException;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.soap.SOAPBody;
import org.apache.axiom.soap.SOAPEnvelope;
@@ -36,47 +37,38 @@
public class CloseSequence implements IOMRMPart {
- private OMElement closeSequenceElement;
private Identifier identifier;
- OMNamespace rmNameSpace = null;
- SOAPFactory factory;
- String namespaceValue = null;
- public CloseSequence(SOAPFactory factory, String namespaceValue) throws SandeshaException {
+ private OMFactory defaultFactory;
+
+ private String namespaceValue = null;
+
+ public CloseSequence(OMFactory factory, String namespaceValue) throws SandeshaException {
if (!isNamespaceSupported(namespaceValue))
throw new SandeshaException ("Unsupported namespace");
- this.factory = factory;
+ this.defaultFactory = factory;
this.namespaceValue = namespaceValue;
- rmNameSpace = factory.createOMNamespace(
- namespaceValue, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
- closeSequenceElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.CLOSE_SEQUENCE, rmNameSpace);
}
- public OMElement getOMElement() throws OMException {
- return closeSequenceElement;
+ public String getNamespaceValue() {
+ return namespaceValue;
}
public Object fromOMElement(OMElement body) throws OMException,SandeshaException {
if (!(body instanceof SOAPBody))
- throw new OMException(
- "Cant add 'close sequence' to a non body element");
+ throw new OMException("Cant extract 'close sequence' from a non body element");
OMElement closeSeqPart = body.getFirstChildWithName(new QName(
namespaceValue, Sandesha2Constants.WSRM_COMMON.CLOSE_SEQUENCE));
if (closeSeqPart == null)
- throw new OMException(
- "passed element does not contain a close sequence part");
+ throw new OMException("passed element does not contain a close sequence part");
- identifier = new Identifier(factory,namespaceValue);
+ identifier = new Identifier(defaultFactory,namespaceValue);
identifier.fromOMElement(closeSeqPart);
- closeSequenceElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.CLOSE_SEQUENCE, rmNameSpace);
-
return this;
}
@@ -86,19 +78,18 @@
throw new OMException(
"Cant add close sequence to a nonbody element");
- if (closeSequenceElement == null)
- throw new OMException(
- "Cant add close sequnce since the internal element is null");
-
if (identifier == null)
- throw new OMException(
- "Cant add close sequence since identifier is not set");
+ throw new OMException("Cant add close sequence since identifier is not set");
+ OMFactory factory = body.getOMFactory();
+ if (factory==null)
+ factory = defaultFactory;
+
+ OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+ OMElement closeSequenceElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.CLOSE_SEQUENCE, rmNamespace);
+
identifier.toOMElement(closeSequenceElement);
body.addChild(closeSequenceElement);
-
- closeSequenceElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.CLOSE_SEQUENCE, rmNameSpace);
return body;
}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CloseSequenceResponse.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CloseSequenceResponse.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CloseSequenceResponse.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CloseSequenceResponse.java Sat Apr 15 22:03:29 2006
@@ -23,6 +23,7 @@
import org.apache.sandesha2.SandeshaException;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.soap.SOAPBody;
import org.apache.axiom.soap.SOAPEnvelope;
@@ -35,26 +36,22 @@
*/
public class CloseSequenceResponse implements IOMRMPart {
- private OMElement closeSequenceResponseElement;
private Identifier identifier;
- OMNamespace rmNameSpace = null;
- SOAPFactory factory;
- String namespaceValue = null;
- public CloseSequenceResponse(SOAPFactory factory, String namespaceValue) throws SandeshaException {
+ private OMFactory defaultFactory;
+
+ private String namespaceValue = null;
+
+ public CloseSequenceResponse(OMFactory factory, String namespaceValue) throws SandeshaException {
if (!isNamespaceSupported(namespaceValue))
throw new SandeshaException ("Unsupported namespace");
- this.factory = factory;
+ this.defaultFactory = factory;
this.namespaceValue = namespaceValue;
- rmNameSpace = factory.createOMNamespace(
- namespaceValue, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
- closeSequenceResponseElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.CLOSE_SEQUENCE_RESPONSE, rmNameSpace);
}
- public OMElement getOMElement() throws OMException {
- return closeSequenceResponseElement;
+ public String getNamespaceValue() {
+ return namespaceValue;
}
public Object fromOMElement(OMElement body) throws OMException,SandeshaException {
@@ -67,15 +64,11 @@
namespaceValue, Sandesha2Constants.WSRM_COMMON.CLOSE_SEQUENCE_RESPONSE));
if (closeSeqResponsePart == null)
- throw new OMException(
- "passed element does not contain a 'close sequence response' part");
+ throw new OMException("passed element does not contain a 'close sequence response' part");
- identifier = new Identifier(factory,namespaceValue);
+ identifier = new Identifier(defaultFactory,namespaceValue);
identifier.fromOMElement(closeSeqResponsePart);
- closeSequenceResponseElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.CLOSE_SEQUENCE_RESPONSE, rmNameSpace);
-
return this;
}
@@ -85,19 +78,19 @@
throw new OMException(
"Cant add close sequence response to a nonbody element");
- if (closeSequenceResponseElement == null)
- throw new OMException(
- "Cant add close sequnce response since the internal element is null");
-
if (identifier == null)
throw new OMException(
"Cant add close sequence response since identifier is not set");
+ OMFactory factory = body.getOMFactory();
+ if (factory==null)
+ factory = defaultFactory;
+
+ OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+ OMElement closeSequenceResponseElement = factory.createOMElement(
+ Sandesha2Constants.WSRM_COMMON.CLOSE_SEQUENCE_RESPONSE, rmNamespace);
identifier.toOMElement(closeSequenceResponseElement);
body.addChild(closeSequenceResponseElement);
-
- closeSequenceResponseElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.CLOSE_SEQUENCE_RESPONSE, rmNameSpace);
return body;
}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequence.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequence.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequence.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequence.java Sat Apr 15 22:03:29 2006
@@ -20,6 +20,7 @@
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.soap.SOAPBody;
import org.apache.axiom.soap.SOAPEnvelope;
@@ -37,25 +38,25 @@
public class CreateSequence implements IOMRMPart {
- private OMElement createSequenceElement;
private AcksTo acksTo = null;
+
private Expires expires = null;
+
private SequenceOffer sequenceOffer = null;
- private SOAPFactory factory;
- OMNamespace rmNamespace = null;
- OMNamespace addressingNamespace = null;
-
- public CreateSequence(SOAPFactory factory,String rmNamespaceValue,String addressingNamespaceValue) throws SandeshaException {
+
+ private OMFactory defaultFactory;
+
+ private String rmNamespaceValue = null;
+
+ private String addressingNamespaceValue = null;
+
+ public CreateSequence(OMFactory factory,String rmNamespaceValue,String addressingNamespaceValue) throws SandeshaException {
if (!isNamespaceSupported(rmNamespaceValue))
throw new SandeshaException ("Unsupported namespace");
- this.factory = factory;
- rmNamespace = factory.createOMNamespace(
- rmNamespaceValue, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
- addressingNamespace = factory.createOMNamespace(
- addressingNamespaceValue, Sandesha2Constants.WSA.NS_PREFIX_ADDRESSING);
- createSequenceElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.CREATE_SEQUENCE, rmNamespace);
+ this.defaultFactory = factory;
+ this.rmNamespaceValue = rmNamespaceValue;
+ this.addressingNamespaceValue = addressingNamespaceValue;
}
public CreateSequence (AcksTo acksTo,SOAPFactory factory,String rmNamespaceValue,String addressingNamespaceValue) throws SandeshaException {
@@ -63,38 +64,33 @@
this.acksTo = acksTo;
}
- public OMElement getOMElement() throws OMException {
- return createSequenceElement;
+ public String getNamespaceValue() {
+ return rmNamespaceValue;
}
public Object fromOMElement(OMElement bodyElement) throws OMException,SandeshaException {
OMElement createSequencePart = bodyElement
- .getFirstChildWithName(new QName(rmNamespace.getName(),
- Sandesha2Constants.WSRM_COMMON.CREATE_SEQUENCE));
+ .getFirstChildWithName(new QName(rmNamespaceValue,
+ Sandesha2Constants.WSRM_COMMON.CREATE_SEQUENCE));
if (createSequencePart == null)
- throw new OMException(
- "Create sequence is not present in the passed element");
-
- createSequenceElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.CREATE_SEQUENCE, rmNamespace);
-
- acksTo = new AcksTo(factory,rmNamespace.getName(),addressingNamespace.getName());
+ throw new OMException("Create sequence is not present in the passed element");
+
+ acksTo = new AcksTo(defaultFactory,rmNamespaceValue,addressingNamespaceValue);
acksTo.fromOMElement(createSequencePart);
- OMElement offerPart = createSequencePart
- .getFirstChildWithName(new QName(rmNamespace.getName(),
- Sandesha2Constants.WSRM_COMMON.SEQUENCE_OFFER));
+ OMElement offerPart = createSequencePart.getFirstChildWithName(new QName(rmNamespaceValue,
+ Sandesha2Constants.WSRM_COMMON.SEQUENCE_OFFER));
if (offerPart != null) {
- sequenceOffer = new SequenceOffer(factory,rmNamespace.getName());
+ sequenceOffer = new SequenceOffer(defaultFactory,rmNamespaceValue);
sequenceOffer.fromOMElement(createSequencePart);
}
- OMElement expiresPart = createSequenceElement
- .getFirstChildWithName(new QName(rmNamespace.getName(),
+ OMElement expiresPart = createSequencePart.getFirstChildWithName(
+ new QName(rmNamespaceValue,
Sandesha2Constants.WSRM_COMMON.EXPIRES));
if (expiresPart != null) {
- expires = new Expires(factory,rmNamespace.getName());
+ expires = new Expires(defaultFactory,rmNamespaceValue);
expires.fromOMElement(createSequencePart);
}
@@ -104,14 +100,20 @@
public OMElement toOMElement(OMElement bodyElement) throws OMException {
if (bodyElement == null || !(bodyElement instanceof SOAPBody))
- throw new OMException(
- "Cant add Create Sequence Part to a non-body element");
+ throw new OMException("Cant add Create Sequence Part to a non-body element");
if (acksTo == null)
- throw new OMException(
- "Cant add create seqeunce part, having acks to as null");
+ throw new OMException("Cant add create seqeunce part, having acks to as null");
SOAPBody soapBody = (SOAPBody) bodyElement;
+
+ OMFactory factory = bodyElement.getOMFactory();
+ if (factory==null)
+ factory = defaultFactory;
+ OMNamespace rmNamespace = factory.createOMNamespace(rmNamespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+ OMElement createSequenceElement = factory.createOMElement(
+ Sandesha2Constants.WSRM_COMMON.CREATE_SEQUENCE, rmNamespace);
+
acksTo.toOMElement(createSequenceElement);
if (sequenceOffer != null) {
@@ -123,9 +125,6 @@
}
soapBody.addChild(createSequenceElement);
-
- createSequenceElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.CREATE_SEQUENCE, rmNamespace);
return soapBody;
}
@@ -149,7 +148,7 @@
SOAPBody body = envelope.getBody();
//detach if already exist.
- OMElement elem = body.getFirstChildWithName(new QName(rmNamespace.getName(),
+ OMElement elem = body.getFirstChildWithName(new QName(rmNamespaceValue,
Sandesha2Constants.WSRM_COMMON.CREATE_SEQUENCE));
if (elem!=null)
elem.detach();
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequenceResponse.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequenceResponse.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequenceResponse.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequenceResponse.java Sat Apr 15 22:03:29 2006
@@ -20,6 +20,7 @@
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.soap.SOAPBody;
import org.apache.axiom.soap.SOAPEnvelope;
@@ -37,68 +38,59 @@
public class CreateSequenceResponse implements IOMRMPart {
- private OMElement createSequenceResponseElement;
private Identifier identifier;
+
private Accept accept;
+
private Expires expires;
- SOAPFactory factory;
- OMNamespace rmNamespace = null;
- OMNamespace addressingNamespace = null;
+
+ private OMFactory defaultFactory;
+
+ private String rmNamespaceValue = null;
+
+ private String addressingNamespaceValue = null;
- public CreateSequenceResponse(SOAPFactory factory, String rmNamespaceValue, String addressingNamespaceValue) throws SandeshaException {
+ public CreateSequenceResponse(OMFactory factory, String rmNamespaceValue, String addressingNamespaceValue) throws SandeshaException {
if (!isNamespaceSupported(rmNamespaceValue))
throw new SandeshaException ("Unsupported namespace");
- this.factory = factory;
- rmNamespace = factory.createOMNamespace(
- rmNamespaceValue, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
- addressingNamespace = factory.createOMNamespace(
- addressingNamespaceValue, Sandesha2Constants.WSA.NS_PREFIX_ADDRESSING);
-
- createSequenceResponseElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.CREATE_SEQUENCE_RESPONSE,
- rmNamespace);
+ this.defaultFactory = factory;
+ this.rmNamespaceValue = rmNamespaceValue;
+ this.addressingNamespaceValue = addressingNamespaceValue;
}
- public OMElement getOMElement() throws OMException {
- return createSequenceResponseElement;
+ public String getNamespaceValue() {
+ return rmNamespaceValue;
}
public Object fromOMElement(OMElement bodyElement) throws OMException,SandeshaException {
if (bodyElement == null || !(bodyElement instanceof SOAPBody))
- throw new OMException(
- "Cant get create sequnce response from a non-body element");
+ throw new OMException("Cant get create sequnce response from a non-body element");
SOAPBody SOAPBody = (SOAPBody) bodyElement;
OMElement createSeqResponsePart = SOAPBody
- .getFirstChildWithName(new QName(rmNamespace.getName(),
- Sandesha2Constants.WSRM_COMMON.CREATE_SEQUENCE_RESPONSE));
+ .getFirstChildWithName(new QName(rmNamespaceValue,Sandesha2Constants.WSRM_COMMON.CREATE_SEQUENCE_RESPONSE));
if (createSeqResponsePart == null)
- throw new OMException(
- "The passed element does not contain a create seqence response part");
-
- createSequenceResponseElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.CREATE_SEQUENCE_RESPONSE,
- rmNamespace);
+ throw new OMException("The passed element does not contain a create seqence response part");
- identifier = new Identifier(factory,rmNamespace.getName());
+ identifier = new Identifier(defaultFactory,rmNamespaceValue);
identifier.fromOMElement(createSeqResponsePart);
- OMElement expiresPart = createSeqResponsePart
- .getFirstChildWithName(new QName(rmNamespace.getName(),
- Sandesha2Constants.WSRM_COMMON.EXPIRES));
+ OMElement expiresPart = createSeqResponsePart.getFirstChildWithName(
+ new QName(rmNamespaceValue,
+ Sandesha2Constants.WSRM_COMMON.EXPIRES));
if (expiresPart != null) {
- expires = new Expires(factory,rmNamespace.getName());
+ expires = new Expires(defaultFactory,rmNamespaceValue);
expires.fromOMElement(createSeqResponsePart);
}
- OMElement acceptPart = createSeqResponsePart
- .getFirstChildWithName(new QName(rmNamespace.getName(),
+ OMElement acceptPart = createSeqResponsePart.getFirstChildWithName(
+ new QName(rmNamespaceValue,
Sandesha2Constants.WSRM_COMMON.ACCEPT));
if (acceptPart != null) {
- accept = new Accept(factory,rmNamespace.getName(),addressingNamespace.getName());
+ accept = new Accept(defaultFactory,rmNamespaceValue,addressingNamespaceValue);
accept.fromOMElement(createSeqResponsePart);
}
@@ -113,13 +105,20 @@
SOAPBody SOAPBody = (SOAPBody) bodyElement;
- if (createSequenceResponseElement == null)
- throw new OMException(
- "cant set create sequnce response since the internal element is not set");
if (identifier == null)
- throw new OMException(
- "cant set create sequnce response since the Identifier is not set");
+ throw new OMException("cant set create sequnce response since the Identifier is not set");
+ OMFactory factory = bodyElement.getOMFactory();
+ if (factory==null)
+ factory = defaultFactory;
+
+ OMNamespace rmNamespace = factory.createOMNamespace(rmNamespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+ OMNamespace addressingNamespace = factory.createOMNamespace(addressingNamespaceValue,Sandesha2Constants.WSA.NS_PREFIX_ADDRESSING);
+
+ OMElement createSequenceResponseElement = factory.createOMElement(
+ Sandesha2Constants.WSRM_COMMON.CREATE_SEQUENCE_RESPONSE,
+ rmNamespace);
+
identifier.toOMElement(createSequenceResponseElement);
if (expires != null) {
@@ -132,9 +131,7 @@
SOAPBody.addChild(createSequenceResponseElement);
- createSequenceResponseElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.CREATE_SEQUENCE_RESPONSE,
- rmNamespace);
+
return SOAPBody;
}
@@ -167,7 +164,7 @@
SOAPBody body = envelope.getBody();
//detach if already exist.
- OMElement elem = body.getFirstChildWithName(new QName(rmNamespace.getName(),
+ OMElement elem = body.getFirstChildWithName(new QName(rmNamespaceValue,
Sandesha2Constants.WSRM_COMMON.CREATE_SEQUENCE_RESPONSE));
if (elem!=null)
elem.detach();
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Expires.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Expires.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Expires.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Expires.java Sat Apr 15 22:03:29 2006
@@ -21,6 +21,7 @@
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.SOAPFactory;
import org.apache.sandesha2.Sandesha2Constants;
@@ -34,59 +35,54 @@
public class Expires implements IOMRMElement {
- SOAPFactory factory;
- OMNamespace rmNamespace = null;
- OMElement expiresElement = null;
- String duration = null;
- String namespaceValue = null;
+ private OMFactory defaultFactory;
+
+ private String duration = null;
+
+ private String namespaceValue = null;
- public Expires(SOAPFactory factory,String namespaceValue) throws SandeshaException {
+ public Expires(OMFactory factory,String namespaceValue) throws SandeshaException {
if (!isNamespaceSupported(namespaceValue))
throw new SandeshaException ("Unsupported namespace");
- this.factory = factory;
+ this.defaultFactory = factory;
this.namespaceValue = namespaceValue;
- rmNamespace = factory.createOMNamespace(
- namespaceValue, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
- expiresElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.EXPIRES, rmNamespace);
}
public Object fromOMElement(OMElement element) throws OMException {
OMElement expiresPart = element.getFirstChildWithName(new QName(
namespaceValue, Sandesha2Constants.WSRM_COMMON.EXPIRES));
if (expiresPart == null)
- throw new OMException(
- "Passed elemenet does not have a Expires part");
+ throw new OMException("Passed elemenet does not have a Expires part");
String expiresText = expiresPart.getText();
if (expiresText == null || expiresText == "")
throw new OMException("The duration value is not valid");
- expiresElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.EXPIRES, rmNamespace);
-
duration = expiresText;
return element;
}
- public OMElement getOMElement() throws OMException {
+ public String getNamespaceValue() throws OMException {
// TODO Auto-generated method stub
- return expiresElement;
+ return namespaceValue;
}
public OMElement toOMElement(OMElement element) throws OMException {
- if (expiresElement == null)
- throw new OMException("Cant set Expires. It is null");
+
if (duration == null || duration == "")
- throw new OMException(
- "Cant set Expires. The duration value is not set");
+ throw new OMException("Cant set Expires. The duration value is not set");
+ OMFactory factory = element.getOMFactory();
+ if (factory==null)
+ factory = defaultFactory;
+
+ OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+ OMElement expiresElement = factory.createOMElement(
+ Sandesha2Constants.WSRM_COMMON.EXPIRES, rmNamespace);
+
expiresElement.setText(duration);
element.addChild(expiresElement);
- expiresElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.EXPIRES, rmNamespace);
-
return element;
}
@@ -96,14 +92,6 @@
public void setDuration(String duration) {
this.duration = duration;
- }
-
- public OMElement getExpiresElement() {
- return expiresElement;
- }
-
- public void setExpiresElement(OMElement expiresElement) {
- this.expiresElement = expiresElement;
}
public boolean isNamespaceSupported (String namespaceName) {
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/FaultCode.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/FaultCode.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/FaultCode.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/FaultCode.java Sat Apr 15 22:03:29 2006
@@ -20,6 +20,7 @@
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.SOAPFactory;
import org.apache.sandesha2.Sandesha2Constants;
@@ -33,47 +34,38 @@
public class FaultCode implements IOMRMElement {
- private OMElement faultCodeElement;
- String faultCode = null;
- SOAPFactory factory;
- OMNamespace rmNameSpace = null;
- String namespaceValue = null;
+ private String faultCode = null;
+
+ private SOAPFactory defaultFactory;
+
+ private String namespaceValue = null;
public FaultCode(SOAPFactory factory, String namespaceValue) throws SandeshaException {
if (!isNamespaceSupported(namespaceValue))
throw new SandeshaException ("Unsupported namespace");
- this.factory = factory;
+ this.defaultFactory = factory;
this.namespaceValue = namespaceValue;
- rmNameSpace = factory.createOMNamespace(
- namespaceValue, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
- faultCodeElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.FAULT_CODE, rmNameSpace);
}
- public OMElement getOMElement() throws OMException {
- return faultCodeElement;
+ public String getNamespaceValue() {
+ return namespaceValue;
}
public Object fromOMElement(OMElement sequenceFault) throws OMException {
if (sequenceFault == null)
- throw new OMException(
- "Can't add Fault Code part since the passed element is null");
+ throw new OMException("Can't add Fault Code part since the passed element is null");
OMElement faultCodePart = sequenceFault
.getFirstChildWithName(new QName(namespaceValue,
Sandesha2Constants.WSRM_COMMON.FAULT_CODE));
if (faultCodePart == null)
- throw new OMException(
- "Passed element does not contain a Fauld Code part");
+ throw new OMException("Passed element does not contain a Fauld Code part");
this.faultCode = faultCodePart.getText();
- faultCodeElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.FAULT_CODE, rmNameSpace);
-
return sequenceFault;
}
@@ -88,9 +80,12 @@
throw new OMException(
"Cant add fault code since the the value is not set correctly.");
- if (faultCodeElement == null)
- throw new OMException(
- "Cant add the fault code since the internal element is null");
+ OMFactory factory = sequenceFault.getOMFactory();
+ if (factory==null)
+ factory = defaultFactory;
+
+ OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+ OMElement faultCodeElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.FAULT_CODE,rmNamespace);
faultCodeElement.setText(faultCode);
sequenceFault.addChild(faultCodeElement);
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/IOMRMElement.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/IOMRMElement.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/IOMRMElement.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/IOMRMElement.java Sat Apr 15 22:03:29 2006
@@ -29,7 +29,7 @@
import org.apache.axiom.om.OMException;
public interface IOMRMElement {
- public OMElement getOMElement() throws OMException;
+ public String getNamespaceValue();
public Object fromOMElement(OMElement element) throws OMException,SandeshaException ;
public OMElement toOMElement(OMElement element) throws OMException, SandeshaException ;
public boolean isNamespaceSupported (String namespaceName);
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Identifier.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Identifier.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Identifier.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Identifier.java Sat Apr 15 22:03:29 2006
@@ -26,6 +26,7 @@
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.SOAPFactory;
import org.apache.sandesha2.Sandesha2Constants;
@@ -33,22 +34,18 @@
public class Identifier implements Sandesha2Constants, IOMRMElement {
- private OMElement identifierElement;
private String identifier = null;
- OMNamespace wsrmNamespace = null;
- private SOAPFactory factory;
- String namespaceValue = null;
- public Identifier(SOAPFactory factory, String namespaceValue) throws SandeshaException {
+ private OMFactory defaultFactory;
+
+ private String namespaceValue = null;
+
+ public Identifier(OMFactory defaultFactory, String namespaceValue) throws SandeshaException {
if (!isNamespaceSupported(namespaceValue))
throw new SandeshaException ("Unsupported namespace");
- this.factory = factory;
+ this.defaultFactory = defaultFactory;
this.namespaceValue = namespaceValue;
- wsrmNamespace = factory.createOMNamespace(
- namespaceValue, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
- identifierElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.IDENTIFIER, wsrmNamespace);
}
public void setIndentifer(String identifier) {
@@ -59,21 +56,21 @@
return identifier;
}
- public OMElement getOMElement() throws OMException {
- identifierElement.setText(identifier);
- return identifierElement;
+ public String getNamespaceValue() throws OMException {
+ return namespaceValue;
}
public Object fromOMElement(OMElement element) throws OMException {
+ OMFactory factory = element.getOMFactory();
+ if (factory==null)
+ factory = defaultFactory;
+
OMElement identifierPart = element.getFirstChildWithName(new QName(
namespaceValue, Sandesha2Constants.WSRM_COMMON.IDENTIFIER));
if (identifierPart == null)
- throw new OMException(
- "The parsed element does not contain an identifier part");
- identifierElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.IDENTIFIER, wsrmNamespace);
-
+ throw new OMException("The parsed element does not contain an identifier part");
+
String identifierText = identifierPart.getText();
if (identifierText == null || identifierText == "")
throw new OMException("The identifier value is not valid");
@@ -87,12 +84,16 @@
if (identifier == null || identifier == "") {
throw new OMException("identifier is not set .. ");
}
+
+ OMFactory factory = element.getOMFactory();
+ if (factory==null)
+ factory = defaultFactory;
+
+ 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);
-
- identifierElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.IDENTIFIER, wsrmNamespace);
return element;
}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/LastMessage.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/LastMessage.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/LastMessage.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/LastMessage.java Sat Apr 15 22:03:29 2006
@@ -20,6 +20,7 @@
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.SOAPFactory;
import org.apache.sandesha2.Sandesha2Constants;
@@ -33,63 +34,43 @@
public class LastMessage implements IOMRMElement {
- private OMElement lastMessageElement;
- OMNamespace rmNamespace = null;
- SOAPFactory factory;
- String namespaceValue = null;
+ private SOAPFactory defaultFactory;
+
+ private String namespaceValue = null;
public LastMessage(SOAPFactory factory,String namespaceValue) throws SandeshaException {
if (!isNamespaceSupported(namespaceValue))
throw new SandeshaException ("Unsupported namespace");
- this.factory = factory;
+ this.defaultFactory = factory;
this.namespaceValue = namespaceValue;
- rmNamespace = factory.createOMNamespace(
- namespaceValue, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
- lastMessageElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.LAST_MSG, rmNamespace);
}
- public OMElement getOMElement() throws OMException {
- return lastMessageElement;
+ 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(
- "The passed element does not contain a Last Message part");
-
- lastMessageElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.LAST_MSG, rmNamespace);
+ throw new OMException("The passed element does not contain a Last Message part");
return this;
}
public OMElement toOMElement(OMElement sequenceElement) throws OMException {
- //soapheaderblock element will be given
- if (lastMessageElement == null)
- throw new OMException("Cant set last message element. It is null");
- sequenceElement.addChild(lastMessageElement);
-
- lastMessageElement = factory.createOMElement(
+ OMFactory factory = sequenceElement.getOMFactory();
+ if (factory==null)
+ factory = defaultFactory;
+
+ 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 void setLastMessageElement(OMElement lastMsgElement) {
- lastMessageElement = lastMsgElement;
- }
-
- public OMElement getLastMessageElement() {
- return lastMessageElement;
- }
-
- public boolean isPresent() {
- return (lastMessageElement != null) ? true : false;
}
public boolean isNamespaceSupported (String namespaceName) {
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/MessageNumber.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/MessageNumber.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/MessageNumber.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/MessageNumber.java Sat Apr 15 22:03:29 2006
@@ -20,6 +20,7 @@
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.SOAPFactory;
import org.apache.sandesha2.Sandesha2Constants;
@@ -34,19 +35,17 @@
public class MessageNumber implements IOMRMElement {
private long messageNumber;
- private OMElement messageNoElement;
- OMNamespace rmNamespace = null;
- SOAPFactory factory;
- String namespaceValue = null;
- public MessageNumber(SOAPFactory factory,String namespaceValue) throws SandeshaException {
+ private OMFactory defaultFactory;
+
+ private String namespaceValue = null;
+
+ public MessageNumber(OMFactory factory,String namespaceValue) throws SandeshaException {
if (!isNamespaceSupported(namespaceValue))
throw new SandeshaException ("Unsupported namespace");
- this.factory = factory;
+ this.defaultFactory = factory;
this.namespaceValue = namespaceValue;
- rmNamespace = factory.createOMNamespace(namespaceValue, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
- messageNoElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.MSG_NUMBER,rmNamespace);
}
public long getMessageNumber(){
@@ -62,8 +61,6 @@
if (msgNumberPart==null)
throw new OMException ("The passed sequnce element does not contain a message number part");
- messageNoElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.MSG_NUMBER,rmNamespace);
-
String msgNoStr = msgNumberPart.getText();
messageNumber = Long.parseLong(msgNoStr);
return this;
@@ -74,20 +71,20 @@
throw new OMException("Set A Valid Message Number");
}
+ OMFactory factory = element.getOMFactory();
+ if (factory==null)
+ factory = defaultFactory;
+
+ 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);
- messageNoElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.MSG_NUMBER,rmNamespace);
-
return element;
}
- public OMElement getOMElement() throws OMException {
- return messageNoElement;
- }
-
- public OMElement getMessageNumberElement(){
- return messageNoElement;
+ public String getNamespaceValue() throws OMException {
+ return namespaceValue;
}
public boolean isNamespaceSupported (String namespaceName) {
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Nack.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Nack.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Nack.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Nack.java Sat Apr 15 22:03:29 2006
@@ -18,6 +18,7 @@
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.SOAPFactory;
import org.apache.sandesha2.Sandesha2Constants;
@@ -31,31 +32,26 @@
public class Nack implements IOMRMElement {
- private OMElement nackElement;
private long nackNumber;
- SOAPFactory factory;
- OMNamespace rmNamespace = null;
- String namespaceValue = null;
+
+ private SOAPFactory defaultFactory;
+
+ private String namespaceValue = null;
public Nack(SOAPFactory factory,String namespaceValue) throws SandeshaException {
if (!isNamespaceSupported(namespaceValue))
throw new SandeshaException ("Unsupported namespace");
- this.factory = factory;
+ this.defaultFactory = factory;
this.namespaceValue = namespaceValue;
- rmNamespace = factory.createOMNamespace(namespaceValue, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
- nackElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.NACK,rmNamespace);
}
- public OMElement getOMElement() throws OMException {
- return nackElement;
+ public String getNamespaceValue() {
+ return namespaceValue;
}
public Object fromOMElement(OMElement nackElement) throws OMException{
- /*OMElement nackPart = sequenceAckElement.getFirstChildWithName(
- new QName (Sandesha2Constants.WSRM.NS_URI_RM,Sandesha2Constants.WSRM.NACK));*/
if (nackElement==null)
throw new OMException ("Passed seq ack element does not contain a nack part");
@@ -66,9 +62,6 @@
throw new OMException ("Nack element does not contain a valid long value");
}
- nackElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.NACK,rmNamespace);
-
return this;
}
@@ -79,14 +72,14 @@
if (nackNumber<=0)
throw new OMException ("Cant set the nack part since the nack number does not have a valid value");
- if (nackElement==null)
- throw new OMException ("Cant set the nack part since the element is null");
+ OMFactory factory = sequenceAckElement.getOMFactory();
+ if (factory==null)
+ factory = defaultFactory;
+ 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);
-
- nackElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.NACK,rmNamespace);
return sequenceAckElement;
}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/RMElements.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/RMElements.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/RMElements.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/RMElements.java Sat Apr 15 22:03:29 2006
@@ -49,8 +49,8 @@
private CloseSequenceResponse closeSequenceResponse = null;
private AckRequested ackRequested = null;
private SOAPFactory factory = null;
- String rmNamespaceValue = null;
- String addressingNamespaceValue = null;
+ private String rmNamespaceValue = null;
+ private String addressingNamespaceValue = null;
public void fromSOAPEnvelope(SOAPEnvelope envelope, String action) throws SandeshaException {
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Sequence.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Sequence.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Sequence.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Sequence.java Sat Apr 15 22:03:29 2006
@@ -20,6 +20,7 @@
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;
@@ -36,29 +37,23 @@
public class Sequence implements IOMRMPart {
- private OMElement sequenceElement;
private Identifier identifier;
private MessageNumber messageNumber;
private LastMessage lastMessage = null;
- private SOAPFactory factory;
- OMNamespace seqNoNamespace = null;
+ private SOAPFactory defaultFactory;
private boolean mustUnderstand = true;
- String namespaceValue = null;
+ private String namespaceValue = null;
public Sequence(SOAPFactory factory,String namespaceValue) throws SandeshaException {
if (!isNamespaceSupported(namespaceValue))
throw new SandeshaException ("Unsupported namespace");
- this.factory = factory;
+ this.defaultFactory = factory;
this.namespaceValue = namespaceValue;
- seqNoNamespace = factory.createOMNamespace(
- namespaceValue, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
- sequenceElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.SEQUENCE, seqNoNamespace);
}
- public OMElement getOMElement() throws OMException {
- return sequenceElement;
+ public String getNamespaceValue() {
+ return namespaceValue;
}
public Object fromOMElement(OMElement headerElement) throws OMException,SandeshaException {
@@ -68,27 +63,21 @@
throw new OMException(
"Sequence element cannot be added to non-header element");
- OMElement sequencePart = sequenceElement = headerElement
- .getFirstChildWithName(new QName(namespaceValue,
+ OMElement sequencePart = headerElement.getFirstChildWithName(new QName(namespaceValue,
Sandesha2Constants.WSRM_COMMON.SEQUENCE));
if (sequencePart == null)
- throw new OMException(
- "Cannot find Sequence element in the given element");
+ throw new OMException("Cannot find Sequence element in the given element");
- sequenceElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.SEQUENCE, seqNoNamespace);
-
- identifier = new Identifier(factory,namespaceValue);
- messageNumber = new MessageNumber(factory,namespaceValue);
+ identifier = new Identifier(defaultFactory,namespaceValue);
+ messageNumber = new MessageNumber(defaultFactory,namespaceValue);
identifier.fromOMElement(sequencePart);
messageNumber.fromOMElement(sequencePart);
OMElement lastMessageElement = sequencePart
- .getFirstChildWithName(new QName(namespaceValue,
- Sandesha2Constants.WSRM_COMMON.LAST_MSG));
+ .getFirstChildWithName(new QName(namespaceValue,Sandesha2Constants.WSRM_COMMON.LAST_MSG));
if (lastMessageElement != null) {
- lastMessage = new LastMessage(factory,namespaceValue);
+ lastMessage = new LastMessage(defaultFactory,namespaceValue);
lastMessage.fromOMElement(sequencePart);
}
@@ -98,42 +87,29 @@
public OMElement toOMElement(OMElement headerElement) throws OMException {
if (headerElement == null || !(headerElement instanceof SOAPHeader))
- throw new OMException(
- "Cant add Sequence Part to a non-header element");
+ throw new OMException("Cant add Sequence Part to a non-header element");
SOAPHeader soapHeader = (SOAPHeader) headerElement;
- if (soapHeader == null)
- throw new OMException(
- "cant add the sequence part to a non-header element");
- if (sequenceElement == null)
- throw new OMException(
- "cant add Sequence Part since Sequence is null");
+
if (identifier == null)
- throw new OMException(
- "Cant add Sequence part since identifier is null");
+ throw new OMException("Cant add Sequence part since identifier is null");
if (messageNumber == null)
- throw new OMException(
- "Cant add Sequence part since MessageNumber is null");
+ throw new OMException("Cant add Sequence part since MessageNumber is null");
+ OMFactory factory = headerElement.getOMFactory();
+ if (factory==null)
+ factory = defaultFactory;
+ OMNamespace rmNamespace = factory.createOMNamespace(
+ namespaceValue, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
SOAPHeaderBlock sequenceHeaderBlock = soapHeader.addHeaderBlock(
- Sandesha2Constants.WSRM_COMMON.SEQUENCE, seqNoNamespace);
- //soapHeader.addChild(sequenceHeaderBlock);
- //OMElement elem1 = factory.createOMElement("test","http://test1","test2");
- //soapHeader.addChild(elem1)
-
+ Sandesha2Constants.WSRM_COMMON.SEQUENCE, rmNamespace);
sequenceHeaderBlock.setMustUnderstand(isMustUnderstand());
identifier.toOMElement(sequenceHeaderBlock);
messageNumber.toOMElement(sequenceHeaderBlock);
if (lastMessage != null)
lastMessage.toOMElement(sequenceHeaderBlock);
-
-
- //resetting the element. So that subsequest toOMElement calls will
- // attach a different object.
- this.sequenceElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.SEQUENCE, seqNoNamespace);
return headerElement;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org