com.shimari.bot
Class Bot

java.lang.Object
  extended bycom.shimari.bot.Bot
All Implemented Interfaces:
Component, java.lang.Runnable

public class Bot
extends java.lang.Object
implements java.lang.Runnable, Component

A Bot is dynamically constructed from a bunch of components. This Bot class is the glue that brings them all together: the Bot object contains the main loop, and glues Connections to Handlers. The Connections send/receive messages to the Bot, and the Handlers process those messages. Some of the Handlers also implement the Cron.Task interface, and have periodically executed behavior. An actual implementation of a Bot in effect configures the Bot with all the right Handler and Connection objects.


Constructor Summary
Bot(Config configuration)
          The default constructor for a Bot -- we must have this so that the Bot can be constructed and configured easily from a configuration file.
Bot(java.lang.String configResource)
           
 
Method Summary
 Channel getBroadcastChannel()
          Return a channel which can be used to talk to everyone who is interested in listening to this bot
 void init(Registry componentMap)
           
 boolean isRunning()
           
 void run()
          The main loop.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Bot

public Bot(Config configuration)
    throws ConfigException
The default constructor for a Bot -- we must have this so that the Bot can be constructed and configured easily from a configuration file. See: JavaBeans.


Bot

public Bot(java.lang.String configResource)
    throws ConfigException
Method Detail

init

public void init(Registry componentMap)
Specified by:
init in interface Component

isRunning

public boolean isRunning()

getBroadcastChannel

public Channel getBroadcastChannel()
Return a channel which can be used to talk to everyone who is interested in listening to this bot


run

public void run()
The main loop. We will start the cron scheduler, start all the worker threads, and then periodically check our connectors to make sure they are OK--if they are not OK we will try and reconnect them.

Specified by:
run in interface java.lang.Runnable