com.agentfactory.cldc.migration
Class MigrationManager

java.lang.Object
  extended by com.agentfactory.cldc.Service
      extended by com.agentfactory.cldc.migration.MigrationManager
All Implemented Interfaces:
java.lang.Runnable

public class MigrationManager
extends Service
implements java.lang.Runnable

The migration manager is a service that is responsible for controlling the migration process.

Author:
Conor Muldoon

Constructor Summary
MigrationManager(java.lang.String[] s, AgentName[] an, Scheduler scheduler, MigrationPlatform platform)
          Creates a new instance of MigrationService.
 
Method Summary
 void modifyBinding(java.lang.Object oldName, java.lang.Object newName)
          Changes the name of an agent in the service's registry if one exists.
 FOS processAction(AgentName agentName, int actionID, FOS data)
          Add the agent with the specified name to the outgoing list.
 FOS processPer(AgentName agentName, int perceptionID)
          Perceives information from within the service.
 void run()
          The run method periodically connections to the MigrationServer.
 
Methods inherited from class com.agentfactory.cldc.Service
register
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MigrationManager

public MigrationManager(java.lang.String[] s,
                        AgentName[] an,
                        Scheduler scheduler,
                        MigrationPlatform platform)
Creates a new instance of MigrationService.

Parameters:
s - arguments to the migration service.
an - the names of the agents on the platform.
scheduler - the schduler periodically executes the run method of the MigrationManager.
platform - the local migration platform, on which the agents reside.
Method Detail

modifyBinding

public void modifyBinding(java.lang.Object oldName,
                          java.lang.Object newName)
Description copied from class: Service
Changes the name of an agent in the service's registry if one exists.

Specified by:
modifyBinding in class Service
Parameters:
oldName - the old name of the agent.
newName - the new name of the agent.

processPer

public FOS processPer(AgentName agentName,
                      int perceptionID)
Description copied from class: Service
Perceives information from within the service.

Specified by:
processPer in class Service
Parameters:
agentName - the agent that wishes to perceive the information.
perceptionID - the ID of the information that is to be perceived.
Returns:
a first order structure that represents the information that has been perceived in the service.

processAction

public FOS processAction(AgentName agentName,
                         int actionID,
                         FOS data)
Add the agent with the specified name to the outgoing list.

Specified by:
processAction in class Service
Parameters:
agentName - the name of the agent to be added to the outgoing list.
actionID - the actionID is not used in this instance of processAction.
data - represents the destination and design URL of the agent.
Returns:
true if the action was performed successfully, false otherwise.

run

public void run()
The run method periodically connections to the MigrationServer. It registers the platform with the server the first time the platform is used. It subsequently checks the server for incomming agents and transfers outgoing agents.

Specified by:
run in interface java.lang.Runnable