mirror of https://github.com/apache/nifi.git
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
This commit is contained in:
parent
5cd8e93beb
commit
69a08e78c2
|
@ -35,6 +35,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.apache.commons.lang3.ClassUtils;
|
import org.apache.commons.lang3.ClassUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -543,28 +544,24 @@ public class StandardControllerServiceProvider implements ControllerServiceProvi
|
||||||
serviceNodes = flowController.getRootControllerServices();
|
serviceNodes = flowController.getRootControllerServices();
|
||||||
} else {
|
} else {
|
||||||
ProcessGroup group = getRootGroup();
|
ProcessGroup group = getRootGroup();
|
||||||
if (FlowController.ROOT_GROUP_ID_ALIAS.equals(groupId) || group.getIdentifier().equals(groupId)) {
|
if (!FlowController.ROOT_GROUP_ID_ALIAS.equals(groupId) && !group.getIdentifier().equals(groupId)) {
|
||||||
serviceNodes = new HashSet<>(serviceCache.values());
|
|
||||||
} else {
|
|
||||||
group = group.findProcessGroup(groupId);
|
group = group.findProcessGroup(groupId);
|
||||||
if (group == null) {
|
|
||||||
return Collections.emptySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
serviceNodes = group.getControllerServices(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (group == null) {
|
||||||
|
return Collections.emptySet();
|
||||||
|
}
|
||||||
|
|
||||||
|
serviceNodes = group.getControllerServices(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Set<String> identifiers = new HashSet<>();
|
return serviceNodes.stream()
|
||||||
for (final ControllerServiceNode serviceNode : serviceNodes) {
|
.filter(service -> serviceType.isAssignableFrom(service.getProxiedControllerService().getClass()))
|
||||||
if (requireNonNull(serviceType).isAssignableFrom(serviceNode.getProxiedControllerService().getClass())) {
|
.map(ControllerServiceNode::getIdentifier)
|
||||||
identifiers.add(serviceNode.getIdentifier());
|
.collect(Collectors.toSet());
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return identifiers;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getControllerServiceName(final String serviceIdentifier) {
|
public String getControllerServiceName(final String serviceIdentifier) {
|
||||||
final ControllerServiceNode node = getControllerServiceNode(serviceIdentifier);
|
final ControllerServiceNode node = getControllerServiceNode(serviceIdentifier);
|
||||||
|
|
Loading…
Reference in New Issue