All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class macondo.mak.Agent

macondo.mak.Agent

public class Agent
A very simple prototype of agent.


Variable Index

 o INIT
Indicates that the agent is executing for the first time.
 o RESTART
Indicates that this agent is executing after a migration.
 o RESTORE
Indicates that this agent is executing after being made persistent.

Constructor Index

 o Agent()
Creates a new Agent.
 o Agent(Agent)
Creates a new Agent from another one.
 o Agent(String)
Creates a new Agent with given name.
 o Agent(String, PlaceName)
Creates a new Agent with given name and current place name.

Method Index

 o flush()
 o flush(Object)
 o getCurrentPlace()
Returns current place.
 o getName()
 o getProperty(Object)
 o getSource()
Returns source place name.
 o go(PlaceName, String)
Moves the agent to a new place.
 o go(String, int, String)
Moves the agent to a new place.
 o init()
Method called to initialize the agent.
 o putProperty(Object, Object)
 o removeProperty(Object)
 o save()
 o save(Object)
 o setName(String)
 o stop()
Method called before agent migration, in order to store relevant information in agent state or release resources.

Variables

 o INIT
 public static final int INIT
Indicates that the agent is executing for the first time.

 o RESTART
 public static final int RESTART
Indicates that this agent is executing after a migration.

 o RESTORE
 public static final int RESTORE
Indicates that this agent is executing after being made persistent.

Constructors

 o Agent
 public Agent()
Creates a new Agent.

 o Agent
 public Agent(String name)
Creates a new Agent with given name.

Parameters:
name - the name of the Agent
 o Agent
 public Agent(String name,
              PlaceName source)
Creates a new Agent with given name and current place name.

Parameters:
name - the name of the Agent
source - the agent's source place name
 o Agent
 public Agent(Agent anAgent)
Creates a new Agent from another one.

Parameters:
anAgent - an Agent

Methods

 o setName
 public void setName(String name)
 o getName
 public String getName()
 o getProperty
 public Object getProperty(Object key)
 o putProperty
 public void putProperty(Object key,
                         Object value)
 o removeProperty
 public Object removeProperty(Object key)
 o flush
 public void flush() throws IOException
 o flush
 public void flush(Object key) throws IOException
 o save
 public void save() throws IOException
 o save
 public void save(Object key) throws IOException
 o init
 public void init()
Method called to initialize the agent. This default implementation does nothing.

 o stop
 public void stop()
Method called before agent migration, in order to store relevant information in agent state or release resources. This default implementation does nothing.

 o go
 protected final void go(String host,
                         int port,
                         String callback) throws TransportException
Moves the agent to a new place.

Parameters:
host - destination host name
port - destination port number
callback - callback method to execute in new location
Throws: TransportException
never occurs. One of the exception is thrown instead.
Throws: UnknownDestinationException
occurs if the destination place is unknown.
Throws: TransportFailedException
occurs if migration fails for any other reason.
 o go
 protected final void go(PlaceName p_name,
                         String callback) throws Exception
Moves the agent to a new place.

Parameters:
p_name - destination place name
callback - callback method to execute in new location
 o getCurrentPlace
 protected Place getCurrentPlace()
Returns current place.

See Also:
Place
 o getSource
 protected PlaceName getSource()
Returns source place name.

Returns:
source place name.
See Also:
PlaceName, Place

All Packages  Class Hierarchy  This Package  Previous  Next  Index