mattyb149 commented on a change in pull request #3543: NIFI-6388 Add dynamic 
relationships to the ExecuteScript processor.
URL: https://github.com/apache/nifi/pull/3543#discussion_r409218787
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/processors/script/ExecuteScript.java
 ##########
 @@ -303,4 +423,57 @@ public void stop() {
 
         return results;
     }
+
+    private void initializeScriptingComponentHelper() {
+        synchronized (scriptingComponentHelper.isInitialized) {
+            if (!scriptingComponentHelper.isInitialized.get()) {
+                scriptingComponentHelper.createResources();
+                
scriptingComponentHelper.addDescriptor(ScriptingComponentUtils.USE_DYNAMIC_RELATIONSHIPS);
+            }
+        }
+    }
+
+    private static boolean propertySpecifiesRelationship(final String 
propertyDescriptorName) {
+        return propertyDescriptorName != null
+                && 
propertyDescriptorName.startsWith(DYNAMIC_RELATIONSHIP_PREFIX);
+    }
+
+    private static String getRelationshipName(final String 
propertyDescriptorName) {
+        return !propertySpecifiesRelationship(propertyDescriptorName) || 
DYNAMIC_RELATIONSHIP_PREFIX.equals(propertyDescriptorName)
+               ? ""
+               : 
propertyDescriptorName.substring(DYNAMIC_RELATIONSHIP_PREFIX.length());
+    }
+
+    private static boolean isValidRelationshipName(final String 
relationshipName) {
+        final String nameInLowerCase = relationshipName.toLowerCase();
+        return !(REL_SUCCESS.getName().equals(nameInLowerCase)
+                || REL_FAILURE.getName().equals(nameInLowerCase));
+    }
+
+    private static class RelationshipInvalidator implements Validator {
 
 Review comment:
   This is a nitpick, but I'm not sure we have any other "Invalidator" 
implementations, usually they're called "Validator" even if their only job is 
to check conditions that may make it invalid.

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to