KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > fr > dyade > aaa > agent > MessageConsumer


1 /*
2  * Copyright (C) 2001 - 2003 ScalAgent Distributed Technologies
3  * Copyright (C) 1996 - 2000 BULL
4  * Copyright (C) 1996 - 2000 INRIA
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA.
20  */

21 package fr.dyade.aaa.agent;
22
23 import java.io.IOException JavaDoc;
24 /**
25  * The parent interface for all messages consumers.
26  *
27  * @see Engine, Network.
28  */

29 public interface MessageConsumer {
30   /**
31    * Returns this <code>MessageConsumer</code>'s name.
32    *
33    * @return this <code>MessageConsumer</code>'s name.
34    */

35   String JavaDoc getName();
36
37   /**
38    * Returns the corresponding domain's name.
39    *
40    * @return this domain's name.
41    */

42   String JavaDoc getDomainName();
43
44   /**
45    * Insert a message in the <code>MessageQueue</code>.
46    * This method is used during initialisation to restore the component
47    * state from persistent storage.
48    *
49    * @param msg the message
50    */

51   void insert(Message msg);
52
53   /**
54    * Saves logical clock information to persistent storage.
55    */

56   void save() throws IOException JavaDoc;
57
58   /**
59    * Restores logical clock information from persistent storage.
60    */

61   void restore() throws Exception JavaDoc;
62
63   /**
64    * Adds a message in "ready to deliver" list. This method allocates a
65    * new time stamp to the message ; be Careful, changing the stamp imply
66    * the filename change too.
67    */

68   void post(Message msg) throws Exception JavaDoc;
69
70   /**
71    * Validates all messages pushed in queue during transaction session.
72    */

73   void validate();
74
75   /**
76    * Causes this component to begin execution.
77    *
78    * @see stop
79    */

80   void start() throws Exception JavaDoc;
81
82   /**
83    * Forces the component to stop executing.
84    *
85    * @see start
86    */

87   void stop();
88
89   /**
90    * Deletes the component, removes all persistent datas. The component
91    * may have been previously stopped, and removed from MessageConsumer
92    * list.
93    * This operation use Transaction calls, you may use commit to validate it.
94    *
95    * @see fr.dyade.aaa.util.Transaction
96    */

97   void delete() throws IllegalStateException JavaDoc;
98
99   /**
100    * Get this consumer's <code>MessageQueue</code>. Use in administration and
101    * debug tasks, should be replaced by a common attribute.
102    *
103    * @return this <code>MessageConsumer</code>'s queue.
104    */

105   MessageQueue getQueue();
106
107   /**
108    * Tests if the component is alive. A <code>MessageConsumer</code> is alive
109    * if it has been started and has not yet stopped.
110    *
111    * @return true if this <code>MessageConsumer</code> is alive; false
112    * otherwise.
113    */

114   boolean isRunning();
115 }
116
Popular Tags