unsw.cse.mica.runner
Class MicaRunner

java.lang.Object
  extended by unsw.cse.mica.runner.MicaRunner

public class MicaRunner
extends java.lang.Object

MicaRunner is a utility for controlling Agent processes. It is provides the necessary functionality for controlling a blackboard and multiple agents in separate processes. Configuration is via an XML document that specifies the Agents that will be used, along with screen size and location coordinates for a Frame that will contain that agent's GUI (if used) At present, it has the following limitations: - The blackboard is always 'JavaBlackboard' - the transports are always the XMLNet classes Notes: - Parameters are passed to the agents via the "arg" XML elements. - the "-autostart" option causes all the child processes to begin immediately. - the "-nogui" causes the system to run without a GUI. -nogui implies -autostart. Note: When -nogui is used, there are two possible conditions under which the runner will terminate: 1. The runner terminates once all the Agent processes are complete. 2. It terminates if the the string "exit" or "quit" is read off its input stream.

Author:
jhw

Field Summary
static long DEFAULT_INITIALISE_TIMEOUT
           
static long DEFAULT_TERMINATE_TIMEOUT
           
static java.lang.String ELEMENT_AGENT
           
static java.lang.String ELEMENT_BLACKBOARD
           
static java.lang.String ELEMENT_POS
           
static java.lang.String ELEMENT_RUNNER
           
static java.lang.String ELEMENT_SIZE
           
static java.lang.String ELEMENT_TERMTIMEOUT
           
static java.lang.String TERMINATE_MESSAGE
           
 
Constructor Summary
MicaRunner()
          Create with default settings (localhost, 8500)
 
Method Summary
 void consoleMode()
          This method watches for a 'terminate' string on System.in, and forwards the method to
 boolean create(java.lang.String filename)
           
 AgentHandler getAgent(int pos)
           
 AgentHandler getAgent(java.lang.String name)
           
 BlackboardHandler getBlackboard()
           
 java.awt.Point getLocation()
           
 int getNumAgents()
           
 java.awt.Dimension getSize()
           
static void main(java.lang.String[] args)
           
 void shutdown()
           
 void shutdown(long timeout)
           
 void startAll()
           
 void terminateAll(long timeout)
           
 void waitForAgents(java.lang.String state, long timeout)
          if timeout <= 0 then wait indefinitely
 void waitForBB(java.lang.String state, long timeout)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TERMINATE_MESSAGE

public static final java.lang.String TERMINATE_MESSAGE
See Also:
Constant Field Values

DEFAULT_INITIALISE_TIMEOUT

public static final long DEFAULT_INITIALISE_TIMEOUT
See Also:
Constant Field Values

DEFAULT_TERMINATE_TIMEOUT

public static final long DEFAULT_TERMINATE_TIMEOUT
See Also:
Constant Field Values

ELEMENT_RUNNER

public static final java.lang.String ELEMENT_RUNNER
See Also:
Constant Field Values

ELEMENT_AGENT

public static final java.lang.String ELEMENT_AGENT
See Also:
Constant Field Values

ELEMENT_BLACKBOARD

public static final java.lang.String ELEMENT_BLACKBOARD
See Also:
Constant Field Values

ELEMENT_SIZE

public static final java.lang.String ELEMENT_SIZE
See Also:
Constant Field Values

ELEMENT_POS

public static final java.lang.String ELEMENT_POS
See Also:
Constant Field Values

ELEMENT_TERMTIMEOUT

public static final java.lang.String ELEMENT_TERMTIMEOUT
See Also:
Constant Field Values
Constructor Detail

MicaRunner

public MicaRunner()
Create with default settings (localhost, 8500)

Method Detail

getLocation

public java.awt.Point getLocation()

getSize

public java.awt.Dimension getSize()

getNumAgents

public int getNumAgents()

getAgent

public AgentHandler getAgent(int pos)

getAgent

public AgentHandler getAgent(java.lang.String name)

getBlackboard

public BlackboardHandler getBlackboard()

startAll

public void startAll()

terminateAll

public void terminateAll(long timeout)

waitForAgents

public void waitForAgents(java.lang.String state,
                          long timeout)
if timeout <= 0 then wait indefinitely

Parameters:
timeout -

waitForBB

public void waitForBB(java.lang.String state,
                      long timeout)

create

public boolean create(java.lang.String filename)

shutdown

public void shutdown()

shutdown

public void shutdown(long timeout)

consoleMode

public void consoleMode()
This method watches for a 'terminate' string on System.in, and forwards the method to


main

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