[ https://issues.apache.org/jira/browse/NIFI-3688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16239519#comment-16239519 ]
ASF GitHub Bot commented on NIFI-3688: -------------------------------------- Github user dlukyanov commented on a diff in the pull request: https://github.com/apache/nifi/pull/1662#discussion_r148956693 --- 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 -- Here I call `setAutoCommit(false)`: [ExecuteGroovyScript.java#L312](https://github.com/dlukyanov/nifi/blob/master/nifi-nar-bundles/nifi-groovyx-bundle/nifi-groovyx-processors/src/main/java/org/apache/nifi/processors/groovyx/ExecuteGroovyScript.java#L312) with hive that's interesting question. according to code [HiveConnection.setAutoCommit()](https://github.com/apache/hive/blob/master/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java#L1338) will log warning. but the [HiveConnection.commit()](https://github.com/apache/hive/blob/master/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java#L873) will not work in any case. What do you think? Allow `groovy.sql.Sql` to be created only for `DBCPService` ? > 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)