|
33 | 33 | import org.apache.nifi.annotation.behavior.Restricted; |
34 | 34 | import org.apache.nifi.annotation.behavior.Restriction; |
35 | 35 | import org.apache.nifi.annotation.behavior.Stateful; |
| 36 | +import org.apache.nifi.annotation.behavior.SupportsSensitiveDynamicProperties; |
36 | 37 | import org.apache.nifi.annotation.documentation.CapabilityDescription; |
37 | 38 | import org.apache.nifi.annotation.documentation.SeeAlso; |
38 | 39 | import org.apache.nifi.annotation.documentation.Tags; |
|
80 | 81 | @Stateful(scopes = {Scope.LOCAL, Scope.CLUSTER}, |
81 | 82 | description = "Scripts can store and retrieve state using the State Management APIs. Consult the State Manager section of the Developer's Guide for more details.") |
82 | 83 | @SeeAlso(classNames = {"org.apache.nifi.processors.script.ExecuteScript"}) |
| 84 | +@SupportsSensitiveDynamicProperties |
83 | 85 | @DynamicProperty(name = "A script engine property to update", |
84 | 86 | value = "The value to set it to", |
85 | 87 | expressionLanguageScope = ExpressionLanguageScope.FLOWFILE_ATTRIBUTES, |
86 | 88 | description = "Updates a script engine property specified by the Dynamic Property's key with the value specified by the Dynamic Property's value. " |
87 | 89 | + "Use `CTL.` to access any controller services, `SQL.` to access any DBCPServices, `RecordReader.` to access RecordReaderFactory instances, or " |
88 | | - + "`RecordWriter.` to access any RecordSetWriterFactory instances. Use `SENSITIVE.` to mark the property as sensitive.") |
| 90 | + + "`RecordWriter.` to access any RecordSetWriterFactory instances.") |
89 | 91 | public class ExecuteGroovyScript extends AbstractProcessor { |
90 | 92 | public static final String GROOVY_CLASSPATH = "${groovy.classes.path}"; |
91 | 93 |
|
92 | | - protected static final String SENSITIVE_PROPERTY_PREFIX = "SENSITIVE."; |
93 | | - |
94 | 94 | private static final String PRELOADS = "import org.apache.nifi.components.*;" + "import org.apache.nifi.flowfile.FlowFile;" + "import org.apache.nifi.processor.*;" |
95 | 95 | + "import org.apache.nifi.processor.FlowFileFilter.FlowFileFilterResult;" + "import org.apache.nifi.processor.exception.*;" + "import org.apache.nifi.processor.io.*;" |
96 | 96 | + "import org.apache.nifi.processor.util.*;" + "import org.apache.nifi.processors.script.*;" + "import org.apache.nifi.logging.ComponentLog;"; |
@@ -545,18 +545,13 @@ protected PropertyDescriptor getSupportedDynamicPropertyDescriptor(final String |
545 | 545 | .build(); |
546 | 546 | } |
547 | 547 |
|
548 | | - final PropertyDescriptor.Builder builder = new PropertyDescriptor.Builder() |
| 548 | + return new PropertyDescriptor.Builder() |
549 | 549 | .name(propertyDescriptorName) |
550 | 550 | .required(false) |
551 | 551 | .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) |
552 | 552 | .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT) |
553 | | - .dynamic(true); |
554 | | - |
555 | | - if (propertyDescriptorName.startsWith(SENSITIVE_PROPERTY_PREFIX)) { |
556 | | - builder.sensitive(true); |
557 | | - } |
558 | | - |
559 | | - return builder.build(); |
| 553 | + .dynamic(true) |
| 554 | + .build(); |
560 | 555 | } |
561 | 556 |
|
562 | 557 | /** simple HashMap with exception on access of non-existent key */ |
|
0 commit comments