xmlBlaster 2.2.0 contributions API

org.xmlBlaster.contrib.htmlmonitor
Class HtmlMonitorPlugin

java.lang.Object
  extended by org.xmlBlaster.contrib.htmlmonitor.HtmlMonitorPlugin
All Implemented Interfaces:
org.xmlBlaster.util.http.I_HttpRequest, org.xmlBlaster.util.plugin.I_Plugin

public class HtmlMonitorPlugin
extends java.lang.Object
implements org.xmlBlaster.util.plugin.I_Plugin, org.xmlBlaster.util.http.I_HttpRequest

HtmlMonitorPlugin is a native plugin to build simple HTML monitoring pages.

The HTML pages are available over the tiny xmlBlaster HTTP server.

This plugin needs to be registered in xmlBlasterPlugins.xml to be available on xmlBlaster server startup.

<plugin id='HtmlMonitorPlugin.MyCompany' className='org.xmlBlaster.contrib.htmlmonitor.HtmlMonitorPlugin'>
   <attribute id='urlPath'>/monitor</attribute>
   <attribute id='documentRoot'>${user.home}${file.separator}html</attribute>
   <attribute id='urlPath.CLASSPATH'>/status.html</attribute>
   <action do='LOAD' onStartupRunlevel='9' sequence='6' onFail='resource.configuration.pluginFailed'/>
   <action do='STOP' onShutdownRunlevel='6' sequence='5'/>
</plugin>
 

Setting urlPath to /monitor and documentRoot to /home/xmlblast/html and invoking in the browser http://localhost:3412/monitor/x.html will lookup /home/xmlblast/html/x.html

This plugin uses java.util.logging and redirects the logging to xmlBlasters default logging framework. You can switch this off by setting the attribute xmlBlaster/jdk14loggingCapture to false.

Author:
Marcel Ruff

Constructor Summary
HtmlMonitorPlugin()
          Default constructor, you need to call init() thereafter.
 
Method Summary
 java.lang.String get(java.lang.String key, java.lang.String def)
          Access a property.
 java.lang.String getType()
          The plugin name as configured im xmlBlasterPlugins.xml
 java.lang.String getVersion()
          The plugin version as configured in xmlBlasterPlugins.xml
 void init(org.xmlBlaster.util.Global global_, org.xmlBlaster.util.plugin.PluginInfo pluginInfo)
          This method is called by the PluginManager.
 org.xmlBlaster.util.http.HttpResponse service(java.lang.String urlPath, java.util.Map properties)
          A HTTP request needs to be processed
 void shutdown()
          Cleans up the resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HtmlMonitorPlugin

public HtmlMonitorPlugin()
Default constructor, you need to call init() thereafter.

Method Detail

init

public void init(org.xmlBlaster.util.Global global_,
                 org.xmlBlaster.util.plugin.PluginInfo pluginInfo)
          throws org.xmlBlaster.util.XmlBlasterException
Description copied from interface: org.xmlBlaster.util.plugin.I_Plugin
This method is called by the PluginManager.

Example how options are evaluated:

   // An entry in xmlBlaster.properties (in one line):
   MimeSubscribePlugin[ContentLenFilter][1.0]=\
                 org.xmlBlaster.engine.mime.demo.ContentLenFilter,\
                 DEFAULT_MAX_LEN=200,DEFAULT_MIN_LEN=20

  // Access it like this:
  java.util.Properties props = pluginInfo.getParameters();
  String maxLen = (String)props.get("DEFAULT_MAX_LEN");
  String throwLen = (String)props.get("THROW_EXCEPTION_FOR_LEN");
 

Specified by:
init in interface org.xmlBlaster.util.plugin.I_Plugin
Throws:
org.xmlBlaster.util.XmlBlasterException
See Also:
I_Plugin.init(org.xmlBlaster.util.Global, org.xmlBlaster.util.plugin.PluginInfo)

getType

public java.lang.String getType()
The plugin name as configured im xmlBlasterPlugins.xml

Specified by:
getType in interface org.xmlBlaster.util.plugin.I_Plugin
See Also:
I_Plugin.getType()

getVersion

public java.lang.String getVersion()
The plugin version as configured in xmlBlasterPlugins.xml

Specified by:
getVersion in interface org.xmlBlaster.util.plugin.I_Plugin
See Also:
I_Plugin.getVersion()

service

public org.xmlBlaster.util.http.HttpResponse service(java.lang.String urlPath,
                                                     java.util.Map properties)
A HTTP request needs to be processed

Specified by:
service in interface org.xmlBlaster.util.http.I_HttpRequest
Parameters:
urlPath - The url path like "/monitor/show.html" or "/status.html" which triggered this call contains the real file name as given in the browser window including the leading slash '/'.
properties - The key values from the browser
Returns:
The HTML page to return

shutdown

public void shutdown()
              throws org.xmlBlaster.util.XmlBlasterException
Description copied from interface: org.xmlBlaster.util.plugin.I_Plugin
Cleans up the resource.

Specified by:
shutdown in interface org.xmlBlaster.util.plugin.I_Plugin
Throws:
org.xmlBlaster.util.XmlBlasterException - if an exception occurs. The exception is handled by the RunLevelManager depending on how the plugin has been configured with the action:

<action do='STOP' onShutdownRunlevel='2' sequence='5' onFail='resource.configuration.pluginFailed'> If onFail is defined to something, the RunLevelManager will stop.

See Also:
I_Plugin.shutdown()

get

public java.lang.String get(java.lang.String key,
                            java.lang.String def)
Access a property.

Parameters:
key - The key to lookup
def - The default to return if key is not found
Returns:
The found value

xmlBlaster 2.2.0 contributions API

Copyright © 1999-2014 The xmlBlaster.org contributers.