Class PluginAdapterImpl
- java.lang.Object
-
- com.dtolabs.rundeck.core.plugins.configuration.PluginAdapterImpl
-
- All Implemented Interfaces:
PluginAdapter
public class PluginAdapterImpl extends java.lang.Object implements PluginAdapter
Plugin adapter implementation
-
-
Constructor Summary
Constructors Constructor Description PluginAdapterImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DescriptionbuildDescription(java.lang.Class<?> type, DescriptionBuilder builder)DescriptionbuildDescription(java.lang.Class<?> type, DescriptionBuilder builder, boolean includeAnnotatedFieldProperties)DescriptionbuildDescription(java.lang.Object object, DescriptionBuilder builder)DescriptionbuildDescription(java.lang.Object object, DescriptionBuilder builder, boolean includeAnnotatedFieldProperties)java.util.List<Property>buildFieldProperties(java.lang.Class<?> aClass)Return the list of properties by introspecting the annotated fields forPluginPropertyvoidbuildFieldProperties(java.lang.Class<?> aClass, DescriptionBuilder builder)Add properties based on introspection of a classjava.util.List<Property>buildFieldProperties(java.lang.Object object)Return the list of properties by introspecting the annotated fields forPluginPropertyvoidbuildFieldProperties(java.lang.Object object, DescriptionBuilder builder)Add properties based on introspection of the objectbooleancanBuildDescription(java.lang.Object object)java.util.Collection<java.lang.reflect.Field>collectClassFields(java.lang.Class<?> aClass)java.util.Collection<java.lang.reflect.Field>collectFields(java.lang.Object object)java.util.Map<java.lang.String,java.lang.Object>configureObjectFieldsWithProperties(java.lang.Object object, java.util.List<Property> properties, java.util.Map<java.lang.String,java.lang.Object> inputConfig)Set field values on an object given a list of properties and input values for those propertiesjava.util.Map<java.lang.String,java.lang.Object>configureObjectFieldsWithProperties(java.lang.Object object, java.util.Map<java.lang.String,java.lang.Object> inputConfig)Set field values on an object using introspection and input values for those propertiesjava.util.Map<java.lang.String,java.lang.Object>configureProperties(PropertyResolver resolver, Description description, java.lang.Object object, PropertyScope defaultScope)Set field values on a plugin object by using a Description, and setting field values to resolved property values.java.util.Map<java.lang.String,java.lang.Object>configureProperties(PropertyResolver resolver, java.lang.Object object)Set field values on a plugin object by using annotated field values to create a Description, and setting field values to resolved property values.voidextractSelectLabels(PropertyBuilder pbuild, java.lang.String[] values, SelectLabels labelsAnnotation)java.lang.reflect.FieldfieldForPropertyName(java.lang.String name, java.lang.Object object)PluginCustomConfiggetCustomConfigAnnotation(java.lang.Object providerInstance)java.lang.StringgetPluginNameAnnotation(java.lang.Class<?> aClass)java.util.Map<java.lang.String,java.lang.String>loadPluginMetadata(java.lang.Class<?> clazz)java.util.Map<java.lang.String,java.lang.Object>mapDescribedProperties(PropertyResolver resolver, Description description)Retrieve the Description's Properties mapped to resolved values given the resolver, using InsanceOnly default scope.java.util.Map<java.lang.String,java.lang.Object>mapDescribedProperties(PropertyResolver resolver, Description description, PropertyScope defaultPropertyScope)Retrieve the Description's Properties mapped to resolved values given the resolver, with a default property scopejava.util.Map<java.lang.String,java.lang.Object>mapProperties(PropertyResolver resolver, java.util.List<Property> properties, PropertyScope defaultPropertyScope)Retrieve the Properties mapped to resolved values given the resolver, with a default property scopebooleannotBlank(java.lang.String string)PropertypropertyFromField(java.lang.reflect.Field field, PluginProperty annotation)Property.TypepropertyTypeFromFieldType(java.lang.Class clazz)voidsetConfig(java.lang.Object object, java.lang.Object config)Set config on fields annotated with PluginConfigPluginCustomConfig
-
-
-
Method Detail
-
canBuildDescription
public boolean canBuildDescription(java.lang.Object object)
- Specified by:
canBuildDescriptionin interfacePluginAdapter- Parameters:
object- potential plugin object annotated withPlugin- Returns:
- true if the object has a valid Plugin annotation
-
buildDescription
public Description buildDescription(java.lang.Object object, DescriptionBuilder builder)
- Specified by:
buildDescriptionin interfacePluginAdapter- Parameters:
object- the objectbuilder- builder- Returns:
- Create a Description using a builder by analyzing the annotations on a plugin object, and including annotations on fields as DescriptionProperties.
-
buildDescription
public Description buildDescription(java.lang.Class<?> type, DescriptionBuilder builder)
- Specified by:
buildDescriptionin interfacePluginAdapter- Parameters:
type- the typebuilder- builder- Returns:
- Create a Description using a builder by analyzing the annotations on a plugin type, and including annotations on fields as DescriptionProperties.
-
buildDescription
public Description buildDescription(java.lang.Object object, DescriptionBuilder builder, boolean includeAnnotatedFieldProperties)
- Specified by:
buildDescriptionin interfacePluginAdapter- Parameters:
object- the objectbuilder- builderincludeAnnotatedFieldProperties- if true, add DescriptionProperties to the Description based on annotations of fields in the class of the instance- Returns:
- Create a Description using a builder by analyzing the annotations on a plugin object.
-
buildDescription
public Description buildDescription(java.lang.Class<?> type, DescriptionBuilder builder, boolean includeAnnotatedFieldProperties)
- Specified by:
buildDescriptionin interfacePluginAdapter- Parameters:
builder- builderincludeAnnotatedFieldProperties- if true, add DescriptionProperties to the Description based on annotations of fields in the class of the instance- Returns:
- Create a Description using a builder by analyzing the annotations on a plugin object.
-
getPluginNameAnnotation
public java.lang.String getPluginNameAnnotation(java.lang.Class<?> aClass)
- Specified by:
getPluginNameAnnotationin interfacePluginAdapter
-
loadPluginMetadata
public java.util.Map<java.lang.String,java.lang.String> loadPluginMetadata(java.lang.Class<?> clazz)
- Specified by:
loadPluginMetadatain interfacePluginAdapter
-
buildFieldProperties
public java.util.List<Property> buildFieldProperties(java.lang.Object object)
Return the list of properties by introspecting the annotated fields forPluginProperty- Specified by:
buildFieldPropertiesin interfacePluginAdapter- Parameters:
object- object- Returns:
- list of properties, may be empty
-
buildFieldProperties
public java.util.List<Property> buildFieldProperties(java.lang.Class<?> aClass)
Return the list of properties by introspecting the annotated fields forPluginProperty- Specified by:
buildFieldPropertiesin interfacePluginAdapter- Parameters:
aClass- class- Returns:
- list of properties, may be empty
-
buildFieldProperties
public void buildFieldProperties(java.lang.Object object, DescriptionBuilder builder)Add properties based on introspection of the object- Specified by:
buildFieldPropertiesin interfacePluginAdapter- Parameters:
object- objectbuilder- builder
-
buildFieldProperties
public void buildFieldProperties(java.lang.Class<?> aClass, DescriptionBuilder builder)Add properties based on introspection of a class- Specified by:
buildFieldPropertiesin interfacePluginAdapter- Parameters:
aClass- classbuilder- builder
-
fieldForPropertyName
public java.lang.reflect.Field fieldForPropertyName(java.lang.String name, java.lang.Object object)- Specified by:
fieldForPropertyNamein interfacePluginAdapter
-
collectFields
public java.util.Collection<java.lang.reflect.Field> collectFields(java.lang.Object object)
- Specified by:
collectFieldsin interfacePluginAdapter
-
collectClassFields
public java.util.Collection<java.lang.reflect.Field> collectClassFields(java.lang.Class<?> aClass)
- Specified by:
collectClassFieldsin interfacePluginAdapter
-
propertyTypeFromFieldType
public Property.Type propertyTypeFromFieldType(java.lang.Class clazz)
- Specified by:
propertyTypeFromFieldTypein interfacePluginAdapter
-
propertyFromField
public Property propertyFromField(java.lang.reflect.Field field, PluginProperty annotation)
- Specified by:
propertyFromFieldin interfacePluginAdapter
-
extractSelectLabels
public void extractSelectLabels(PropertyBuilder pbuild, java.lang.String[] values, SelectLabels labelsAnnotation)
- Specified by:
extractSelectLabelsin interfacePluginAdapter
-
notBlank
public boolean notBlank(java.lang.String string)
- Specified by:
notBlankin interfacePluginAdapter
-
configureProperties
public java.util.Map<java.lang.String,java.lang.Object> configureProperties(PropertyResolver resolver, java.lang.Object object)
Set field values on a plugin object by using annotated field values to create a Description, and setting field values to resolved property values. Any resolved properties that are not mapped to a field will be included in the return result.- Specified by:
configurePropertiesin interfacePluginAdapter- Parameters:
resolver- property resolverobject- plugin object- Returns:
- Map of resolved properties that were not configured in the object's fields
-
configureProperties
public java.util.Map<java.lang.String,java.lang.Object> configureProperties(PropertyResolver resolver, Description description, java.lang.Object object, PropertyScope defaultScope)
Set field values on a plugin object by using a Description, and setting field values to resolved property values. Any resolved properties that are not mapped to a field will be included in the return result.- Specified by:
configurePropertiesin interfacePluginAdapter- Parameters:
resolver- the property resolverdescription- the property descriptionsobject- the target object, which can implementConfigurable, otherwise introspection will be useddefaultScope- a default property scope to assume for unspecified properties- Returns:
- Map of resolved properties that were not configured in the object's fields
-
configureObjectFieldsWithProperties
public java.util.Map<java.lang.String,java.lang.Object> configureObjectFieldsWithProperties(java.lang.Object object, java.util.Map<java.lang.String,java.lang.Object> inputConfig)Set field values on an object using introspection and input values for those properties- Specified by:
configureObjectFieldsWithPropertiesin interfacePluginAdapter- Parameters:
object- objectinputConfig- input- Returns:
- Map of resolved properties that were not configured in the object's fields
-
configureObjectFieldsWithProperties
public java.util.Map<java.lang.String,java.lang.Object> configureObjectFieldsWithProperties(java.lang.Object object, java.util.List<Property> properties, java.util.Map<java.lang.String,java.lang.Object> inputConfig)Set field values on an object given a list of properties and input values for those properties- Specified by:
configureObjectFieldsWithPropertiesin interfacePluginAdapter- Parameters:
object- objectproperties- propertiesinputConfig- input- Returns:
- Map of resolved properties that were not configured in the object's fields
-
mapDescribedProperties
public java.util.Map<java.lang.String,java.lang.Object> mapDescribedProperties(PropertyResolver resolver, Description description)
Retrieve the Description's Properties mapped to resolved values given the resolver, using InsanceOnly default scope.- Specified by:
mapDescribedPropertiesin interfacePluginAdapter- Parameters:
resolver- property resolverdescription- plugin description- Returns:
- All mapped properties by name and value.
-
mapDescribedProperties
public java.util.Map<java.lang.String,java.lang.Object> mapDescribedProperties(PropertyResolver resolver, Description description, PropertyScope defaultPropertyScope)
Retrieve the Description's Properties mapped to resolved values given the resolver, with a default property scope- Specified by:
mapDescribedPropertiesin interfacePluginAdapter- Parameters:
resolver- property resolverdescription- plugin descriptiondefaultPropertyScope- default scope for unspecified property scopes- Returns:
- All mapped properties by name and value.
-
mapProperties
public java.util.Map<java.lang.String,java.lang.Object> mapProperties(PropertyResolver resolver, java.util.List<Property> properties, PropertyScope defaultPropertyScope)
Retrieve the Properties mapped to resolved values given the resolver, with a default property scope- Specified by:
mapPropertiesin interfacePluginAdapter- Parameters:
resolver- property resolverproperties- propertiesdefaultPropertyScope- default scope for unspecified property scopes- Returns:
- All mapped properties by name and value.
-
setConfig
public void setConfig(java.lang.Object object, java.lang.Object config)Set config on fields annotated with PluginConfigPluginCustomConfig- Specified by:
setConfigin interfacePluginAdapter- Parameters:
object-config-
-
getCustomConfigAnnotation
public PluginCustomConfig getCustomConfigAnnotation(java.lang.Object providerInstance)
- Specified by:
getCustomConfigAnnotationin interfacePluginAdapter
-
-