You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by ch...@apache.org on 2006/04/16 07:03:31 UTC
svn commit: r394435 [2/2] - in
/webservices/sandesha/trunk/src/org/apache/sandesha2: client/ util/ wsrm/
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceAcknowledgement.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceAcknowledgement.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceAcknowledgement.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceAcknowledgement.java Sat Apr 15 22:03:29 2006
@@ -24,6 +24,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;
@@ -43,13 +44,11 @@
public class SequenceAcknowledgement implements IOMRMPart {
- private OMElement sequenceAcknowledgementElement;
private Identifier identifier;
private ArrayList acknowledgementRangeList;
private ArrayList nackList;
- OMNamespace rmNamespace = null;
- SOAPFactory factory;
- String namespaceValue = null;
+ private SOAPFactory defaultFactory;
+ private String namespaceValue = null;
private boolean mustUnderstand = false;
private AckNone ackNone = null;
private AckFinal ackFinal = null;
@@ -59,34 +58,32 @@
throw new SandeshaException ("Unsupported namespace");
this.namespaceValue = namespaceValue;
- this.factory = factory;
- rmNamespace = factory.createOMNamespace(
- namespaceValue, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
- sequenceAcknowledgementElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.SEQUENCE_ACK, rmNamespace);
+ this.defaultFactory = factory;
acknowledgementRangeList = new ArrayList();
nackList = new ArrayList();
}
- public OMElement getOMElement() throws OMException {
- return sequenceAcknowledgementElement;
+ public String getNamespaceValue() {
+ return namespaceValue;
}
public Object fromOMElement(OMElement element) throws OMException,SandeshaException {
if (element == null || !(element instanceof SOAPHeader))
- throw new OMException(
- "Cant get sequence acknowlegement from a non-header element");
+ throw new OMException("Cant get sequence acknowlegement from a non-header element");
SOAPHeader header = (SOAPHeader) element;
OMElement sequenceAckPart = header.getFirstChildWithName(new QName(
namespaceValue, Sandesha2Constants.WSRM_COMMON.SEQUENCE_ACK));
if (sequenceAckPart == null)
- throw new OMException(
- "The passed element does not contain a seqence ackknowledgement Part");
+ throw new OMException("The passed element does not contain a seqence ackknowledgement Part");
- identifier = new Identifier(factory,namespaceValue);
+ OMFactory factory = element.getOMFactory();
+ if (factory==null)
+ factory = defaultFactory;
+
+ identifier = new Identifier(defaultFactory,namespaceValue);
identifier.fromOMElement(sequenceAckPart);
Iterator ackRangeParts = sequenceAckPart.getChildrenWithName(new QName(
@@ -95,7 +92,7 @@
while (ackRangeParts.hasNext()) {
OMElement ackRangePart = (OMElement) ackRangeParts.next();
- AcknowledgementRange ackRange = new AcknowledgementRange(factory,namespaceValue);
+ AcknowledgementRange ackRange = new AcknowledgementRange(defaultFactory,namespaceValue);
ackRange.fromOMElement(ackRangePart);
acknowledgementRangeList.add(ackRange);
}
@@ -105,7 +102,7 @@
while (nackParts.hasNext()) {
OMElement nackPart = (OMElement) nackParts.next();
- Nack nack = new Nack(factory,namespaceValue);
+ Nack nack = new Nack(defaultFactory,namespaceValue);
nack.fromOMElement(nackPart);
nackList.add(nack);
}
@@ -115,7 +112,7 @@
if (SpecSpecificConstants.isAckFinalAllowed(rmSpecVersion)) {
OMElement ackFinalPart = sequenceAckPart.getFirstChildWithName(new QName (namespaceValue,Sandesha2Constants.WSRM_COMMON.FINAL));
if (ackFinalPart!=null) {
- ackFinal = new AckFinal (factory,namespaceValue);
+ ackFinal = new AckFinal (defaultFactory,namespaceValue);
ackFinal.fromOMElement(sequenceAckPart);
}
}
@@ -123,15 +120,11 @@
if (SpecSpecificConstants.isAckNoneAllowed(rmSpecVersion)) {
OMElement ackNonePart = sequenceAckPart.getFirstChildWithName(new QName (namespaceValue,Sandesha2Constants.WSRM_COMMON.NONE));
if (ackNonePart!=null) {
- ackNone = new AckNone (factory,namespaceValue);
+ ackNone = new AckNone (defaultFactory,namespaceValue);
ackNone.fromOMElement(sequenceAckPart);
}
}
- sequenceAcknowledgementElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.SEQUENCE_ACK, rmNamespace);
-
-
return this;
}
@@ -140,14 +133,18 @@
if (header == null || !(header instanceof SOAPHeader))
throw new OMException();
+ OMFactory factory = header.getOMFactory();
+ if (factory==null)
+ factory = defaultFactory;
+
+ OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+
SOAPHeader SOAPHeader = (SOAPHeader) header;
-
SOAPHeaderBlock sequenceAcknowledgementHeaderBlock = SOAPHeader.addHeaderBlock(
Sandesha2Constants.WSRM_COMMON.SEQUENCE_ACK,rmNamespace);
if (sequenceAcknowledgementHeaderBlock == null)
- throw new OMException(
- "Cant set sequence acknowledgement since the element is null");
+ throw new OMException("Cant set sequence acknowledgement since the element is null");
if (identifier == null)
throw new OMException(
@@ -205,10 +202,6 @@
}
SOAPHeader.addChild(sequenceAcknowledgementHeaderBlock);
-
-
- sequenceAcknowledgementElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.SEQUENCE_ACK, rmNamespace);
return header;
}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceFault.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceFault.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceFault.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceFault.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.SOAPFactory;
@@ -36,26 +37,22 @@
public class SequenceFault implements IOMRMElement {
- private OMElement sequenceFaultElement;
private FaultCode faultCode;
- SOAPFactory factory;
- OMNamespace rmNamespace = null;
- String namespaceValue = null;
+
+ private SOAPFactory defaultFactory;
+
+ private String namespaceValue = null;
public SequenceFault(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);
- sequenceFaultElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.SEQUENCE_FAULT, rmNamespace);
}
- public OMElement getOMElement() throws OMException {
- return sequenceFaultElement;
+ public String getNamespaceValue() {
+ return namespaceValue;
}
public Object fromOMElement(OMElement body) throws OMException,SandeshaException {
@@ -68,43 +65,36 @@
namespaceValue, Sandesha2Constants.WSRM_COMMON.SEQUENCE_FAULT));
if (sequenceFaultPart == null)
- throw new OMException(
- "The passed element does not contain a Sequence Fault element");
+ throw new OMException("The passed element does not contain a Sequence Fault element");
OMElement faultCodePart = sequenceFaultPart
- .getFirstChildWithName(new QName(namespaceValue,
- Sandesha2Constants.WSRM_COMMON.FAULT_CODE));
+ .getFirstChildWithName(new QName(namespaceValue,Sandesha2Constants.WSRM_COMMON.FAULT_CODE));
if (faultCodePart != null) {
- faultCode = new FaultCode(factory,namespaceValue);
+ faultCode = new FaultCode(defaultFactory,namespaceValue);
faultCode.fromOMElement(sequenceFaultPart);
}
- sequenceFaultElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.SEQUENCE_FAULT, rmNamespace);
-
return this;
-
}
public OMElement toOMElement(OMElement body) throws OMException {
if (body == null || !(body instanceof SOAPBody))
- throw new OMException(
- "Cant get Sequence Fault part from a non-header element");
-
- if (sequenceFaultElement == null)
- throw new OMException(
- "Cant add the sequnce fault since the internal element is null");
+ throw new OMException("Cant get Sequence Fault part from a non-header element");
+ OMFactory factory = body.getOMFactory();
+ if (factory==null)
+ factory = defaultFactory;
+
+ OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+ OMElement sequenceFaultElement =factory.createOMElement(
+ Sandesha2Constants.WSRM_COMMON.SEQUENCE_FAULT, rmNamespace);
if (faultCode != null)
faultCode.toOMElement(sequenceFaultElement);
body.addChild(sequenceFaultElement);
- sequenceFaultElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.SEQUENCE_FAULT, rmNamespace);
-
return body;
}
@@ -114,14 +104,6 @@
public FaultCode getFaultCode() {
return faultCode;
- }
-
- public void setSequenceFaultElement(OMElement sequenceFault) {
- sequenceFaultElement = sequenceFault;
- }
-
- public OMElement getSequenceFaultElement() {
- return sequenceFaultElement;
}
public boolean isNamespaceSupported (String namespaceName) {
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceOffer.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceOffer.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceOffer.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceOffer.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,50 +34,42 @@
public class SequenceOffer implements IOMRMElement {
- private OMElement sequenceOfferElement;
private Identifier identifier = null;
+
private Expires expires = null;
- SOAPFactory factory;
- OMNamespace rmNamespace = null;
- String namespaceValue = null;
+
+ private OMFactory defaultFactory;
+
+ private String namespaceValue = null;
- public SequenceOffer(SOAPFactory factory,String namespaceValue) throws SandeshaException {
+ public SequenceOffer(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);
- sequenceOfferElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.SEQUENCE_OFFER, rmNamespace);
}
- public OMElement getOMElement() throws OMException {
- return sequenceOfferElement;
+ public String getNamespaceValue() {
+ return namespaceValue;
}
public Object fromOMElement(OMElement createSequenceElement)
throws OMException,SandeshaException {
+
OMElement sequenceOfferPart = createSequenceElement
- .getFirstChildWithName(new QName(namespaceValue,
- Sandesha2Constants.WSRM_COMMON.SEQUENCE_OFFER));
+ .getFirstChildWithName(new QName(namespaceValue,Sandesha2Constants.WSRM_COMMON.SEQUENCE_OFFER));
if (sequenceOfferPart == null)
- throw new OMException(
- "The passed element does not contain a SequenceOffer part");
-
- sequenceOfferElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.SEQUENCE_OFFER, rmNamespace);
+ throw new OMException("The passed element does not contain a SequenceOffer part");
- identifier = new Identifier(factory,namespaceValue);
+ identifier = new Identifier(defaultFactory,namespaceValue);
identifier.fromOMElement(sequenceOfferPart);
OMElement expiresPart = sequenceOfferPart
- .getFirstChildWithName(new QName(namespaceValue,
- Sandesha2Constants.WSRM_COMMON.EXPIRES));
+ .getFirstChildWithName(new QName(namespaceValue,Sandesha2Constants.WSRM_COMMON.EXPIRES));
if (expiresPart != null) {
- expires = new Expires(factory,namespaceValue);
- expires.fromOMElement(sequenceOfferElement);
+ expires = new Expires(defaultFactory,namespaceValue);
+ expires.fromOMElement(sequenceOfferPart);
}
return this;
@@ -84,13 +77,17 @@
public OMElement toOMElement(OMElement createSequenceElement)
throws OMException {
- if (sequenceOfferElement == null)
- throw new OMException(
- "Cant set sequnceoffer. Offer element is null");
+
if (identifier == null)
- throw new OMException(
- "Cant set sequnceOffer since identifier is null");
+ throw new OMException("Cant set sequnceOffer since identifier is null");
+ OMFactory factory = createSequenceElement.getOMFactory();
+ if (factory==null)
+ factory = defaultFactory;
+
+ OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+ OMElement sequenceOfferElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.SEQUENCE_OFFER, rmNamespace);
+
identifier.toOMElement(sequenceOfferElement);
if (expires != null) {
@@ -98,9 +95,6 @@
}
createSequenceElement.addChild(sequenceOfferElement);
-
- sequenceOfferElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.SEQUENCE_OFFER, rmNamespace);
return createSequenceElement;
}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/TerminateSequence.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/TerminateSequence.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/TerminateSequence.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/TerminateSequence.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,69 +38,59 @@
public class TerminateSequence implements IOMRMPart {
- private OMElement terminateSequenceElement;
private Identifier identifier;
- OMNamespace rmNameSpace = null;
- SOAPFactory factory;
- String namespaceValue = null;
+
+ private SOAPFactory defaultFactory;
+
+ private String namespaceValue = null;
public TerminateSequence(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);
- terminateSequenceElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.TERMINATE_SEQUENCE, rmNameSpace);
}
- public OMElement getOMElement() throws OMException {
- return terminateSequenceElement;
+ public String getNamespaceValue() {
+ return namespaceValue;
}
public Object fromOMElement(OMElement body) throws OMException,SandeshaException {
if (!(body instanceof SOAPBody))
- throw new OMException(
- "Cant add terminate sequence to a non body element");
+ throw new OMException("Cant add terminate sequence to a non body element");
OMElement terminateSeqPart = body.getFirstChildWithName(new QName(
namespaceValue, Sandesha2Constants.WSRM_COMMON.TERMINATE_SEQUENCE));
if (terminateSeqPart == null)
- throw new OMException(
- "passed element does not contain a terminate sequence part");
+ throw new OMException("passed element does not contain a terminate sequence part");
- identifier = new Identifier(factory,namespaceValue);
+ identifier = new Identifier(defaultFactory,namespaceValue);
identifier.fromOMElement(terminateSeqPart);
- terminateSequenceElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.TERMINATE_SEQUENCE, rmNameSpace);
-
return this;
}
public OMElement toOMElement(OMElement body) throws OMException {
if (body == null || !(body instanceof SOAPBody))
- throw new OMException(
- "Cant add terminate sequence to a nonbody element");
-
- if (terminateSequenceElement == null)
- throw new OMException(
- "Cant add terminate sequnce since the internal element is null");
+ throw new OMException("Cant add terminate sequence to a nonbody element");
if (identifier == null)
- throw new OMException(
- "Cant add terminate sequence since identifier is not set");
+ throw new OMException("Cant add terminate 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 terminateSequenceElement = factory.createOMElement(
+ Sandesha2Constants.WSRM_COMMON.TERMINATE_SEQUENCE, rmNamespace);
+
identifier.toOMElement(terminateSequenceElement);
body.addChild(terminateSequenceElement);
-
- terminateSequenceElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.TERMINATE_SEQUENCE, rmNameSpace);
return body;
}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/TerminateSequenceResponse.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/TerminateSequenceResponse.java?rev=394435&r1=394434&r2=394435&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/TerminateSequenceResponse.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/TerminateSequenceResponse.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,27 +37,23 @@
public class TerminateSequenceResponse implements IOMRMPart {
- private OMElement terminateSequenceResponseElement;
private Identifier identifier;
- OMNamespace rmNameSpace = null;
- SOAPFactory factory;
- String namespaceValue = null;
+
+ private SOAPFactory defaultFactory;
+
+ private String namespaceValue = null;
public TerminateSequenceResponse(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);
- terminateSequenceResponseElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.TERMINATE_SEQUENCE_RESPONSE, rmNameSpace);
}
- public OMElement getOMElement() throws OMException {
- return terminateSequenceResponseElement;
+ public String getNamespaceValue() {
+ return namespaceValue;
}
public Object fromOMElement(OMElement body) throws OMException,SandeshaException {
@@ -72,34 +69,30 @@
throw new OMException(
"passed element does not contain a terminate sequence response part");
- identifier = new Identifier(factory,namespaceValue);
+ identifier = new Identifier(defaultFactory,namespaceValue);
identifier.fromOMElement(terminateSeqResponsePart);
- terminateSequenceResponseElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.TERMINATE_SEQUENCE_RESPONSE, rmNameSpace);
-
return this;
}
public OMElement toOMElement(OMElement body) throws OMException {
if (body == null || !(body instanceof SOAPBody))
- throw new OMException(
- "Cant add terminate sequence response to a nonbody element");
-
- if (terminateSequenceResponseElement == null)
- throw new OMException(
- "Cant add terminate sequnce response since the internal element is null");
+ throw new OMException("Cant add terminate sequence response to a nonbody element");
if (identifier == null)
- throw new OMException(
- "Cant add terminate sequence response since identifier is not set");
+ throw new OMException("Cant add terminate 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 terminateSequenceResponseElement = factory.createOMElement(
+ Sandesha2Constants.WSRM_COMMON.TERMINATE_SEQUENCE_RESPONSE, rmNamespace);
+
identifier.toOMElement(terminateSequenceResponseElement);
body.addChild(terminateSequenceResponseElement);
-
- terminateSequenceResponseElement = factory.createOMElement(
- Sandesha2Constants.WSRM_COMMON.TERMINATE_SEQUENCE_RESPONSE, rmNameSpace);
return body;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org