net.openai.ai.agent
Class Daemon

java.lang.Object
  |
  +--net.openai.ai.agent.Daemon
All Implemented Interfaces:
AgentConstants

public final class Daemon
extends java.lang.Object
implements AgentConstants

This is the "portal" that allows the transmission of Agents between hosts.


Field Summary
static java.lang.String OPTION_AGENTS
          The command-line option to specify the list of agents to start.
static java.lang.String OPTION_CONFIG
          The command-line option to specify the XML configuration file.
static java.lang.String OPTION_LOG
          The command-line option to specify the output log file.
static java.lang.String OPTION_PORT
          The command-line option to specify the port.
static java.lang.String OPTION_SERVICES
          The command-line option to specify the list of services to start.
static java.lang.String OPTION_VERBOSE
          The command-line option to specify that the output should be echoed to stdout as well.
 
Fields inherited from interface net.openai.ai.agent.AgentConstants
AGENT_CONTINUE, AGENT_RETURN_TO_SENDER, AGENT_START
 
Method Summary
 int getAgentCount()
          Returns the number of active agents for this Daemon.
static int[] getDaemonPorts()
          Returns a list of ports that Daemons are running on.
 DaemonDescription getDescription()
          Returns a description of the Daemon as a DaemonDescription.
static java.lang.String getHostIP()
          Returns the host IP for the local host that the Daemon is running on.
static java.lang.String getHostName()
          Returns the hostname for the local host that the Daemon is running on.
static Daemon getInstance(int port)
          Returns an instance of a Daemon running on a particular port.
 java.io.PrintStream getLogStream()
          Returns a handle to the PrintStream that the Daemon will be printing to.
 int getPort()
          Returns the port that the Daemon is running on.
 DaemonService[] getServices()
          Returns a list of active services associated with this Daemon.
static void main(java.lang.String[] args)
          The main entry point for the OsMoSys application.
 void shutdown()
          Shuts down the Daemon.
 void startAgent(Agent agent)
          Starts an agent in its own Thread.
static void startDaemon(java.util.Hashtable options)
          Starts up a Daemon with the given options contained in the Hashtable.
 void startService(DaemonService service)
          Starts a service in its own Thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPTION_PORT

public static final java.lang.String OPTION_PORT
The command-line option to specify the port.

See Also:
Constant Field Values

OPTION_AGENTS

public static final java.lang.String OPTION_AGENTS
The command-line option to specify the list of agents to start.

See Also:
Constant Field Values

OPTION_SERVICES

public static final java.lang.String OPTION_SERVICES
The command-line option to specify the list of services to start.

See Also:
Constant Field Values

OPTION_CONFIG

public static final java.lang.String OPTION_CONFIG
The command-line option to specify the XML configuration file.

See Also:
Constant Field Values

OPTION_LOG

public static final java.lang.String OPTION_LOG
The command-line option to specify the output log file.

See Also:
Constant Field Values

OPTION_VERBOSE

public static final java.lang.String OPTION_VERBOSE
The command-line option to specify that the output should be echoed to stdout as well. This option is automatically enabled if no logging file is given.

See Also:
Constant Field Values
Method Detail

getInstance

public static final Daemon getInstance(int port)
                                throws java.io.IOException
Returns an instance of a Daemon running on a particular port. If a Daemon is already running on that port, it is returned. If there is no Daemon running, a new one is started.

Returns:
The Daemon running on the given port.
java.io.IOException

getDaemonPorts

public static final int[] getDaemonPorts()
Returns a list of ports that Daemons are running on.

Returns:
A list of ports that known Daemons are running on in this VM.

getHostIP

public static final java.lang.String getHostIP()
Returns the host IP for the local host that the Daemon is running on.

Returns:
The host IP for the local host.

getHostName

public static final java.lang.String getHostName()
Returns the hostname for the local host that the Daemon is running on.

Returns:
The hostname for the local host.

getPort

public final int getPort()
Returns the port that the Daemon is running on.

Returns:
The port for the Daemon.

getServices

public final DaemonService[] getServices()
Returns a list of active services associated with this Daemon.

Returns:
A list of active DaemonServices.

getDescription

public final DaemonDescription getDescription()
Returns a description of the Daemon as a DaemonDescription.

Returns:
A DaemonDescription object describing the Daemon.

getLogStream

public final java.io.PrintStream getLogStream()
Returns a handle to the PrintStream that the Daemon will be printing to.

Returns:
The PrintStream that the Daemon will print to.

startService

public final void startService(DaemonService service)
Starts a service in its own Thread. Alternatively, the startAgent method can be used, but that will simply check the type and call the startService method.

Parameters:
service - The DaemonService to start.

startAgent

public final void startAgent(Agent agent)
Starts an agent in its own Thread.

Parameters:
agent - The Agent to start.

getAgentCount

public final int getAgentCount()
Returns the number of active agents for this Daemon.


shutdown

public final void shutdown()
Shuts down the Daemon.


startDaemon

public static final void startDaemon(java.util.Hashtable options)
                              throws java.io.IOException,
                                     java.lang.IllegalArgumentException
Starts up a Daemon with the given options contained in the Hashtable. All options must be stored in the Hashtable as Strings.
FIXME: add more comments.

java.io.IOException
java.lang.IllegalArgumentException

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
The main entry point for the OsMoSys application.

java.lang.Exception


Copyright - 2001 OpenAI Labs. All Rights Reserved.