Github user dlukyanov commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1662#discussion_r148955987
  
    --- 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/>
    --- End diff --
    
    Yes, this adds kind of limit. All custom properties with name beginning 
with `CTL.` automatically supposed to be linked to controller services. It 
means you can't define custom `CTL.*` property with plain string value. After 
`CTL.`there could be any chars. On the level of groovy script the additional 
predefined variable binded : `CTL` - a hashmap with substring after `CTL.` as a 
key and linked controller service as a value. If you defined `CTL.aaa` and 
linked it to distributed cache client service, then on level of groovy it'slike 
`def CTL=[:]` and `CTL['aaa']=LINK_TO_THE_SERVICE`. So, in groovy you can 
access this service  `CTL.aaa.someServiceMethod(...)`
    
    The only conflict expected when you'll try to define custom script variable 
with name `CTL`. Otherwise-no conflicts.


---

Reply via email to