|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.objectweb.mobilitools.smi.goodies.BasicMobileObject
MobiliTools $Name: $, $Id: BasicMobileObject.java,v 1.1.1.1 2003/03/28 14:48:06 dillense Exp $
Implementation of interface MobileObject, with (almost) empty methods, provided
as a helper base class to implement mobile objects.
Note the introduction of protected attribute my_agency
, updated
by implementation of methods afterBirth()
and afterMove()
.
Field Summary | |
protected Agency |
my_agency
reference to the hosting agent system |
Constructor Summary | |
BasicMobileObject()
|
Method Summary | |
void |
afterBirth(AgentSystem agency,
AgentInfo entry,
java.lang.Object argument)
Sets attribute my_agency to current host agency. |
void |
afterMove(AgentSystem agency,
Location location,
java.lang.String place)
Sets attribute my_agency to new host agency. |
void |
afterMoveFailed(Location location,
java.lang.String place,
int reason,
java.lang.String message)
Empty method. |
void |
beforeDeath()
Empty method. |
void |
beforeMove(Location location,
java.lang.String place)
Empty method. |
void |
beforeResume()
Empty method. |
void |
beforeShutdown()
Empty method. |
void |
beforeSuspend()
Empty method. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected transient Agency my_agency
Constructor Detail |
public BasicMobileObject()
Method Detail |
public void afterBirth(AgentSystem agency, AgentInfo entry, java.lang.Object argument) throws BadOperation
afterBirth
in interface MobileObject
org.objectweb.mobilitools.smi.api.MobileObject
agency
- reference to the hosting agency.entry
- a structure of information about the newly created agent.arguments
- arguments for agent initialization.BadOperation
- shall be thrown if the agent refuses to settle.
Identifier BadOperation.REJECTED must be set for this exception.
Note that the agent creation is canceled,
and that beforeDeath()
is not called.public void beforeMove(Location location, java.lang.String place) throws BadOperation
beforeMove
in interface MobileObject
org.objectweb.mobilitools.smi.api.MobileObject
location
- location of destination agencyplace
- name of target placeBadOperation
- thrown to reject the move.
Identifier BadOperation.REJECTED must be set for this exception.
The agent move is simply canceled and the thrown exception is
re-thrown by moveAgent()
(note that afterMoveFailed()
is not called).public void afterMove(AgentSystem agency, Location location, java.lang.String place) throws BadOperation
afterMove
in interface MobileObject
org.objectweb.mobilitools.smi.api.MobileObject
agency
- reference to the new hosting agencylocation
- location of new hosting agencyplace
- the name of the new residing placeBadOperation
- thrown if the agent can not be
correctly reinstalled in the new agency.
Identifier BadOperation.REJECTED must be set for this exception.
The agent stays in the source agency, afterMoveFailed()
is invoked,
and moveAgent()
throws an exception.public void afterMoveFailed(Location location, java.lang.String place, int reason, java.lang.String message)
afterMoveFailed
in interface MobileObject
MobileObject
public void beforeDeath()
beforeDeath
in interface MobileObject
public void beforeSuspend() throws BadOperation
beforeSuspend
in interface MobileObject
org.objectweb.mobilitools.smi.api.MobileObject
BadOperation
- the agent activity was already suspended, or could not be suspended.
Identifier BadOperation.REJECTED must be set for this exception. SMI core detects
whether the agent is already suspended or not, and throws the corresponding exception if
necessary, without invoking this callback.public void beforeResume() throws BadOperation
beforeResume
in interface MobileObject
org.objectweb.mobilitools.smi.api.MobileObject
BadOperation
- the agent activity was already running, or could not be resumed.
Identifier BadOperation.REJECTED must be set for this exception. SMI core detects
whether the agent is already running or not, and throws the corresponding exception if
necessary, without invoking this callback.public void beforeShutdown()
beforeShutdown
in interface MobileObject
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |