org.nukesoft.bot2.lineproc
Class GenericLineProc

java.lang.Object
  |
  +--org.nukesoft.bot2.lineproc.GenericLineProc
All Implemented Interfaces:
LineProc
Direct Known Subclasses:
AdminLineProc, ConsoleLineProc, EchoLineProc, ReverseLineProc, WeatherReportLineProc

public abstract class GenericLineProc
extends Object
implements LineProc

GenericLineProc is an abstract interpretation of the LineProc interface. It provides stub implementations of all the required methods.

Author:
Ryan Michela

Field Summary
protected  LineProcContext context
          A reference to this LineProc's LineProcContext.
protected  String myCommLibBindID
          The bind ID of the comm lib handleing this dialog.
protected  String remoteScreenName
          The dialog bind name of this LineProc's associated IM client.
 
Constructor Summary
GenericLineProc()
           
 
Method Summary
 void bindContext(LineProcContext context)
          Binds a context to the line processor.
protected  void delay(int minDelay, int maxDelay)
          Causes this thread to sleep for a few seconds.
abstract  void handleIM(IM message)
          Handles an incomming IM.
 void handleWarn(String screenName)
          Handles an incomming warning.
 void init(String screenName)
          Called as soon as a line processor is loaded.
 void shutdown()
          Shuts down the line processor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

protected LineProcContext context
A reference to this LineProc's LineProcContext.


remoteScreenName

protected String remoteScreenName
The dialog bind name of this LineProc's associated IM client.


myCommLibBindID

protected String myCommLibBindID
The bind ID of the comm lib handleing this dialog.

Constructor Detail

GenericLineProc

public GenericLineProc()
Method Detail

init

public void init(String screenName)
Description copied from interface: LineProc
Called as soon as a line processor is loaded. Used to perform any necesary initialization. It is better to do initialization here because you have access to the remote screen name of the person doing the initialization.

Specified by:
init in interface LineProc
Parameters:
screenName - The name of the dialog that is initializing the line processor.
See Also:
LineProc.init(java.lang.String)

bindContext

public void bindContext(LineProcContext context)
Description copied from interface: LineProc
Binds a context to the line processor.

Specified by:
bindContext in interface LineProc
Parameters:
context - The context to bind.
See Also:
LineProc.bindContext(org.nukesoft.bot2.lineproc.LineProcContext)

handleIM

public abstract void handleIM(IM message)
Description copied from interface: LineProc
Handles an incomming IM. This method should generate a response IM, but that is not required.

Specified by:
handleIM in interface LineProc
Parameters:
message - The incomming message.
See Also:
LineProc.handleIM(org.nukesoft.bot2.core.IM)

handleWarn

public void handleWarn(String screenName)
Description copied from interface: LineProc
Handles an incomming warning.

Specified by:
handleWarn in interface LineProc
Parameters:
screenName - The screen name doing the warning.
See Also:
LineProc.handleWarn(java.lang.String)

shutdown

public void shutdown()
Description copied from interface: LineProc
Shuts down the line processor. Used to kill any started threads.

Specified by:
shutdown in interface LineProc
See Also:
LineProc.shutdown()

delay

protected void delay(int minDelay,
                     int maxDelay)
Causes this thread to sleep for a few seconds. Can be used to create the effect of the bot typing a response.

Parameters:
minDelay - The minimum number of seconds to sleep for.
maxDelay - The maximum number of seconds to sleep for.