1 17 18 package org.apache.sandesha.ws.rm; 19 20 import org.apache.axis.AxisFault; 21 import org.apache.axis.message.MessageElement; 22 import org.apache.sandesha.Constants; 23 24 import javax.xml.namespace.QName ; 25 import javax.xml.soap.SOAPException ; 26 27 34 public class MessageNumber implements IRmElement { 35 36 39 private long messageNumber; 40 41 44 private MessageElement messageNoElement; 45 46 49 public MessageNumber() { 50 51 messageNoElement = new MessageElement(); 52 53 messageNoElement.setName(Constants.WSRM.NS_PREFIX_RM + Constants.COLON + Constants.WSRM.MSG_NUMBER); 54 } 55 56 61 public long getMessageNumber() { 62 return messageNumber; 63 } 64 65 71 public MessageElement getSoapElement() throws SOAPException { 72 73 messageNoElement.addTextNode((new Long (messageNumber)).toString()); 75 return messageNoElement; 76 } 77 78 84 public MessageNumber fromSOAPEnvelope(MessageElement element) throws AxisFault { 85 86 double tempMsgNo = (new Double (element.getValue())).doubleValue(); 87 if (tempMsgNo >= Constants.WSRM.MAX_MSG_NO) 88 throw new AxisFault(new QName (Constants.FaultCodes.WSRM_FAULT_MSG_NO_ROLLOVER), 89 Constants.FaultMessages.MSG_NO_ROLLOVER, null, null); 90 91 messageNumber = (new Long (element.getValue())).longValue(); 92 return this; 93 } 94 95 102 public MessageElement toSOAPEnvelope(MessageElement msgElement) throws SOAPException { 103 104 msgElement.addChildElement(Constants.WSRM.MSG_NUMBER, Constants.WSRM.NS_PREFIX_RM) 105 .addTextNode((new Long (messageNumber)).toString()); 106 107 return msgElement; 108 } 109 110 116 public void setMessageNumber(long msgNo) { 117 messageNumber = msgNo; 118 } 119 120 121 126 public void addChildElement(MessageElement element) { 127 } 128 } | Popular Tags |