View Javadoc

1   /*
2    * Copyright  1999-2004 The Apache Software Foundation.
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   *
16   */
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.SOAPException;
24  
25  /***
26   * class LastMessage
27   *
28   * @author Amila Navarathna
29   * @author Jaliya Ekanayaka
30   * @author Sudar Nimalan
31   */
32  public class LastMessage extends MessageElement implements IRmElement {
33  
34      /***
35       * Field lastMsgElement
36       */
37      private MessageElement lastMsgElement;
38  
39      /***
40       * Constructor LastMessage
41       */
42      public LastMessage() {
43          lastMsgElement = new MessageElement();
44  
45          lastMsgElement.setName(Constants.WSRM.NS_PREFIX_RM + Constants.COLON +
46                  Constants.WSRM.LAST_MSG);
47      }
48  
49      /***
50       * Method getSoapElement
51       *
52       * @return MessageElement
53       */
54      public MessageElement getSoapElement() {
55          return lastMsgElement;
56      }
57  
58      /***
59       * Method fromSOAPEnvelope
60       *
61       * @param element
62       * @return LastMessage
63       */
64      public LastMessage fromSOAPEnvelope(MessageElement element) {
65          return this;
66      }
67  
68      /***
69       * Method toSOAPEnvelope
70       *
71       * @param msgElement
72       * @return MessageElement
73       * @throws SOAPException
74       */
75      public MessageElement toSOAPEnvelope(MessageElement msgElement) throws SOAPException {
76          msgElement.addChildElement(Constants.WSRM.LAST_MSG, Constants.WSRM.NS_PREFIX_RM);
77          return msgElement;
78      }
79  
80      /***
81       * Method addChildElement
82       *
83       * @param element
84       */
85      public void addChildElement(MessageElement element) {
86  
87          // no child elements in LastMessage element
88      }
89  
90      /***
91       * Method getLastMsgElement
92       *
93       * @return MessageElement
94       */
95      public MessageElement getLastMsgElement() {
96          return lastMsgElement;
97      }
98  
99      /***
100      * Method setLastMsgElement
101      *
102      * @param element
103      */
104     public void setLastMsgElement(MessageElement element) {
105         lastMsgElement = element;
106     }
107 }