Package com.dtolabs.rundeck.core.plugins
Class AbstractDescribableScriptPlugin
- java.lang.Object
-
- com.dtolabs.rundeck.core.plugins.AbstractDescribableScriptPlugin
-
- All Implemented Interfaces:
Describable
- Direct Known Subclasses:
BaseScriptPlugin,ScriptPluginResourceModelSourceFactory
public abstract class AbstractDescribableScriptPlugin extends java.lang.Object implements Describable
AbstractDescribableScriptPlugin is a base ScriptPlugin provider implementation that can be used to provide a describable interface for a script plugin. The description provided by the base implementation is configured by theScriptPluginProvider's metadata:title = Title of the Plugin description = Description of the pluginconfig.X.PROPERTY_TYPE = Type name of the property, fromProperty.Typeconfig.X.name = Name of the property (key string) config.X.title = Title of the property config.X.description = description of the property config.X.required = true/false, if the property is required. config.X.default = default string of the property config.X.values = comma-separated values list for Select or FreeSelect properties config.X.scope = scope of the property, fromPropertyScope
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCONFIG_BLANK_IF_UNEXPANDEDstatic java.lang.StringCONFIG_DEFAULTstatic java.lang.StringCONFIG_DESCRIPTIONstatic java.lang.StringCONFIG_LABELSstatic java.lang.StringCONFIG_NAMEstatic java.lang.StringCONFIG_PROP_PREFIXstatic java.lang.StringCONFIG_RENDERING_OPTIONSstatic java.lang.StringCONFIG_REQUIREDstatic java.lang.StringCONFIG_SCOPEstatic java.lang.StringCONFIG_TITLEstatic java.lang.StringCONFIG_TYPEstatic java.lang.StringCONFIG_VALUESstatic java.lang.StringDESCRIPTION_PROPstatic java.lang.StringSETTING_MERGE_ENVIRONMENTstatic java.lang.StringTITLE_PROP
-
Constructor Summary
Constructors Constructor Description AbstractDescribableScriptPlugin(ScriptPluginProvider provider)AbstractDescribableScriptPlugin(ScriptPluginProvider provider, Framework framework)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected static voidcreateDescription(ScriptPluginProvider provider, boolean allowCustomProperties, boolean useConventionalPropertiesMapping, DescriptionBuilder builder)protected static voidcreateDescription(ScriptPluginProvider provider, boolean allowCustomProperties, DescriptionBuilder builder)java.util.Map<java.lang.String,java.lang.String>createPluginData()DescriptiongetDescription()FrameworkgetFramework()ScriptPluginProvidergetProvider()abstract booleanisAllowCustomProperties()booleanisUseConventionalPropertiesMapping()protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>>loadConfigData(ExecutionContext context, java.util.Map<java.lang.String,java.lang.Object> instanceData, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> localDataContext, Description description, java.lang.String serviceName)Loads the plugin configuration values stored in project or framework properties, alsoprotected voidloadContentConversionPropertyValues(java.util.Map<java.lang.String,java.lang.String> data, ExecutionContext context, java.util.List<Property> pluginProperties)Looks for properties with content conversion, and converts the valuesprotected java.util.Map<java.lang.String,java.lang.Object>loadInstanceDataFromNodeAttributes(INodeEntry node, Description description)Map node attributes as instance configuration values based on property descriptions.
-
-
-
Field Detail
-
TITLE_PROP
public static final java.lang.String TITLE_PROP
- See Also:
- Constant Field Values
-
DESCRIPTION_PROP
public static final java.lang.String DESCRIPTION_PROP
- See Also:
- Constant Field Values
-
CONFIG_PROP_PREFIX
public static final java.lang.String CONFIG_PROP_PREFIX
- See Also:
- Constant Field Values
-
CONFIG_TITLE
public static final java.lang.String CONFIG_TITLE
- See Also:
- Constant Field Values
-
CONFIG_DESCRIPTION
public static final java.lang.String CONFIG_DESCRIPTION
- See Also:
- Constant Field Values
-
CONFIG_NAME
public static final java.lang.String CONFIG_NAME
- See Also:
- Constant Field Values
-
CONFIG_TYPE
public static final java.lang.String CONFIG_TYPE
- See Also:
- Constant Field Values
-
CONFIG_REQUIRED
public static final java.lang.String CONFIG_REQUIRED
- See Also:
- Constant Field Values
-
CONFIG_DEFAULT
public static final java.lang.String CONFIG_DEFAULT
- See Also:
- Constant Field Values
-
CONFIG_VALUES
public static final java.lang.String CONFIG_VALUES
- See Also:
- Constant Field Values
-
CONFIG_LABELS
public static final java.lang.String CONFIG_LABELS
- See Also:
- Constant Field Values
-
CONFIG_SCOPE
public static final java.lang.String CONFIG_SCOPE
- See Also:
- Constant Field Values
-
CONFIG_RENDERING_OPTIONS
public static final java.lang.String CONFIG_RENDERING_OPTIONS
- See Also:
- Constant Field Values
-
SETTING_MERGE_ENVIRONMENT
public static final java.lang.String SETTING_MERGE_ENVIRONMENT
- See Also:
- Constant Field Values
-
CONFIG_BLANK_IF_UNEXPANDED
public static final java.lang.String CONFIG_BLANK_IF_UNEXPANDED
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractDescribableScriptPlugin
public AbstractDescribableScriptPlugin(ScriptPluginProvider provider, Framework framework)
-
AbstractDescribableScriptPlugin
public AbstractDescribableScriptPlugin(ScriptPluginProvider provider)
-
-
Method Detail
-
createPluginData
public java.util.Map<java.lang.String,java.lang.String> createPluginData()
- Returns:
- data with exported plugin details
-
createDescription
protected static void createDescription(ScriptPluginProvider provider, boolean allowCustomProperties, DescriptionBuilder builder) throws ConfigurationException
- Throws:
ConfigurationException
-
createDescription
protected static void createDescription(ScriptPluginProvider provider, boolean allowCustomProperties, boolean useConventionalPropertiesMapping, DescriptionBuilder builder) throws ConfigurationException
- Throws:
ConfigurationException
-
loadInstanceDataFromNodeAttributes
protected java.util.Map<java.lang.String,java.lang.Object> loadInstanceDataFromNodeAttributes(INodeEntry node, Description description)
Map node attributes as instance configuration values based on property descriptions. If a property has a rendering option key ofStringRenderingConstants.INSTANCE_SCOPE_NODE_ATTRIBUTE_KEYthen use the value of that option as the node attribute name to use.- Parameters:
node- nodedescription- plugin description- Returns:
- instance config data
-
loadConfigData
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> loadConfigData(ExecutionContext context, java.util.Map<java.lang.String,java.lang.Object> instanceData, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> localDataContext, Description description, java.lang.String serviceName) throws ConfigurationException
Loads the plugin configuration values stored in project or framework properties, also- Parameters:
context- execution contextlocalDataContext- current context datadescription- plugin descriptioninstanceData- instance dataserviceName- service name- Returns:
- context data with a new "config" entry containing the loaded plugin config properties.
- Throws:
ConfigurationException- configuration error
-
loadContentConversionPropertyValues
protected void loadContentConversionPropertyValues(java.util.Map<java.lang.String,java.lang.String> data, ExecutionContext context, java.util.List<Property> pluginProperties) throws ConfigurationExceptionLooks for properties with content conversion, and converts the values- Parameters:
data- map of values for config propertiescontext- execution contextpluginProperties- definition of plugin properties- Throws:
ConfigurationException
-
getDescription
public Description getDescription()
- Specified by:
getDescriptionin interfaceDescribable- Returns:
- the configuration description
-
isAllowCustomProperties
public abstract boolean isAllowCustomProperties()
- Returns:
- true if the script-plugin allows custom configuration properties defined in plugin metadata.
-
isUseConventionalPropertiesMapping
public boolean isUseConventionalPropertiesMapping()
- Returns:
- true to provide conventional mapping from config properties to framework/project properties.
-
getProvider
public ScriptPluginProvider getProvider()
-
getFramework
public Framework getFramework()
-
-