org.iids.aos.agentserver
Class LocalAgentServer

java.lang.Object
  extended by org.iids.aos.systemservices.LocalSystemService
      extended by org.iids.aos.agentserver.LocalAgentServer
All Implemented Interfaces:
AgentServer, SystemService

public class LocalAgentServer
extends LocalSystemService
implements AgentServer

Local binding of an agent server interface. Runs directly on top of an AgentRunner for transparency.

Author:
rjtimmer@cs.vu.nl

Field Summary
 
Fields inherited from interface org.iids.aos.systemservices.AgentServer
FINISHED_AGENT, LOOKUP_REGISTRATION_NAME
 
Constructor Summary
LocalAgentServer(AgentRunner ar)
           
 
Method Summary
 java.lang.String do_http_request(java.lang.String request)
           
 java.util.Vector<AgentID> get_agents()
           
static LocalAgentServer get(AgentScapeID id)
          Returns the local location manager with name id if it exists in this JVM.
 int getAgentCPUtime(AgentID agentID)
           
 void pingService()
           
 void remove_agent(AgentID agentId)
          Remove agent from the agent server.
static void remove(AgentScapeID id)
          Remove static registration of an agent server.
 void shutdown()
           
 void start_agent(AgentID agentId, java.lang.String[] args)
          Start running an agent on this agent server.
 void suspend_agent(AgentID agentId)
          Suspend the running agent and, if possible, store its state in the container belonging to the agent.
 void unbind()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalAgentServer

public LocalAgentServer(AgentRunner ar)
Method Detail

start_agent

public void start_agent(AgentID agentId,
                        java.lang.String[] args)
                 throws AgentIDUnknownException,
                        AgentStartupException
Description copied from interface: AgentServer
Start running an agent on this agent server. Agent code is read from the agent container (through the API).

Specified by:
start_agent in interface AgentServer
Parameters:
agentId - The AgentID of the agent to register.
Throws:
AgentIDUnknownException - If the agent is not known by the host manager.
AgentStartupException - If the agent implementation cannot be loaded or started.

suspend_agent

public void suspend_agent(AgentID agentId)
                   throws AgentIDUnknownException,
                          AgentSuspendException
Description copied from interface: AgentServer
Suspend the running agent and, if possible, store its state in the container belonging to the agent.

If the AgentRunner that implements this function supports this, the agent state is automatically written to the agent container, though this depends on the implementation of the agent server.

Specified by:
suspend_agent in interface AgentServer
Parameters:
agentId - The AgentID of the agent to suspend.
Throws:
AgentIDUnknownException - The AgentID is not known on this agent server.
AgentSuspendException - Problem suspending the agent.

remove_agent

public void remove_agent(AgentID agentId)
                  throws AgentIDUnknownException
Description copied from interface: AgentServer
Remove agent from the agent server. If possible, the agent process is also killed, though it depends on the agent server implementation whether this actually is possible.

Specified by:
remove_agent in interface AgentServer
Parameters:
agentId - The AgentID of the agent to remove.
Throws:
AgentIDUnknownException - The AgentID is not known on this agent server.

get_agents

public java.util.Vector<AgentID> get_agents()
Specified by:
get_agents in interface AgentServer

getAgentCPUtime

public int getAgentCPUtime(AgentID agentID)
                    throws AgentIDUnknownException
Specified by:
getAgentCPUtime in interface AgentServer
Throws:
AgentIDUnknownException

unbind

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

shutdown

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

get

public static LocalAgentServer 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 LocalAgentServer of the location, if it exists. Otherwise this function returns null, which also indicates that the LocationManager for this location runs somewhere else.

remove

public static void remove(AgentScapeID id)
Remove static registration of an agent server. Can be called for example whenever an agent server implementation shuts down. Should prefrerrably not be called by other parties, but it is required to be public because agent servers reside in a different package than their language-specific implementation classes.


pingService

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

do_http_request

public java.lang.String do_http_request(java.lang.String request)
Specified by:
do_http_request in interface AgentServer


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