markap14 commented on a change in pull request #5113:
URL: https://github.com/apache/nifi/pull/5113#discussion_r657370390
##########
File path:
nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/config/PropertiesFileFlowDefinitionParser.java
##########
@@ -174,6 +180,80 @@
return new ArrayList<>(reportingTaskDefinitions.values());
}
+ private List<ParameterProviderDefinition> getParameterProviders(final
Map<String, String> properties, final List<ParameterOverride>
parameterOverrides) {
+ final Map<String, ParameterProviderDefinition>
parameterProviderDefinitions = new LinkedHashMap<>();
+
+ for (final String propertyName : properties.keySet()) {
+ final Matcher matcher =
PARAMETER_PROVIDER_PATTERN.matcher(propertyName);
+ if (!matcher.matches()) {
+ continue;
+ }
+
+ // For a property name like:
+ // nifi.stateless.parameter.provider.abc.name=hello
+ // We consider 'abc' the <parameter provider key> and 'name' the
<relative property name>
+ final String parameterProviderKey = matcher.group(1);
+ final ParameterProviderDefinition definition =
parameterProviderDefinitions.computeIfAbsent(parameterProviderKey, key -> new
ParameterProviderDefinition());
+ final String relativePropertyName = matcher.group(2);
+ final String propertyValue = properties.get(propertyName);
+
+ if (relativePropertyName.startsWith("properties.")) {
+ if (relativePropertyName.length() < 12) {
+ logger.warn("Encountered unexpected property <" +
propertyName + "> in flow definition. This property will be ignored.");
+ continue;
+ }
+
+ final String providerPropertyName =
relativePropertyName.substring(11);
+ definition.getPropertyValues().put(providerPropertyName,
propertyValue);
Review comment:
Thanks. Made it really easy to replicate. I also caught a couple of
other minor tweaks that should be added to clarify when things aren't as
expected. Will update these.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]