Adding processor documentation for EvaluateJsonPath and SplitJson

This commit is contained in:
Aldrin Piri 2015-03-01 00:13:22 -05:00
parent 162f02b12f
commit b1f971335a
2 changed files with 229 additions and 0 deletions

View File

@ -0,0 +1,150 @@
<!DOCTYPE html>
<html lang="en">
<!--
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.
-->
<head>
<meta charset="utf-8"/>
<title>EvaluateJsonPath</title>
<link rel="stylesheet" href="../../css/component-usage.css" type="text/css"/>
</head>
<body>
<!-- Processor Documentation ================================================== -->
<h2>Description:</h2>
<p>
Evaluates one or more JsonPath expressions against the content of a FlowFile. The results of those expressions are
assigned to FlowFile Attributes or are written to the content of the FlowFile itself, depending on configuration of
the Processor. 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. 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. If
Destination is flowfile-attribute and the expression matches nothing, attributes will be created with empty
strings as the value, and the FlowFile will always be routed to 'matched.'
</p>
<p>
<strong>Properties:</strong>
</p>
<p>
In the list below, the names of required properties appear in bold.
Any other properties (not in bold) are considered optional. If a
property has a default value, it is indicated. If a property
supports the use of the NiFi Expression Language (or simply,
"expression language"), that is also indicated.
</p>
<p>
<strong>Modifies Attributes:</strong>
</p>
<p>
This processor adds user-defined attributes if the &lt;Destination&gt; property is set to
<code>flowfile-attribute</code>.
</p>
<ul>
<li>
<strong>Destination</strong>
<ul>
<li>Indicates whether the results of the JsonPath evaluation are
written to the FlowFile content or a FlowFile attribute; if using
attribute, the attribute's name must be specified in the value of
the Attribute Name property.
</li>
<li>
Valid values are:
<ul>
<li>flowfile-content</li>
<li>flowfile-attribute</li>
</ul>
</li>
<li>Default value: flowfile-content</li>
<li>Supports expression language: false</li>
</ul>
</li>
<li>
<strong>Return Type</strong>
<ul>
<li>Indicates the desired return type of the Xpath expressions.
Selecting 'auto-detect' will set the return type to 'json' for a
Destination of 'flowfile-content', and 'scalar' for a Destination of
'flowfile-attribute'.")
</li>
<li>
Valid values are:
<ul>
<li>auto-detect</li>
<li>json</li>
<li>scalar</li>
</ul>
</li>
<li>Default value: auto-detect</li>
<li>Supports expression language: false</li>
</ul>
</li>
<li>
user-defined properties
<ul>
<li>The name of the attribute to put the JsonPath result into if
flowfile-attribute is used as the value for the Destination
property; if using flowfile-content as the value for the
Destination property, this value is ignored.
</li>
<li>Supports expression language: false</li>
</ul>
</li>
</ul>
<p>
<strong>Relationships:</strong>
</p>
<ul>
<li>
failure
<ul>
<li>If the JsonPath cannot be evaluated against the content of the
FlowFile, then the FlowFile follows this relationship. For
example, if the FlowFile does not contain valid JSON.
</li>
</ul>
</li>
<li>
matched
<ul>
<li>If the JsonPath is successfully evaluated and the FlowFile is
modified as a result, then the FlowFile follows this
relationship.
</li>
</ul>
</li>
<li>
unmatched
<ul>
<li>If the JsonPath does not match the content of the FlowFile, then
the FlowFile follows this relationship.
</li>
</ul>
</li>
</ul>
</p>
</body>
</html>

View File

@ -0,0 +1,79 @@
<!DOCTYPE html>
<html lang="en">
<!--
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.
-->
<head>
<meta charset="utf-8"/>
<title>SplitJson</title>
<link rel="stylesheet" href="../../css/component-usage.css" type="text/css"/>
</head>
<body>
<!-- Processor Documentation ================================================== -->
<h2>Description:</h2>
<p>
This processor splits a JSON File into multiple, separate FlowFiles for an array element specified by a JsonPath
expression.
Each generated FlowFile is comprised of an element of the specified array and transferred to relationship 'split,'
with the original file transferred to the 'original' relationship. If the specified JsonPath is not found or
does not evaluate to an array element, the original file is routed to 'failure' and no files are generated.
</p>
<strong>Properties:</strong>
</p>
<p>
In the list below, the names of required properties appear in bold. Any other properties (not in bold) are
considered optional. If a property has a default value, it is indicated. If a property supports the use of the NiFi
Expression Language (or simply, "expression language"), that is also indicated.
</p>
<ul>
<li><strong>JsonPath Expression</strong>
<ul>
<li>A JsonPath expression that indicates the array element to split into JSON/scalar fragments.</li>
<li>Supports expression language: false</li>
</ul>
</li>
</ul>
<p>
<strong>Relationships:</strong>
</p>
<ul>
<li>failure
<ul>
<li>If a FlowFile fails processing for any reason (for example, the FlowFile is not valid JSON or the
specified path does not exist) and does not go down the original relationship.
</li>
</ul>
</li>
<li>original
<ul>
<li>If FlowFiles are successfully split, a copy of the original FlowFile follows this relationship.</li>
</ul>
</li>
<li>split
<ul>
<li>If FlowFiles are successfully split into one or more files, those split files follow this
relationship.
</li>
</ul>
</li>
</ul>
</body>
</html>