Package flexagon.fd.core.plugin
Class AbstractPluginProvider
java.lang.Object
flexagon.fd.core.plugin.AbstractPluginProvider
- All Implemented Interfaces:
PluginProvider
- Direct Known Subclasses:
AbstractPartialDeployPluginProvider
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:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAborts the current execution if an abort signal was received.protected voidabortOnRequest(String pMessage) Aborts the current execution if an abort signal was received.voidcleanup()Can be overridden by the concrete subclass to perform a necessary cleanup of resources (e.g.abstract PluginResultexecute()Must be implemented by the concrete subclass to perform the execution of the plugin operation.protected BooleanReturns the value of a target property as a Boolean for the given property name within the current target group.protected BooleangetBooleanCurrentInstancePropertyValueOrDefault(String pKey, Boolean pDefault) Returns the value of a target property as a Boolean for the given property name within the current target group.protected BooleangetBooleanInput(String pInputName) Returns the value of the given input as a Boolean.protected BooleangetBooleanInputOrDefault(String pInputName, Boolean pDefault) Returns the value of the given input as a Boolean.protected BooleangetBooleanInstancePropertyValue(String pInstanceCode, String pKey) Returns the value of a target property as a Boolean for the given target group code and property name.protected BooleangetBooleanInstancePropertyValueOrDefault(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.protected BooleanReturns the value of a project property as a Boolean for the given name.protected BooleangetBooleanProjectPropertyValueOrDefault(String pKey, Boolean pDefault) Returns the value of a project property as a Boolean for the given name.protected DoubleReturns the value of a target property as a Double for the given property name within the current target group.protected DoublegetDoubleCurrentInstancePropertyValueOrDefault(String pKey, Double pDefault) Returns the value of a target property as a Double for the given property name within the current target group.protected DoublegetDoubleInput(String pInputName) Returns the value of the given input as a Double.protected DoublegetDoubleInputOrDefault(String pInputName, Double pDefault) Returns the value of the given input as a Double.protected DoublegetDoubleInstancePropertyValue(String pInstanceCode, String pKey) Returns the value of a target property as a Double for the given target group code and property name.protected DoublegetDoubleInstancePropertyValueOrDefault(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.protected DoubleReturns the value of a project property as a Double for the given name.protected DoublegetDoubleProjectPropertyValueOrDefault(String pKey, Double pDefault) Returns the value of a project property as a Double for the given name.protected IntegerReturns the value of a target property as an Integer for the given property name within the current target group.protected IntegergetIntegerCurrentInstancePropertyValueOrDefault(String pKey, Integer pDefault) Returns the value of a target property as an Integer for the given property name within the current target group.protected IntegergetIntegerInput(String pInputName) Returns the value of the given input as an Integer.protected IntegergetIntegerInputOrDefault(String pInputName, Integer pDefault) Returns the value of the given input as an Integer.protected IntegergetIntegerInstancePropertyValue(String pInstanceCode, String pKey) Returns the value of a target property as an Integer for the given target group code and property name.protected IntegergetIntegerInstancePropertyValueOrDefault(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.protected IntegerReturns the value of a project property as an Integer for the given name.protected IntegergetIntegerProjectPropertyValueOrDefault(String pKey, Integer pDefault) Returns the value of a project property as an Integer for the given name.protected LongReturns the value of a target property as a Long for the given property name within the current target group.protected LonggetLongCurrentInstancePropertyValueOrDefault(String pKey, Long pDefault) Returns the value of a target property as a Long for the given property name within the current target group.protected LonggetLongInput(String pInputName) Returns the value of the given input as a Long.protected LonggetLongInputOrDefault(String pInputName, Long pDefault) Returns the value of the given input as a Long.protected LonggetLongInstancePropertyValue(String pInstanceCode, String pKey) Returns the value of a target property as a Long for the given target group code and property name.protected LonggetLongInstancePropertyValueOrDefault(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.protected LongReturns the value of a project property as a Long for the given name.protected LonggetLongProjectPropertyValueOrDefault(String pKey, Long pDefault) Returns the value of a project property as a Long for the given name.protected StringReturns the value of a target property as a String for the given property name within the current target group.protected StringgetStringCurrentInstancePropertyValueOrDefault(String pKey, String pDefault) Returns the value of a target property as a String for the given property name within the current target group.protected StringgetStringInput(String pInputName) Returns the value of the given input as a String.protected StringgetStringInputOrDefault(String pInputName, String pDefault) Returns the value of the given input as a String.protected StringgetStringInstancePropertyValue(String pInstanceCode, String pKey) Returns the value of a target property as an Object for the given target group code and property name.protected StringgetStringInstancePropertyValueOrDefault(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.protected StringReturns the value of a project property as a String for the given name.protected StringgetStringProjectPropertyValueOrDefault(String pKey, String pDefault) Returns the value of a project property as a String for the given name.Returns the WorkflowExecutionContext for the current plugin operation execution.protected booleanReturns whether an abort signal was received for the current plugin execution.protected voidsetOutput(String pName, Object pValue, DataTypeEnum pDataType) Sets an output into WorkflowExecutionContext, which will be returned within a PluginResult from the execute() method.voidsetWorkflowExecutionContext(WorkflowExecutionContext pExecutionContext) FOR INTERNAL USE AND TEST SETUP ONLYabstract voidvalidate()Must be implemented by the concrete subclass to perform any validation (prior to execution).protected voidvalidateContext(Collection<String> pRequiredProperties, Collection<String> pRequiredInputs) Validates that the given properties and inputs have non-null values within the WorkflowExecution context for the current execution instance.protected voidvalidateContext(Collection<String> pRequiredProperties, Collection<String> pRequiredInputs, String pValidateTargetGroup) Validates that the given properties and inputs have non-null values within the WorkflowExecution context for the given execution instance.protected voidvalidateRequiredInputs(Collection<String> pRequiredInputs) Validates that the given inputs have non-null values within the WorkflowExecution context for the current execution instance.protected voidvalidateRequiredPropertiesForCurrentInstance(Collection<String> pRequiredProperties) Validates that the given properties have non-null values within the WorkflowExecution context for the current execution instance.protected voidvalidateRequiredPropertiesForInstance(Collection<String> pRequiredProperties, String pValidateTargetGroup) Validates that the given properties have non-null values within the WorkflowExecution context for the given execution instance.
-
Constructor Details
-
AbstractPluginProvider
public AbstractPluginProvider()INTERNAL USE ONLY
-
-
Method Details
-
setWorkflowExecutionContext
FOR INTERNAL USE AND TEST SETUP ONLY- Specified by:
setWorkflowExecutionContextin interfacePluginProvider- Parameters:
pExecutionContext- the workflow execution context
-
getWorkflowExecutionContext
Returns the WorkflowExecutionContext for the current plugin operation execution.- Returns:
- the execution context object
-
execute
Must be implemented by the concrete subclass to perform the execution of the plugin operation.- Specified by:
executein interfacePluginProvider- Returns:
- the result of the plugin operation execution
- Throws:
FlexCheckedException- if the plugin operation fails
-
validate
Must be implemented by the concrete subclass to perform any validation (prior to execution).- Specified by:
validatein interfacePluginProvider- 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:
cleanupin interfacePluginProvider
-
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 propertiespRequiredInputs- 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 propertiespRequiredInputs- a collection of required inputspValidateTargetGroup- 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 propertiespValidateTargetGroup- 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
Sets an output into WorkflowExecutionContext, which will be returned within a PluginResult from the execute() method.- Parameters:
pName- the name of the output to setpValue- the value of the output (must be of type pDataType)pDataType- the data type of the property
-
getBooleanInput
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Aborts the current execution if an abort signal was received.- Throws:
FlexAbortPluginException- if an abort signal was received
-
abortOnRequest
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
-