Java Code Examples for org.apache.nifi.groups.ProcessGroup#getControllerServices()
The following examples show how to use
org.apache.nifi.groups.ProcessGroup#getControllerServices() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StandardControllerServiceDAO.java From nifi with Apache License 2.0 | 6 votes |
@Override public Set<ControllerServiceNode> getControllerServices(final String groupId, final boolean includeAncestorGroups, final boolean includeDescendantGroups) { final FlowManager flowManager = flowController.getFlowManager(); if (groupId == null) { return flowManager.getRootControllerServices(); } else { final String searchId = groupId.equals(FlowManager.ROOT_GROUP_ID_ALIAS) ? flowManager.getRootGroupId() : groupId; final ProcessGroup procGroup = flowManager.getRootGroup().findProcessGroup(searchId); if (procGroup == null) { throw new ResourceNotFoundException("Could not find Process Group with ID " + groupId); } final Set<ControllerServiceNode> serviceNodes = procGroup.getControllerServices(includeAncestorGroups); if (includeDescendantGroups) { serviceNodes.addAll(procGroup.findAllControllerServices()); } return serviceNodes; } }
Example 2
Source File: StandardParameterContextDAO.java From nifi with Apache License 2.0 | 6 votes |
@Override public void verifyDelete(final String parameterContextId) { // Find all Process Groups that are bound to the Parameter Context final List<ProcessGroup> groupsReferencingParameterContext = getBoundProcessGroups(parameterContextId); // If any component is referencing a Parameter and is running/enabled then fail for (final ProcessGroup group : groupsReferencingParameterContext) { for (final ProcessorNode processor : group.getProcessors()) { if (processor.isReferencingParameter() && processor.isRunning()) { throw new IllegalStateException("Cannot delete Parameter Context with ID " + parameterContextId + " because it is in use by at least one Processor that is running"); } } for (final ControllerServiceNode service : group.getControllerServices(false)) { if (service.isReferencingParameter() && service.getState() != ControllerServiceState.DISABLED) { throw new IllegalStateException("Cannot delete Parameter Context with ID " + parameterContextId + " because it is in use by at least one Controller Service that is enabled"); } } } }
Example 3
Source File: StandardControllerServiceProvider.java From nifi with Apache License 2.0 | 6 votes |
@Override public Set<String> getControllerServiceIdentifiers(final Class<? extends ControllerService> serviceType, final String groupId) { final Set<ControllerServiceNode> serviceNodes; if (groupId == null) { serviceNodes = flowManager.getRootControllerServices(); } else { ProcessGroup group = getRootGroup(); if (!FlowManager.ROOT_GROUP_ID_ALIAS.equals(groupId) && !group.getIdentifier().equals(groupId)) { group = group.findProcessGroup(groupId); } if (group == null) { return Collections.emptySet(); } serviceNodes = group.getControllerServices(true); } return serviceNodes.stream() .filter(service -> serviceType.isAssignableFrom(service.getProxiedControllerService().getClass())) .map(ControllerServiceNode::getIdentifier) .collect(Collectors.toSet()); }
Example 4
Source File: StandardControllerServiceDAO.java From localization_nifi with Apache License 2.0 | 5 votes |
@Override public Set<ControllerServiceNode> getControllerServices(final String groupId) { if (groupId == null) { return flowController.getRootControllerServices(); } else { final String searchId = groupId.equals(ROOT_GROUP_ID_ALIAS) ? flowController.getRootGroupId() : groupId; final ProcessGroup procGroup = flowController.getGroup(flowController.getRootGroupId()).findProcessGroup(searchId); if (procGroup == null) { throw new ResourceNotFoundException("Could not find Process Group with ID " + groupId); } return procGroup.getControllerServices(true); } }
Example 5
Source File: StandardControllerServiceProvider.java From localization_nifi with Apache License 2.0 | 5 votes |
@Override public Set<String> getControllerServiceIdentifiers(final Class<? extends ControllerService> serviceType, final String groupId) { final Set<ControllerServiceNode> serviceNodes; if (groupId == null) { serviceNodes = flowController.getRootControllerServices(); } else { ProcessGroup group = getRootGroup(); 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()); } } return identifiers; }
Example 6
Source File: TestFlowController.java From localization_nifi with Apache License 2.0 | 5 votes |
@Test public void testDeleteProcessGroup() { ProcessGroup pg = controller.createProcessGroup("my-process-group"); pg.setName("my-process-group"); ControllerServiceNode cs = controller.createControllerService("org.apache.nifi.NonExistingControllerService", "my-controller-service", false); pg.addControllerService(cs); controller.getRootGroup().addProcessGroup(pg); controller.getRootGroup().removeProcessGroup(pg); pg.getControllerServices(true); assertTrue(pg.getControllerServices(true).isEmpty()); }
Example 7
Source File: TestFlowController.java From nifi with Apache License 2.0 | 5 votes |
@Test public void testDeleteProcessGroup() { ProcessGroup pg = controller.getFlowManager().createProcessGroup("my-process-group"); pg.setName("my-process-group"); ControllerServiceNode cs = controller.getFlowManager().createControllerService("org.apache.nifi.NonExistingControllerService", "my-controller-service", systemBundle.getBundleDetails().getCoordinate(), null, false, true); pg.addControllerService(cs); controller.getFlowManager().getRootGroup().addProcessGroup(pg); controller.getFlowManager().getRootGroup().removeProcessGroup(pg); pg.getControllerServices(true); assertTrue(pg.getControllerServices(true).isEmpty()); }