org.objectweb.mobilitools.smi.api
Class Agency

java.lang.Object
  |
  +--java.util.Observable
        |
        +--org.objectweb.mobilitools.smi.api.Agency
All Implemented Interfaces:
AgencyPersonality, AgentSystem

public class Agency
extends java.util.Observable
implements AgentSystem, AgencyPersonality

MobiliTools $Name: $, $Id: Agency.java,v 1.1.1.1 2003/03/28 14:48:05 dillense Exp $

Instances of this class are execution environments for agents, supporting lifecycle/mobility management, using and providing MAFAgentSystem implementation. An agency may be created by directly instantiating this class, by running this class from command line or by running the AgencyGUI class.

An agency may be customized with an AgencyPersonality implementation. A personality may be declared when creating a new agency (using the appropriate constructor), or via inheritance. A personality's main role is to encapsulate agents by intercepting all lifecycle callbacks defined by interface MobileObject.

See Also:
AgencyGUI, AgencyPersonality, MobileObject

Field Summary
protected  java.util.Hashtable agentsByName
           
protected  java.util.Hashtable agentsByRef
           
protected  org.omg.CfMAF.MAFFinder my_finder
           
protected  org.omg.CfMAF.AgentSystemInfo my_info
           
protected  Location my_location
           
protected  java.lang.String my_name
           
protected  NameService my_ns
           
protected  java.lang.String my_ns_name
           
protected  org.omg.CORBA.ORB my_orb
           
protected  AgencyPersonality my_personality
           
protected  java.lang.String my_region
           
protected  AgentSystem my_shell
           
static java.lang.String NOTIFY_TERMINATE
           
protected  org.objectweb.mobilitools.util.thread.ShutdownLock shutdownLock
           
protected static boolean standalone
          if using an agency personality, set this attribute to true if you wish the agency to perform System.exit(0) when terminating the agency.
protected  org.objectweb.mobilitools.smi.idl._MAFAgentSystemComplementImplBase tie
           
 
Constructor Summary
Agency(java.lang.String region, AgencyPersonality personality, AgentSystem shell, org.omg.CfMAF.AgentSystemInfo info)
          Create a new agency for creating and receiving agents, and customize it with the provided agency personality and shell.
Agency(java.lang.String region, org.omg.CORBA.ORB orb, AgencyPersonality personality, AgentSystem shell, org.omg.CfMAF.AgentSystemInfo info)
          Create a new agency for creating and receiving agents.
Agency(java.lang.String name, java.lang.String region)
          Create a new agency for creating and receiving agents.
Agency(java.lang.String name, java.lang.String region, org.omg.CORBA.ORB orb)
          Create a new agency for creating and receiving agents.
 
Method Summary
 void afterBirth(MobileObject agent, AgentSystem agency, AgentInfo entry, java.lang.Object arguments)
          Call afterBirth() on agent.
 void afterMove(MobileObject agent, AgentSystem agency, Location location, java.lang.String place)
          Call afterMove() on agent.
 void afterMoveFailed(MobileObject agent, Location agency, java.lang.String place, int reason, java.lang.String message)
          Call afterMoveFailed on agent.
 void agencyShutdown()
          Nothing special to do
 void beforeDeath(MobileObject agent)
          Call beforeDeath() on agent
 void beforeMove(MobileObject agent, Location location, java.lang.String place)
          Call beforeMove() on agent.
 void beforeResume(MobileObject agent)
          Call beforeResume() on agent
 void beforeShutdown(MobileObject agent)
          Call beforeShutdown() on agent
 void beforeSuspend(MobileObject agent)
          Call beforeSuspend() on agent
 AgentInfo createLocalAgent(java.lang.String classname, Name name, org.omg.CfMAF.AgentProfile profile, java.lang.String place, java.lang.String codebase, byte[] agent_data, java.lang.Object argument, org.omg.CfMAF.MAFAgentSystem class_provider)
          Creates an agent in current agency.
 AgentInfo createLocalAgent(java.lang.String agent_class, Name name, java.lang.String place, java.lang.String codebase, java.util.Properties properties, java.lang.Object argument)
          Creates an agent in current agency.
 void exitOnTerminate(boolean mode, long delay)
          The agency may invoke System.exit() to make the JVM exit when the agency is terminated.
 AgentInfo getAgentInfo(MobileObject agent)
           
 AgentInfo getAgentInfo(Name agent)
           
 org.omg.CfMAF.AgentSystemInfo getAgentSystemInfo()
           
 Location getLocation()
           
 org.omg.CfMAF.MAFFinder getMAFFinder()
           
 Name getName()
           
 java.lang.String getNsName()
           
 org.omg.CORBA.ORB getORB()
           
 java.lang.String getRegion()
           
 org.omg.CfMAF.Name[] listAgents(org.omg.CfMAF.AgentProfile profile)
           
 org.omg.CfMAF.Name[] listAgents(byte[] authority)
           
 Name[] listLocalAgents(org.omg.CfMAF.AgentProfile profile)
           
 boolean localAgentIsRunning(MobileObject agent)
           
 boolean localAgentIsRunning(Name agent)
           
static void main(java.lang.String[] args)
          Launches a SMI agency.
 org.omg.CfMAF.AgentProfile makeAgentProfile(java.util.Properties properties)
           
 void moveLocalAgent(MobileObject agent, Location agency, java.lang.String place)
          Invokes the beforeMove() callback on the agent, and then tries to move it if no exception has been thrown by beforeMove().
 void moveLocalAgent(Name agent, Location agency, java.lang.String place)
          Invokes the beforeMove() callback on the agent, and then tries to move it if no exception has been thrown by beforeMove().
 void receiveAgent(java.lang.String class_name, byte[] agent_state, org.omg.CfMAF.Name agent_name, org.omg.CfMAF.AgentProfile agent_profile, java.lang.String place, java.lang.String code_base, org.omg.CfMAF.MAFAgentSystem class_provider)
          Receives a moving agent, invokes callback afterMove() on the newly installed agent.
 void resumeLocalAgent(MobileObject agent)
          Invokes the beforeResume() callback on an agent in order to resume its activity.
 void resumeLocalAgent(Name agent)
          Invokes the beforeResume() callback on an agent in order to resume its activity.
 void setLocalAgentProperty(MobileObject agent, java.lang.String property, java.lang.String value)
          Sets, changes or unsets an agent property.
 void setLocalAgentProperty(Name agent, java.lang.String property, java.lang.String value)
          Sets, changes or unsets an agent property.
 void suspendLocalAgent(MobileObject agent)
          Invokes the beforeSuspend() callback on an agent in order to suspend its activity.
 void suspendLocalAgent(Name agent)
          Invokes the beforeSuspend() callback on an agent in order to suspend its activity.
 void terminate()
          Calls beforeShutdown() on the hosted agents, terminates agents that are still hosted, then calls agencyShutdown() on the agency, and finally shuts the agency down.
 void terminateLocalAgent(MobileObject agent)
          Invokes the beforeDeath() callback on an agent, and then terminates it.
 void terminateLocalAgent(Name agent)
          Invokes the beforeDeath() callback on an agent, and then terminates it.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

standalone

protected static boolean standalone
if using an agency personality, set this attribute to true if you wish the agency to perform System.exit(0) when terminating the agency.

NOTIFY_TERMINATE

public static final java.lang.String NOTIFY_TERMINATE

my_region

protected java.lang.String my_region

my_name

protected java.lang.String my_name

tie

protected org.objectweb.mobilitools.smi.idl._MAFAgentSystemComplementImplBase tie

my_ns

protected NameService my_ns

my_ns_name

protected java.lang.String my_ns_name

my_location

protected Location my_location

my_orb

protected org.omg.CORBA.ORB my_orb

agentsByRef

protected java.util.Hashtable agentsByRef

agentsByName

protected java.util.Hashtable agentsByName

my_finder

protected org.omg.CfMAF.MAFFinder my_finder

my_personality

protected AgencyPersonality my_personality

my_shell

protected AgentSystem my_shell

my_info

protected org.omg.CfMAF.AgentSystemInfo my_info

shutdownLock

protected org.objectweb.mobilitools.util.thread.ShutdownLock shutdownLock
Constructor Detail

Agency

public Agency(java.lang.String name,
              java.lang.String region)
       throws BadOperation
Create a new agency for creating and receiving agents. The authority for this agency is set from the "user.name" system property. The agency's MAFAgentSystem interface is bound in the CORBA naming service accordingly to the region name and the agency name.
Parameters:
name - name of the agency, unique in the given region.
region - name of the region the agency belongs to.
Throws:
BadOperation - if the name of the agency is not accepted by the MAFFinder (name already used?).

Agency

public Agency(java.lang.String region,
              AgencyPersonality personality,
              AgentSystem shell,
              org.omg.CfMAF.AgentSystemInfo info)
       throws BadOperation
Create a new agency for creating and receiving agents, and customize it with the provided agency personality and shell. The agency's MAFAgentSystem interface is bound in the CORBA naming service accordingly to the region name and the agency name.
Parameters:
region - name of the region the agency belongs to.
personality - object intercepting agent lifecycle callbacks.
shell - reference that will be given to the agents created in or moving to this agency.
info - data record describing the customized agency (see MAF). This info should hold the agency's MAF name, whose identity field is taken as the agency's unique name in SMI's sense.
Throws:
BadOperation - if the name of the agency is not accepted by the MAFFinder (name already used).
See Also:
Constants.makeAgentSystemInfo(byte[], byte[])

Agency

public Agency(java.lang.String name,
              java.lang.String region,
              org.omg.CORBA.ORB orb)
       throws BadOperation
Create a new agency for creating and receiving agents. The authority for this agency is set from the "user.name" system property. The agency's MAFAgentSystem interface is bound in the CORBA naming service accordingly to the region name and the agency name.
Parameters:
name - name of the agency, unique in the given region.
region - name of the region the agency belongs to.
orb - the ORB object to use.
Throws:
BadOperation - if the name of the agency is not accepted by the MAFFinder (name already used?).
See Also:
ORB.init()

Agency

public Agency(java.lang.String region,
              org.omg.CORBA.ORB orb,
              AgencyPersonality personality,
              AgentSystem shell,
              org.omg.CfMAF.AgentSystemInfo info)
       throws BadOperation
Create a new agency for creating and receiving agents. The authority for this agency is set from the "user.name" system property. The agency's MAFAgentSystem interface is bound in the CORBA naming service accordingly to the region name and the agency name.
Parameters:
region - name of the region the agency belongs to.
orb - the ORB object to use.
personality - the agency personality that will handle the agents. A null value means no personality (i.e. current agency instance).
shell - agency reference that will be given to the hosted agents after creation or move. A null value means no specific shell, in which case the host agency will be used.
info - the AgentSystemInfo information record about the agent system personality. This info should hold the agency's MAF name, whose identity field is taken as the agency's unique name in SMI's sense.
Throws:
BadOperation - if the name of the agency is not accepted by the MAFFinder (already used?).
See Also:
ORB.init(), Constants.makeAgentSystemInfo(byte[], byte[])
Method Detail

main

public static void main(java.lang.String[] args)
Launches a SMI agency.
Parameters:
args - command-line arguments should specify:
  • args[0] the agency unique name in the given region,
  • args[1] the region name.
See Also:
Agency(String, String, ORB)

getAgentSystemInfo

public org.omg.CfMAF.AgentSystemInfo getAgentSystemInfo()
Returns:
a data record describing current agent system (see MAF).

makeAgentProfile

public org.omg.CfMAF.AgentProfile makeAgentProfile(java.util.Properties properties)
Parameters:
properties - the agent properties to be inserted in the profile.
Returns:
a new AgentProfile instance for SMI (or personality) agents, with the given properties.

receiveAgent

public void receiveAgent(java.lang.String class_name,
                         byte[] agent_state,
                         org.omg.CfMAF.Name agent_name,
                         org.omg.CfMAF.AgentProfile agent_profile,
                         java.lang.String place,
                         java.lang.String code_base,
                         org.omg.CfMAF.MAFAgentSystem class_provider)
                  throws org.omg.CfMAF.ClassUnknown,
                         org.omg.CfMAF.DeserializationFailed,
                         org.omg.CfMAF.MAFExtendedException
Receives a moving agent, invokes callback afterMove() on the newly installed agent.
Parameters:
class_name - class name of the received agent.
agent_state - the state of the received agent.
agent_name - the MAF unique name of the received agent.
agent_profile - the profile of the received agent (see MAF specifications).
place - the name of the place where to settle the new agent.
code_base - codebase to load classes for this agent.
class_provider - the MAFAgentSystem implementation from where to pick the classes of the received agent.
Throws:
org.omg.CfMAF.ClassUnknown - at least one of the needed classes could not be found
org.omg.CfMAF.DeserializationFailed - the received agent is not of SMI agent system type, or an exception was thrown during the agent deserialization
org.omg.CfMAF.MAFExtendedException - an exception was thrown by the agent afterMove() method

getMAFFinder

public org.omg.CfMAF.MAFFinder getMAFFinder()
Returns:
CORBA object reference to MAFFinder implementation this agency is bound to. Returns null if the agency is running without MAFFinder support.

getRegion

public java.lang.String getRegion()
Returns:
the name of the region the agency belongs to.

getName

public Name getName()
Returns:
a wrapper for the MAF name of the agency.

getNsName

public java.lang.String getNsName()
Returns:
the full name of the agency, as it appears in the CORBA naming service. String'fied COSnaming names have the following format: /naming context1!kind1/.../object!kind

getLocation

public Location getLocation()
Returns:
the location of the agency.

getAgentInfo

public AgentInfo getAgentInfo(Name agent)
Parameters:
agent - the MAF unique name of the agent.
Returns:
a record of data about an agent hosted by the agency, or null if the designated agent is not known by the agency.

getAgentInfo

public AgentInfo getAgentInfo(MobileObject agent)
Parameters:
agent - the Java object reference to the agent.
Returns:
a record of data about an agent hosted by the agency, or null if the designated agent is not known by the agency.

createLocalAgent

public AgentInfo createLocalAgent(java.lang.String agent_class,
                                  Name name,
                                  java.lang.String place,
                                  java.lang.String codebase,
                                  java.util.Properties properties,
                                  java.lang.Object argument)
                           throws BadOperation
Creates an agent in current agency. The agent's default constructor is called unless a constructor taking a single Object as argument is defined and "argument" is both non-null and not an empty array.
Parameters:
agent_class - the class name of the new agent.
name - the identity part of the MAF name of the new agent (must be unique in the set of names of the agency's authority; the authority part of the MAF agent name will be the same as the agency's).
place - the name of the place where to settle the new agent.
codebase - codebase to load classes for this agent.
properties - agent's properties.
argument - parameter for agent constructor and initialization.
Throws:
BadOperation - the agent creation failed
See Also:
MobileObject.afterBirth(AgentSystem, AgentInfo, Object)

createLocalAgent

public AgentInfo createLocalAgent(java.lang.String classname,
                                  Name name,
                                  org.omg.CfMAF.AgentProfile profile,
                                  java.lang.String place,
                                  java.lang.String codebase,
                                  byte[] agent_data,
                                  java.lang.Object argument,
                                  org.omg.CfMAF.MAFAgentSystem class_provider)
                           throws BadOperation
Creates an agent in current agency. The agent's default constructor is called unless a constructor taking a single Object as argument is defined and "argument" is both non-null and not an empty array.
Parameters:
classname - the class name of the new agent.
name - the MAF unique name of the new agent.
profile - agent MAF profile.
place - the name of the place where to settle the new agent.
codebase - codebase to load classes for this agent.
agent_data - ignored if null or empty array ; otherwise, should contain a serialized Java object which will be used as agent constructor and initialization parameter.
argument - parameter for agent constructor and initialization (ignored if agent_data is non-null and non-empty).
class_provider - the MAFAgentSystem implementation from where to pick the classes; (if null, the codebase will be interpreted locally.
Throws:
BadOperation - the agent creation failed
See Also:
MobileObject.afterBirth(AgentSystem, AgentInfo, Object)

moveLocalAgent

public void moveLocalAgent(Name agent,
                           Location agency,
                           java.lang.String place)
                    throws BadOperation
Invokes the beforeMove() callback on the agent, and then tries to move it if no exception has been thrown by beforeMove(). If the move fails, the afterMoveFailed() callback is invoked on the agent, and an exception is thrown.
Parameters:
agent - name wrapper for agent's MAF name.
agency - location of the target agency.
place - the name of the target place in the given agency.
Throws:
BadOperation - on aborted move.
See Also:
MobileObject, AgencyPersonality

moveLocalAgent

public void moveLocalAgent(MobileObject agent,
                           Location agency,
                           java.lang.String place)
                    throws BadOperation
Invokes the beforeMove() callback on the agent, and then tries to move it if no exception has been thrown by beforeMove(). If the move fails, the afterMoveFailed() callback is invoked on the agent, and an exception is thrown.
Parameters:
agent - Java object reference to the agent.
agency - location of the target agency.
place - the name of the target place in the given agency.
Throws:
BadOperation - on aborted move.
See Also:
MobileObject, AgencyPersonality

terminate

public void terminate()
Calls beforeShutdown() on the hosted agents, terminates agents that are still hosted, then calls agencyShutdown() on the agency, and finally shuts the agency down.
See Also:
MobileObject, AgencyPersonality

terminateLocalAgent

public void terminateLocalAgent(Name agent)
                         throws BadOperation
Invokes the beforeDeath() callback on an agent, and then terminates it.
Parameters:
agent - MAF unique name of the agent.
Throws:
BadOperation - the target agent is not known by the agency, or its termination threw an exception.
See Also:
MobileObject, AgencyPersonality

terminateLocalAgent

public void terminateLocalAgent(MobileObject agent)
                         throws BadOperation
Invokes the beforeDeath() callback on an agent, and then terminates it.
Parameters:
agent - the Java object reference to the agent.
Throws:
BadOperation - the target agent is not known by the agency, or its termination threw an exception.
See Also:
MobileObject, AgencyPersonality

listLocalAgents

public Name[] listLocalAgents(org.omg.CfMAF.AgentProfile profile)
Parameters:
profile - the agent profile to be matched; if null, all the agents are selected.
Returns:
an array of names of hosted agents matching a given profile. The returned array is zero-sized if no agent matches the given profile (or if there is no agent at all).

listAgents

public org.omg.CfMAF.Name[] listAgents(org.omg.CfMAF.AgentProfile profile)
Parameters:
profile - the agent profile to be matched; if null, all the agents are selected.
Returns:
an array of MAF names of hosted agents matching a given profile. The returned array is zero-sized if no agent matches the given profile (or if there is no agent at all).

listAgents

public org.omg.CfMAF.Name[] listAgents(byte[] authority)
Parameters:
authority - the agent's authority.
Returns:
an array of MAF names of local agents belonging to the given authority. The returned array is zero-sized if no agent matches the given profile (or if there is no agent at all).

resumeLocalAgent

public void resumeLocalAgent(Name agent)
                      throws BadOperation
Invokes the beforeResume() callback on an agent in order to resume its activity. Unless this callback throws an exception, the agent activity is then considered as resumed.
Parameters:
agent - MAF unique agent name.
Throws:
BadOperation - the agent could not be found and resumed, or it was already running.
See Also:
MobileObject, AgencyPersonality

resumeLocalAgent

public void resumeLocalAgent(MobileObject agent)
                      throws BadOperation
Invokes the beforeResume() callback on an agent in order to resume its activity. Unless this callback throws an exception, the agent activity is then considered as resumed.
Parameters:
agent - the agent's Java object reference.
Throws:
BadOperation - the agent could not be found and resumed, or it was already running.
See Also:
MobileObject, AgencyPersonality

suspendLocalAgent

public void suspendLocalAgent(Name agent)
                       throws BadOperation
Invokes the beforeSuspend() callback on an agent in order to suspend its activity. Unless this callback throws an exception, the agent activity is then considered as suspended.
Parameters:
agent - MAF unique agent name.
Throws:
BadOperation - the agent could not be found and suspended, or was already suspended.
See Also:
MobileObject, AgencyPersonality

suspendLocalAgent

public void suspendLocalAgent(MobileObject agent)
                       throws BadOperation
Invokes the beforeSuspend() callback on an agent in order to suspend its activity. Unless this callback throws an exception, the agent activity is then considered as suspended.
Parameters:
agent - the agent's Java object reference.
Throws:
BadOperation - the agent could not be found and suspended, or was already suspended.
See Also:
MobileObject, AgencyPersonality

setLocalAgentProperty

public void setLocalAgentProperty(Name agent,
                                  java.lang.String property,
                                  java.lang.String value)
                           throws BadOperation
Sets, changes or unsets an agent property.
Parameters:
agent - the agent MAF name wrapper.
property - property name.
value - property value; if null, the property is unset.
Throws:
BadOperation - the agent could not be found in local agency.

setLocalAgentProperty

public void setLocalAgentProperty(MobileObject agent,
                                  java.lang.String property,
                                  java.lang.String value)
                           throws BadOperation
Sets, changes or unsets an agent property.
Parameters:
agent - the agent's Java object reference.
property - property name.
value - property value; if null, the property is unset.
Throws:
BadOperation - the agent could not be found in local agency.

localAgentIsRunning

public boolean localAgentIsRunning(Name agent)
                            throws BadOperation
Parameters:
agent - wrapper to the agent's MAF name.
Returns:
true if the designated agent is currently active, false if the agent is suspended.
Throws:
BadOperation - the agent could not be found in local agency.

localAgentIsRunning

public boolean localAgentIsRunning(MobileObject agent)
                            throws BadOperation
Parameters:
agent - the agent's Java object reference.
Returns:
true if the designated agent is currently active, false if the agent is suspended.
Throws:
BadOperation - the agent could not be found in local agency.

getORB

public org.omg.CORBA.ORB getORB()
Returns:
the ORB object used by current agency.

exitOnTerminate

public void exitOnTerminate(boolean mode,
                            long delay)
The agency may invoke System.exit() to make the JVM exit when the agency is terminated.
Parameters:
mode - true enables the automatic exit on agency termination, false disables.
delay - delay in ms before calling System.exit(), after all callbacks (on agents, on agency personality) have returned; a negative value results in (1) dedicated system property, or (2) previous value set, or (3) default value to be applied.
See Also:
Constants

afterBirth

public void afterBirth(MobileObject agent,
                       AgentSystem agency,
                       AgentInfo entry,
                       java.lang.Object arguments)
                throws BadOperation
Call afterBirth() on agent.
Specified by:
afterBirth in interface AgencyPersonality
Following copied from interface: org.objectweb.mobilitools.smi.api.AgencyPersonality
Parameters:
agent - target agent.
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(MobileObject agent,
                       Location location,
                       java.lang.String place)
                throws BadOperation
Call beforeMove() on agent.
Specified by:
beforeMove in interface AgencyPersonality
Following copied from interface: org.objectweb.mobilitools.smi.api.AgencyPersonality
Parameters:
agent - target agent
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(MobileObject agent,
                      AgentSystem agency,
                      Location location,
                      java.lang.String place)
               throws BadOperation
Call afterMove() on agent.
Specified by:
afterMove in interface AgencyPersonality
Following copied from interface: org.objectweb.mobilitools.smi.api.AgencyPersonality
Parameters:
agent - target agent
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(MobileObject agent,
                            Location agency,
                            java.lang.String place,
                            int reason,
                            java.lang.String message)
Call afterMoveFailed on agent.
Specified by:
afterMoveFailed in interface AgencyPersonality
Following copied from interface: org.objectweb.mobilitools.smi.api.AgencyPersonality
Parameters:
agent - target agent
agency - location of the target agency
place - the target place name
reason - problem identifier
message - textual explanation

beforeDeath

public void beforeDeath(MobileObject agent)
Call beforeDeath() on agent
Specified by:
beforeDeath in interface AgencyPersonality
Following copied from interface: org.objectweb.mobilitools.smi.api.AgencyPersonality
Parameters:
agent - target agent

beforeSuspend

public void beforeSuspend(MobileObject agent)
                   throws BadOperation
Call beforeSuspend() on agent
Specified by:
beforeSuspend in interface AgencyPersonality
Following copied from interface: org.objectweb.mobilitools.smi.api.AgencyPersonality
Parameters:
agent - target agent
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(MobileObject agent)
                  throws BadOperation
Call beforeResume() on agent
Specified by:
beforeResume in interface AgencyPersonality
Following copied from interface: org.objectweb.mobilitools.smi.api.AgencyPersonality
Parameters:
agent - target agent
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(MobileObject agent)
Call beforeShutdown() on agent
Specified by:
beforeShutdown in interface AgencyPersonality
Following copied from interface: org.objectweb.mobilitools.smi.api.AgencyPersonality
Parameters:
agent - target agent

agencyShutdown

public void agencyShutdown()
Nothing special to do
Specified by:
agencyShutdown in interface AgencyPersonality