1 17 18 package org.apache.sandesha.ws.rm; 19 20 import org.apache.axis.message.MessageElement; 21 import org.apache.sandesha.Constants; 22 23 import javax.xml.soap.SOAPElement ; 24 import javax.xml.soap.SOAPException ; 25 26 33 public class AcknowledgementRange implements IRmElement { 34 35 38 private MessageElement ackRangeElement; 39 40 43 private long minValue; 44 45 48 private long maxValue; 49 50 53 public AcknowledgementRange() { 54 ackRangeElement = new MessageElement(); 55 ackRangeElement.setName(Constants.WSRM.NS_PREFIX_RM + Constants.COLON + Constants.WSRM.ACK_RANGE); 56 } 57 58 63 public void setMaxValue(long max) { 64 maxValue = max; 65 } 66 67 72 public void setMinValue(long min) { 73 minValue = min; 74 } 75 76 81 82 87 public MessageElement getSoapElement() { 88 89 ackRangeElement.setAttribute(Constants.WSRM.UPPER, new Long (maxValue).toString()); 90 ackRangeElement.setAttribute(Constants.WSRM.LOWER, new Long (minValue).toString()); 91 92 return ackRangeElement; 93 } 94 95 102 public MessageElement toSOAPEnvelope(MessageElement msgElement) 103 throws SOAPException { 104 105 SOAPElement ackRange = msgElement.addChildElement(Constants.WSRM.ACK_RANGE, Constants.WSRM.NS_PREFIX_RM); 106 107 ackRange.setAttribute(Constants.WSRM.UPPER, new Long (maxValue).toString()); 108 ackRange.setAttribute(Constants.WSRM.LOWER, new Long (minValue).toString()); 109 110 return msgElement; 111 } 112 113 119 public AcknowledgementRange fromSOAPEnvelope(MessageElement element) { 120 121 minValue = (new Long (element.getAttribute(Constants.WSRM.LOWER).trim())).longValue(); 122 maxValue = (new Long (element.getAttribute(Constants.WSRM.UPPER).trim())).longValue(); 123 124 return this; 125 } 126 127 128 133 public void addChildElement(MessageElement element) { 134 } 135 136 141 public long getMaxValue() { 142 return maxValue; 143 } 144 145 150 public long getMinValue() { 151 return minValue; 152 } 153 } | Popular Tags |