|
xmlBlaster 1.6.2 API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.xmlBlaster.contrib.htmlmonitor.HtmlMonitorPlugin
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.
| Field Summary | |
private CommandManager |
commandManager
|
private java.lang.String |
documentRoot
|
private ServerScope |
global
|
private HttpIORServer |
httpServer
|
private static java.util.logging.Logger |
log
|
private java.util.Map |
mimeTypes
|
private PluginInfo |
pluginInfo
|
private ReplaceVariable |
replaceVariable
|
private java.util.Set |
urlPathClasspathSet
|
| 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. |
private java.lang.String |
getMimeType(java.lang.String fileName)
|
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(Global global_,
PluginInfo pluginInfo)
This method is called by the PluginManager. |
private void |
invokeAction(java.lang.String parameter)
Checks for parameter in the URL and if it contains an invokeAction part, it starts this action. |
private java.lang.String |
lookup(java.lang.String query)
Lookup the given administrative command. |
private java.lang.String |
replaceAllVariables(java.lang.String template)
Replace ${...} occurrences. |
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 |
| Field Detail |
private static java.util.logging.Logger log
private ServerScope global
private PluginInfo pluginInfo
private HttpIORServer httpServer
private java.util.Set urlPathClasspathSet
private java.lang.String documentRoot
private CommandManager commandManager
private ReplaceVariable replaceVariable
private java.util.Map mimeTypes
| Constructor Detail |
public HtmlMonitorPlugin()
| Method Detail |
public void init(Global global_,
PluginInfo pluginInfo)
throws XmlBlasterException
I_Plugin
// 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");
init in interface I_PluginXmlBlasterExceptionI_Plugin.init(org.xmlBlaster.util.Global, org.xmlBlaster.util.plugin.PluginInfo)public java.lang.String getType()
getType in interface I_PluginI_Plugin.getType()public java.lang.String getVersion()
getVersion in interface I_PluginI_Plugin.getVersion()private java.lang.String getMimeType(java.lang.String fileName)
public HttpResponse service(java.lang.String urlPath,
java.util.Map properties)
service in interface I_HttpRequesturlPath - 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
private void invokeAction(java.lang.String parameter)
parameter - contains the parameter given in the URL.
private java.lang.String replaceAllVariables(java.lang.String template)
throws XmlBlasterException
template - The template text containing ${}
XmlBlasterException
private java.lang.String lookup(java.lang.String query)
throws XmlBlasterException
XmlBlasterException
public void shutdown()
throws XmlBlasterException
I_Plugin
shutdown in interface I_PluginXmlBlasterException - 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.I_Plugin.shutdown()
public java.lang.String get(java.lang.String key,
java.lang.String def)
key - The key to lookupdef - The default to return if key is not found
|
xmlBlaster 1.6.2 API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||