Class ExampleScriptingFramework

java.lang.Object
de.calamanari.pk.plugin.ExampleScriptingFramework
All Implemented Interfaces:
MacroPluginFramework

public class ExampleScriptingFramework
extends java.lang.Object
implements MacroPluginFramework
This minimum framework demonstrates the usage of the PLUGIN pattern.
Author:
Karl Eilebrecht
  • Constructor Summary

    Constructors
    Constructor Description
    ExampleScriptingFramework()  
  • Method Summary

    Modifier and Type Method Description
    void addProtocolMessage​(java.lang.String source, java.lang.String message)
    Allows protocol messages.
    void executeScriptFile​(java.io.File scriptFile, MacroPluginFactory pluginFactory)
    Executes the script from the given file using the specified factory.
    java.lang.Object getProperty​(java.lang.String propertyName)
    Returns the value of the requested property.
    java.lang.String getProtocol()
    Returns the protocol.
    boolean isPropertyAvailable​(java.lang.String propertyName)
    Returns whether the given property is currently known
    void setProperty​(java.lang.String propertyName, java.lang.Object value)
    Sets the value of the denoted property.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getProperty

      public java.lang.Object getProperty​(java.lang.String propertyName)
      Description copied from interface: MacroPluginFramework
      Returns the value of the requested property.
      Specified by:
      getProperty in interface MacroPluginFramework
      Parameters:
      propertyName - name of the property, case insensitive, NOT NULL
      Returns:
      mapped value
    • setProperty

      public void setProperty​(java.lang.String propertyName, java.lang.Object value)
      Description copied from interface: MacroPluginFramework
      Sets the value of the denoted property.
      Specified by:
      setProperty in interface MacroPluginFramework
      Parameters:
      propertyName - name of the property, case insensitive, NOT NULL
      value - new value
    • isPropertyAvailable

      public boolean isPropertyAvailable​(java.lang.String propertyName)
      Description copied from interface: MacroPluginFramework
      Returns whether the given property is currently known
      Specified by:
      isPropertyAvailable in interface MacroPluginFramework
      Parameters:
      propertyName - name of property, case insensitive, NOT NULL
      Returns:
      true if property exists, otherwise false
    • addProtocolMessage

      public void addProtocolMessage​(java.lang.String source, java.lang.String message)
      Description copied from interface: MacroPluginFramework
      Allows protocol messages.
      Specified by:
      addProtocolMessage in interface MacroPluginFramework
      Parameters:
      source - usually the plugin name
      message - info to be logged
    • getProtocol

      public java.lang.String getProtocol()
      Returns the protocol.
      Returns:
      protocol as a string
    • executeScriptFile

      public void executeScriptFile​(java.io.File scriptFile, MacroPluginFactory pluginFactory)
      Executes the script from the given file using the specified factory.
      Parameters:
      scriptFile - file with script line by line
      pluginFactory - factory for retrieving plugins for macro execution