[jira] [Commented] (MINIFICPP-397) Implement RouteOnAttribute

2018-03-14 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/MINIFICPP-397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16398626#comment-16398626
 ] 

ASF GitHub Bot commented on MINIFICPP-397:
--

Github user asfgit closed the pull request at:

https://github.com/apache/nifi-minifi-cpp/pull/268


> Implement RouteOnAttribute
> --
>
> Key: MINIFICPP-397
> URL: https://issues.apache.org/jira/browse/MINIFICPP-397
> Project: NiFi MiNiFi C++
>  Issue Type: Improvement
>Reporter: Andrew Christianson
>Assignee: Andrew Christianson
>Priority: Major
>
> RouteOnAttribute is notably missing from MiNiFi - C++ and should be 
> implemented.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (MINIFICPP-397) Implement RouteOnAttribute

2018-03-14 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/MINIFICPP-397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16398618#comment-16398618
 ] 

ASF GitHub Bot commented on MINIFICPP-397:
--

Github user phrocker commented on the issue:

https://github.com/apache/nifi-minifi-cpp/pull/268
  
Will build and merge now


> Implement RouteOnAttribute
> --
>
> Key: MINIFICPP-397
> URL: https://issues.apache.org/jira/browse/MINIFICPP-397
> Project: NiFi MiNiFi C++
>  Issue Type: Improvement
>Reporter: Andrew Christianson
>Assignee: Andrew Christianson
>Priority: Major
>
> RouteOnAttribute is notably missing from MiNiFi - C++ and should be 
> implemented.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (MINIFICPP-397) Implement RouteOnAttribute

2018-03-06 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/MINIFICPP-397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16387935#comment-16387935
 ] 

ASF GitHub Bot commented on MINIFICPP-397:
--

Github user achristianson commented on the issue:

https://github.com/apache/nifi-minifi-cpp/pull/268
  
Rebased & fixed linter. Ready for re-review.


> Implement RouteOnAttribute
> --
>
> Key: MINIFICPP-397
> URL: https://issues.apache.org/jira/browse/MINIFICPP-397
> Project: NiFi MiNiFi C++
>  Issue Type: Improvement
>Reporter: Andrew Christianson
>Assignee: Andrew Christianson
>Priority: Major
>
> RouteOnAttribute is notably missing from MiNiFi - C++ and should be 
> implemented.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (MINIFICPP-397) Implement RouteOnAttribute

2018-03-06 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/MINIFICPP-397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16387922#comment-16387922
 ] 

ASF GitHub Bot commented on MINIFICPP-397:
--

Github user achristianson commented on the issue:

https://github.com/apache/nifi-minifi-cpp/pull/268
  
Taking a look at linter issues.


> Implement RouteOnAttribute
> --
>
> Key: MINIFICPP-397
> URL: https://issues.apache.org/jira/browse/MINIFICPP-397
> Project: NiFi MiNiFi C++
>  Issue Type: Improvement
>Reporter: Andrew Christianson
>Assignee: Andrew Christianson
>Priority: Major
>
> RouteOnAttribute is notably missing from MiNiFi - C++ and should be 
> implemented.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (MINIFICPP-397) Implement RouteOnAttribute

2018-02-28 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/MINIFICPP-397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16381058#comment-16381058
 ] 

ASF GitHub Bot commented on MINIFICPP-397:
--

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

https://github.com/apache/nifi-minifi-cpp/pull/268#discussion_r171389409
  
--- Diff: libminifi/src/processors/RouteOnAttribute.cpp ---
@@ -0,0 +1,107 @@
+/**
+ * @file RouteOnAttribute.cpp
+ * RouteOnAttribute class implementation
+ *
+ * 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.
+ */
+
+#include "processors/RouteOnAttribute.h"
+
+#include 
+#include 
+#include 
+
+namespace org {
+namespace apache {
+namespace nifi {
+namespace minifi {
+namespace processors {
+
+core::Relationship RouteOnAttribute::Unmatched(
+"unmatched",
+"Files which do not match any expression are routed here");
+core::Relationship RouteOnAttribute::Failure(
+"failure",
+"Failed files are transferred to failure");
+
+void RouteOnAttribute::initialize() {
+  std::set properties;
+  setSupportedProperties(properties);
+}
+
+void RouteOnAttribute::onDynamicPropertyModified(const core::Property 
&orig_property,
+ const core::Property 
&new_property) {
+
+  // Update the routing table when routes are added via dynamic properties.
+  route_properties_[new_property.getName()] = new_property;
+
+  std::set relationships;
+
+  for (const auto &route : route_properties_) {
+core::Relationship route_rel{route.first, "Dynamic route"};
+route_rels_[route.first] = route_rel;
+relationships.insert(route_rel);
+logger_->log_info("RouteOnAttribute registered route '%s' with 
expression '%s'",
+  route.first,
+  route.second.getValue());
+  }
+
+  relationships.insert(Unmatched);
+  relationships.insert(Failure);
+  setSupportedRelationships(relationships);
--- End diff --

OK.


> Implement RouteOnAttribute
> --
>
> Key: MINIFICPP-397
> URL: https://issues.apache.org/jira/browse/MINIFICPP-397
> Project: NiFi MiNiFi C++
>  Issue Type: Improvement
>Reporter: Andrew Christianson
>Assignee: Andrew Christianson
>Priority: Major
>
> RouteOnAttribute is notably missing from MiNiFi - C++ and should be 
> implemented.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (MINIFICPP-397) Implement RouteOnAttribute

2018-02-28 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/MINIFICPP-397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16380793#comment-16380793
 ] 

ASF GitHub Bot commented on MINIFICPP-397:
--

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

https://github.com/apache/nifi-minifi-cpp/pull/268#discussion_r171338847
  
--- Diff: libminifi/src/processors/RouteOnAttribute.cpp ---
@@ -0,0 +1,107 @@
+/**
+ * @file RouteOnAttribute.cpp
+ * RouteOnAttribute class implementation
+ *
+ * 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.
+ */
+
+#include "processors/RouteOnAttribute.h"
+
+#include 
+#include 
+#include 
+
+namespace org {
+namespace apache {
+namespace nifi {
+namespace minifi {
+namespace processors {
+
+core::Relationship RouteOnAttribute::Unmatched(
+"unmatched",
+"Files which do not match any expression are routed here");
+core::Relationship RouteOnAttribute::Failure(
+"failure",
+"Failed files are transferred to failure");
+
+void RouteOnAttribute::initialize() {
+  std::set properties;
+  setSupportedProperties(properties);
+}
+
+void RouteOnAttribute::onDynamicPropertyModified(const core::Property 
&orig_property,
+ const core::Property 
&new_property) {
+
+  // Update the routing table when routes are added via dynamic properties.
+  route_properties_[new_property.getName()] = new_property;
+
+  std::set relationships;
+
+  for (const auto &route : route_properties_) {
+core::Relationship route_rel{route.first, "Dynamic route"};
+route_rels_[route.first] = route_rel;
+relationships.insert(route_rel);
+logger_->log_info("RouteOnAttribute registered route '%s' with 
expression '%s'",
+  route.first,
+  route.second.getValue());
+  }
+
+  relationships.insert(Unmatched);
+  relationships.insert(Failure);
+  setSupportedRelationships(relationships);
--- End diff --

Since we don't support changing of relationships if isRunning() is true, a 
call to update properties/relationships will not go through and the failure 
will be logged. I think that's the behavior we want.


> Implement RouteOnAttribute
> --
>
> Key: MINIFICPP-397
> URL: https://issues.apache.org/jira/browse/MINIFICPP-397
> Project: NiFi MiNiFi C++
>  Issue Type: Improvement
>Reporter: Andrew Christianson
>Assignee: Andrew Christianson
>Priority: Major
>
> RouteOnAttribute is notably missing from MiNiFi - C++ and should be 
> implemented.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (MINIFICPP-397) Implement RouteOnAttribute

2018-02-28 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/MINIFICPP-397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16380528#comment-16380528
 ] 

ASF GitHub Bot commented on MINIFICPP-397:
--

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

https://github.com/apache/nifi-minifi-cpp/pull/268#discussion_r171293683
  
--- Diff: libminifi/src/processors/RouteOnAttribute.cpp ---
@@ -0,0 +1,107 @@
+/**
+ * @file RouteOnAttribute.cpp
+ * RouteOnAttribute class implementation
+ *
+ * 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.
+ */
+
+#include "processors/RouteOnAttribute.h"
+
+#include 
+#include 
+#include 
+
+namespace org {
+namespace apache {
+namespace nifi {
+namespace minifi {
+namespace processors {
+
+core::Relationship RouteOnAttribute::Unmatched(
+"unmatched",
+"Files which do not match any expression are routed here");
+core::Relationship RouteOnAttribute::Failure(
+"failure",
+"Failed files are transferred to failure");
+
+void RouteOnAttribute::initialize() {
+  std::set properties;
+  setSupportedProperties(properties);
+}
+
+void RouteOnAttribute::onDynamicPropertyModified(const core::Property 
&orig_property,
+ const core::Property 
&new_property) {
+
+  // Update the routing table when routes are added via dynamic properties.
+  route_properties_[new_property.getName()] = new_property;
+
+  std::set relationships;
+
+  for (const auto &route : route_properties_) {
+core::Relationship route_rel{route.first, "Dynamic route"};
+route_rels_[route.first] = route_rel;
+relationships.insert(route_rel);
+logger_->log_info("RouteOnAttribute registered route '%s' with 
expression '%s'",
+  route.first,
+  route.second.getValue());
+  }
+
+  relationships.insert(Unmatched);
+  relationships.insert(Failure);
+  setSupportedRelationships(relationships);
--- End diff --

bool Connectable::setSupportedRelationships(std::set 
relationships) {
  if (isRunning()) {
logger_->log_warn("Can not set processor supported relationship while 
the process %s is running", name_);
return false;
  }
what if we do the onDynamicPropertyModified while the processor is running


> Implement RouteOnAttribute
> --
>
> Key: MINIFICPP-397
> URL: https://issues.apache.org/jira/browse/MINIFICPP-397
> Project: NiFi MiNiFi C++
>  Issue Type: Improvement
>Reporter: Andrew Christianson
>Assignee: Andrew Christianson
>Priority: Major
>
> RouteOnAttribute is notably missing from MiNiFi - C++ and should be 
> implemented.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (MINIFICPP-397) Implement RouteOnAttribute

2018-02-21 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/MINIFICPP-397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16371554#comment-16371554
 ] 

ASF GitHub Bot commented on MINIFICPP-397:
--

GitHub user achristianson opened a pull request:

https://github.com/apache/nifi-minifi-cpp/pull/268

MINIFICPP-397 Added implementation of RouteOnAttribute

Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.

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

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

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

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

- [x] Is your initial contribution a single, squashed commit?

### For code changes:
- [x] 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)?
- [x] If applicable, have you updated the LICENSE file?
- [x] If applicable, have you updated the NOTICE file?

### For documentation related changes:
- [x] 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/achristianson/nifi-minifi-cpp MINIFICPP-397

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

https://github.com/apache/nifi-minifi-cpp/pull/268.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 #268


commit 8328f8e386e6a32253c0fc19c9769aad90d95281
Author: Andrew I. Christianson 
Date:   2018-02-20T16:22:18Z

MINIFICPP-397 Added implementation of RouteOnAttribute




> Implement RouteOnAttribute
> --
>
> Key: MINIFICPP-397
> URL: https://issues.apache.org/jira/browse/MINIFICPP-397
> Project: NiFi MiNiFi C++
>  Issue Type: Improvement
>Reporter: Andrew Christianson
>Assignee: Andrew Christianson
>Priority: Major
>
> RouteOnAttribute is notably missing from MiNiFi - C++ and should be 
> implemented.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)