org.iids.aos.agentserver
Class AgentWrapper

java.lang.Object
  extended by org.iids.aos.agentserver.AgentWrapper
Direct Known Subclasses:
BinaryAgentWrapper, JavaAgentWrapper

public abstract class AgentWrapper
extends java.lang.Object

Mechanism that allows the middleware to interact with a running agent. This mainly consists of passing messages and other meta information (such as its location ID) to agents.

This class is abstract, so that it cannot be used directly. Even though it has no abstract methods itself. Any implementation should probably overload the start() and stop() methods. The agent wrapper should preferably take care of managing and monitoring the state of the running agent, though this is not enforced.

Author:
hidde (original), rjtimmer

Field Summary
protected  AgentHandle agentHandle
           
protected  AgentScapeID locationId
           
 
Constructor Summary
AgentWrapper(AgentHandle agentHandle)
           
 
Method Summary
 void addMessage(byte[] data)
          Deliver message to agent.
 AgentHandle getAgentHandle()
           
 long getAgentStartTime()
           
 java.lang.String getContainerId()
           
 AgentScapeID getLocationId()
           
 byte[] getMessage(boolean block)
           
 boolean isSuspended()
           
 void setContainerId(java.lang.String _containerId)
           
 void setLocationId(AgentScapeID _locationId)
           
 void setSuspended(boolean suspended)
           
abstract  void start()
          Start running the agent.
abstract  void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

agentHandle

protected AgentHandle agentHandle

locationId

protected AgentScapeID locationId
Constructor Detail

AgentWrapper

public AgentWrapper(AgentHandle agentHandle)
Method Detail

setLocationId

public void setLocationId(AgentScapeID _locationId)

getAgentHandle

public AgentHandle getAgentHandle()

setContainerId

public void setContainerId(java.lang.String _containerId)

getContainerId

public java.lang.String getContainerId()

getMessage

public byte[] getMessage(boolean block)

addMessage

public void addMessage(byte[] data)
Deliver message to agent. The message is appended to the back of the incoming message queue of the agent. Delivery is in-order.

Parameters:
data - The message to deliver.

start

public abstract void start()
                    throws AgentStartupException
Start running the agent. In this abstract class, the agent is not really started. This should be handled by the respective implementation.

Throws:
AgentStartupException

stop

public abstract void stop()

getLocationId

public AgentScapeID getLocationId()

getAgentStartTime

public long getAgentStartTime()

isSuspended

public boolean isSuspended()

setSuspended

public void setSuspended(boolean suspended)


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