xmlBlaster 2.2.0 API

org.xmlBlaster.engine.mime
Interface I_PublishFilter

All Known Implementing Classes:
PublishDelayer, PublishLenChecker, ReplManagerPlugin

public interface I_PublishFilter

This interface hides the real implementation used to intercept published messages.

The interface may be used to filter/check/manipulate messages arriving with publish(). Only messages where the intercept() method returns "OK" or "" are accepted and passed to the xmlBlaster core for processing.

Note that you can manipulate the content of a message with your plugin but changing the XmlKey or QoS is not allowed.

The plugin with your filter rules must implement this interface.

Steps to add a new plugin:

Version:
$Revision: 1.4 $
Author:
xmlBlaster@marcelruff.info

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 types for which this plugin applies, "*" is for all mime types
 java.lang.String getName()
          Get a human readable name of this filter implementation
 void initialize(ServerScope glob)
          This is called after instantiation of the plugin
 java.lang.String intercept(SubjectInfo publisher, MsgUnit msgUnit)
          Add your business code with your implementation of inercept().
 void shutdown()
           
 

Method Detail

initialize

void initialize(ServerScope glob)
This is called after instantiation of the plugin

Parameters:
glob - The Global handle of this xmlBlaster server instance.

getName

java.lang.String getName()
Get a human readable name of this filter implementation


getMimeTypes

java.lang.String[] getMimeTypes()
Get the content MIME types for which this plugin applies, "*" is for all mime types

Returns:
The supported mime types, for example return { "text/plain", "text/xml", "application/mytext" };

getMimeExtended

java.lang.String[] getMimeExtended()
Get the content MIME version number for which this plugin applies. The returned String array length must be the same as this of getMimeTypes(), the index corresponds to the index of getMimeTypes().
For example "stable" is the extended mime type of "application/mytext" (see getMimeTypes()).

Returns:
E.g. a string array like { "1.0", "1.3", "stable" }

intercept

java.lang.String intercept(SubjectInfo publisher,
                           MsgUnit msgUnit)
                           throws XmlBlasterException
Add your business code with your implementation of inercept().

You may manipulate the content of the message, but not the key and qos or other attributes of the MsgUnit object.

Parameters:
publisher - The subject object describing the publisher
msgUnit - The message to check
Returns:
"" or "OK": The message is accepted
Any other string: The message is rejected and your string is passed back to the publisher.
Throws:
XmlBlasterException - Is thrown on problems, for example if the MIME type does not fit to message content.
Take care throwing an exception, as the exception is routed back to the publisher. If the publish() had many messages (a MsgUnit[]), all other messages are lost as well. Probably it is best to return 'ERROR' instead and log the situation.

shutdown

void shutdown()

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.