Class AbstractPluginProvider

java.lang.Object
flexagon.fd.core.plugin.AbstractPluginProvider
All Implemented Interfaces:
PluginProvider
Direct Known Subclasses:
AbstractPartialDeployPluginProvider

public abstract class AbstractPluginProvider extends Object implements PluginProvider
Abstract PluginProvider base class which provides a number of convenience methods for plugin operation implementations. Although plugin operation implementations may implement PluginProvider interface directly, it is strongly encouraged that they extend this base class instead if other inheritance is not required.

This class provides the following base implementation:

  • Empty implementation for cleanup(), which can be overridden if necessary
  • Methods for WorkflowExecutionContext validation (e.g. required inputs/properties)
  • Methods for extracting properties/inputs from WorkflowExecutionContext by type
  • Methods for extracting properties/inputs from WorkflowExecutionContext by type, and returning defaults if not found
  • Constructor Details

    • AbstractPluginProvider

      public AbstractPluginProvider()
      INTERNAL USE ONLY
  • Method Details

    • setWorkflowExecutionContext

      public void setWorkflowExecutionContext(WorkflowExecutionContext pExecutionContext)
      FOR INTERNAL USE AND TEST SETUP ONLY
      Specified by:
      setWorkflowExecutionContext in interface PluginProvider
      Parameters:
      pExecutionContext - the workflow execution context
    • getWorkflowExecutionContext

      public WorkflowExecutionContext getWorkflowExecutionContext()
      Returns the WorkflowExecutionContext for the current plugin operation execution.
      Returns:
      the execution context object
    • execute

      public abstract PluginResult execute() throws FlexCheckedException
      Must be implemented by the concrete subclass to perform the execution of the plugin operation.
      Specified by:
      execute in interface PluginProvider
      Returns:
      the result of the plugin operation execution
      Throws:
      FlexCheckedException - if the plugin operation fails
    • validate

      public abstract void validate() throws FlexCheckedException
      Must be implemented by the concrete subclass to perform any validation (prior to execution).
      Specified by:
      validate in interface PluginProvider
      Throws:
      FlexCheckedException - if the WorkflowExecutionContext provides configuration which is not valid for this plugin operation execution
    • cleanup

      public void cleanup()
      Can be overridden by the concrete subclass to perform a necessary cleanup of resources (e.g. closing/deleting files, closing connections, etc.). The default implementation does nothing.
      Specified by:
      cleanup in interface PluginProvider
    • validateContext

      protected void validateContext(Collection<String> pRequiredProperties, Collection<String> pRequiredInputs) throws FlexCheckedException
      Validates that the given properties and inputs have non-null values within the WorkflowExecution context for the current execution instance.
      Parameters:
      pRequiredProperties - a collection of required properties
      pRequiredInputs - a collection of required inputs
      Throws:
      FlexCheckedException - if any or all of the properties/inputs are invalid
    • validateContext

      protected void validateContext(Collection<String> pRequiredProperties, Collection<String> pRequiredInputs, String pValidateTargetGroup) throws FlexCheckedException
      Validates that the given properties and inputs have non-null values within the WorkflowExecution context for the given execution instance.
      Parameters:
      pRequiredProperties - a collection of required properties
      pRequiredInputs - a collection of required inputs
      pValidateTargetGroup - the target group used to locate properties
      Throws:
      FlexCheckedException - if any or all of the properties/inputs are invalid
    • validateRequiredInputs

      protected void validateRequiredInputs(Collection<String> pRequiredInputs) throws FlexCheckedException
      Validates that the given inputs have non-null values within the WorkflowExecution context for the current execution instance.
      Parameters:
      pRequiredInputs - a collection of required inputs
      Throws:
      FlexCheckedException - if any or all of the inputs are invalid
    • validateRequiredPropertiesForInstance

      protected void validateRequiredPropertiesForInstance(Collection<String> pRequiredProperties, String pValidateTargetGroup) throws FlexCheckedException
      Validates that the given properties have non-null values within the WorkflowExecution context for the given execution instance.
      Parameters:
      pRequiredProperties - a collection of required properties
      pValidateTargetGroup - the target group used to locate properties
      Throws:
      FlexCheckedException - if any or all of the properties are invalid
    • validateRequiredPropertiesForCurrentInstance

      protected void validateRequiredPropertiesForCurrentInstance(Collection<String> pRequiredProperties) throws FlexCheckedException
      Validates that the given properties have non-null values within the WorkflowExecution context for the current execution instance.
      Parameters:
      pRequiredProperties - a collection of required properties
      Throws:
      FlexCheckedException - if any or all of the properties are invalid
    • setOutput

      protected void setOutput(String pName, Object pValue, DataTypeEnum pDataType)
      Sets an output into WorkflowExecutionContext, which will be returned within a PluginResult from the execute() method.
      Parameters:
      pName - the name of the output to set
      pValue - the value of the output (must be of type pDataType)
      pDataType - the data type of the property
    • getBooleanInput

      protected Boolean getBooleanInput(String pInputName)
      Returns the value of the given input as a Boolean. Returns Boolean.FALSE if value for pInputName is null or cannot be resolved to a boolean value.
      Parameters:
      pInputName - the name of the input to retrieve
      Returns:
      the Boolean value of the input
    • getBooleanInputOrDefault

      protected Boolean getBooleanInputOrDefault(String pInputName, Boolean pDefault)
      Returns the value of the given input as a Boolean. Returns pDefault if input is not found.
      Parameters:
      pInputName - the name of the input to retrieve
      Returns:
      the Boolean value of the input
    • getDoubleInput

      protected Double getDoubleInput(String pInputName)
      Returns the value of the given input as a Double. Returns null if pInputName is not found.
      Parameters:
      pInputName - the name of the input to retrieve
      Returns:
      the Double value of the input
    • getDoubleInputOrDefault

      protected Double getDoubleInputOrDefault(String pInputName, Double pDefault)
      Returns the value of the given input as a Double. Returns pDefault if input is not found.
      Parameters:
      pInputName - the name of the input to retrieve
      Returns:
      the Double value of the input
    • getStringInput

      protected String getStringInput(String pInputName)
      Returns the value of the given input as a String. Returns null if pInputName is not found.
      Parameters:
      pInputName - the name of the input to retrieve
      Returns:
      the String value of the input
    • getStringInputOrDefault

      protected String getStringInputOrDefault(String pInputName, String pDefault)
      Returns the value of the given input as a String. Returns pDefault if input is not found.
      Parameters:
      pInputName - the name of the input to retrieve
      Returns:
      the String value of the input
    • getIntegerInput

      protected Integer getIntegerInput(String pInputName)
      Returns the value of the given input as an Integer. Returns null if pInputName is not found.
      Parameters:
      pInputName - the name of the input to retrieve
      Returns:
      the Integer value of the input
    • getIntegerInputOrDefault

      protected Integer getIntegerInputOrDefault(String pInputName, Integer pDefault)
      Returns the value of the given input as an Integer. Returns pDefault if input is not found.
      Parameters:
      pInputName - the name of the input to retrieve
      Returns:
      the Integer value of the input
    • getLongInput

      protected Long getLongInput(String pInputName)
      Returns the value of the given input as a Long. Returns null if pInputName is not found.
      Parameters:
      pInputName - the name of the input to retrieve
      Returns:
      the Long value of the input
    • getLongInputOrDefault

      protected Long getLongInputOrDefault(String pInputName, Long pDefault)
      Returns the value of the given input as a Long. Returns pDefault if input is not found.
      Parameters:
      pInputName - the name of the input to retrieve
      Returns:
      the Long value of the input
    • getStringProjectPropertyValue

      protected String getStringProjectPropertyValue(String pKey)
      Returns the value of a project property as a String for the given name. Returns null if pKey is not found.
      Parameters:
      pKey - the name of the project property
      Returns:
      the project property value as a String
    • getStringProjectPropertyValueOrDefault

      protected String getStringProjectPropertyValueOrDefault(String pKey, String pDefault)
      Returns the value of a project property as a String for the given name. Returns pDefault if property is not found.
      Parameters:
      pKey - the name of the project property
      Returns:
      the project property value as a String
    • getStringInstancePropertyValue

      protected String getStringInstancePropertyValue(String pInstanceCode, String pKey)
      Returns the value of a target property as an Object for the given target group code and property name. Returns null if pKey is not found within the given target group code.
      Parameters:
      pKey - the name of the target property
      Returns:
      the target property value as an Object
    • getStringInstancePropertyValueOrDefault

      protected String getStringInstancePropertyValueOrDefault(String pInstanceCode, String pKey, String pDefault)
      Returns the value of a target property as a String for the given target group code and property name. Returns pDefault if property is not found within the given target group code.
      Parameters:
      pKey - the name of the target property
      Returns:
      the target property value as a String
    • getStringCurrentInstancePropertyValue

      protected String getStringCurrentInstancePropertyValue(String pKey)
      Returns the value of a target property as a String for the given property name within the current target group. Returns null if pKey is not found within the current target group.
      Parameters:
      pKey - the name of the target property
      Returns:
      the target property value as a String
    • getStringCurrentInstancePropertyValueOrDefault

      protected String getStringCurrentInstancePropertyValueOrDefault(String pKey, String pDefault)
      Returns the value of a target property as a String for the given property name within the current target group. Returns pDefault if property is not found within the current target group.
      Parameters:
      pKey - the name of the target property
      Returns:
      the target property value as a String
    • getDoubleProjectPropertyValue

      protected Double getDoubleProjectPropertyValue(String pKey)
      Returns the value of a project property as a Double for the given name. Returns null if pKey is not found.
      Parameters:
      pKey - the name of the project property
      Returns:
      the project property value as a Double
    • getDoubleProjectPropertyValueOrDefault

      protected Double getDoubleProjectPropertyValueOrDefault(String pKey, Double pDefault)
      Returns the value of a project property as a Double for the given name. Returns pDefault if property is not found.
      Parameters:
      pKey - the name of the project property
      Returns:
      the project property value as a Double
    • getDoubleInstancePropertyValue

      protected Double getDoubleInstancePropertyValue(String pInstanceCode, String pKey)
      Returns the value of a target property as a Double for the given target group code and property name. Returns null if pKey is not found within the given target group code.
      Parameters:
      pKey - the name of the target property
      Returns:
      the target property value as a Double
    • getDoubleInstancePropertyValueOrDefault

      protected Double getDoubleInstancePropertyValueOrDefault(String pInstanceCode, String pKey, Double pDefault)
      Returns the value of a target property as a Double for the given target group code and property name. Returns pDefault if property is not found within the given target group code.
      Parameters:
      pKey - the name of the target property
      Returns:
      the target property value as a Double
    • getDoubleCurrentInstancePropertyValue

      protected Double getDoubleCurrentInstancePropertyValue(String pKey)
      Returns the value of a target property as a Double for the given property name within the current target group. Returns null if pKey is not found within the current target group.
      Parameters:
      pKey - the name of the target property
      Returns:
      the target property value as a Double
    • getDoubleCurrentInstancePropertyValueOrDefault

      protected Double getDoubleCurrentInstancePropertyValueOrDefault(String pKey, Double pDefault)
      Returns the value of a target property as a Double for the given property name within the current target group. Returns pDefault if property is not found within the current target group.
      Parameters:
      pKey - the name of the target property
      Returns:
      the target property value as a Double
    • getIntegerProjectPropertyValue

      protected Integer getIntegerProjectPropertyValue(String pKey)
      Returns the value of a project property as an Integer for the given name. Returns null if pKey is not found.
      Parameters:
      pKey - the name of the project property
      Returns:
      the project property value as an Integer
    • getIntegerProjectPropertyValueOrDefault

      protected Integer getIntegerProjectPropertyValueOrDefault(String pKey, Integer pDefault)
      Returns the value of a project property as an Integer for the given name. Returns pDefault if property is not found.
      Parameters:
      pKey - the name of the project property
      Returns:
      the project property value as an Integer
    • getIntegerInstancePropertyValue

      protected Integer getIntegerInstancePropertyValue(String pInstanceCode, String pKey)
      Returns the value of a target property as an Integer for the given target group code and property name. Returns null if pKey is not found within the given target group code.
      Parameters:
      pKey - the name of the target property
      Returns:
      the target property value as an Integer
    • getIntegerInstancePropertyValueOrDefault

      protected Integer getIntegerInstancePropertyValueOrDefault(String pInstanceCode, String pKey, Integer pDefault)
      Returns the value of a target property as an Integer for the given target group code and property name. Returns pDefault if property is not found within the given target group code.
      Parameters:
      pKey - the name of the target property
      Returns:
      the target property value as an Integer
    • getIntegerCurrentInstancePropertyValue

      protected Integer getIntegerCurrentInstancePropertyValue(String pKey)
      Returns the value of a target property as an Integer for the given property name within the current target group. Returns null if pKey is not found within the current target group.
      Parameters:
      pKey - the name of the target property
      Returns:
      the target property value as an Integer
    • getIntegerCurrentInstancePropertyValueOrDefault

      protected Integer getIntegerCurrentInstancePropertyValueOrDefault(String pKey, Integer pDefault)
      Returns the value of a target property as an Integer for the given property name within the current target group. Returns pDefault if property is not found within the current target group.
      Parameters:
      pKey - the name of the target property
      Returns:
      the target property value as an Integer
    • getBooleanProjectPropertyValue

      protected Boolean getBooleanProjectPropertyValue(String pKey)
      Returns the value of a project property as a Boolean for the given name. Returns null if pKey is not found.
      Parameters:
      pKey - the name of the project property
      Returns:
      the project property value as a Boolean
    • getBooleanProjectPropertyValueOrDefault

      protected Boolean getBooleanProjectPropertyValueOrDefault(String pKey, Boolean pDefault)
      Returns the value of a project property as a Boolean for the given name. Returns pDefault if property is not found.
      Parameters:
      pKey - the name of the project property
      Returns:
      the project property value as a Boolean
    • getBooleanInstancePropertyValue

      protected Boolean getBooleanInstancePropertyValue(String pInstanceCode, String pKey)
      Returns the value of a target property as a Boolean for the given target group code and property name. Returns null if pKey is not found within the given target group code.
      Parameters:
      pKey - the name of the target property
      Returns:
      the target property value as a Boolean
    • getBooleanInstancePropertyValueOrDefault

      protected Boolean getBooleanInstancePropertyValueOrDefault(String pInstanceCode, String pKey, Boolean pDefault)
      Returns the value of a target property as a Boolean for the given target group code and property name. Returns pDefault if property is not found within the given target group code.
      Parameters:
      pKey - the name of the target property
      Returns:
      the target property value as a Boolean
    • getBooleanCurrentInstancePropertyValue

      protected Boolean getBooleanCurrentInstancePropertyValue(String pKey)
      Returns the value of a target property as a Boolean for the given property name within the current target group. Returns null if pKey is not found within the current target group.
      Parameters:
      pKey - the name of the target property
      Returns:
      the target property value as a Boolean
    • getBooleanCurrentInstancePropertyValueOrDefault

      protected Boolean getBooleanCurrentInstancePropertyValueOrDefault(String pKey, Boolean pDefault)
      Returns the value of a target property as a Boolean for the given property name within the current target group. Returns pDefault if property is not found within the current target group.
      Parameters:
      pKey - the name of the target property
      Returns:
      the target property value as a Boolean
    • getLongProjectPropertyValue

      protected Long getLongProjectPropertyValue(String pKey)
      Returns the value of a project property as a Long for the given name. Returns null if pKey is not found.
      Parameters:
      pKey - the name of the project property
      Returns:
      the project property value as a Long
    • getLongProjectPropertyValueOrDefault

      protected Long getLongProjectPropertyValueOrDefault(String pKey, Long pDefault)
      Returns the value of a project property as a Long for the given name. Returns pDefault if property is not found.
      Parameters:
      pKey - the name of the project property
      Returns:
      the project property value as a Long
    • getLongInstancePropertyValue

      protected Long getLongInstancePropertyValue(String pInstanceCode, String pKey)
      Returns the value of a target property as a Long for the given target group code and property name. Returns null if pKey is not found within the given target group code.
      Parameters:
      pKey - the name of the target property
      Returns:
      the target property value as a Long
    • getLongInstancePropertyValueOrDefault

      protected Long getLongInstancePropertyValueOrDefault(String pInstanceCode, String pKey, Long pDefault)
      Returns the value of a target property as a Long for the given target group code and property name. Returns pDefault if property is not found within the given target group code.
      Parameters:
      pKey - the name of the target property
      Returns:
      the target property value as a Long
    • getLongCurrentInstancePropertyValue

      protected Long getLongCurrentInstancePropertyValue(String pKey)
      Returns the value of a target property as a Long for the given property name within the current target group. Returns null if pKey is not found within the current target group.
      Parameters:
      pKey - the name of the target property
      Returns:
      the target property value as a Long
    • getLongCurrentInstancePropertyValueOrDefault

      protected Long getLongCurrentInstancePropertyValueOrDefault(String pKey, Long pDefault)
      Returns the value of a target property as a Long for the given property name within the current target group. Returns pDefault if property is not found within the current target group.
      Parameters:
      pKey - the name of the target property
      Returns:
      the target property value as a Long
    • isExecutionAborting

      protected boolean isExecutionAborting()
      Returns whether an abort signal was received for the current plugin execution.
      Returns:
      true if an abort signal was received, false otherwise
    • abortOnRequest

      protected void abortOnRequest() throws FlexAbortPluginException
      Aborts the current execution if an abort signal was received.
      Throws:
      FlexAbortPluginException - if an abort signal was received
    • abortOnRequest

      protected void abortOnRequest(String pMessage) throws FlexAbortPluginException
      Aborts the current execution if an abort signal was received.
      Parameters:
      pMessage - the message to log with the exception which is thrown
      Throws:
      FlexAbortPluginException - if an abort signal was received