KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > mobilitools > smi > api > MobileObject


1 /*
2 * MobiliTools: an implementation of the Object Management Group's
3 * Mobile Agent Facility specification.
4 * Copyright (C) 2003 France Telecom R&D
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 of the License, or (at your option) 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 USA
19 *
20 * MobiliTools $Name: $
21 *
22 * Contact: mobilitools-smi@lists.debian-sf.objectweb.org
23 *
24 * Authors: Bruno Dillenseger
25 */

26
27
28 package org.objectweb.mobilitools.smi.api;
29
30
31 import java.io.Serializable JavaDoc;
32 import org.omg.CORBA.Any JavaDoc;
33 import org.omg.CfMAF.*;
34
35
36 /**
37  * MobiliTools $Name: $, $Id: MobileObject.java,v 1.1.1.1 2003/03/28 14:48:06 dillense Exp $
38  * <P>
39  * This interface must be implemented by any agent class in order
40  * to be managed by the SMI framework.
41 */

42 public interface MobileObject extends Serializable JavaDoc
43 {
44     /**
45         Called on agent creation.
46         @param agency reference to the hosting agency.
47         @param entry a structure of information about the newly created agent.
48         @param arguments arguments for agent initialization.
49         @throws BadOperation shall be thrown if the agent refuses to settle.
50         Identifier BadOperation.REJECTED must be set for this exception.
51         Note that the agent creation is canceled,
52         and that <code>beforeDeath()</code> is not called.
53     */

54     public void afterBirth(AgentSystem agency, AgentInfo entry, Object JavaDoc arguments)
55         throws BadOperation;
56
57     /**
58         Called before before moving.
59         @param location location of destination agency
60         @param place name of target place
61         @throws BadOperation thrown to reject the move.
62         Identifier BadOperation.REJECTED must be set for this exception.
63         The agent move is simply canceled and the thrown exception is
64         re-thrown by <code>moveAgent()</code> (note that <code>afterMoveFailed()</code>
65         is not called).
66     */

67     public void beforeMove(Location location, String JavaDoc place)
68         throws BadOperation;
69
70     /**
71         Called on reinstalling in the target agency after a move.
72         @param agency reference to the new hosting agency
73         @param location location of new hosting agency
74         @param place the name of the new residing place
75         @throws BadOperation thrown if the agent can not be
76         correctly reinstalled in the new agency.
77         Identifier BadOperation.REJECTED must be set for this exception.
78         The agent stays in the source agency, <code>afterMoveFailed()</code> is invoked,
79         and <code>moveAgent()</code> throws an exception.
80     */

81     public void afterMove(AgentSystem agency, Location location, String JavaDoc place)
82         throws BadOperation;
83
84     /**
85         Called on move failure. (note that throwing an exception in
86         <code>beforeMove()</code> does not result in
87         <code>afterMoveFailed()</code> being called)
88         @param agency location of the target agency
89         @param place the target place name
90         @param reason problem identifier
91         @param message textual explanation
92     */

93     public void afterMoveFailed(
94         Location agency,
95         String JavaDoc place,
96         int reason,
97         String JavaDoc message);
98
99     /**
100         Called before discarding the agent.
101         (note that an exception in <code>afterBirth()</code> does not
102         result in <code>beforeDeath()</code> being called)
103     */

104     public void beforeDeath();
105
106     /**
107         Called to suspend the agent activity (if any).
108         @throws BadOperation the agent activity was already suspended, or could not be suspended.
109         Identifier BadOperation.REJECTED must be set for this exception. SMI core detects
110         whether the agent is already suspended or not, and throws the corresponding exception if
111         necessary, without invoking this callback.
112     */

113     public void beforeSuspend()
114         throws BadOperation;
115
116     /**
117         Called to resume the agent activity (if any).
118         @throws BadOperation the agent activity was already running, or could not be resumed.
119         Identifier BadOperation.REJECTED must be set for this exception. SMI core detects
120         whether the agent is already running or not, and throws the corresponding exception if
121         necessary, without invoking this callback.
122     */

123     public void beforeResume()
124         throws BadOperation;
125
126     /**
127         Called before the agent's hosting agency shutdown.
128         If the agent is still residing in the shutting agency
129         after this callback, it is terminated and callback
130         beforeDeath() is invoked (an agent can't survive the
131         shutdown of its hosting agency).
132     */

133     public void beforeShutdown();
134 }
135
Popular Tags