KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > mobilitools > smi > goodies > BasicMobileObject


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.goodies;
29
30
31 import org.objectweb.mobilitools.smi.api.*;
32 import org.objectweb.mobilitools.smi.api.Agency;
33 import org.omg.CORBA.Any JavaDoc;
34 import org.omg.CfMAF.*;
35
36
37 /**
38  * MobiliTools $Name: $, $Id: BasicMobileObject.java,v 1.1.1.1 2003/03/28 14:48:06 dillense Exp $
39  * <P>
40  * Implementation of interface MobileObject, with (almost) empty methods, provided
41  * as a helper base class to implement mobile objects.
42  * Note the introduction of protected attribute <code>my_agency</code>, updated
43  * by implementation of methods <code>afterBirth()</code> and <code>afterMove()</code>.
44 */

45
46 public class BasicMobileObject implements MobileObject
47 {
48     /** reference to the hosting agent system */
49     protected transient Agency my_agency = null;
50
51
52     /**
53         Sets attribute my_agency to current host agency.
54     */

55     public void afterBirth(AgentSystem agency, AgentInfo entry, Object JavaDoc argument)
56         throws BadOperation
57     {
58         my_agency = (Agency)agency;
59     }
60
61
62     /**
63         Empty method.
64     */

65     public void beforeMove(Location location, String JavaDoc place)
66         throws BadOperation
67     {
68     }
69
70
71     /**
72         Sets attribute my_agency to new host agency.
73     */

74     public void afterMove(AgentSystem agency, Location location, String JavaDoc place)
75         throws BadOperation
76     {
77         my_agency = (Agency)agency;
78     }
79
80
81     /**
82         Empty method.
83         @see MobileObject
84     */

85     public void afterMoveFailed(
86         Location location,
87         String JavaDoc place,
88         int reason,
89         String JavaDoc message)
90     {
91     }
92
93
94     /**
95         Empty method.
96     */

97     public void beforeDeath()
98     {
99     }
100
101
102     /**
103         Empty method.
104     */

105     public void beforeSuspend()
106         throws BadOperation
107     {
108     }
109
110
111     /**
112         Empty method.
113     */

114     public void beforeResume()
115         throws BadOperation
116     {
117     }
118
119
120     /**
121         Empty method.
122     */

123     public void beforeShutdown()
124     {
125     }
126 }
127
Popular Tags