|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xmlBlaster.engine.mime.regex.GnuRegexFilter
public class GnuRegexFilter
This regex plugin allows to filter message contents with regular expressions.
Message contents which don't match the regular expression are not send via update() or updateOneway() to the subscriber. The same filter may be used for the synchronous get() access and for clusters to map messages to master nodes. Please register this plugin in xmlBlaster.properties:MimeAccessPlugin[GnuRegexFilter][1.0]=org.xmlBlaster.engine.mime.regex.GnuRegexFilterPlugins must implement the I_Plugin interface to be loadable by the PluginManager and must implement the I_AccessFilter interface to be usable as a filter. NOTE: Since JDK 1.4 we have a java.util.regex package, but regrettably this can't be used with JDK 1.2 or JDK 1.3. If you want to use Suns package just copy this class and code it with suns implementation in our match() method:
import java.util.regex.Pattern; import java.util.regex.Matcher; ... query.setPreparedQuery(Pattern.compile(query.getQuery())); ... Matcher m = preparedQuery.matcher(msgUnit.getContentStr()); return m.matches();
Field Summary | |
---|---|
private ServerScope |
glob
|
private static java.util.logging.Logger |
log
|
private java.lang.String |
ME
|
Constructor Summary | |
---|---|
GnuRegexFilter()
|
Method Summary | |
---|---|
java.lang.String[] |
getMimeExtended()
Get the content MIME version number for which this plugin applies |
java.lang.String[] |
getMimeTypes()
Get the content MIME type for which this plugin applies |
java.lang.String |
getName()
Get a human readable name of this filter implementation |
java.lang.String |
getType()
Return plugin type for Plugin loader |
java.lang.String |
getVersion()
Return plugin version for Plugin loader |
void |
init(Global glob,
PluginInfo pluginInfo)
This method is called by the PluginManager (enforced by I_Plugin). |
void |
initialize(ServerScope glob)
This is called after instantiation of the plugin |
boolean |
match(SessionInfo receiver,
MsgUnit msgUnit,
Query query)
Check if the filter rule matches for this message. |
void |
shutdown()
Cleans up the resource. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final java.lang.String ME
private ServerScope glob
private static java.util.logging.Logger log
Constructor Detail |
---|
public GnuRegexFilter()
Method Detail |
---|
public void initialize(ServerScope glob)
initialize
in interface I_AccessFilter
glob
- The Global handle of this xmlBlaster server instance.public void init(Global glob, PluginInfo pluginInfo)
init
in interface I_Plugin
I_Plugin.init(org.xmlBlaster.util.Global,org.xmlBlaster.util.plugin.PluginInfo)
public java.lang.String getType()
getType
in interface I_Plugin
public java.lang.String getVersion()
getVersion
in interface I_Plugin
public java.lang.String getName()
getName
in interface I_AccessFilter
public java.lang.String[] getMimeTypes()
getMimeTypes
in interface I_AccessFilter
public java.lang.String[] getMimeExtended()
getMimeExtended
in interface I_AccessFilter
public boolean match(SessionInfo receiver, MsgUnit msgUnit, Query query) throws XmlBlasterException
match
in interface I_AccessFilter
publisher
- The subject object describing the publisherreceiver
- The subject object describing the receivermsgUnit
- The message to checkquery
- The Query instance holding the regular expression from your filter.see
- I_AccessFilter#match()
XmlBlasterException
- Is thrown on problems, for example if the MIME type
does not fit to message content.public void shutdown()
I_Plugin
shutdown
in interface I_AccessFilter
shutdown
in interface I_Plugin
|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |