Github user mattyb149 commented on a diff in the pull request: https://github.com/apache/nifi/pull/1662#discussion_r148412024 --- Diff: nifi-nar-bundles/nifi-groovyx-bundle/nifi-groovyx-processors/src/main/resources/docs/org.apache.nifi.processors.groovyx.ExecuteGroovyScript/additionalDetails.html --- @@ -0,0 +1,202 @@ +<!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>Groovy</title> + <!--link rel="stylesheet" href="../../css/component-usage.css" type="text/css" /--> + <link rel="stylesheet" href="/nifi-docs/css/component-usage.css" type="text/css" /> +</head> + +<body> +<h2>Summary</h2> +<p>This is a grooviest groovy script :)</p> +<h2>Script Bindings:</h2> +<table> +<tr><th>variable</th><th>type</th><th>description</th></tr> +<tr> + <td>session</td> + <td>org.apache.nifi.processor.ProcessSession</td> + <td>the session that is used to get, change, and transfer input files</td> +</tr> +<tr> + <td>context</td> + <td>org.apache.nifi.processor.ProcessContext</td> + <td>the context (almost unusefull)</td> +</tr> +<tr> + <td>log</td> + <td>org.apache.nifi.logging.ComponentLog</td> + <td>the logger for this processor instance</td> +</tr> +<tr> + <td>REL_SUCCESS</td> + <td>org.apache.nifi.processor.Relationship</td> + <td>the success relationship</td> +</tr> +<tr> + <td>REL_FAILURE</td> + <td>org.apache.nifi.processor.Relationship</td> + <td>the failure relationship</td> +</tr> +<tr> + <td>flowFile</td> + <td>org.apache.nifi.flowfile.FlowFile</td> + <td>Binded only if the property `Require flow file`=true for the processor</td> +</tr> +<tr> + <td>CTL</td> + <td>java.util.HashMap</td> + <td>Map populated with controller services binded through `CTL.*` processor properties</td> +</tr> +<tr> + <td>Dynamic processor properties</td> + <td>org.apache.nifi.components.PropertyDescriptor</td> + <td>All processor properties not started with `CTL.` are binded to script variables</td> +</tr> +</table> + +<h2>CTL map</h2> +<p> +CTL.* objects accessible if corresponding processor property defined.<br/> +<b>Example:</b> if you defined property <code>`CTL.cache`</code> to DistributedMapCacheClientService, then you can access it from code <code>CTL.cache</code><br/> +If CTL property references to Database connection pool, then corresponding CTL entry will contain groovy.sql.Sql object connected to database with autocommit=false.</br> +CTL - Database transactions automatically rolled back on script exception and committed on success. Script must not disconnect connection.<br/> +<img src="CTL.gif"/><br/> +<img src="CTL2.gif"/> +</p> + +<h2>SessionFile - flow file extension</h2> +<p> + The (org.apache.nifi.processors.groovyx.flow.SessionFile) is an actual object returned by session in Extended Groovy processor.<br/> + This flow file is a container that references session and the real flow file.<br/> + This allows to use simplified syntax to work with file attributes and content: +</p> +<p><i>set new attribute value</i></p> +<pre> + flowFile.ATTRIBUTE_NAME = ATTRIBUTE_VALUE --- End diff -- These features are awesome!
---