From c6d500b3157ed7158fbaa5aa2a51549741328958 Mon Sep 17 00:00:00 2001 From: Aldrin Piri Date: Wed, 12 Aug 2015 18:17:08 -0400 Subject: [PATCH 1/3] NIFI-845 Converting tabs to spaces for indentation in accordance with checkstyle rules. --- .../org/apache/nifi/processors/standard/RouteOnAttribute.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/RouteOnAttribute.java b/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/RouteOnAttribute.java index a9be2e77e4..0d113ced59 100644 --- a/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/RouteOnAttribute.java +++ b/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/RouteOnAttribute.java @@ -193,8 +193,8 @@ public class RouteOnAttribute extends AbstractProcessor { @OnStopped public void onStopped() { - getLogger().debug("Clearing propertyMap"); - propertyMap.clear(); + getLogger().debug("Clearing propertyMap"); + propertyMap.clear(); } @Override From 13042dc2e901442b873709fa4ab443b1342e7b35 Mon Sep 17 00:00:00 2001 From: Aldrin Piri Date: Sun, 26 Jul 2015 23:36:39 -0400 Subject: [PATCH 2/3] NIFI-758 Defaulting to POSIX compliant single bracket test command in lieu of the Bash [[ --- .../nifi-resources/src/main/resources/bin/nifi.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi.sh b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi.sh index 86e97d8657..2d60d5a701 100755 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi.sh +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi.sh @@ -155,7 +155,7 @@ run() { sudo_cmd_prefix="" if $cygwin; then - if [[ -n "$run_as" ]]; then + if [ -n "$run_as" ]; then echo "The run.as option is not supported in a Cygwin environment. Exiting." exit 1 fi; @@ -163,7 +163,7 @@ run() { NIFI_HOME=`cygpath --path --windows "$NIFI_HOME"` BOOTSTRAP_CONF=`cygpath --path --windows "$BOOTSTRAP_CONF"` else - if [[ -n "$run_as" ]]; then + if [ -n "$run_as" ]; then if id -u "$run_as" >/dev/null 2>&1; then sudo_cmd_prefix="sudo -u ${run_as}" else From b51433e97c5b51b0e8f35450c3e4265fd747f51a Mon Sep 17 00:00:00 2001 From: Aldrin Piri Date: Wed, 12 Aug 2015 17:10:57 -0400 Subject: [PATCH 3/3] NIFI-726 Providing updated documentation on how the return type property is interpreted for EvaluateJsonPath --- .../nifi/processors/standard/EvaluateJsonPath.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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 b4ddc16a32..ad3120cc6d 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 @@ -66,6 +66,9 @@ import java.util.concurrent.ConcurrentMap; + "JsonPaths are entered by adding user-defined properties; the name of the property maps to the Attribute Name " + "into which the result will be placed (if the Destination is flowfile-attribute; otherwise, the property name is ignored). " + "The value of the property must be a valid JsonPath expression. " + + "A Return Type of 'auto-detect' will make a determination based off the configured destination. " + + "When 'Destination' is set to 'flowfile-attribute,' a return type of 'scalar' will be used. " + + "When 'Destination' is set to 'flowfile-content,' a return type of 'JSON' will be used." + "If the JsonPath evaluates to a JSON array or JSON object and the Return Type is set to 'scalar' the FlowFile will be unmodified and will be routed to failure. " + "A Return Type of JSON can return scalar values if the provided JsonPath evaluates to the specified value and will be routed as a match." + "If Destination is 'flowfile-content' and the JsonPath does not evaluate to a defined path, the FlowFile will be routed to 'unmatched' without having its contents modified. " @@ -99,7 +102,7 @@ public class EvaluateJsonPath extends AbstractJsonPathProcessor { public static final PropertyDescriptor RETURN_TYPE = new PropertyDescriptor.Builder() .name("Return Type").description("Indicates the desired return type of the JSON Path expressions. Selecting 'auto-detect' will set the return type to 'json' " - + "for a Destination of 'flowfile-content', and 'string' for a Destination of 'flowfile-attribute'.") + + "for a Destination of 'flowfile-content', and 'scalar' for a Destination of 'flowfile-attribute'.") .required(true) .allowableValues(RETURN_TYPE_AUTO, RETURN_TYPE_JSON, RETURN_TYPE_SCALAR) .defaultValue(RETURN_TYPE_AUTO) @@ -224,7 +227,7 @@ public class EvaluateJsonPath extends AbstractJsonPathProcessor { } @Override - public void onTrigger(ProcessContext processContext, final ProcessSession processSession) throws ProcessException { + public void onTrigger(final ProcessContext processContext, final ProcessSession processSession) throws ProcessException { FlowFile flowFile = processSession.get(); if (flowFile == null) { @@ -266,13 +269,13 @@ public class EvaluateJsonPath extends AbstractJsonPathProcessor { for (final Map.Entry attributeJsonPathEntry : attributeToJsonPathMap.entrySet()) { - String jsonPathAttrKey = attributeJsonPathEntry.getKey(); - JsonPath jsonPathExp = attributeJsonPathEntry.getValue(); + final String jsonPathAttrKey = attributeJsonPathEntry.getKey(); + final JsonPath jsonPathExp = attributeJsonPathEntry.getValue(); final String pathNotFound = processContext.getProperty(PATH_NOT_FOUND).getValue(); final ObjectHolder resultHolder = new ObjectHolder<>(null); try { - Object result = documentContext.read(jsonPathExp); + final Object result = documentContext.read(jsonPathExp); if (returnType.equals(RETURN_TYPE_SCALAR) && !isJsonScalar(result)) { logger.error("Unable to return a scalar value for the expression {} for FlowFile {}. Evaluated value was {}. Transferring to {}.", new Object[]{jsonPathExp.getPath(), flowFile.getId(), result.toString(), REL_FAILURE.getName()});