|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
MobiliTools $Name: $, $Id: AgencyPersonality.java,v 1.1.1.1 2003/03/28 14:48:06 dillense Exp $
Interface that must be implemented by an agency personality to give hooks to SMI generic Agency. Most of this interface consists in intercepting MobileObject life cycle.
Agency
,
MobileObject
Method Summary | |
void |
afterBirth(MobileObject agent,
AgentSystem agency,
AgentInfo entry,
java.lang.Object arguments)
Called on agent creation. |
void |
afterMove(MobileObject agent,
AgentSystem agency,
Location location,
java.lang.String place)
Called on reinstalling in the target agency after a move. |
void |
afterMoveFailed(MobileObject agent,
Location agency,
java.lang.String place,
int reason,
java.lang.String message)
Called on move failure. (note that throwing an exception in beforeMove() does not result in
afterMoveFailed() being called) |
void |
agencyShutdown()
Called before agency shutdown (once all agents have been warned and terminated). |
void |
beforeDeath(MobileObject agent)
Called before discarding the agent. (note that an exception in afterBirth() does not
result in beforeDeath() being called) |
void |
beforeMove(MobileObject agent,
Location location,
java.lang.String place)
Called before before moving. |
void |
beforeResume(MobileObject agent)
Called to resume the agent activity (if any). |
void |
beforeShutdown(MobileObject agent)
Called before the agent's hosting agency shutdown. |
void |
beforeSuspend(MobileObject agent)
Called to suspend the agent activity (if any). |
Method Detail |
public void afterBirth(MobileObject agent, AgentSystem agency, AgentInfo entry, java.lang.Object arguments) throws BadOperation
agent
- target agent.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(MobileObject agent, Location location, java.lang.String place) throws BadOperation
agent
- target agentlocation
- 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(MobileObject agent, AgentSystem agency, Location location, java.lang.String place) throws BadOperation
agent
- target agentagency
- 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(MobileObject agent, Location agency, java.lang.String place, int reason, java.lang.String message)
beforeMove()
does not result in
afterMoveFailed()
being called)agent
- target agentagency
- location of the target agencyplace
- the target place namereason
- problem identifiermessage
- textual explanationpublic void beforeDeath(MobileObject agent)
afterBirth()
does not
result in beforeDeath()
being called)agent
- target agentpublic void beforeSuspend(MobileObject agent) throws BadOperation
agent
- target agentBadOperation
- 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(MobileObject agent) throws BadOperation
agent
- target agentBadOperation
- 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(MobileObject agent)
agent
- target agentpublic void agencyShutdown()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |