[
https://issues.apache.org/jira/browse/NIFI-3688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16244486#comment-16244486
]
ASF GitHub Bot commented on NIFI-3688:
--------------------------------------
Github user mattyb149 commented on a diff in the pull request:
https://github.com/apache/nifi/pull/1662#discussion_r149756860
--- 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>
--- End diff --
The version of setAutoCommit() you link to is their master branch. The
version that ships with NiFi's Hive NAR is
[here](https://github.com/apache/hive/blob/release-1.2.1/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java#L1197).
Strangely, they're handling it backwards from how they do in master.
Just to be safe, it might be better to not explicitly call
setAutoCommit(false) and maybe instead allow the script writer to call it on
CTL or the appropriate object?
This is your processor and contribution, so you can choose whether to
support JDBC connections that don't behave with the calls you're making. Hive
is just one example, but there might be others that don't implement certain
methods well or at all. It is totally fine to just say "those aren't
supported", I'm just bringing it up in case you wanted to address such things.
Let me know either way and I'll continue the review/merge, thanks!
> Create extended groovy scripting processor
> ------------------------------------------
>
> Key: NIFI-3688
> URL: https://issues.apache.org/jira/browse/NIFI-3688
> Project: Apache NiFi
> Issue Type: New Feature
> Components: Extensions
> Reporter: Dmitry Lukyanov
> Priority: Minor
>
> The idea is to simplify groovy scripting.
> Main targets:
> - to be compatible with existing groovy scripting
> - simplify read/write attributes
> - simplify read/write content
> - avoid closure casting to nifi types like `StreamCallback`
> - simplify and provide visibility when accessing to controller services from
> script
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)