org.objectweb.mobilitools.smi.goodies
Class BasicMobileObject

java.lang.Object
  |
  +--org.objectweb.mobilitools.smi.goodies.BasicMobileObject
All Implemented Interfaces:
MobileObject, java.io.Serializable

public class BasicMobileObject
extends java.lang.Object
implements MobileObject

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().

See Also:
Serialized Form

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

my_agency

protected transient Agency my_agency
reference to the hosting agent system
Constructor Detail

BasicMobileObject

public BasicMobileObject()
Method Detail

afterBirth

public void afterBirth(AgentSystem agency,
                       AgentInfo entry,
                       java.lang.Object argument)
                throws BadOperation
Sets attribute my_agency to current host agency.
Specified by:
afterBirth in interface MobileObject
Following copied from interface: org.objectweb.mobilitools.smi.api.MobileObject
Parameters:
agency - reference to the hosting agency.
entry - a structure of information about the newly created agent.
arguments - arguments for agent initialization.
Throws:
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.

beforeMove

public void beforeMove(Location location,
                       java.lang.String place)
                throws BadOperation
Empty method.
Specified by:
beforeMove in interface MobileObject
Following copied from interface: org.objectweb.mobilitools.smi.api.MobileObject
Parameters:
location - location of destination agency
place - name of target place
Throws:
BadOperation - 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).

afterMove

public void afterMove(AgentSystem agency,
                      Location location,
                      java.lang.String place)
               throws BadOperation
Sets attribute my_agency to new host agency.
Specified by:
afterMove in interface MobileObject
Following copied from interface: org.objectweb.mobilitools.smi.api.MobileObject
Parameters:
agency - reference to the new hosting agency
location - location of new hosting agency
place - the name of the new residing place
Throws:
BadOperation - 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.

afterMoveFailed

public void afterMoveFailed(Location location,
                            java.lang.String place,
                            int reason,
                            java.lang.String message)
Empty method.
Specified by:
afterMoveFailed in interface MobileObject
See Also:
MobileObject

beforeDeath

public void beforeDeath()
Empty method.
Specified by:
beforeDeath in interface MobileObject

beforeSuspend

public void beforeSuspend()
                   throws BadOperation
Empty method.
Specified by:
beforeSuspend in interface MobileObject
Following copied from interface: org.objectweb.mobilitools.smi.api.MobileObject
Throws:
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.

beforeResume

public void beforeResume()
                  throws BadOperation
Empty method.
Specified by:
beforeResume in interface MobileObject
Following copied from interface: org.objectweb.mobilitools.smi.api.MobileObject
Throws:
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.

beforeShutdown

public void beforeShutdown()
Empty method.
Specified by:
beforeShutdown in interface MobileObject