org.iids.aos.locationmanager
Class LocalLocationManager

java.lang.Object
  extended by org.iids.aos.systemservices.LocalSystemService
      extended by org.iids.aos.locationmanager.LocalLocationManager
All Implemented Interfaces:
LocationManager, SystemService

public class LocalLocationManager
extends LocalSystemService
implements LocationManager


Field Summary
 
Fields inherited from interface org.iids.aos.systemservices.LocationManager
HOST_MANAGER_LOCATION, LOCATION_MANAGER_ADDRESS, LOOKUP_REGISTRATION_NAME
 
Constructor Summary
LocalLocationManager(LocationManager parent, LocationConfigurationModule lcm, AgentManagementModule amm, AgentScapeDCNegotiationModule nm)
           
 
Method Summary
 AgreementOffer acceptLease(java.lang.String leaseIdentifier)
           
 AgentID create_agentid()
          Generate ID for a new agent, which can be used to create an agent on a host in this location.
 AgentScapeID create_agentscapeid()
          Generate ID for new service.
 boolean deregister(AgentScapeID id)
          Deregister host manager with location manager.
static LocalLocationManager get(AgentScapeID id)
          Returns the local location manager with name id if it exists in this JVM.
 Address insert_agent(AgentID agentID, java.lang.String leaseIdentifier)
          Finds a suitable host to run the agent on, and return the address where this host manager can be contacted.
 java.util.HashMap<AgentScapeID,java.util.List<AgentID>> list_agents()
          Obtain list of all agents in this location.
 java.util.HashMap<AgentScapeID,Address> list_hosts()
          Obtain a list of all the hosts that are part of this location.
 MigrationEndpoint local_migration_request(AgentID agentId, java.lang.String leaseIdentifier, AgentScapeID requestingAgentServer, AgentScapeID destLocationId)
          Called by a host manager (part of this location) to instruct the location manager to start the migration process by contacting the remote location manager.
 void pingService()
           
 java.lang.String pingString()
           
 void pingVoid()
           
 int register(AgentScapeID id, Address address)
          Register host manager with location.
 void rejectLease(java.lang.String leaseIdentifier)
           
 MigrationEndpoint remote_migration_request(AgentID agentId, java.lang.String leaseIdentifier, Address requestingLocationAddress, Address requestingHostAddress)
          Called by location manager that initiates migration, to request migration of an agent to this location.
 AgreementOffer requestLease(AgreementOffer leaseRequest)
           
 AgreementOffer requestLeaseStatus(java.lang.String leaseIdentifier)
           
 TemplateList requestTemplates()
           
 void shutdown()
           
 void unbind()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalLocationManager

public LocalLocationManager(LocationManager parent,
                            LocationConfigurationModule lcm,
                            AgentManagementModule amm,
                            AgentScapeDCNegotiationModule nm)
Method Detail

register

public int register(AgentScapeID id,
                    Address address)
Description copied from interface: LocationManager
Register host manager with location.

TODO exceptions

Specified by:
register in interface LocationManager
Parameters:
id - The AgentScapeID of the host manager to add.
address - Address where host manager can be contacted.
Returns:
timeout in seconds after which registration will be automatically removed. Renew before that time.

deregister

public boolean deregister(AgentScapeID id)
Description copied from interface: LocationManager
Deregister host manager with location manager.

TODO exceptions

Specified by:
deregister in interface LocationManager
Parameters:
id - The AgentScapeID of the host manager to remove.
Returns:
true if deregistration has succeeded, false otherwise

create_agentid

public AgentID create_agentid()
Description copied from interface: LocationManager
Generate ID for a new agent, which can be used to create an agent on a host in this location.

Specified by:
create_agentid in interface LocationManager
Returns:
The newly generated AgentID.

create_agentscapeid

public AgentScapeID create_agentscapeid()
Description copied from interface: LocationManager
Generate ID for new service.

XXX experimental..

Specified by:
create_agentscapeid in interface LocationManager

insert_agent

public Address insert_agent(AgentID agentID,
                            java.lang.String leaseIdentifier)
                     throws AgentCreationException
Description copied from interface: LocationManager
Finds a suitable host to run the agent on, and return the address where this host manager can be contacted.

Specified by:
insert_agent in interface LocationManager
Parameters:
agentID - ID of the agent XXX unused parameter.
leaseIdentifier - The lease to extract the host information from.
Returns:
Address of hostmanager where agent will run.
Throws:
AgentCreationException - If the agreement provider in the lease cannot be located. TODO should be NegotiationLibException?

remote_migration_request

public MigrationEndpoint remote_migration_request(AgentID agentId,
                                                  java.lang.String leaseIdentifier,
                                                  Address requestingLocationAddress,
                                                  Address requestingHostAddress)
                                           throws MigrationFailedException
Description copied from interface: LocationManager
Called by location manager that initiates migration, to request migration of an agent to this location.

Specified by:
remote_migration_request in interface LocationManager
Parameters:
agentId - The AgentID of the agent to be migrated.
leaseIdentifier - Identifier of the lease that contains agent placement.
requestingLocationAddress - Address of source LocationManager XXX unused?
requestingHostAddress - Address of source HostManager.
Returns:
Migration endpoint where the agent container can be sent to.
Throws:
MigrationFailedException - Error performing migration request.

local_migration_request

public MigrationEndpoint local_migration_request(AgentID agentId,
                                                 java.lang.String leaseIdentifier,
                                                 AgentScapeID requestingAgentServer,
                                                 AgentScapeID destLocationId)
                                          throws MigrationFailedException
Description copied from interface: LocationManager
Called by a host manager (part of this location) to instruct the location manager to start the migration process by contacting the remote location manager.

Specified by:
local_migration_request in interface LocationManager
Parameters:
agentId - The AgentID of the agent to be migrated.
leaseIdentifier - Identifier of the lease that contains agent placement.
requestingAgentServer - The Address of the requesting agent server.
destLocationId - Target location for the agent.
Returns:
Migration endpoint where the agent container can be sent to.
Throws:
MigrationFailedException - Error performing migration request.

requestTemplates

public TemplateList requestTemplates()
Specified by:
requestTemplates in interface LocationManager

requestLease

public AgreementOffer requestLease(AgreementOffer leaseRequest)
Specified by:
requestLease in interface LocationManager

acceptLease

public AgreementOffer acceptLease(java.lang.String leaseIdentifier)
Specified by:
acceptLease in interface LocationManager

rejectLease

public void rejectLease(java.lang.String leaseIdentifier)
Specified by:
rejectLease in interface LocationManager

requestLeaseStatus

public AgreementOffer requestLeaseStatus(java.lang.String leaseIdentifier)
Specified by:
requestLeaseStatus in interface LocationManager

list_agents

public java.util.HashMap<AgentScapeID,java.util.List<AgentID>> list_agents()
Description copied from interface: LocationManager
Obtain list of all agents in this location.

Repeatedly queries all host managers for a list of agents that are running there. The entire collection of all AgentID's that are running on all hosts in this location, is returned by this method.

Specified by:
list_agents in interface LocationManager
Returns:
List of all agents that are present in this location.

list_hosts

public java.util.HashMap<AgentScapeID,Address> list_hosts()
Description copied from interface: LocationManager
Obtain a list of all the hosts that are part of this location.

XXX experimental call...

Specified by:
list_hosts in interface LocationManager
Returns:
A map of <AgentScapeID,Address> pairs.

unbind

public void unbind()
Specified by:
unbind in interface SystemService

shutdown

public void shutdown()
Specified by:
shutdown in interface SystemService

get

public static LocalLocationManager get(AgentScapeID id)
Returns the local location manager with name id if it exists in this JVM.

Parameters:
id - The location ID of the LocationManager interface.
Returns:
The LocalLocationManager of the location, if it exists. Otherwise this function returns null, which also indicates that the LocationManager for this location runs somewhere else.

pingService

public void pingService()
Specified by:
pingService in interface SystemService

pingString

public java.lang.String pingString()
Specified by:
pingString in interface LocationManager

pingVoid

public void pingVoid()
Specified by:
pingVoid in interface LocationManager


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