nifi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joew...@apache.org
Subject [45/50] [abbrv] incubator-nifi git commit: Adjusting onRemoved methods for both JsonPath processors to clean up entries on exit.
Date Mon, 02 Mar 2015 04:04:24 GMT
Adjusting onRemoved methods for both JsonPath processors to clean up entries on exit.


Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/484687a6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/484687a6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/484687a6

Branch: refs/heads/develop
Commit: 484687a67b12fb5fc13dabd7851f83a6e4a898be
Parents: 5a2a8fc
Author: Aldrin Piri <aldrinpiri@gmail.com>
Authored: Sun Mar 1 14:16:22 2015 -0500
Committer: Aldrin Piri <aldrinpiri@gmail.com>
Committed: Sun Mar 1 14:16:22 2015 -0500

----------------------------------------------------------------------
 .../processors/standard/AbstractJsonPathProcessor.java  |  2 +-
 .../nifi/processors/standard/EvaluateJsonPath.java      |  2 +-
 .../org/apache/nifi/processors/standard/SplitJson.java  | 12 ++++++++++++
 3 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/484687a6/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/AbstractJsonPathProcessor.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/AbstractJsonPathProcessor.java
b/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/AbstractJsonPathProcessor.java
index baeef7b..febc3f8 100644
--- a/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/AbstractJsonPathProcessor.java
+++ b/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/AbstractJsonPathProcessor.java
@@ -86,7 +86,7 @@ public abstract class AbstractJsonPathProcessor extends AbstractProcessor
{
         return JSON_PROVIDER.toJson(jsonPathResult);
     }
 
-    protected abstract static class JsonPathValidator implements Validator {
+    abstract static class JsonPathValidator implements Validator {
 
         @Override
         public ValidationResult validate(final String subject, final String input, final
ValidationContext context) {

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/484687a6/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EvaluateJsonPath.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EvaluateJsonPath.java
b/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EvaluateJsonPath.java
index b40f6c6..81c9bbe 100644
--- a/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EvaluateJsonPath.java
+++ b/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EvaluateJsonPath.java
@@ -182,7 +182,7 @@ public class EvaluateJsonPath extends AbstractJsonPathProcessor {
      * isStale()
      */
     @OnRemoved
-    public void onRemoved() {
+    public void onRemoved(ProcessContext processContext) {
         for (PropertyDescriptor propertyDescriptor : getPropertyDescriptors()) {
             if (propertyDescriptor.isDynamic()) {
                 cachedJsonPathMap.remove(propertyDescriptor.getName());

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/484687a6/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/SplitJson.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/SplitJson.java
b/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/SplitJson.java
index 59f4d71..7bb8c4e 100644
--- a/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/SplitJson.java
+++ b/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/SplitJson.java
@@ -26,6 +26,7 @@ import org.apache.nifi.annotation.behavior.SideEffectFree;
 import org.apache.nifi.annotation.behavior.SupportsBatching;
 import org.apache.nifi.annotation.documentation.CapabilityDescription;
 import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.annotation.lifecycle.OnRemoved;
 import org.apache.nifi.components.PropertyDescriptor;
 import org.apache.nifi.flowfile.FlowFile;
 import org.apache.nifi.logging.ProcessorLog;
@@ -111,6 +112,17 @@ public class SplitJson extends AbstractJsonPathProcessor {
         }
     }
 
+    /**
+     * Provides cleanup of the map for any JsonPath values that may have been created.  This
will remove common values
+     * shared between multiple instances, but will be regenerated when the next validation
cycle occurs as a result of
+     * isStale()
+     */
+    @OnRemoved
+    public void onRemoved(ProcessContext processContext) {
+        String jsonPathExpression = processContext.getProperty(ARRAY_JSON_PATH_EXPRESSION).getValue();
+        JSON_PATH_MAP.remove(jsonPathExpression);
+    }
+
     @Override
     public void onTrigger(final ProcessContext processContext, final ProcessSession processSession)
{
         final FlowFile original = processSession.get();


Mime
View raw message