You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by mc...@apache.org on 2017/08/17 16:48:36 UTC

nifi git commit: NIFI-4295: - When determining which controller services to return for a component, ensure that we don't show services that belong to 'child groups' - Fixed a logic bug that determined which process group to use for obtaining controller s

Repository: nifi
Updated Branches:
  refs/heads/master 5cd8e93be -> 69a08e78c


NIFI-4295:
- When determining which controller services to return for a component, ensure that we don't show services that belong to 'child groups'
- Fixed a logic bug that determined which process group to use for obtaining controller services
- This closes #2087


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/69a08e78
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/69a08e78
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/69a08e78

Branch: refs/heads/master
Commit: 69a08e78c2cd47661e3d775ceece94ae82ac567e
Parents: 5cd8e93
Author: Mark Payne <ma...@hotmail.com>
Authored: Tue Aug 15 12:48:30 2017 -0400
Committer: Matt Gilman <ma...@gmail.com>
Committed: Thu Aug 17 12:47:46 2017 -0400

----------------------------------------------------------------------
 .../StandardControllerServiceProvider.java      | 25 +++++++++-----------
 1 file changed, 11 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/69a08e78/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceProvider.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceProvider.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceProvider.java
index 0745ed0..02e190a 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceProvider.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceProvider.java
@@ -35,6 +35,7 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
 
 import org.apache.commons.lang3.ClassUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -543,28 +544,24 @@ public class StandardControllerServiceProvider implements ControllerServiceProvi
             serviceNodes = flowController.getRootControllerServices();
         } else {
             ProcessGroup group = getRootGroup();
-            if (FlowController.ROOT_GROUP_ID_ALIAS.equals(groupId) || group.getIdentifier().equals(groupId)) {
-                serviceNodes = new HashSet<>(serviceCache.values());
-            } else {
+            if (!FlowController.ROOT_GROUP_ID_ALIAS.equals(groupId) && !group.getIdentifier().equals(groupId)) {
                 group = group.findProcessGroup(groupId);
-                if (group == null) {
-                    return Collections.emptySet();
-                }
-
-                serviceNodes = group.getControllerServices(true);
             }
-        }
 
-        final Set<String> identifiers = new HashSet<>();
-        for (final ControllerServiceNode serviceNode : serviceNodes) {
-            if (requireNonNull(serviceType).isAssignableFrom(serviceNode.getProxiedControllerService().getClass())) {
-                identifiers.add(serviceNode.getIdentifier());
+            if (group == null) {
+                return Collections.emptySet();
             }
+
+            serviceNodes = group.getControllerServices(true);
         }
 
-        return identifiers;
+        return serviceNodes.stream()
+            .filter(service -> serviceType.isAssignableFrom(service.getProxiedControllerService().getClass()))
+            .map(ControllerServiceNode::getIdentifier)
+            .collect(Collectors.toSet());
     }
 
+
     @Override
     public String getControllerServiceName(final String serviceIdentifier) {
         final ControllerServiceNode node = getControllerServiceNode(serviceIdentifier);