org.webharvest.runtime.processors
Class WebHarvestPlugin

java.lang.Object
  extended by org.webharvest.runtime.processors.BaseProcessor
      extended by org.webharvest.runtime.processors.WebHarvestPlugin
Direct Known Subclasses:
DatabasePlugin, DbParamPlugin, FtpDelPlugin, FtpGetPlugin, FtpListPlugin, FtpMkdirPlugin, FtpPlugin, FtpPutPlugin, FtpRmdirPlugin, JsonToXmlPlugin, MailAttachPlugin, MailPlugin, TokenizePlugin, XmlToJsonPlugin, ZipEntryPlugin, ZipPlugin

public abstract class WebHarvestPlugin
extends BaseProcessor

Base for all user-defined plugins.


Constructor Summary
WebHarvestPlugin()
           
 
Method Summary
 Variable execute(Scraper scraper, ScraperContext context)
           
abstract  Variable executePlugin(Scraper scraper, ScraperContext context)
          Mathod that actually executes processor.
 java.lang.String getAttributeDesc()
           
 java.lang.String[] getAttributeValueSuggestions(java.lang.String attributeName)
           
 java.lang.Class[] getDependantProcessors()
          Defines dependant subprocessors that are used inside this plugin and that will automatically be registered with this plugin.
abstract  java.lang.String getName()
          Defines name of the processor.
 java.lang.String[] getRequiredAttributes()
          This method should return all mandatory attribute names for the plugin processor.
 java.lang.String[] getRequiredSubprocessors()
          This method should return all mandatory subprocessor names, or in other words all mandatory subtags that must be present in the body of this processor plugin.
 java.lang.String getTagDesc()
           
 java.lang.String[] getValidAttributes()
          This method should return all possible attribute names for the plugin processor.
 java.lang.String[] getValidSubprocessors()
          This method should return all names of all allowed processors inside the body of this processor plugin.
 boolean hasBody()
           
 void setDef(WebHarvestPluginDef def)
           
 
Methods inherited from class org.webharvest.runtime.processors.BaseProcessor
getElementDef, run
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebHarvestPlugin

public WebHarvestPlugin()
Method Detail

getName

public abstract java.lang.String getName()
Defines name of the processor. Should be valid identifier. Processor's tag will use this name. For example, if this name is "myprocessor" in config file it will be used as <myprocessor...>...</myprocessor>

Returns:
Name of the processor

getValidAttributes

public java.lang.String[] getValidAttributes()
This method should return all possible attribute names for the plugin processor.

Returns:
Array of attribute names (case insensitive)

getRequiredAttributes

public java.lang.String[] getRequiredAttributes()
This method should return all mandatory attribute names for the plugin processor.

Returns:
Array of attribute names (case insensitive)

getValidSubprocessors

public java.lang.String[] getValidSubprocessors()
This method should return all names of all allowed processors inside the body of this processor plugin. If null is returned, then all subprocessors are allowed.

Returns:
Array of allowed subprocessor names (case insensitive)

getRequiredSubprocessors

public java.lang.String[] getRequiredSubprocessors()
This method should return all mandatory subprocessor names, or in other words all mandatory subtags that must be present in the body of this processor plugin.

Returns:
Array of mandatory subprocessor names (case insensitive)

getDependantProcessors

public java.lang.Class[] getDependantProcessors()
Defines dependant subprocessors that are used inside this plugin and that will automatically be registered with this plugin.

Returns:
Array of subprocessor classes

getAttributeValueSuggestions

public java.lang.String[] getAttributeValueSuggestions(java.lang.String attributeName)
Parameters:
attributeName - Name of plugin attribute
Returns:
Array of valuee suggestions for specified attribute (this is used for auto-complete feature in IDE). null means nothing to suggest.

hasBody

public boolean hasBody()

execute

public final Variable execute(Scraper scraper,
                              ScraperContext context)
Specified by:
execute in class BaseProcessor

executePlugin

public abstract Variable executePlugin(Scraper scraper,
                                       ScraperContext context)
Mathod that actually executes processor. Since one instance of this class may be used for multiple executions, creator of plugin is responsible for initiating local variables at the beginning of this method.

Parameters:
scraper -
context -
Returns:
Instance of variable as result of xecution.

getTagDesc

public java.lang.String getTagDesc()

getAttributeDesc

public java.lang.String getAttributeDesc()

setDef

public void setDef(WebHarvestPluginDef def)