View Javadoc

1   package org.codehaus.xfire.service;
2   
3   import java.util.Iterator;
4   
5   import javax.xml.namespace.QName;
6   
7   
8   /***
9    * Represents the description of a service operation message.
10   * <p/>
11   * Messages are created using the {@link OperationInfo#createMessage} method.
12   *
13   * @author <a href="mailto:poutsma@mac.com">Arjen Poutsma</a>
14   */
15  public class MessageInfo
16          extends MessagePartContainer
17          implements Visitable
18  {
19      private QName name;
20  
21      /***
22       * Initializes a new instance of the <code>MessageInfo</code> class with the given qualified name and operation.
23       *
24       * @param name      the name.
25       * @param operation the operation.
26       */
27      MessageInfo(QName name, OperationInfo operation)
28      {
29          super(operation);
30          this.name = name;
31      }
32  
33      /***
34       * Returns the qualified name of the message info.
35       *
36       * @return the name.
37       */
38      public QName getName()
39      {
40          return name;
41      }
42  
43      /***
44       * Sets the qualified name of the message info.
45       *
46       * @param name the qualified name.
47       */
48      public void setName(QName name)
49      {
50          this.name = name;
51      }
52  
53      /***
54       * Acceps the given visitor. Iterates over all message part infos.
55       *
56       * @param visitor the visitor.
57       */
58      public void accept(Visitor visitor)
59      {
60          visitor.startMessage(this);
61          for (Iterator iterator = getMessageHeaders().iterator(); iterator.hasNext();)
62          {
63              MessageHeaderInfo messageHeaderInfo = (MessageHeaderInfo) iterator.next();
64              messageHeaderInfo.accept(visitor);
65          }
66          for (Iterator iterator = getMessageParts().iterator(); iterator.hasNext();)
67          {
68              MessagePartInfo messagePartInfo = (MessagePartInfo) iterator.next();
69              messagePartInfo.accept(visitor);
70          }
71          visitor.endMessage(this);
72      }
73  }