Class RunnablePlugin<T extends org.gcube.vremanagement.executor.plugin.Plugin>

java.lang.Object
org.gcube.vremanagement.executor.pluginmanager.RunnablePlugin<T>
All Implemented Interfaces:
Runnable

public class RunnablePlugin<T extends org.gcube.vremanagement.executor.plugin.Plugin> extends Object implements Runnable
Author:
Luca Frosini (ISTI - CNR)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.gcube.vremanagement.executor.plugin.PluginStateEvolution
     
    static final String
    The key, in the configuration of a plugin, of the identifier of its client.
    static final String
    The key, in the configuration of a plugin, of the secret of its client.
    protected final String
    The Context the task runs in.
    static final String
    The metric of the executions, by plugin, Context and final state, in the metrics of the node.
    protected final Map<String,Object>
     
    protected final int
     
    protected final org.gcube.common.security.secrets.Secret
    The secret of the node in the Context of the task: the service does its own work with it.
    protected final String
     
    protected final T
     
    protected org.gcube.common.security.secrets.Secret
    The secret the plugin runs with, see obtainPluginSecret(Map); set when the execution starts.
    protected final List<org.gcube.vremanagement.executor.plugin.PluginStateNotification>
     
    protected final UUID
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    RunnablePlugin(T plugin, Map<String,Object> inputs, UUID uuid, int iterationNumber, String ownerId, String context, List<org.gcube.vremanagement.executor.plugin.PluginStateNotification> pluginStateNotifications)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Runs code of the plugin with the secret of the plugin.
    protected void
    countExecution(org.gcube.vremanagement.executor.plugin.PluginState pluginState)
    Counts the execution in the metrics of the node (/smartgears/metrics, not public): "smartexecutor.executions" by plugin, Context and final state.
     
     
    protected org.gcube.common.security.secrets.Secret
    Returns the secret the plugin runs with: a token of its client, given by "client_id" and "client_secret" in its configuration, in the Context of the task.
    protected Map<String,Object>
    Returns the configuration of the plugin: the content of <plugin>.yaml in the directory of the plugin (WEB-INF/lib/plugins/<plugin>/), written by the provisioning and read by SmartGears when the service starts.
    void
    run()
     
    protected void
    setPercentage(Integer percentage)
     
    void
    setState(org.gcube.vremanagement.executor.plugin.PluginState pluginState)
     
    void
    setState(org.gcube.vremanagement.executor.plugin.PluginState pluginState, Exception e)
     
    protected void
    setState(org.gcube.vremanagement.executor.plugin.PluginState pluginState, Integer percentage, Exception exception)
    It is up to the plugin to update the State of the Running Plugin using this facilities function.
    void
    Stop the Plugin setting state to PluginState.STOPPED
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • CLIENT_ID

      public static final String CLIENT_ID
      The key, in the configuration of a plugin, of the identifier of its client.
      See Also:
    • CLIENT_SECRET

      public static final String CLIENT_SECRET
      The key, in the configuration of a plugin, of the secret of its client.
      See Also:
    • plugin

      protected final T extends org.gcube.vremanagement.executor.plugin.Plugin plugin
    • inputs

      protected final Map<String,Object> inputs
    • uuid

      protected final UUID uuid
    • iterationNumber

      protected final int iterationNumber
    • pluginStateNotifications

      protected final List<org.gcube.vremanagement.executor.plugin.PluginStateNotification> pluginStateNotifications
    • ownerId

      protected final String ownerId
    • context

      protected final String context
      The Context the task runs in.
    • nodeSecret

      protected final org.gcube.common.security.secrets.Secret nodeSecret
      The secret of the node in the Context of the task: the service does its own work with it.
    • pluginSecret

      protected volatile org.gcube.common.security.secrets.Secret pluginSecret
      The secret the plugin runs with, see obtainPluginSecret(Map); set when the execution starts.
    • actualStateEvolution

      protected org.gcube.vremanagement.executor.plugin.PluginStateEvolution actualStateEvolution
    • EXECUTIONS_METRIC

      public static final String EXECUTIONS_METRIC
      The metric of the executions, by plugin, Context and final state, in the metrics of the node.
      See Also:
  • Constructor Details

    • RunnablePlugin

      public RunnablePlugin(T plugin, Map<String,Object> inputs, UUID uuid, int iterationNumber, String ownerId, String context, List<org.gcube.vremanagement.executor.plugin.PluginStateNotification> pluginStateNotifications)
  • Method Details