agentserver
Class AgentServer

java.lang.Object
  |
  +--fipaos.agent.FIPAOSAgent
        |
        +--agentserver.AgentServer
All Implemented Interfaces:
fipaos.agent.conversation.ConversationListener, LocalMsg

public class AgentServer
extends fipaos.agent.FIPAOSAgent
implements LocalMsg

AgentServer implements an AgentServer for FIPAOS.

An AgentServer provides a lightweight process space, which can be used to host other agents. The AgentServer extends the FIPAOSAgent shell.

All requests are sent using the agentserver-management ontology. Any other ontology is ignored. The possible requests are:

When a create request is recieved, or a create, agents are created in this process space.

The list request will return a list of the agents currently running in this AgentServer.

The properties request will return the name of this AgentServer and the number of agents currently hosted by this AgentServer, and the maximum number of agents this agentserver can host.

An agentserver can be run with or without a gui, depending on command line switches.

The agentserver has a limit of the number of agents that it can start. This is settable via command line swtiches.

Usage:
java fipaos.agentserver.AgentServer


Inner Class Summary
 class AgentServer.CreateTask
          Create an agent
 class AgentServer.IdleTask
          IdleTask.
 class AgentServer.ListTask
          List the agents that have been created in this AgentServer.
 class AgentServer.PropertiesTask
          List the properties of this AgentServer.
 
Inner classes inherited from class fipaos.agent.FIPAOSAgent
fipaos.agent.FIPAOSAgent.TopLevelHandlerTask
 
Fields inherited from class fipaos.agent.FIPAOSAgent
_database_profile, _registered_with, _state, _tm
 
Constructor Summary
AgentServer(java.lang.String platform, java.lang.String name, java.lang.String ownership, java.lang.String ma, java.lang.String gui)
          constructor - sets up an IdleTask as the default ListenerTask for incoming messages, and starts off registration with the AMS and DF
 
Method Summary
 void activate()
          This method is invoked when GUI should be shown - generally this is invoked by the AgentLoader when the Agent is in the List of running Agents - the default implementation in FIPAOSAgent does nothing.
 LocalPostOffice getLocalPostOffice()
          return the current localpostoffice object
static void main(java.lang.String[] args)
          Test-harness
 boolean sendReply(fipaos.ont.fipa.ACL orig_acl, java.lang.String performative)
           
 boolean sendReply(fipaos.ont.fipa.ACL orig_acl, java.lang.String performative, java.lang.String content)
          Send a reply message in response to the given ACL message
 void setLocalPostOffice(LocalPostOffice localpo)
          set the localpostoffice to the given argument
 void shutdown()
          Invoked when this Agent is about to be shutdown - this overrides the shutdown() method in the FIPAOSAgent class to enable the AgentServerGUI associated with this AgentServer to be removed
 boolean startAgent(java.lang.String class_name, java.lang.String agent_name, java.lang.String owner, java.lang.String[] parameters)
          Starts an agent
 void writeMsg(java.lang.String msg)
          write a message, either to the GUI or to system.out
 
Methods inherited from class fipaos.agent.FIPAOSAgent
addNewProtocol, deregisterWithAMS, deregisterWithDF, forward, forward, getAID, getCM, getCurrentConversation, getHAP, getLocalAMS, getLocalAMSAID, getLocalDF, getLocalDFAID, getNewConversation, getOwnership, getPlatformProfile, getProfile, getState, isShutdown, knowsProtocol, notify, notify, notifyDone, notifyError, notifyMessageInEndedConversation, notifyMessageUndeliverable, notifyTimeout, registeredWith, registeredWithAMS, registeredWithDF, registerWithAMS, registerWithAMS, registerWithAMS, registerWithAMS, registerWithDF, registerWithDF, registerWithDF, registerWithDF, sendNotUnderstood, sendNotUnderstood, setListenerTask, setMessageSender, startPushing, waitForPushLock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgentServer

public AgentServer(java.lang.String platform,
                   java.lang.String name,
                   java.lang.String ownership,
                   java.lang.String ma,
                   java.lang.String gui)
constructor - sets up an IdleTask as the default ListenerTask for incoming messages, and starts off registration with the AMS and DF
Method Detail

shutdown

public void shutdown()
Invoked when this Agent is about to be shutdown - this overrides the shutdown() method in the FIPAOSAgent class to enable the AgentServerGUI associated with this AgentServer to be removed
Overrides:
shutdown in class fipaos.agent.FIPAOSAgent

activate

public void activate()
This method is invoked when GUI should be shown - generally this is invoked by the AgentLoader when the Agent is in the List of running Agents - the default implementation in FIPAOSAgent does nothing.
Overrides:
activate in class fipaos.agent.FIPAOSAgent

setLocalPostOffice

public void setLocalPostOffice(LocalPostOffice localpo)
set the localpostoffice to the given argument
Specified by:
setLocalPostOffice in interface LocalMsg

getLocalPostOffice

public LocalPostOffice getLocalPostOffice()
return the current localpostoffice object
Specified by:
getLocalPostOffice in interface LocalMsg

writeMsg

public void writeMsg(java.lang.String msg)
write a message, either to the GUI or to system.out

sendReply

public boolean sendReply(fipaos.ont.fipa.ACL orig_acl,
                         java.lang.String performative,
                         java.lang.String content)
Send a reply message in response to the given ACL message
Parameters:
acl - The ACL object to reply to
performative - The performative
content - Any additional message

sendReply

public boolean sendReply(fipaos.ont.fipa.ACL orig_acl,
                         java.lang.String performative)

startAgent

public boolean startAgent(java.lang.String class_name,
                          java.lang.String agent_name,
                          java.lang.String owner,
                          java.lang.String[] parameters)
Starts an agent
Parameters:
agent_name - Name of the Agent to start
class_name - Name of the class for this Agent
owner - Owner of the Agent

main

public static void main(java.lang.String[] args)
Test-harness