Search in sources :

Example 6 with ControllerServiceReference

use of org.apache.nifi.controller.service.ControllerServiceReference in project nifi by apache.

the class StandardNiFiServiceFacade method getControllerServiceReferencingComponents.

@Override
public ControllerServiceReferencingComponentsEntity getControllerServiceReferencingComponents(final String controllerServiceId) {
    final ControllerServiceNode service = controllerServiceDAO.getControllerService(controllerServiceId);
    final ControllerServiceReference ref = service.getReferences();
    return createControllerServiceReferencingComponentsEntity(ref, Sets.newHashSet(controllerServiceId));
}
Also used : ControllerServiceNode(org.apache.nifi.controller.service.ControllerServiceNode) ControllerServiceReference(org.apache.nifi.controller.service.ControllerServiceReference)

Example 7 with ControllerServiceReference

use of org.apache.nifi.controller.service.ControllerServiceReference in project nifi by apache.

the class StandardProcessGroup method getComponentsAffectedByVariable.

@Override
public Set<ConfiguredComponent> getComponentsAffectedByVariable(final String variableName) {
    final Set<ConfiguredComponent> affected = new HashSet<>();
    // Determine any Processors that references the variable
    for (final ProcessorNode processor : getProcessors()) {
        for (final VariableImpact impact : getVariableImpact(processor)) {
            if (impact.isImpacted(variableName)) {
                affected.add(processor);
            }
        }
    }
    // find any references to that service and add it.
    for (final ControllerServiceNode service : getControllerServices(false)) {
        for (final VariableImpact impact : getVariableImpact(service)) {
            if (impact.isImpacted(variableName)) {
                affected.add(service);
                final ControllerServiceReference reference = service.getReferences();
                affected.addAll(reference.findRecursiveReferences(ConfiguredComponent.class));
            }
        }
    }
    // is overriding the variable and its components are actually referencing a different variable.
    for (final ProcessGroup childGroup : getProcessGroups()) {
        final ComponentVariableRegistry childRegistry = childGroup.getVariableRegistry();
        final VariableDescriptor descriptor = childRegistry.getVariableKey(variableName);
        final boolean overridden = childRegistry.getVariableMap().containsKey(descriptor);
        if (!overridden) {
            affected.addAll(childGroup.getComponentsAffectedByVariable(variableName));
        }
    }
    return affected;
}
Also used : VariableImpact(org.apache.nifi.attribute.expression.language.VariableImpact) ProcessorNode(org.apache.nifi.controller.ProcessorNode) ControllerServiceNode(org.apache.nifi.controller.service.ControllerServiceNode) ConfiguredComponent(org.apache.nifi.controller.ConfiguredComponent) ComponentVariableRegistry(org.apache.nifi.registry.ComponentVariableRegistry) ControllerServiceReference(org.apache.nifi.controller.service.ControllerServiceReference) VersionedProcessGroup(org.apache.nifi.registry.flow.VersionedProcessGroup) VersionedRemoteProcessGroup(org.apache.nifi.registry.flow.VersionedRemoteProcessGroup) VariableDescriptor(org.apache.nifi.registry.VariableDescriptor) LinkedHashSet(java.util.LinkedHashSet) HashSet(java.util.HashSet)

Example 8 with ControllerServiceReference

use of org.apache.nifi.controller.service.ControllerServiceReference in project nifi by apache.

the class StandardAuthorizableLookup method getControllerServiceReferencingComponent.

@Override
public Authorizable getControllerServiceReferencingComponent(String controllerServiceId, String id) {
    final ControllerServiceNode controllerService = controllerServiceDAO.getControllerService(controllerServiceId);
    final ControllerServiceReference referencingComponents = controllerService.getReferences();
    final ConfiguredComponent reference = findControllerServiceReferencingComponent(referencingComponents, id);
    if (reference == null) {
        throw new ResourceNotFoundException("Unable to find referencing component with id " + id);
    }
    return reference;
}
Also used : ControllerServiceNode(org.apache.nifi.controller.service.ControllerServiceNode) ConfiguredComponent(org.apache.nifi.controller.ConfiguredComponent) ControllerServiceReference(org.apache.nifi.controller.service.ControllerServiceReference) ResourceNotFoundException(org.apache.nifi.web.ResourceNotFoundException)

Aggregations

ControllerServiceReference (org.apache.nifi.controller.service.ControllerServiceReference)8 HashSet (java.util.HashSet)5 LinkedHashSet (java.util.LinkedHashSet)5 ConfiguredComponent (org.apache.nifi.controller.ConfiguredComponent)5 ControllerServiceNode (org.apache.nifi.controller.service.ControllerServiceNode)5 HashMap (java.util.HashMap)4 LinkedHashMap (java.util.LinkedHashMap)4 NiFiUser (org.apache.nifi.authorization.user.NiFiUser)4 ArrayList (java.util.ArrayList)3 Map (java.util.Map)3 Set (java.util.Set)3 ControllerServiceReferencingComponentsEntity (org.apache.nifi.web.api.entity.ControllerServiceReferencingComponentsEntity)3 Sets (com.google.common.collect.Sets)2 IOException (java.io.IOException)2 StandardCharsets (java.nio.charset.StandardCharsets)2 Arrays (java.util.Arrays)2 Collection (java.util.Collection)2 Collections (java.util.Collections)2 Comparator (java.util.Comparator)2 Date (java.util.Date)2