nifi-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [nifi] YolandaMDavis commented on a change in pull request #3824: NIFI-6778 - Added rules engine service api and Easy Rules Implementation
Date Thu, 17 Oct 2019 21:15:14 GMT
YolandaMDavis commented on a change in pull request #3824: NIFI-6778 - Added rules engine service
api and Easy Rules Implementation
URL: https://github.com/apache/nifi/pull/3824#discussion_r336230454
 
 

 ##########
 File path: nifi-nar-bundles/nifi-easyrules-bundle/nifi-easyrules-service/src/main/java/org/apache/nifi/rules/engine/EasyRulesEngineService.java
 ##########
 @@ -0,0 +1,193 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.rules.engine;
+
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.annotation.lifecycle.OnEnabled;
+import org.apache.nifi.components.AllowableValue;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.controller.AbstractControllerService;
+import org.apache.nifi.controller.ConfigurationContext;
+import org.apache.nifi.controller.ControllerServiceInitializationContext;
+import org.apache.nifi.expression.ExpressionLanguageScope;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.reporting.InitializationException;
+import org.apache.nifi.rules.Action;
+import org.apache.nifi.rules.ActionHandler;
+import org.apache.nifi.rules.Rule;
+import org.apache.nifi.rules.RulesFactory;
+import org.jeasy.rules.api.Condition;
+import org.jeasy.rules.api.Facts;
+import org.jeasy.rules.api.RuleListener;
+import org.jeasy.rules.api.Rules;
+import org.jeasy.rules.core.DefaultRulesEngine;
+import org.jeasy.rules.core.RuleBuilder;
+import org.jeasy.rules.mvel.MVELCondition;
+import org.jeasy.rules.spel.SpELCondition;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Implementation of RulesEngineService interface
+ *
+ * @see RulesEngineService
+ */
+@CapabilityDescription("Defines and execute the rules stored in NiFi or EasyRules file formats
for a given set of facts. Supports " +
+        "rules stored as JSON or YAML.")
+@Tags({ "rules","rules-engine","engine","actions","facts" })
+public class EasyRulesEngineService  extends AbstractControllerService implements RulesEngineService
{
+
+    static final AllowableValue YAML = new AllowableValue("YAML", "YAML", "YAML file configuration
type.");
+    static final AllowableValue JSON = new AllowableValue("JSON", "JSON", "JSON file configuration
type.");
+    static final AllowableValue NIFI = new AllowableValue("NIFI", "NiFi", "NIFI rules formatted
file.");
+    static final AllowableValue MVEL = new AllowableValue("MVEL", "Easy Rules MVEL", "Easy
Rules File format using MVFLEX Expression Language");
+    static final AllowableValue SPEL = new AllowableValue("SPEL", "Easy Rules SpEL", "Easy
Rules File format using Spring Expression Language");
+
+    static final PropertyDescriptor RULES_FILE_PATH = new PropertyDescriptor.Builder()
+            .name("rules-file-path")
+            .displayName("Rules File Path")
+            .description("Rules File Location")
+            .required(true)
+            .addValidator(StandardValidators.FILE_EXISTS_VALIDATOR)
+            .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
+            .build();
+
+    static final PropertyDescriptor RULES_FILE_TYPE = new PropertyDescriptor.Builder()
+            .name("rules-file-type")
+            .displayName("Rules File Type")
+            .description("File type for rules definition. Supported file types are YAML and
JSON")
+            .required(true)
+            .allowableValues(JSON,YAML)
+            .defaultValue(JSON.getValue())
+            .build();
+
+    static final PropertyDescriptor RULES_FILE_FORMAT = new PropertyDescriptor.Builder()
+            .name("rules-file-format")
+            .displayName("Rules File Format")
+            .description("File format for rules. Supported formats are NiFi Rules.")
 
 Review comment:
   Good catch here, I forgot to update (when I only had NiFi rules format implemented:))

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message