nandorsoma commented on code in PR #7228:
URL: https://github.com/apache/nifi/pull/7228#discussion_r1185451465
##########
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExecuteStreamCommand.java:
##########
@@ -363,8 +348,37 @@ protected PropertyDescriptor
getSupportedDynamicPropertyDescriptor(final String
.expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
.addValidator(ATTRIBUTE_EXPRESSION_LANGUAGE_VALIDATOR)
.build();
+ } else {
+ return new PropertyDescriptor.Builder()
+ .name(propertyDescriptorName)
+ .description("Sets the environment variable '" +
propertyDescriptorName + "' for the process' environment")
+ .dynamic(true)
+ .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+ .build();
}
- return null;
+ }
+
+ @Override
+ protected Collection<ValidationResult> customValidate(ValidationContext
validationContext) {
+ final List<ValidationResult> validationResults = new
ArrayList<>(super.customValidate(validationContext));
+
+ final String argumentStrategy =
validationContext.getProperty(ARGUMENTS_STRATEGY).getValue();
+ if (DYNAMIC_PROPERTY_ARGUMENTS_STRATEGY.getValue() !=
argumentStrategy) {
+ for (final PropertyDescriptor propertyDescriptor :
validationContext.getProperties().keySet()) {
+ if (!propertyDescriptor.isDynamic()) {
+ continue;
+ }
+
+ final String propertyName = propertyDescriptor.getName();
+ final Matcher matcher =
COMMAND_ARGUMENT_PATTERN.matcher(propertyName);
+ if (matcher.matches()) {
+ logger.warn(String.format("'%s' should be set to '%s' when
command arguments are supplied as Dynamic Properties. The property '%s' will be
ignored.",
Review Comment:
In a separate 2.0 only PR I'd add an invalid validation result here. Is it
ok?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]