net.jetrix.filter
Class MessageFilter

java.lang.Object
  extended by net.jetrix.filter.MessageFilter
Direct Known Subclasses:
AmplifierFilter, GenericFilter, PingFilter

public abstract class MessageFilter
extends Object

Abstract class defining a channel filter. A filter transforms a given message into a list of messages. Concrete filters just need to inherit from this class and implement the process() method.

Version:
$Revision: 550 $, $Date: 2005-01-06 13:26:21 +0100 (jeu., 06 janv. 2005) $
Author:
Emmanuel Bourg

Field Summary
protected  FilterConfig config
           
 
Constructor Summary
MessageFilter()
           
 
Method Summary
 void destroy()
          Called by the channel to indicate to a filter that the filter is being taken out of service.
 String getAuthor()
          Returns the author of this filter.
 Channel getChannel()
          Returns the channel this filter applies on.
 FilterConfig getConfig()
          Return the configuration used to initialize this filter.
 String getDescription()
          Returns a short description of this filter.
 String getName()
          Returns the name of this filter.
 String getProperty(String key)
          Gets the filter property indicated by the specified key.
 String getVersion()
          Returns the version of this filter
 void init()
          Called by the channel to indicate to a filter that the filter is being placed into service.
 boolean isShared()
          Indicates if the filter is shared or not.
abstract  void process(Message m, List<Message> out)
          Process a message and outputs messages to the specified List.
 void setChannel(Channel channel)
          Sets the channel this filter applies on.
 void setConfig(FilterConfig config)
          Set the configuration used to initialize this filter.
 void setProperty(String key, String value)
          Sets the filter property indicated by the specified key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

config

protected FilterConfig config
Constructor Detail

MessageFilter

public MessageFilter()
Method Detail

isShared

public boolean isShared()
Indicates if the filter is shared or not. A shared filter should be a singleton if it's independant from the channel context (for example: a color stripper or a profanity filter). By default a filter is not a singleton. This method must be overwritten to return true if the filter is meant to be instanciated only once.

Returns:
false

init

public void init()
Called by the channel to indicate to a filter that the filter is being placed into service.


setConfig

public void setConfig(FilterConfig config)
Set the configuration used to initialize this filter.


getConfig

public FilterConfig getConfig()
Return the configuration used to initialize this filter.


destroy

public void destroy()
Called by the channel to indicate to a filter that the filter is being taken out of service.


process

public abstract void process(Message m,
                             List<Message> out)
Process a message and outputs messages to the specified List.


getName

public String getName()
Returns the name of this filter.


getDescription

public String getDescription()
Returns a short description of this filter.


getVersion

public String getVersion()
Returns the version of this filter


getAuthor

public String getAuthor()
Returns the author of this filter.


getProperty

public final String getProperty(String key)
Gets the filter property indicated by the specified key.


setProperty

public final void setProperty(String key,
                              String value)
Sets the filter property indicated by the specified key.


getChannel

public final Channel getChannel()
Returns the channel this filter applies on.


setChannel

public final void setChannel(Channel channel)
Sets the channel this filter applies on.



Copyright © 2001-2008 Emmanuel Bourg. All Rights Reserved.