mattyb149 commented on a change in pull request #3886: NIFI-6855 - added action 
type enforcement option for handlers
URL: https://github.com/apache/nifi/pull/3886#discussion_r347523331
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-rules-action-handler-bundle/nifi-rules-action-handler-service/src/main/java/org/apache/nifi/rules/handlers/AbstractActionHandlerService.java
 ##########
 @@ -16,22 +16,54 @@
  */
 package org.apache.nifi.rules.handlers;
 
+import org.apache.commons.lang3.StringUtils;
+import org.apache.nifi.annotation.lifecycle.OnEnabled;
+import org.apache.nifi.components.PropertyDescriptor;
 import org.apache.nifi.context.PropertyContext;
 import org.apache.nifi.controller.AbstractControllerService;
+import org.apache.nifi.controller.ConfigurationContext;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.reporting.InitializationException;
 import org.apache.nifi.rules.Action;
 import org.apache.nifi.rules.PropertyContextActionHandler;
 
 import java.util.Map;
 
 public abstract class AbstractActionHandlerService extends 
AbstractControllerService implements PropertyContextActionHandler {
 
+    protected String enforceActionType;
+
     public static enum DebugLevels {
         trace, debug, info, warn, error
     }
-    public abstract void execute(Action action, Map<String, Object> facts);
+
+    public static final PropertyDescriptor ENFORCE_ACTION_TYPE = new 
PropertyDescriptor.Builder()
+            .name("action-handler-enforce-type")
+            .displayName("Enforce Action Type")
+            .required(false)
+            .description("The Action Type that should be supported by this 
handler.  If provided any other type an " +
 
 Review comment:
   My thought was for when the person that writes the rules is different from 
the person that configures the handler, and that maybe the rules file will 
include everything they'd ever want, but only want to turn on certain handlers 
/ types at certain times. I didn't wrap my head fully around the use case, but 
I figure the more flexibility and power the better :)
   
   Speaking of which, I think we should support EL here too, perhaps on a dev 
machine they are using the same rules file but don't want to fire alerts or 
SEND events, where in production they would.

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