com.aelitis.azureus.core.messenger.browser.listeners
Class AbstractBrowserMessageListener

java.lang.Object
  extended by com.aelitis.azureus.core.messenger.browser.listeners.AbstractBrowserMessageListener
All Implemented Interfaces:
BrowserMessageListener
Direct Known Subclasses:
ConfigListener, DisplayListener, MetaSearchListener, TorrentListener, VuzeListener

public abstract class AbstractBrowserMessageListener
extends Object
implements BrowserMessageListener

Accepts and handles messages dispatched from BrowserMessageDispatcher. Subclasses should use the message's operation ID and parameters to perform the requested operation.

Author:
dharkness

Field Summary
protected  ClientMessageContext context
           
 
Constructor Summary
AbstractBrowserMessageListener(String id)
          Stores the given context for accessing the browser and its services.
 
Method Summary
protected  void debug(String message)
          Displays a debug message tagged with the listener ID.
 void debug(String message, Throwable t)
          Displays a debug message and exception tagged with the listener ID.
 ClientMessageContext getContext()
          Returns the context for this listener.
 String getId()
          Returns the unique ID for this listener.
abstract  void handleMessage(BrowserMessage message)
          Handles the given message, usually by parsing the parameters and calling the appropriate operation.
 void setContext(ClientMessageContext context)
          Sets the context for this listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

protected ClientMessageContext context
Constructor Detail

AbstractBrowserMessageListener

public AbstractBrowserMessageListener(String id)
Stores the given context for accessing the browser and its services.

Parameters:
context - used to access the browser
Method Detail

debug

protected void debug(String message)
Displays a debug message tagged with the listener ID.

Parameters:
message - sent to the debug log

debug

public void debug(String message,
                  Throwable t)
Displays a debug message and exception tagged with the listener ID.

Parameters:
message - sent to the debug log
t - exception to log with message

getContext

public ClientMessageContext getContext()
Returns the context for this listener.

Specified by:
getContext in interface BrowserMessageListener
Returns:
listener's context

getId

public String getId()
Returns the unique ID for this listener.

Specified by:
getId in interface BrowserMessageListener
Returns:
listener's unique ID

handleMessage

public abstract void handleMessage(BrowserMessage message)
Handles the given message, usually by parsing the parameters and calling the appropriate operation.

Specified by:
handleMessage in interface BrowserMessageListener
Parameters:
message - holds all message information

setContext

public void setContext(ClientMessageContext context)
Sets the context for this listener. Called by its dispatcher when attached.

Specified by:
setContext in interface BrowserMessageListener
Parameters:
context - the new context for this listener