org.iids.aos.locationmanager
Class AgentManagementModule

java.lang.Object
  extended by org.iids.aos.systemservices.module.AbstractModule
      extended by org.iids.aos.locationmanager.AgentManagementModule
All Implemented Interfaces:
Module

public class AgentManagementModule
extends AbstractModule

Author:
mobach@cs.vu.nl Allows: - inserting of new agents into a location - handling of migration requests from local agents - handling of migration requests by remote location managers

Constructor Summary
AgentManagementModule(Communicator _comm, AgentScapeConfig config, LocationConfigurationModule lcm, AsLookupService lus, AgentScapeDCNegotiationModule nm)
           
 
Method Summary
 AgentID createAgentID()
          Create a new ID for a to-be-created agent.
 Address insertAgent(AgentID agentID, java.lang.String migrationToken)
          Insert agent in location, determine host manager address from lease information.
 boolean isStarted()
           
 java.util.HashMap<AgentScapeID,java.util.List<AgentID>> listAgents()
          List all agents available at this location.
 MigrationEndpoint localMigrationRequest(AgentID agentId, java.lang.String migrationToken, AgentScapeID reqPrincipal, AgentScapeID destLocationId)
          Handles a local request from a hostmanager for a migration.
 MigrationEndpoint remoteMigrationRequest(AgentID agentId, java.lang.String migrationToken, Address requestingLocation, Address requestingAddress)
          This method handles incoming migration requests from remote locations.
 void shutdown()
           
 void start()
           
 void stop()
           
 
Methods inherited from class org.iids.aos.systemservices.module.AbstractModule
getCommunicator, getModuleName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgentManagementModule

public AgentManagementModule(Communicator _comm,
                             AgentScapeConfig config,
                             LocationConfigurationModule lcm,
                             AsLookupService lus,
                             AgentScapeDCNegotiationModule nm)
Method Detail

shutdown

public void shutdown()

createAgentID

public AgentID createAgentID()
Create a new ID for a to-be-created agent.

Implementation of LocationManager.create_agentid().


insertAgent

public Address insertAgent(AgentID agentID,
                           java.lang.String migrationToken)
                    throws AgentCreationException
Insert agent in location, determine host manager address from lease information.

Implementation of LocationManager.insert_agent(org.iids.aos.systemservices.communicator.structs.AgentID, java.lang.String).

Throws:
AgentCreationException

localMigrationRequest

public MigrationEndpoint localMigrationRequest(AgentID agentId,
                                               java.lang.String migrationToken,
                                               AgentScapeID reqPrincipal,
                                               AgentScapeID destLocationId)
                                        throws MigrationFailedException
Handles a local request from a hostmanager for a migration.

Note: blocks until either a remote migration endpoint was created, or a failure occurred.

Implementation of LocationManager.remote_migration_request(org.iids.aos.systemservices.communicator.structs.AgentID, java.lang.String, org.iids.aos.systemservices.communicator.structs.Address, org.iids.aos.systemservices.communicator.structs.Address).

Parameters:
agentId - ID of the agent requesting the migration.
migrationToken - String containing either a pre-negotiated lease identifier, or a language string indicating where the agent should move to.
Returns:
A MigrationEndpoint to which the agent can be sent.
Throws:
MigrationFailedException - If the migration request cannot be completed.

remoteMigrationRequest

public MigrationEndpoint remoteMigrationRequest(AgentID agentId,
                                                java.lang.String migrationToken,
                                                Address requestingLocation,
                                                Address requestingAddress)
                                         throws MigrationFailedException
This method handles incoming migration requests from remote locations.

Implementation of LocationManager.remote_migration_request(org.iids.aos.systemservices.communicator.structs.AgentID, java.lang.String, org.iids.aos.systemservices.communicator.structs.Address, org.iids.aos.systemservices.communicator.structs.Address).

It also incorporates resource negotiation. For each incoming request it examines if lease offers have been made. If they have been made, this migration request is treated as an implicit acceptance of this offer.

Parameters:
agentId - The AgentID of the agent to migrate.
migrationToken - Either a lease identifier of pre-negotiated lease, or language specification for the agent to migrate
requestingLocation - The Address of the requesting LocationManager.
requestingAddress - The Address of the requesting HostManager.
Returns:
The MigrationEndpoint containing the desination Address and MigrationID for sending the agent container.
Throws:
MigrationFailedException - If there was some problem in performing the migration request.

listAgents

public java.util.HashMap<AgentScapeID,java.util.List<AgentID>> listAgents()
List all agents available at this location.

Implementation of LocationManager.list_agents().


isStarted

public boolean isStarted()

start

public void start()

stop

public void stop()


Copyright © 2003, 2004 IIDS Group. All Rights Reserved.