[GitHub] nifi issue #1662: NIFI-3688 Extended Groovy Nifi Processor

2017-11-12 Thread dlukyanov
Github user dlukyanov commented on the issue:

https://github.com/apache/nifi/pull/1662
  
mattyb149, i just refactored the the `CTL` properties: 
- 'CTL' provides direct access to controller services without any 
additional logic
- a new map named `SQL` provides fast to transactional DBCP service


---


[GitHub] nifi pull request #1662: NIFI-3688 Extended Groovy Nifi Processor

2017-11-05 Thread dlukyanov
Github user dlukyanov commented on a diff in the pull request:

https://github.com/apache/nifi/pull/1662#discussion_r148957155
  
--- Diff: nifi-nar-bundles/pom.xml ---
@@ -94,7 +95,7 @@
 
 
 
-
+

[GitHub] nifi pull request #1662: NIFI-3688 Extended Groovy Nifi Processor

2017-11-05 Thread dlukyanov
Github user dlukyanov commented on a diff in the pull request:

https://github.com/apache/nifi/pull/1662#discussion_r148957134
  
--- Diff: 
nifi-nar-bundles/nifi-groovyx-bundle/nifi-groovyx-processors/src/main/java/org/apache/nifi/processors/groovyx/ExecuteGroovyScript.java
 ---
@@ -0,0 +1,453 @@
+/*
+ * 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.
+ */
+package org.apache.nifi.processors.groovyx;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.nifi.annotation.behavior.Restricted;
+import org.apache.nifi.annotation.behavior.DynamicProperty;
+import org.apache.nifi.annotation.behavior.EventDriven;
+import org.apache.nifi.annotation.behavior.InputRequirement;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.SeeAlso;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.annotation.lifecycle.OnScheduled;
+import org.apache.nifi.annotation.lifecycle.OnStopped;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.controller.ControllerService;
+import org.apache.nifi.dbcp.DBCPService;
+import org.apache.nifi.flowfile.FlowFile;
--- End diff --

fixed


---


[GitHub] nifi pull request #1662: NIFI-3688 Extended Groovy Nifi Processor

2017-11-05 Thread dlukyanov
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 @@
+
+
+
+
+
+Groovy
+
+
+
+
+
+Summary
+This is a grooviest groovy script :)
+Script Bindings:
+
+variabletypedescription
+
+   session
+   org.apache.nifi.processor.ProcessSession
+   the session that is used to get, change, and transfer input 
files
+
+
+   context
+   org.apache.nifi.processor.ProcessContext
+   the context (almost unusefull)
+
+
+   log
+   org.apache.nifi.logging.ComponentLog
+   the logger for this processor instance
+
+
+   REL_SUCCESS
+   org.apache.nifi.processor.Relationship
+   the success relationship
+
+
+   REL_FAILURE
+   org.apache.nifi.processor.Relationship
+   the failure relationship
+
+
+   flowFile
+   org.apache.nifi.flowfile.FlowFile
+   Binded only if the property `Require flow file`=true for the 
processor
+
+
+   CTL
+   java.util.HashMap
+   Map populated with controller services binded through `CTL.*` 
processor properties
+
+
+   Dynamic processor properties
+   org.apache.nifi.components.PropertyDescriptor
+   All processor properties not started with `CTL.` are binded to 
script variables
+
+
+
+CTL map
+
+CTL.* objects accessible if corresponding processor property defined.
+Example: if you defined property `CTL.cache` to 
DistributedMapCacheClientService, then you can access it from code 
CTL.cache
+If CTL property references to Database connection pool, then corresponding 
CTL entry will contain groovy.sql.Sql object connected to database with 
autocommit=false.
--- 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` ? 


---


[GitHub] nifi pull request #1662: NIFI-3688 Extended Groovy Nifi Processor

2017-11-05 Thread dlukyanov
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 @@
+
+
+
+
+
+Groovy
+
+
+
+
+
+Summary
+This is a grooviest groovy script :)
+Script Bindings:
+
+variabletypedescription
+
+   session
+   org.apache.nifi.processor.ProcessSession
+   the session that is used to get, change, and transfer input 
files
+
+
+   context
+   org.apache.nifi.processor.ProcessContext
+   the context (almost unusefull)
+
+
+   log
+   org.apache.nifi.logging.ComponentLog
+   the logger for this processor instance
+
+
+   REL_SUCCESS
+   org.apache.nifi.processor.Relationship
+   the success relationship
+
+
+   REL_FAILURE
+   org.apache.nifi.processor.Relationship
+   the failure relationship
+
+
+   flowFile
+   org.apache.nifi.flowfile.FlowFile
+   Binded only if the property `Require flow file`=true for the 
processor
+
+
+   CTL
+   java.util.HashMap
+   Map populated with controller services binded through `CTL.*` 
processor properties
+
+
+   Dynamic processor properties
+   org.apache.nifi.components.PropertyDescriptor
+   All processor properties not started with `CTL.` are binded to 
script variables
+
+
+
+CTL map
+
+CTL.* objects accessible if corresponding processor property defined.
+Example: if you defined property `CTL.cache` to 
DistributedMapCacheClientService, then you can access it from code 
CTL.cache
--- 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.


---


[GitHub] nifi issue #1662: NIFI-3688 Extended Groovy Nifi Processor

2017-10-22 Thread dlukyanov
Github user dlukyanov commented on the issue:

https://github.com/apache/nifi/pull/1662
  
mattyb149, rebased against the latest master 1.5.0-SNAPSHOT


---


[GitHub] nifi issue #1662: NIFI-3688 Extended Groovy Nifi Processor

2017-09-19 Thread dlukyanov
Github user dlukyanov commented on the issue:

https://github.com/apache/nifi/pull/1662
  
@mattyb149, do you have any comments to my last commit?


---


[GitHub] nifi issue #1662: NIFI-3688 Extended Groovy Nifi Processor

2017-07-16 Thread dlukyanov
Github user dlukyanov commented on the issue:

https://github.com/apache/nifi/pull/1662
  
@mattyb149, I fixed everything except:

- Failure strategy
 this property does not limit anything in error handling. it provides 
default algorithms for non-handled exceptions. the user still can do 
try-catch-transfer in code. i beleive i've added enough description of this 
property. ready for discussion about this point.
- rightShift
 i really like it, but the main reason why i did not do it - that in 
similar cases in groovy only `leftShift` used.
 -- 
http://docs.groovy-lang.org/latest/html/groovy-jdk/java/io/OutputStream.html
 -- http://docs.groovy-lang.org/latest/html/groovy-jdk/java/io/Writer.html
 -- 
http://docs.groovy-lang.org/latest/html/groovy-jdk/java/util/Collection.html




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] nifi pull request #1662: NIFI-3688 Extended Groovy Nifi Processor

2017-06-27 Thread dlukyanov
Github user dlukyanov commented on a diff in the pull request:

https://github.com/apache/nifi/pull/1662#discussion_r124206087
  
--- Diff: 
nifi-nar-bundles/nifi-groovyx-bundle/nifi-groovyx-processors/src/main/java/org/apache/nifi/processors/groovyx/GroovyMethods.java
 ---
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+package org.apache.nifi.processors.groovyx;
+
+import groovy.lang.DelegatingMetaClass;
+import groovy.lang.GroovySystem;
+
+import org.apache.nifi.processors.groovyx.flow.ProcessSessionWrap;
+import org.apache.nifi.processors.groovyx.flow.SessionFile;
+
+import org.apache.nifi.processor.Relationship;
+import org.apache.nifi.flowfile.FlowFile;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Class to initialize additional groovy methods to work with SessionFile, 
Relationship, and Sessions easier
+ */
+class GroovyMethods {
+private static boolean initialized = false;
+
+static void init() {
+if (!initialized) {
+synchronized (GroovyMethods.class) {
+if (!initialized) {
+initialized = metaRelationship();
+}
+}
+}
+}
+
+private static boolean metaRelationship() {
+
GroovySystem.getMetaClassRegistry().setMetaClass(Relationship.class, new 
DelegatingMetaClass(Relationship.class) {
+@Override
+public Object invokeMethod(Object object, String methodName, 
Object[] args) {
+if (object instanceof Relationship) {
+if ("leftShift".equals(methodName) && args.length == 
1) {
+if (args[0] instanceof SessionFile) {
+return this.leftShift((Relationship) object, 
(SessionFile) args[0]);
+} else if (args[0] instanceof Collection) {
+return this.leftShift((Relationship) object, 
(Collection) args[0]);
+}
+}
+}
+return super.invokeMethod(object, methodName, args);
+}
+
+/** to support: REL_SUCCESS << sessionFile */
+private Relationship leftShift(Relationship r, SessionFile f) {
--- End diff --

btw. leftshift allows syntax: 
`REL_SUCCESS << a << b << c`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] nifi pull request #1662: NIFI-3688 Extended Groovy Nifi Processor

2017-06-27 Thread dlukyanov
Github user dlukyanov commented on a diff in the pull request:

https://github.com/apache/nifi/pull/1662#discussion_r124205062
  
--- Diff: 
nifi-nar-bundles/nifi-groovyx-bundle/nifi-groovyx-processors/src/main/java/org/apache/nifi/processors/groovyx/ExecuteGroovyScript.java
 ---
@@ -0,0 +1,468 @@
+/*
+ * 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.
+ */
+package org.apache.nifi.processors.groovyx;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.nifi.annotation.behavior.Restricted;
+import org.apache.nifi.annotation.behavior.DynamicProperty;
+import org.apache.nifi.annotation.behavior.EventDriven;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.SeeAlso;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.annotation.lifecycle.OnScheduled;
+import org.apache.nifi.annotation.lifecycle.OnStopped;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.controller.ControllerService;
+import org.apache.nifi.dbcp.DBCPService;
+import org.apache.nifi.flowfile.FlowFile;
+import org.apache.nifi.processor.AbstractProcessor;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.ProcessorInitializationContext;
+import org.apache.nifi.processor.Relationship;
+import org.apache.nifi.processor.exception.ProcessException;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.codehaus.groovy.control.CompilerConfiguration;
+import org.codehaus.groovy.runtime.ResourceGroovyMethods;
+import org.codehaus.groovy.runtime.StackTraceUtils;
+
+import org.apache.nifi.processors.groovyx.sql.OSql;
+import org.apache.nifi.processors.groovyx.util.Files;
+import org.apache.nifi.processors.groovyx.util.Validators;
+import org.apache.nifi.processors.groovyx.flow.GroovyProcessSessionWrap;
+
+import groovy.lang.GroovyShell;
+import groovy.lang.Script;
+
+import org.apache.nifi.components.ValidationResult;
+import org.apache.nifi.components.ValidationContext;
+
+@EventDriven
+@Tags({"script", "groovy", "groovyx"})
+@CapabilityDescription(
+"Experimental Extended Groovy script processor. The script is 
responsible for "
++ "handling the incoming flow file (transfer to SUCCESS or remove, 
e.g.) as well as any flow files created by "
++ "the script. If the handling is incomplete or incorrect, the 
session will be rolled back.")
+@Restricted("Provides operator the ability to execute arbitrary code 
assuming all permissions that NiFi has.")
+@SeeAlso({})
--- End diff --

ok. it's just a copy-paste from somewhere)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] nifi pull request #1662: NIFI-3688 Extended Groovy Nifi Processor

2017-06-27 Thread dlukyanov
Github user dlukyanov commented on a diff in the pull request:

https://github.com/apache/nifi/pull/1662#discussion_r124203242
  
--- Diff: 
nifi-nar-bundles/nifi-groovyx-bundle/nifi-groovyx-processors/src/main/java/org/apache/nifi/processors/groovyx/ExecuteGroovyScript.java
 ---
@@ -0,0 +1,468 @@
+/*
+ * 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.
+ */
+package org.apache.nifi.processors.groovyx;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.nifi.annotation.behavior.Restricted;
+import org.apache.nifi.annotation.behavior.DynamicProperty;
+import org.apache.nifi.annotation.behavior.EventDriven;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.SeeAlso;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.annotation.lifecycle.OnScheduled;
+import org.apache.nifi.annotation.lifecycle.OnStopped;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.controller.ControllerService;
+import org.apache.nifi.dbcp.DBCPService;
+import org.apache.nifi.flowfile.FlowFile;
+import org.apache.nifi.processor.AbstractProcessor;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.ProcessorInitializationContext;
+import org.apache.nifi.processor.Relationship;
+import org.apache.nifi.processor.exception.ProcessException;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.codehaus.groovy.control.CompilerConfiguration;
+import org.codehaus.groovy.runtime.ResourceGroovyMethods;
+import org.codehaus.groovy.runtime.StackTraceUtils;
+
+import org.apache.nifi.processors.groovyx.sql.OSql;
+import org.apache.nifi.processors.groovyx.util.Files;
+import org.apache.nifi.processors.groovyx.util.Validators;
+import org.apache.nifi.processors.groovyx.flow.GroovyProcessSessionWrap;
+
+import groovy.lang.GroovyShell;
+import groovy.lang.Script;
+
+import org.apache.nifi.components.ValidationResult;
+import org.apache.nifi.components.ValidationContext;
+
+@EventDriven
+@Tags({"script", "groovy", "groovyx"})
+@CapabilityDescription(
+"Experimental Extended Groovy script processor. The script is 
responsible for "
++ "handling the incoming flow file (transfer to SUCCESS or remove, 
e.g.) as well as any flow files created by "
++ "the script. If the handling is incomplete or incorrect, the 
session will be rolled back.")
+@Restricted("Provides operator the ability to execute arbitrary code 
assuming all permissions that NiFi has.")
+@SeeAlso({})
+@DynamicProperty(name = "A script engine property to update",
+value = "The value to set it to",
+supportsExpressionLanguage = true,
+description = "Updates a script engine property specified by the 
Dynamic Property's key with the value "
++ "specified by the Dynamic Property's value. Use `CTL.` 
to access any controller services.")
+public class ExecuteGroovyScript extends AbstractProcessor {
+public static final String GROOVY_CLASSPATH = "${groovy.classes.path}";
+
+private static final String PRELOADS = "import 
org.apache.nifi.components.*;" + "import org.apache.nifi.flowfile.FlowFile;" + 
"import org.apache.nifi.processor.*;"
++ "import 
org.apache.nifi.processor.FlowFileFilter.FlowFileFilterResult;" + "import 
org.apach

[GitHub] nifi pull request #1662: NIFI-3688 Extended Groovy Nifi Processor

2017-06-27 Thread dlukyanov
Github user dlukyanov commented on a diff in the pull request:

https://github.com/apache/nifi/pull/1662#discussion_r124194297
  
--- Diff: 
nifi-nar-bundles/nifi-groovyx-bundle/nifi-groovyx-processors/src/main/java/org/apache/nifi/processors/groovyx/GroovyMethods.java
 ---
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+package org.apache.nifi.processors.groovyx;
+
+import groovy.lang.DelegatingMetaClass;
+import groovy.lang.GroovySystem;
+
+import org.apache.nifi.processors.groovyx.flow.ProcessSessionWrap;
+import org.apache.nifi.processors.groovyx.flow.SessionFile;
+
+import org.apache.nifi.processor.Relationship;
+import org.apache.nifi.flowfile.FlowFile;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Class to initialize additional groovy methods to work with SessionFile, 
Relationship, and Sessions easier
+ */
+class GroovyMethods {
+private static boolean initialized = false;
+
+static void init() {
+if (!initialized) {
+synchronized (GroovyMethods.class) {
+if (!initialized) {
+initialized = metaRelationship();
+}
+}
+}
+}
+
+private static boolean metaRelationship() {
+
GroovySystem.getMetaClassRegistry().setMetaClass(Relationship.class, new 
DelegatingMetaClass(Relationship.class) {
+@Override
+public Object invokeMethod(Object object, String methodName, 
Object[] args) {
+if (object instanceof Relationship) {
+if ("leftShift".equals(methodName) && args.length == 
1) {
+if (args[0] instanceof SessionFile) {
+return this.leftShift((Relationship) object, 
(SessionFile) args[0]);
+} else if (args[0] instanceof Collection) {
+return this.leftShift((Relationship) object, 
(Collection) args[0]);
+}
+}
+}
+return super.invokeMethod(object, methodName, args);
+}
+
+/** to support: REL_SUCCESS << sessionFile */
+private Relationship leftShift(Relationship r, SessionFile f) {
--- End diff --

we can do both. at the beginning i did rightShift (more logical when 
coding). then i looked at 
http://docs.groovy-lang.org/latest/html/groovy-jdk/java/io/OutputStream.html 
and it implements only leftShift, so i decided to use leftShift. but i like 
rightShift also)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] nifi issue #1662: NIFI-3688 Extended Groovy Nifi Processor

2017-06-14 Thread dlukyanov
Github user dlukyanov commented on the issue:

https://github.com/apache/nifi/pull/1662
  
@mattyb149 , done. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] nifi issue #1662: NIFI-3688 Extended Groovy Nifi Processor

2017-05-19 Thread dlukyanov
Github user dlukyanov commented on the issue:

https://github.com/apache/nifi/pull/1662
  
In this case i believe it's ready for review.
I've reverted last commits and rebased all commits into one
Tried to build locally - and it's fine. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] nifi issue #1662: NIFI-3688 Extended Groovy Nifi Processor

2017-05-18 Thread dlukyanov
Github user dlukyanov commented on the issue:

https://github.com/apache/nifi/pull/1662
  
I've made last several commits in StandardFlowSerializerTest.java

trying to detect the problem java.nio.channels.OverlappingFileLockException 
in org.apache.nifi.controller.scheduling.TestProcessorLifecycle


https://issues.apache.org/jira/browse/NIFI-3853?focusedCommentId=16015655&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16015655

and succeed with build. 
normally should revert this change in my fork...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] nifi pull request #1662: NIFI-3688 Extended Groovy Nifi Processor

2017-05-15 Thread dlukyanov
Github user dlukyanov commented on a diff in the pull request:

https://github.com/apache/nifi/pull/1662#discussion_r116540624
  
--- Diff: nifi-nar-bundles/nifi-groovyx-bundle/nifi-groovyx-nar/pom.xml ---
@@ -0,0 +1,44 @@
+
+
+http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+4.0.0
+
+
+org.apache.nifi
+nifi-groovyx-bundle
+1.2.0-SNAPSHOT
--- End diff --

Great! I'll do it this weekend.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] nifi issue #1662: NIFI-3688 Extended Groovy Nifi Processor

2017-05-14 Thread dlukyanov
Github user dlukyanov commented on the issue:

https://github.com/apache/nifi/pull/1662
  
@mattyb149 , @joewitt , @alopresto ,

I know that 1.2.0. released 
This pull request was not ready (

I need to know your opinion about this pull request - to continue or not.

In any case I fixed documentation and nar bundle content.
You can try all the cases from pull request description.

I built groovyx nar bundle with nifi 1.2.0
https://github.com/dlukyanov/nifi/releases/tag/nifi-groovyx-nar-1.2.0



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] nifi issue #1662: NIFI-3688 Extended Groovy Nifi Processor

2017-05-04 Thread dlukyanov
Github user dlukyanov commented on the issue:

https://github.com/apache/nifi/pull/1662
  
seems I fixed all checkstyle issues) but appveyor failed.. what should i do 
with it? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] nifi issue #1662: NIFI-3688 Extended Groovy Nifi Processor [WIP]

2017-05-01 Thread dlukyanov
Github user dlukyanov commented on the issue:

https://github.com/apache/nifi/pull/1662
  
@mattyb149, I renamed the processor, created test cases for all mentioned 
in pull request description.
The case 
[test_sql_01_select.groovy](https://github.com/dlukyanov/nifi/blob/master/nifi-nar-bundles/nifi-groovyx-bundle/nifi-groovyx-processors/src/test/resources/groovy/test_sql_01_select.groovy)
 dedicated to a new way of controller services usage from groovy script.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] nifi issue #1662: NIFI-3688 Extended Groovy Nifi Processor

2017-04-19 Thread dlukyanov
Github user dlukyanov commented on the issue:

https://github.com/apache/nifi/pull/1662
  
Can somebody help me?
Avro tests fails all the time and I did not touch it.
Failed tests: 
  TestAvroRecordReader.testLogicalTypes:109 expected:<2017-04-0[4]> but 
was:<2017-04-0[5]>




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] nifi issue #1662: NIFI-3688 Extended Groovy Nifi Processor

2017-04-15 Thread dlukyanov
Github user dlukyanov commented on the issue:

https://github.com/apache/nifi/pull/1662
  
@joewitt , about naming: CallGroovy would be fine?
Actually it's another implementation of groovy script. 
And the Script processor is just a Script - and not CallScript.
I wanted to point that it's extended groovy script.. What do you think 
about the name?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] nifi pull request #1662: NIFI-3688 Extended Groovy Nifi Processor

2017-04-15 Thread dlukyanov
Github user dlukyanov commented on a diff in the pull request:

https://github.com/apache/nifi/pull/1662#discussion_r111661969
  
--- Diff: 
nifi-nar-bundles/nifi-groovyx-bundle/nifi-groovyx-nar/src/main/resources/META-INF/NOTICE
 ---
@@ -0,0 +1,123 @@
+nifi-groovyx-nar
+Copyright 2014-2017 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+**
+Apache Software License v2
+**
+
+The following binary components are provided under the Apache Software 
License v2
+
+  (ASLv2) Apache Commons IO
+The following NOTICE information applies:
+  Apache Commons IO
+  Copyright 2002-2016 The Apache Software Foundation
+
+  (ASLv2) Apache Commons Email
+The following NOTICE information applies:
+  Apache Commons Email
+  Copyright 2002-2016 The Apache Software Foundation
+
+  (ASLv2) Apache Commons Lang
+The following NOTICE information applies:
+  Apache Commons Lang
+  Copyright 2001-2015 The Apache Software Foundation
+
+  This product includes software from the Spring Framework,
+  under the Apache License 2.0 (see: StringUtils.containsWhitespace())
+
+  (ASLv2) Apache Commons Logging
+The following NOTICE information applies:
+  Apache Commons Logging
+  Copyright 2003-2016 The Apache Software Foundation
+
+  (ASLv2) Apache HttpComponents
+The following NOTICE information applies:
+  Apache HttpClient
+  Copyright 1999-2015 The Apache Software Foundation
+
+  Apache HttpCore
+  Copyright 2005-2015 The Apache Software Foundation
+
+  Apache HttpMime
+  Copyright 1999-2013 The Apache Software Foundation
+
+  This project contains annotations derived from JCIP-ANNOTATIONS
+  Copyright (c) 2005 Brian Goetz and Tim Peierls. See 
http://www.jcip.net
+
+  (ASLv2) Spring Framework
+The following NOTICE information applies:
+  Spring Framework
+  Copyright 2002-2016 
+  
+  (ASLv2) SubEthaSMTP - A SMTP mail server
+The following NOTICE information applies:
+  Spring Framework
+  Copyright 2006-2007
+
+  (ASLv2) Apache POI
+The following NOTICE information applies:
+
+This product contains parts that were originally based on software 
from BEA.
+Copyright (c) 2000-2003, BEA Systems, <http://www.bea.com/>.
+
+This product contains W3C XML Schema documents. Copyright 2001-2003 (c)
+World Wide Web Consortium (Massachusetts Institute of Technology, 
European
+Research Consortium for Informatics and Mathematics, Keio University)
+
+This product contains the Piccolo XML Parser for Java
+(http://piccolo.sourceforge.net/). Copyright 2002 Yuval Oren.
+
+This product contains the chunks_parse_cmds.tbl file from the vsdump 
program.
+Copyright (C) 2006-2007 Valek Filippov (f...@df.ru)
+
+This product contains parts of the eID Applet project
+(http://eid-applet.googlecode.com). Copyright (c) 2009-2014
+FedICT (federal ICT department of Belgium), e-Contract.be BVBA 
(https://www.e-contract.be),
+Bart Hanssens from FedICT
+
+CurvesAIP is BSD-licensed software ( 
https://github.com/virtuald/curvesapi/)
+Copyright (c) 2005, Graph Builder
+
+  (ASLv2) Joda Time
+The following NOTICE information applies:
+  This product includes software developed by
+  Joda.org (http://www.joda.org/).
+
+
+
+Common Development and Distribution License 1.1
+
+
+The following binary components are provided under the Common Development 
and Distribution License 1.1. See project link for details.
+
+(CDDL 1.1) (GPL2 w/ CPE) JavaMail API (compat) 
(javax.mail:mail:jar:1.5.6 - https://java.net/projects/javamail/pages/Home)
+
+
+Common Development and Distribution License 1.0
+
+
+The following binary components are provided under the Common Development 
and Distribution License 1.0.  See project link for details.
+
+(CDDL 1.0) JavaBeans Activation Framework (JAF) 
(javax.activation:activation:jar:1.1 - 
http://java.sun.com/products/javabeans/jaf/index.jsp)
+
+
+The MIT License
+
+
+The following binary components are provided under the MIT License.  See 
project link for details.
+
+  (MIT License) EWS Java API
--- End diff --

This just copy-paste from another processor. Could you point to the right 
one license header?


---
I

[GitHub] nifi pull request #1662: NIFI-3688 Extended Groovy Nifi Processor

2017-04-10 Thread dlukyanov
Github user dlukyanov commented on a diff in the pull request:

https://github.com/apache/nifi/pull/1662#discussion_r110773203
  
--- Diff: nifi-nar-bundles/nifi-groovyx-bundle/nifi-groovyx-nar/pom.xml ---
@@ -0,0 +1,44 @@
+
+
+http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+4.0.0
+
+
+org.apache.nifi
+nifi-groovyx-bundle
+1.2.0-SNAPSHOT
+
+
+nifi-groovyx-nar
+nar
+
+true
--- End diff --

no reason. i'll fix it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] nifi pull request #1662: NIFI-3688 Extended Groovy Nifi Processor

2017-04-10 Thread dlukyanov
GitHub user dlukyanov opened a pull request:

https://github.com/apache/nifi/pull/1662

NIFI-3688 Extended Groovy Nifi Processor 

Thank you for submitting a contribution to Apache NiFi.

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

### For all changes:
- [YES] Is there a JIRA ticket associated with this PR? Is it referenced 
 in the commit message?
 in last one only

- [YES] Does your PR title start with NIFI- where  is the JIRA 
number you are trying to resolve? Pay particular attention to the hyphen "-" 
character.

- [YES] Has your PR been rebased against the latest commit within the 
target branch (typically master)?

- [YES?] Is your initial contribution a single, squashed commit?
 
### For code changes:
- [YES] Have you ensured that the full suite of tests is executed via mvn 
-Pcontrib-check clean install at the root nifi folder?
- [NO] Have you written or updated unit tests to verify your changes?
 no changes done to existing code. but no tests to groovyx processor.
- [YES] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)? 
- [YES?] If applicable, have you updated the LICENSE file, including the 
main LICENSE file under nifi-assembly?
- [YES?] If applicable, have you updated the NOTICE file, including the 
main NOTICE file found under nifi-assembly?
- [NO] If adding new Properties, have you added .displayName in addition to 
.name (programmatic access) for each of the new properties?
 not applicable?
### For documentation related changes:
- [YES] Have you ensured that format looks appropriate for the output in 
which it is rendered?

### Note:
Please ensure that once the PR is submitted, you check travis-ci for build 
issues and submit an update to your PR as soon as possible.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/dlukyanov/nifi master

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/nifi/pull/1662.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1662


commit 279e0502deef66d2a2934a211430aac52d3a5b28
Author: dlukyanov 
Date:   2017-04-02T07:55:22Z

groovyx initial version

commit 0bb6f9f970b186b6ec018d70e5afa68c9345b7c1
Author: dlukyanov 
Date:   2017-04-10T21:09:54Z

https://issues.apache.org/jira/browse/NIFI-3688

commit 8d142dd629fee4f42434f754c16c897edfa08447
Author: dlukyanov 
Date:   2017-04-10T21:22:38Z

NIFI-3688 license update to ASF

commit cd26cb1f3f2ebcbdc2ebda8904c424c62f2e5298
Author: dlukyanov 
Date:   2017-04-10T21:24:30Z

NIFI-3688 add groovyx dependency




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---