xmlBlaster 2.2.0 API

org.xmlBlaster.contrib.filewatcher
Class FileWatcherPlugin

java.lang.Object
  extended by org.xmlBlaster.contrib.GlobalInfo
      extended by org.xmlBlaster.contrib.filewatcher.FileWatcherPlugin
All Implemented Interfaces:
FileWatcherPluginMBean, I_Info, I_AdminPlugin, I_AdminService, I_AdminUsage, I_Plugin

public class FileWatcherPlugin
extends GlobalInfo
implements FileWatcherPluginMBean

FileWatcherPlugin polls on a directory in the file system for new files. If one new file is found which meets the required specifications, its content is read and published.

Author:
Michele Laghi
See Also:
The contrib.filewatcher requirement

Field Summary
private  ContextNode contextNode
           
private  boolean isShutdown
           
private static java.util.logging.Logger log
           
private  java.lang.Object mbeanHandle
          My JMX registration
private  java.lang.String ME
           
private  Publisher publisherClient
           
 
Fields inherited from class org.xmlBlaster.contrib.GlobalInfo
global, LOWER_CASE, ORIGINAL_ENGINE_GLOBAL, pluginInfo, UNTOUCHED, UPPER_CASE
 
Fields inherited from interface org.xmlBlaster.contrib.I_Info
ID, JMX_PREFIX
 
Constructor Summary
  FileWatcherPlugin()
           
private FileWatcherPlugin(java.lang.String fakeString)
          This constructor shall be invoked if using this class standalone
 
Method Summary
 void activate()
          Activate this service
 void deActivate()
          Deactivate the service to standby.
 void doInit(Global global_, PluginInfo pluginInfo_)
           
 long getDelaySinceLastFileChange()
           
 java.lang.String getDirectoryName()
           
 java.lang.String getDiscarded()
           
 java.lang.String getFileFilter()
           
 java.lang.String getFilterType()
           
 java.lang.String getLockExtention()
           
 long getMaximumFileSize()
           
 long getPollInterval()
           
 java.lang.String getSent()
           
 java.lang.String getUsageUrl()
           
 boolean isActive()
          Access the current state
 boolean isCopyOnMove()
           
 boolean isRecursive()
           
 boolean isShutdown()
          Check status
static void main(java.lang.String[] args)
           
 void setCopyOnMove(boolean copyOnMove)
           
 void setDelaySinceLastFileChange(long delaySinceLastFileChange)
           
 void setDirectoryName(java.lang.String directoryName)
           
 void setDiscarded(java.lang.String discarded)
           
 void setFileFilter(java.lang.String fileFilter)
           
 void setFilterType(java.lang.String filterType)
           
 void setLockExtention(java.lang.String lockExtention)
           
 void setMaximumFileSize(long maximumFileSize)
           
 void setPollInterval(long pollInterval)
           
 void setRecursive(boolean rec)
           
 void setSent(java.lang.String sent)
           
 void setUsageUrl(java.lang.String url)
           
 void shutdown()
          Cleans up the resource.
 java.lang.String triggerScan()
          Triggers a filewatcher scan.
 java.lang.String usage()
           
 
Methods inherited from class org.xmlBlaster.contrib.GlobalInfo
dump, get, getBoolean, getGlobal, getInt, getKeys, getLong, getObject, getObjectKeys, getOriginalGlobal, getRaw, getStrippedString, getType, getVersion, init, loadPlugin, put, putObject, putRaw, replaceAllEntries, setStrippedHostname
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xmlBlaster.util.admin.I_AdminPlugin
getType, getVersion
 

Field Detail

log

private static java.util.logging.Logger log

ME

private java.lang.String ME

publisherClient

private Publisher publisherClient

mbeanHandle

private java.lang.Object mbeanHandle
My JMX registration


contextNode

private ContextNode contextNode

isShutdown

private boolean isShutdown
Constructor Detail

FileWatcherPlugin

private FileWatcherPlugin(java.lang.String fakeString)
This constructor shall be invoked if using this class standalone

Parameters:
fakeString -

FileWatcherPlugin

public FileWatcherPlugin()
Method Detail

doInit

public void doInit(Global global_,
                   PluginInfo pluginInfo_)
            throws XmlBlasterException
Specified by:
doInit in class GlobalInfo
Parameters:
global_ - The global passed by the RunLevelManager, this is not the object owned by the plugin. It is the original global.
Throws:
XmlBlasterException
See Also:
I_Plugin.init(org.xmlBlaster.util.Global, org.xmlBlaster.util.plugin.PluginInfo)

shutdown

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

Specified by:
shutdown in interface I_AdminPlugin
Specified by:
shutdown in interface I_Plugin
Overrides:
shutdown in class GlobalInfo
Throws:
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()

triggerScan

public java.lang.String triggerScan()
Description copied from interface: FileWatcherPluginMBean
Triggers a filewatcher scan.

Specified by:
triggerScan in interface FileWatcherPluginMBean
See Also:
FileWatcherPluginMBean.triggerScan()

getDirectoryName

public java.lang.String getDirectoryName()
Specified by:
getDirectoryName in interface FileWatcherPluginMBean
Returns:
Returns the directoryName.
See Also:
FileWatcherPluginMBean.getDirectoryName()

setDirectoryName

public void setDirectoryName(java.lang.String directoryName)
Specified by:
setDirectoryName in interface FileWatcherPluginMBean
Parameters:
directoryName - The directoryName to set.
See Also:
FileWatcherPluginMBean.setDirectoryName(java.lang.String)

getFileFilter

public java.lang.String getFileFilter()
Specified by:
getFileFilter in interface FileWatcherPluginMBean
Returns:
Returns the fileFilter.
See Also:
FileWatcherPluginMBean.getFileFilter()

setFileFilter

public void setFileFilter(java.lang.String fileFilter)
Specified by:
setFileFilter in interface FileWatcherPluginMBean
Parameters:
fileFilter - The fileFilter to set.
See Also:
FileWatcherPluginMBean.setFileFilter(java.lang.String)

getFilterType

public java.lang.String getFilterType()
Specified by:
getFilterType in interface FileWatcherPluginMBean
Returns:
Returns the filterType.
See Also:
FileWatcherPluginMBean.getFilterType()

setFilterType

public void setFilterType(java.lang.String filterType)
Specified by:
setFilterType in interface FileWatcherPluginMBean
Parameters:
filterType - The filterType to set.
See Also:
FileWatcherPluginMBean.setFilterType(java.lang.String)

getMaximumFileSize

public long getMaximumFileSize()
Specified by:
getMaximumFileSize in interface FileWatcherPluginMBean
Returns:
Returns the maximumFileSize.
See Also:
FileWatcherPluginMBean.getMaximumFileSize()

setMaximumFileSize

public void setMaximumFileSize(long maximumFileSize)
Specified by:
setMaximumFileSize in interface FileWatcherPluginMBean
Parameters:
maximumFileSize - The maximumFileSize to set.
See Also:
FileWatcherPluginMBean.setMaximumFileSize(long)

getPollInterval

public long getPollInterval()
Specified by:
getPollInterval in interface FileWatcherPluginMBean
Returns:
Returns the pollInterval.
See Also:
FileWatcherPluginMBean.getPollInterval()

setPollInterval

public void setPollInterval(long pollInterval)
Specified by:
setPollInterval in interface FileWatcherPluginMBean
Parameters:
pollInterval - The pollInterval to set.
See Also:
FileWatcherPluginMBean.setPollInterval(long)

activate

public void activate()
              throws java.lang.Exception
Description copied from interface: I_AdminService
Activate this service

Specified by:
activate in interface I_AdminService
Throws:
java.lang.Exception
See Also:
I_AdminService.activate()

deActivate

public void deActivate()
Description copied from interface: I_AdminService
Deactivate the service to standby. A call to activate() fires the service up again

Specified by:
deActivate in interface I_AdminService
See Also:
I_AdminService.deActivate()

isActive

public boolean isActive()
Description copied from interface: I_AdminService
Access the current state

Specified by:
isActive in interface I_AdminService
Returns:
true if active
See Also:
I_AdminService.isActive()

isCopyOnMove

public boolean isCopyOnMove()
Specified by:
isCopyOnMove in interface FileWatcherPluginMBean
Returns:
Returns the copyOnMove.
See Also:
FileWatcherPluginMBean.isCopyOnMove()

setCopyOnMove

public void setCopyOnMove(boolean copyOnMove)
Specified by:
setCopyOnMove in interface FileWatcherPluginMBean
Parameters:
copyOnMove - The copyOnMove to set.
See Also:
FileWatcherPluginMBean.setCopyOnMove(boolean)

getDelaySinceLastFileChange

public long getDelaySinceLastFileChange()
Specified by:
getDelaySinceLastFileChange in interface FileWatcherPluginMBean
Returns:
Returns the delaySinceLastFileChange.
See Also:
FileWatcherPluginMBean.getDelaySinceLastFileChange()

setDelaySinceLastFileChange

public void setDelaySinceLastFileChange(long delaySinceLastFileChange)
Specified by:
setDelaySinceLastFileChange in interface FileWatcherPluginMBean
Parameters:
delaySinceLastFileChange - The delaySinceLastFileChange to set.
See Also:
FileWatcherPluginMBean.setDelaySinceLastFileChange(long)

getDiscarded

public java.lang.String getDiscarded()
Specified by:
getDiscarded in interface FileWatcherPluginMBean
Returns:
Returns the discarded.
See Also:
FileWatcherPluginMBean.getDiscarded()

setDiscarded

public void setDiscarded(java.lang.String discarded)
Specified by:
setDiscarded in interface FileWatcherPluginMBean
Parameters:
discarded - The discarded to set.
See Also:
FileWatcherPluginMBean.setDiscarded(java.lang.String)

getLockExtention

public java.lang.String getLockExtention()
Specified by:
getLockExtention in interface FileWatcherPluginMBean
Returns:
Returns the lockExtention.
See Also:
FileWatcherPluginMBean.getLockExtention()

setLockExtention

public void setLockExtention(java.lang.String lockExtention)
Specified by:
setLockExtention in interface FileWatcherPluginMBean
Parameters:
lockExtention - The lockExtention to set.
See Also:
FileWatcherPluginMBean.setLockExtention(java.lang.String)

getSent

public java.lang.String getSent()
Specified by:
getSent in interface FileWatcherPluginMBean
Returns:
Returns the sent.
See Also:
FileWatcherPluginMBean.getSent()

setSent

public void setSent(java.lang.String sent)
Specified by:
setSent in interface FileWatcherPluginMBean
Parameters:
sent - The sent to set.
See Also:
FileWatcherPluginMBean.setSent(java.lang.String)

isShutdown

public boolean isShutdown()
Description copied from interface: I_AdminPlugin
Check status

Specified by:
isShutdown in interface I_AdminPlugin
Returns:
true if down
See Also:
I_AdminPlugin.isShutdown()

usage

public java.lang.String usage()
Specified by:
usage in interface I_AdminUsage
Returns:
a human readable usage help string
See Also:
I_AdminUsage.usage()

getUsageUrl

public java.lang.String getUsageUrl()
Specified by:
getUsageUrl in interface I_AdminUsage
Returns:
A link on javadoc for JMX usage
See Also:
I_AdminUsage.getUsageUrl()

setUsageUrl

public void setUsageUrl(java.lang.String url)
Specified by:
setUsageUrl in interface I_AdminUsage
See Also:
I_AdminUsage.setUsageUrl(java.lang.String)

setRecursive

public void setRecursive(boolean rec)
Specified by:
setRecursive in interface FileWatcherPluginMBean

isRecursive

public boolean isRecursive()
Specified by:
isRecursive in interface FileWatcherPluginMBean

main

public static void main(java.lang.String[] args)

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.