java.lang.Object
org.gcube.vremanagement.executor.plugin.Plugin
All Implemented Interfaces:
PluginDefinition

public abstract class Plugin extends Object implements PluginDefinition
This class represent the contract for a plugin runnable by the executor.
Author:
Luca Frosini (ISTI - CNR)
  • Field Details

    • PLUGIN_PROPERTIES_SUFFIX_FILENAME

      public static final String PLUGIN_PROPERTIES_SUFFIX_FILENAME
      Suffix for plugin properties files
      See Also:
    • GROUP_PROPERTY

      public static final String GROUP_PROPERTY
      Property name for plugin group ID
      See Also:
    • NAME_PROPERTY

      public static final String NAME_PROPERTY
      Property name for plugin artifact ID (name)
      See Also:
    • VERSION_PROPERTY

      public static final String VERSION_PROPERTY
      Property name for plugin version
      See Also:
    • DESCRIPTION_PROPERTY

      public static final String DESCRIPTION_PROPERTY
      Property name for plugin description
      See Also:
    • properties

      protected Properties properties
      Plugin configuration properties
    • uuid

      protected UUID uuid
      Unique identifier for this plugin execution instance
    • iterationNumber

      protected int iterationNumber
      Current iteration number of the plugin execution
    • percentageSetter

      protected PercentageSetter percentageSetter
      Interface for reporting execution progress percentage
  • Constructor Details

    • Plugin

      public Plugin()
      Default constructor for Plugin. Initializes the plugin with default settings and percentage setter.
  • Method Details

    • getGroup

      public String getGroup()
      Description copied from interface: PluginDefinition
      This method is used by executor to retrieve the Plugin group It will be published on the IS instance created by the executor
      Specified by:
      getGroup in interface PluginDefinition
      Returns:
      the plugin group.
    • getName

      public String getName()
      Description copied from interface: PluginDefinition
      This method is used by executor to retrieve the Plugin name It will be published on the IS instance created by the executor
      Specified by:
      getName in interface PluginDefinition
      Returns:
      the plugin name.
    • getVersion

      public String getVersion()
      Description copied from interface: PluginDefinition
      This method is used by executor to retrieve the plugin version. It will be published on the IS instance created by the executor
      Specified by:
      getVersion in interface PluginDefinition
      Returns:
      the plugin version.
    • getDescription

      public String getDescription()
      Description copied from interface: PluginDefinition
      This method is used by executor to retrieve the Plugin human oriented description. It will be published on the IS instance created by the executor
      Specified by:
      getDescription in interface PluginDefinition
      Returns:
      the plugin description.
    • getSupportedCapabilities

      public Map<String,String> getSupportedCapabilities()
      Description copied from interface: PluginDefinition
      This method is used by the Executor to get a key-value Map to be published on IS , so a client which want to launch a Plugin only under certain condition can query the IS to obtain its own filtered list.
      Specified by:
      getSupportedCapabilities in interface PluginDefinition
      Returns:
      the Map with the supported capabilities
    • setPercentageSetter

      public void setPercentageSetter(PercentageSetter percentageSetter)
      Parameters:
      percentageSetter - the percentageSetter to set
    • setPercentageEvolution

      protected void setPercentageEvolution(Integer integer)
      Sets the percentage evolution for the current plugin execution.
      Parameters:
      integer - the completion percentage (0-100)
    • getUUID

      public UUID getUUID()
      Returns:
      the uuid
    • setUUID

      public void setUUID(UUID uuid)
      Parameters:
      uuid - the uuid to set
    • getIterationNumber

      public int getIterationNumber()
      Returns:
      the Iteration Number
    • setIterationNumber

      public void setIterationNumber(int iterationNumber)
      Parameters:
      iterationNumber - the iterationNumner to set
    • launch

      public abstract void launch(Map<String,Object> inputs) throws Exception
      Launch the plugin with the provided input.
      Parameters:
      inputs - the input parameters for the plugin execution
      Throws:
      Exception - if the launch fails
    • onStop

      protected abstract void onStop() throws Exception
      This function is used to correctly stop the plugin
      Throws:
      Exception - if the stop operation fails
    • stop

      public void stop() throws Exception
      Invoke onStop() function to allow the plugin to safely stop the execution
      Throws:
      Exception - if the stop operation fails