org.nukesoft.lineproc
Class DynamicLoadLPContext

java.lang.Object
  |
  +--org.nukesoft.lineproc.DynamicLoadLPContext
All Implemented Interfaces:
LineProcContext

public class DynamicLoadLPContext
extends Object
implements LineProcContext

The DynamicLoadLPContext provides an internal implementation of the LineProcContext interface. It handles loading of the external LineProc class, as well as context maintnance. For each conversational dialog, there exists exactly one DynamicLoadLPContext. The context will reload a different LineProc if asked to do so by the LineProc. This keeps LineProc manipulation out of the Dialog implementation.

Author:
Ryan Michela

Constructor Summary
DynamicLoadLPContext(String defaultLibPath)
          Createst a DynamicLoadLPContext object and register a callback and an initial LineProc.
 
Method Summary
 void bindCallback(LineProcContextCallback callback)
          Binds a local callback.
 void bindConversation(String dialogID)
          Executes a conversation bind.
 String[] getConversations()
          Returns a list of active conversations.
 String getIdentity()
          Returns the dialog identity string.
 String getWarningLevel()
          Returns the current warning level.
 void handleIM(IM message)
          Forewards an incomming IM to the LineProc.
 void handleWarn(String screenName)
          Forewards an incomming warning to the LineProc.
 String lastLoadedLineProc()
          Returns the lib path to the last loaded line processor.
 void loadNewLineProc(String libPath)
          Loads a new line processor.
 void sendIM(IM message)
          Sends an IM.
 void sendWarning(String screenName, boolean anonymous)
          Sends a warning.
 void shutdown()
          Shuts down the current loaded line processor.
 void unbindConversation(String dialogID)
          Executes a conversation unbind.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynamicLoadLPContext

public DynamicLoadLPContext(String defaultLibPath)
Createst a DynamicLoadLPContext object and register a callback and an initial LineProc.

Parameters:
defaultLibPath -
Method Detail

bindCallback

public void bindCallback(LineProcContextCallback callback)
Binds a local callback.

Parameters:
callback - The callback.

sendIM

public void sendIM(IM message)
Sends an IM.

Specified by:
sendIM in interface LineProcContext
Parameters:
message - The IM to send.
See Also:
LineProcContext.sendIM(org.nukesoft.core.IM)

sendWarning

public void sendWarning(String screenName,
                        boolean anonymous)
Sends a warning.

Specified by:
sendWarning in interface LineProcContext
Parameters:
screenName - The sceen name to warn.
anonymous - If true, send an anonymous warning.
See Also:
LineProcContext.sendWarning(java.lang.String, boolean)

handleIM

public void handleIM(IM message)
Forewards an incomming IM to the LineProc.

Parameters:
message - The message to foreward.

handleWarn

public void handleWarn(String screenName)
Forewards an incomming warning to the LineProc.

Parameters:
screenName - The screen name that did the warning.

loadNewLineProc

public void loadNewLineProc(String libPath)
Loads a new line processor.

Specified by:
loadNewLineProc in interface LineProcContext
See Also:
LineProcContext.loadNewLineProc(java.lang.String)

lastLoadedLineProc

public String lastLoadedLineProc()
Returns the lib path to the last loaded line processor.

Specified by:
lastLoadedLineProc in interface LineProcContext
Returns:
Path.
See Also:
LineProcContext.lastLoadedLineProc()

getWarningLevel

public String getWarningLevel()
Returns the current warning level.

Specified by:
getWarningLevel in interface LineProcContext
Returns:
Integer string containing warning level if warning is supported on the supporting network. "N/A" if warning is not.
See Also:
LineProcContext.getWarningLevel()

getConversations

public String[] getConversations()
Returns a list of active conversations.

Specified by:
getConversations in interface LineProcContext
Returns:
String array with fully qualified conversation names in the format CommPortBindName:ForeignScreenName.
See Also:
LineProcContext.getConversations()

bindConversation

public void bindConversation(String dialogID)
Executes a conversation bind.

Specified by:
bindConversation in interface LineProcContext
Parameters:
dialogID - The dialog to bind to.
See Also:
LineProcContext.bindConversation(java.lang.String)

unbindConversation

public void unbindConversation(String dialogID)
Executes a conversation unbind.

Specified by:
unbindConversation in interface LineProcContext
Parameters:
dialogID - The dialog to unbind from.
See Also:
LineProcContext.unbindConversation(java.lang.String)

getIdentity

public String getIdentity()
Returns the dialog identity string.

Specified by:
getIdentity in interface LineProcContext
Returns:
Identity string in the form CommPortBindName:ForeignScreenName.
See Also:
LineProcContext.getIdentity()

shutdown

public void shutdown()
Shuts down the current loaded line processor.