[GitHub] nifi pull request #721: Nifi 2398 - Apache Ignite Get Processor

2016-10-05 Thread asfgit
Github user asfgit closed the pull request at:

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


---
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 #721: Nifi 2398 - Apache Ignite Get Processor

2016-10-03 Thread pvillard31
Github user pvillard31 commented on a diff in the pull request:

https://github.com/apache/nifi/pull/721#discussion_r81645352
  
--- Diff: 
nifi-nar-bundles/nifi-ignite-bundle/nifi-ignite-processors/src/main/java/org/apache/nifi/processors/ignite/AbstractIgniteProcessor.java
 ---
@@ -92,6 +94,14 @@ public void initializeIgnite(ProcessContext context) {
 return;
 }
 
+List grids = Ignition.allGrids();
+
+if ( grids.size() == 1 ) {
+getLogger().warn("Ignite grid already avaialble");
--- End diff --

I think this should not be a warning because if using Put and Get 
processors on the canvas we will get a warning bulletin although there is no 
issue. Maybe log as info and inform the user we use a shared grid? (also take 
care of the typo).


---
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 #721: Nifi 2398 - Apache Ignite Get Processor

2016-09-21 Thread pvillard31
Github user pvillard31 commented on a diff in the pull request:

https://github.com/apache/nifi/pull/721#discussion_r79940293
  
--- Diff: 
nifi-nar-bundles/nifi-ignite-bundle/nifi-ignite-processors/src/main/java/org/apache/nifi/processors/ignite/cache/GetIgniteCache.java
 ---
@@ -0,0 +1,119 @@
+/*
+ * 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.ignite.cache;
+
+import java.io.ByteArrayInputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.nifi.annotation.behavior.EventDriven;
+import org.apache.nifi.annotation.behavior.InputRequirement;
+import org.apache.nifi.annotation.behavior.InputRequirement.Requirement;
+import org.apache.nifi.annotation.behavior.SupportsBatching;
+import org.apache.nifi.annotation.behavior.WritesAttribute;
+import org.apache.nifi.annotation.behavior.WritesAttributes;
+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.components.PropertyDescriptor;
+import org.apache.nifi.flowfile.FlowFile;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.exception.ProcessException;
+
+/**
+ * Get cache processors which gets byte array for the key from Ignite 
cache and set the array
+ * as the FlowFile content.
+ */
+@EventDriven
+@SupportsBatching
+@Tags({ "Ignite", "get", "read", "cache", "key" })
+@InputRequirement(Requirement.INPUT_REQUIRED)
+@CapabilityDescription("Get the byte array from Ignite Cache and adds it 
as the content of a FlowFile." +
+"The processor uses the value of FlowFile attribute (Ignite cache 
entry key) as the cache key lookup. " +
+"If the entry corresponding to the key is not found in the cache an 
error message is associated with the FlowFile " +
+"Note - The Ignite Kernel periodically outputs node performance 
statistics to the logs. This message " +
+" can be turned off by setting the log level for logger 
'org.apache.ignite' to WARN in the logback.xml configuration file.")
+@WritesAttributes({
+@WritesAttribute(attribute = 
GetIgniteCache.IGNITE_GET_FAILED_REASON_ATTRIBUTE_KEY, description = "The 
reason for getting entry from cache"),
+@WritesAttribute(attribute = 
GetIgniteCache.IGNITE_GET_FAILED_MISSING_KEY_MESSAGE, description = "The 
FlowFile key attribute was missing.")
+})
+@SeeAlso({PutIgniteCache.class})
+public class GetIgniteCache extends AbstractIgniteCacheProcessor {
+
+/** Flow file attribute keys and messages */
+public static final String IGNITE_GET_FAILED_REASON_ATTRIBUTE_KEY = 
"ignite.cache.get.failed.reason";
+public static final String IGNITE_GET_FAILED_MISSING_KEY_MESSAGE = 
"The FlowFile key attribute was missing";
+public static final String IGNITE_GET_FAILED_MISSING_ENTRY_MESSAGE = 
"The cache byte array entry was null or zero length";
+public static final String IGNITE_GET_FAILED_MESSAGE_PREFIX = "The 
cache request failed because of ";
+
+static {
+descriptors = new ArrayList<>();
--- End diff --

You are sharing a static reference for descriptors in both processors, it 
results in a race condition and not all properties are present. Have a look to 
other processors extending an abstract class to have an example.


---
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 #721: Nifi 2398 - Apache Ignite Get Processor

2016-09-21 Thread pvillard31
Github user pvillard31 commented on a diff in the pull request:

https://github.com/apache/nifi/pull/721#discussion_r79868592
  
--- Diff: 
nifi-nar-bundles/nifi-ignite-bundle/nifi-ignite-processors/src/main/java/org/apache/nifi/processors/ignite/cache/GetIgniteCache.java
 ---
@@ -0,0 +1,119 @@
+/*
+ * 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.ignite.cache;
+
+import java.io.ByteArrayInputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.nifi.annotation.behavior.EventDriven;
+import org.apache.nifi.annotation.behavior.InputRequirement;
+import org.apache.nifi.annotation.behavior.InputRequirement.Requirement;
+import org.apache.nifi.annotation.behavior.SupportsBatching;
+import org.apache.nifi.annotation.behavior.WritesAttribute;
+import org.apache.nifi.annotation.behavior.WritesAttributes;
+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.components.PropertyDescriptor;
+import org.apache.nifi.flowfile.FlowFile;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.exception.ProcessException;
+
+/**
+ * Get cache processors which gets byte array for the key from Ignite 
cache and set the array
+ * as the FlowFile content.
+ */
+@EventDriven
+@SupportsBatching
+@Tags({ "Ignite", "get", "read", "cache", "key" })
+@InputRequirement(Requirement.INPUT_REQUIRED)
+@CapabilityDescription("Get the byte array from Ignite Cache and adds it 
as the content of a FlowFile." +
+"The processor uses the value of FlowFile attribute (Ignite cache 
entry key) as the cache key lookup. " +
+"If the entry corresponding to the key is not found in the cache an 
error message is associated with the FlowFile " +
+"Note - The Ignite Kernel periodically outputs node performance 
statistics to the logs. This message " +
+" can be turned off by setting the log level for logger 
'org.apache.ignite' to WARN in the logback.xml configuration file.")
+@WritesAttributes({
+@WritesAttribute(attribute = 
GetIgniteCache.IGNITE_GET_FAILED_REASON_ATTRIBUTE_KEY, description = "The 
reason for getting entry from cache"),
+@WritesAttribute(attribute = 
GetIgniteCache.IGNITE_GET_FAILED_MISSING_KEY_MESSAGE, description = "The 
FlowFile key attribute was missing.")
+})
+@SeeAlso({PutIgniteCache.class})
+public class GetIgniteCache extends AbstractIgniteCacheProcessor {
+
+/** Flow file attribute keys and messages */
+public static final String IGNITE_GET_FAILED_REASON_ATTRIBUTE_KEY = 
"ignite.cache.get.failed.reason";
+public static final String IGNITE_GET_FAILED_MISSING_KEY_MESSAGE = 
"The FlowFile key attribute was missing";
--- End diff --

Shouldn't it be a key and not a description (as you did with the other 
written attribute)?


---
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 #721: Nifi 2398 - Apache Ignite Get Processor

2016-09-21 Thread pvillard31
Github user pvillard31 commented on a diff in the pull request:

https://github.com/apache/nifi/pull/721#discussion_r79939789
  
--- Diff: 
nifi-nar-bundles/nifi-ignite-bundle/nifi-ignite-processors/src/main/java/org/apache/nifi/processors/ignite/cache/GetIgniteCache.java
 ---
@@ -0,0 +1,119 @@
+/*
+ * 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.ignite.cache;
+
+import java.io.ByteArrayInputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.nifi.annotation.behavior.EventDriven;
+import org.apache.nifi.annotation.behavior.InputRequirement;
+import org.apache.nifi.annotation.behavior.InputRequirement.Requirement;
+import org.apache.nifi.annotation.behavior.SupportsBatching;
+import org.apache.nifi.annotation.behavior.WritesAttribute;
+import org.apache.nifi.annotation.behavior.WritesAttributes;
+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.components.PropertyDescriptor;
+import org.apache.nifi.flowfile.FlowFile;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.exception.ProcessException;
+
+/**
+ * Get cache processors which gets byte array for the key from Ignite 
cache and set the array
+ * as the FlowFile content.
+ */
+@EventDriven
+@SupportsBatching
+@Tags({ "Ignite", "get", "read", "cache", "key" })
+@InputRequirement(Requirement.INPUT_REQUIRED)
+@CapabilityDescription("Get the byte array from Ignite Cache and adds it 
as the content of a FlowFile." +
+"The processor uses the value of FlowFile attribute (Ignite cache 
entry key) as the cache key lookup. " +
+"If the entry corresponding to the key is not found in the cache an 
error message is associated with the FlowFile " +
+"Note - The Ignite Kernel periodically outputs node performance 
statistics to the logs. This message " +
+" can be turned off by setting the log level for logger 
'org.apache.ignite' to WARN in the logback.xml configuration file.")
+@WritesAttributes({
+@WritesAttribute(attribute = 
GetIgniteCache.IGNITE_GET_FAILED_REASON_ATTRIBUTE_KEY, description = "The 
reason for getting entry from cache"),
+@WritesAttribute(attribute = 
GetIgniteCache.IGNITE_GET_FAILED_MISSING_KEY_MESSAGE, description = "The 
FlowFile key attribute was missing.")
+})
+@SeeAlso({PutIgniteCache.class})
+public class GetIgniteCache extends AbstractIgniteCacheProcessor {
+
+/** Flow file attribute keys and messages */
+public static final String IGNITE_GET_FAILED_REASON_ATTRIBUTE_KEY = 
"ignite.cache.get.failed.reason";
+public static final String IGNITE_GET_FAILED_MISSING_KEY_MESSAGE = 
"The FlowFile key attribute was missing";
--- End diff --

Shouldn't it be a key instead of a string message here?


---
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.
---