xmlBlaster 2.2.0 API

org.xmlBlaster.client.filepoller
Class FilePollerPlugin

java.lang.Object
  extended by org.xmlBlaster.client.filepoller.FilePollerPlugin
All Implemented Interfaces:
FilePollerPluginMBean, I_AdminPlugin, I_AdminService, I_AdminUsage, I_Plugin

public class FilePollerPlugin
extends java.lang.Object
implements I_Plugin, FilePollerPluginMBean

FilePollerPlugin 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 client.filepoller requirement

Field Summary
private  ContextNode contextNode
           
private  Global glob
           
private  boolean isShutdown
           
private static java.util.logging.Logger log
           
private  java.lang.Object mbeanHandle
          My JMX registration
private  java.lang.String ME
           
private  PluginInfo pluginConfig
           
private  Publisher publisherClient
           
 
Constructor Summary
FilePollerPlugin()
           
 
Method Summary
 void activate()
          Activate this service
 void deActivate()
          Deactivate the service to standby.
 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 getType()
          The unique name of the plugin (together with the version).
 java.lang.String getUsageUrl()
           
 java.lang.String getVersion()
          The version of the plugin
 void init(Global global, PluginInfo pluginInfo)
          This method is called by the PluginManager.
 boolean isActive()
          Access the current state
 boolean isCopyOnMove()
           
 boolean isShutdown()
          Check status
 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 setSent(java.lang.String sent)
           
 void setUsageUrl(java.lang.String url)
           
 void shutdown()
          Shutdown the plugin, free resources.
 java.lang.String triggerScan()
          Triggers a filepoller scan.
 java.lang.String usage()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

glob

private Global glob

pluginConfig

private PluginInfo pluginConfig

isShutdown

private boolean isShutdown
Constructor Detail

FilePollerPlugin

public FilePollerPlugin()
Method Detail

init

public void init(Global global,
                 PluginInfo pluginInfo)
          throws XmlBlasterException
Description copied from interface: 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 I_Plugin
Throws:
XmlBlasterException
See Also:
I_Plugin.init(org.xmlBlaster.util.Global, org.xmlBlaster.util.plugin.PluginInfo)

getType

public java.lang.String getType()
Description copied from interface: I_AdminPlugin
The unique name of the plugin (together with the version).

Specified by:
getType in interface I_AdminPlugin
Specified by:
getType in interface I_Plugin
Returns:
For example "IOR"
See Also:
I_Plugin.getType()

getVersion

public java.lang.String getVersion()
Description copied from interface: I_AdminPlugin
The version of the plugin

Specified by:
getVersion in interface I_AdminPlugin
Specified by:
getVersion in interface I_Plugin
Returns:
For example "1.0"
See Also:
I_Plugin.getVersion()

shutdown

public void shutdown()
              throws XmlBlasterException
Description copied from interface: I_AdminPlugin
Shutdown the plugin, free resources.

Specified by:
shutdown in interface I_AdminPlugin
Specified by:
shutdown in interface I_Plugin
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: FilePollerPluginMBean
Triggers a filepoller scan.

Specified by:
triggerScan in interface FilePollerPluginMBean

getDirectoryName

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

setDirectoryName

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

getFileFilter

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

setFileFilter

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

getFilterType

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

setFilterType

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

getMaximumFileSize

public long getMaximumFileSize()
Specified by:
getMaximumFileSize in interface FilePollerPluginMBean
Returns:
Returns the maximumFileSize.

setMaximumFileSize

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

getPollInterval

public long getPollInterval()
Specified by:
getPollInterval in interface FilePollerPluginMBean
Returns:
Returns the pollInterval.

setPollInterval

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

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

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

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

isCopyOnMove

public boolean isCopyOnMove()
Specified by:
isCopyOnMove in interface FilePollerPluginMBean
Returns:
Returns the copyOnMove.

setCopyOnMove

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

getDelaySinceLastFileChange

public long getDelaySinceLastFileChange()
Specified by:
getDelaySinceLastFileChange in interface FilePollerPluginMBean
Returns:
Returns the delaySinceLastFileChange.

setDelaySinceLastFileChange

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

getDiscarded

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

setDiscarded

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

getLockExtention

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

setLockExtention

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

getSent

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

setSent

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

isShutdown

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

Specified by:
isShutdown in interface I_AdminPlugin
Returns:
true if down

usage

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

getUsageUrl

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

setUsageUrl

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

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.