KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > dream > message > Message


1 /**
2  * Dream
3  * Copyright (C) 2003-2004 INRIA Rhone-Alpes
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Contact : dream@objectweb.org
20  *
21  * Initial developer(s): Matthieu Leclercq
22  * Contributor(s): Vivien Quema
23  */

24
25 package org.objectweb.dream.message;
26
27 import java.util.Iterator JavaDoc;
28
29 import org.objectweb.dream.pool.Recyclable;
30
31 /**
32  * Base interface of every messages manipulated by Dream components. A message
33  * is composed of named chunks and a list of sub messages. More precisely, A
34  * <code>Message</code> is a <i>naming context </i> for its chunks. This means
35  * that a message can not have two chunks with the same name. In addition a
36  * message can have two chunks with the same type since they have different
37  * names.
38  *
39  * @see org.objectweb.dream.message.Chunk
40  * @see org.objectweb.dream.message.MessageType
41  */

42 public interface Message extends Recyclable
43 {
44
45   /**
46    * An empty <code>Message</code> array constant. This constant should be
47    * used by classes requiring an empty <code>Message</code> array.
48    */

49   Message[] EMPTY_MESSAGE_ARRAY = new Message[0];
50
51   /**
52    * Returns the id of the message manager that created this message.
53    *
54    * @return the id of the message manager that created this message.
55    */

56   short getMessageManagerId();
57
58   /**
59    * Sets the id of the message manager that created this message.
60    *
61    * @param id the id of the message manager that created this message.
62    */

63   void setMessageManagerId(short id);
64
65   /**
66    * Returns a chunk of this message, or <code>null</code> if this message
67    * doesn't have a chunk with the specified name.
68    *
69    * @param name the name of the chunk, as specified in the message type.
70    * @return a chunk of this message.
71    */

72   Object JavaDoc getChunk(String JavaDoc name);
73
74   /**
75    * Returns an <code>Iterator</code> that iterate over the sub messages of
76    * this message.
77    *
78    * @return an iterator on the sub messages.
79    */

80   Iterator JavaDoc getSubMessageIterator();
81
82   /**
83    * Returns an (eventually empty) array containing the sub messages of this
84    * message.
85    *
86    * @return an array containing the sub messages of this message.
87    */

88   Message[] getSubMessages();
89
90   /**
91    * Returns the type of this message.
92    *
93    * @return the type of this message.
94    */

95   MessageType getMessageType();
96
97   /**
98    * Transferts the state of the message's chunks into the specified new
99    * instance.
100    * <p>
101    * <i>Note: </i> the given new isntance contains all the chunks contained in
102    * this message.
103    *
104    * @param newInstance the new instance of message.
105    */

106   void transfertChunkStates(Message newInstance);
107 }
Popular Tags