Search in sources :

Example 11 with RemoteProcessGroupStatus

use of org.apache.nifi.controller.status.RemoteProcessGroupStatus in project nifi by apache.

the class ComponentMapHolder method createComponentMap.

private static ComponentMapHolder createComponentMap(final ProcessGroupStatus status, final ParentProcessGroupSearchNode thisProcessGroupNode) {
    final ComponentMapHolder holder = new ComponentMapHolder();
    final Map<String, String> componentNameMap = holder.componentNameMap;
    final Map<String, ParentProcessGroupSearchNode> componentToParentGroupMap = holder.componentToParentGroupMap;
    final Map<String, String> sourceToConnectionParentGroupMap = holder.sourceToConnectionParentGroupMap;
    final Map<String, String> destinationToConnectionParentGroupMap = holder.destinationToConnectionParentGroupMap;
    if (status != null) {
        componentNameMap.put(status.getId(), status.getName());
        for (final ProcessorStatus procStatus : status.getProcessorStatus()) {
            componentNameMap.put(procStatus.getId(), procStatus.getName());
            componentToParentGroupMap.put(procStatus.getId(), thisProcessGroupNode);
        }
        for (final PortStatus portStatus : status.getInputPortStatus()) {
            componentNameMap.put(portStatus.getId(), portStatus.getName());
            componentToParentGroupMap.put(portStatus.getId(), thisProcessGroupNode);
        }
        for (final PortStatus portStatus : status.getOutputPortStatus()) {
            componentNameMap.put(portStatus.getId(), portStatus.getName());
            componentToParentGroupMap.put(portStatus.getId(), thisProcessGroupNode);
        }
        for (final RemoteProcessGroupStatus rpgStatus : status.getRemoteProcessGroupStatus()) {
            componentNameMap.put(rpgStatus.getId(), rpgStatus.getName());
            componentToParentGroupMap.put(rpgStatus.getId(), thisProcessGroupNode);
        }
        for (final ConnectionStatus connectionStatus : status.getConnectionStatus()) {
            componentNameMap.put(connectionStatus.getId(), connectionStatus.getName());
            componentToParentGroupMap.put(connectionStatus.getId(), thisProcessGroupNode);
            // Add source and destination for Remote Input/Output Ports because metadata for those are only available at ConnectionStatus.
            componentNameMap.computeIfAbsent(connectionStatus.getSourceId(), k -> connectionStatus.getSourceName());
            componentNameMap.computeIfAbsent(connectionStatus.getDestinationId(), k -> connectionStatus.getDestinationName());
            sourceToConnectionParentGroupMap.put(connectionStatus.getSourceId(), connectionStatus.getGroupId());
            destinationToConnectionParentGroupMap.put(connectionStatus.getDestinationId(), connectionStatus.getGroupId());
        }
        for (final ProcessGroupStatus childGroup : status.getProcessGroupStatus()) {
            componentNameMap.put(childGroup.getId(), childGroup.getName());
            ParentProcessGroupSearchNode childProcessGroupNode = new ParentProcessGroupSearchNode(childGroup.getId(), thisProcessGroupNode);
            componentToParentGroupMap.put(childGroup.getId(), thisProcessGroupNode);
            holder.putAll(createComponentMap(childGroup, childProcessGroupNode));
        }
    }
    return holder;
}
Also used : RemoteProcessGroupStatus(org.apache.nifi.controller.status.RemoteProcessGroupStatus) ProcessGroupStatus(org.apache.nifi.controller.status.ProcessGroupStatus) PortStatus(org.apache.nifi.controller.status.PortStatus) RemoteProcessGroupStatus(org.apache.nifi.controller.status.RemoteProcessGroupStatus) ConnectionStatus(org.apache.nifi.controller.status.ConnectionStatus) ProcessorStatus(org.apache.nifi.controller.status.ProcessorStatus)

Example 12 with RemoteProcessGroupStatus

use of org.apache.nifi.controller.status.RemoteProcessGroupStatus in project nifi by apache.

the class TestSiteToSiteStatusReportingTask method generateRemoteProcessGroupStatus.

public static RemoteProcessGroupStatus generateRemoteProcessGroupStatus(String id, String namePrefix) {
    RemoteProcessGroupStatus rpgStatus = new RemoteProcessGroupStatus();
    rpgStatus.setId(id);
    rpgStatus.setName(namePrefix + "-" + UUID.randomUUID().toString());
    rpgStatus.setActiveRemotePortCount(0);
    rpgStatus.setActiveThreadCount(1);
    rpgStatus.setAverageLineageDuration(2l);
    rpgStatus.setInactiveRemotePortCount(3);
    rpgStatus.setReceivedContentSize(4l);
    rpgStatus.setReceivedCount(5);
    rpgStatus.setSentContentSize(6l);
    rpgStatus.setSentCount(7);
    rpgStatus.setTargetUri("uri");
    return rpgStatus;
}
Also used : RemoteProcessGroupStatus(org.apache.nifi.controller.status.RemoteProcessGroupStatus)

Example 13 with RemoteProcessGroupStatus

use of org.apache.nifi.controller.status.RemoteProcessGroupStatus in project nifi by apache.

the class DtoFactory method createProcessGroupStatusDto.

public ProcessGroupStatusDTO createProcessGroupStatusDto(final ProcessGroup processGroup, final ProcessGroupStatus processGroupStatus) {
    final ProcessGroupStatusDTO processGroupStatusDto = createConciseProcessGroupStatusDto(processGroupStatus);
    final ProcessGroupStatusSnapshotDTO snapshot = processGroupStatusDto.getAggregateSnapshot();
    // processor status
    final Collection<ProcessorStatusSnapshotEntity> processorStatusSnapshotEntities = new ArrayList<>();
    snapshot.setProcessorStatusSnapshots(processorStatusSnapshotEntities);
    final Collection<ProcessorStatus> processorStatusCollection = processGroupStatus.getProcessorStatus();
    if (processorStatusCollection != null) {
        for (final ProcessorStatus processorStatus : processorStatusCollection) {
            final ProcessorStatusDTO processorStatusDto = createProcessorStatusDto(processorStatus);
            final ProcessorNode processor = processGroup.findProcessor(processorStatusDto.getId());
            final PermissionsDTO processorPermissions = createPermissionsDto(processor);
            processorStatusSnapshotEntities.add(entityFactory.createProcessorStatusSnapshotEntity(processorStatusDto.getAggregateSnapshot(), processorPermissions));
        }
    }
    // connection status
    final Collection<ConnectionStatusSnapshotEntity> connectionStatusDtoCollection = new ArrayList<>();
    snapshot.setConnectionStatusSnapshots(connectionStatusDtoCollection);
    final Collection<ConnectionStatus> connectionStatusCollection = processGroupStatus.getConnectionStatus();
    if (connectionStatusCollection != null) {
        for (final ConnectionStatus connectionStatus : connectionStatusCollection) {
            final ConnectionStatusDTO connectionStatusDto = createConnectionStatusDto(connectionStatus);
            final Connection connection = processGroup.findConnection(connectionStatusDto.getId());
            final PermissionsDTO connectionPermissions = createPermissionsDto(connection);
            connectionStatusDtoCollection.add(entityFactory.createConnectionStatusSnapshotEntity(connectionStatusDto.getAggregateSnapshot(), connectionPermissions));
        }
    }
    // local child process groups
    final Collection<ProcessGroupStatusSnapshotEntity> childProcessGroupStatusDtoCollection = new ArrayList<>();
    snapshot.setProcessGroupStatusSnapshots(childProcessGroupStatusDtoCollection);
    final Collection<ProcessGroupStatus> childProcessGroupStatusCollection = processGroupStatus.getProcessGroupStatus();
    if (childProcessGroupStatusCollection != null) {
        for (final ProcessGroupStatus childProcessGroupStatus : childProcessGroupStatusCollection) {
            final ProcessGroupStatusDTO childProcessGroupStatusDto = createProcessGroupStatusDto(processGroup, childProcessGroupStatus);
            final ProcessGroup childProcessGroup = processGroup.findProcessGroup(childProcessGroupStatusDto.getId());
            final PermissionsDTO childProcessGroupPermissions = createPermissionsDto(childProcessGroup);
            childProcessGroupStatusDtoCollection.add(entityFactory.createProcessGroupStatusSnapshotEntity(childProcessGroupStatusDto.getAggregateSnapshot(), childProcessGroupPermissions));
        }
    }
    // remote child process groups
    final Collection<RemoteProcessGroupStatusSnapshotEntity> childRemoteProcessGroupStatusDtoCollection = new ArrayList<>();
    snapshot.setRemoteProcessGroupStatusSnapshots(childRemoteProcessGroupStatusDtoCollection);
    final Collection<RemoteProcessGroupStatus> childRemoteProcessGroupStatusCollection = processGroupStatus.getRemoteProcessGroupStatus();
    if (childRemoteProcessGroupStatusCollection != null) {
        for (final RemoteProcessGroupStatus childRemoteProcessGroupStatus : childRemoteProcessGroupStatusCollection) {
            final RemoteProcessGroupStatusDTO childRemoteProcessGroupStatusDto = createRemoteProcessGroupStatusDto(childRemoteProcessGroupStatus);
            final RemoteProcessGroup remoteProcessGroup = processGroup.findRemoteProcessGroup(childRemoteProcessGroupStatusDto.getId());
            final PermissionsDTO remoteProcessGroupPermissions = createPermissionsDto(remoteProcessGroup);
            childRemoteProcessGroupStatusDtoCollection.add(entityFactory.createRemoteProcessGroupStatusSnapshotEntity(childRemoteProcessGroupStatusDto.getAggregateSnapshot(), remoteProcessGroupPermissions));
        }
    }
    // input ports
    final Collection<PortStatusSnapshotEntity> inputPortStatusDtoCollection = new ArrayList<>();
    snapshot.setInputPortStatusSnapshots(inputPortStatusDtoCollection);
    final Collection<PortStatus> inputPortStatusCollection = processGroupStatus.getInputPortStatus();
    if (inputPortStatusCollection != null) {
        for (final PortStatus portStatus : inputPortStatusCollection) {
            final PortStatusDTO portStatusDto = createPortStatusDto(portStatus);
            final Port inputPort = processGroup.findInputPort(portStatus.getId());
            final PermissionsDTO inputPortPermissions = createPermissionsDto(inputPort);
            inputPortStatusDtoCollection.add(entityFactory.createPortStatusSnapshotEntity(portStatusDto.getAggregateSnapshot(), inputPortPermissions));
        }
    }
    // output ports
    final Collection<PortStatusSnapshotEntity> outputPortStatusDtoCollection = new ArrayList<>();
    snapshot.setOutputPortStatusSnapshots(outputPortStatusDtoCollection);
    final Collection<PortStatus> outputPortStatusCollection = processGroupStatus.getOutputPortStatus();
    if (outputPortStatusCollection != null) {
        for (final PortStatus portStatus : outputPortStatusCollection) {
            final PortStatusDTO portStatusDto = createPortStatusDto(portStatus);
            final Port outputPort = processGroup.findOutputPort(portStatus.getId());
            final PermissionsDTO outputPortPermissions = createPermissionsDto(outputPort);
            outputPortStatusDtoCollection.add(entityFactory.createPortStatusSnapshotEntity(portStatusDto.getAggregateSnapshot(), outputPortPermissions));
        }
    }
    return processGroupStatusDto;
}
Also used : InstantiatedVersionedRemoteGroupPort(org.apache.nifi.registry.flow.mapping.InstantiatedVersionedRemoteGroupPort) RemoteGroupPort(org.apache.nifi.remote.RemoteGroupPort) RootGroupPort(org.apache.nifi.remote.RootGroupPort) Port(org.apache.nifi.connectable.Port) InstantiatedVersionedPort(org.apache.nifi.registry.flow.mapping.InstantiatedVersionedPort) ArrayList(java.util.ArrayList) PortStatusDTO(org.apache.nifi.web.api.dto.status.PortStatusDTO) RemoteProcessGroupStatusSnapshotEntity(org.apache.nifi.web.api.entity.RemoteProcessGroupStatusSnapshotEntity) ProcessGroupStatusSnapshotEntity(org.apache.nifi.web.api.entity.ProcessGroupStatusSnapshotEntity) PortStatusSnapshotEntity(org.apache.nifi.web.api.entity.PortStatusSnapshotEntity) ConnectionStatusSnapshotEntity(org.apache.nifi.web.api.entity.ConnectionStatusSnapshotEntity) ProcessorStatusDTO(org.apache.nifi.web.api.dto.status.ProcessorStatusDTO) ProcessorNode(org.apache.nifi.controller.ProcessorNode) PortStatus(org.apache.nifi.controller.status.PortStatus) ConnectionStatus(org.apache.nifi.controller.status.ConnectionStatus) NodeConnectionStatus(org.apache.nifi.cluster.coordination.node.NodeConnectionStatus) RemoteProcessGroupStatusDTO(org.apache.nifi.web.api.dto.status.RemoteProcessGroupStatusDTO) ProcessGroupStatus(org.apache.nifi.controller.status.ProcessGroupStatus) RemoteProcessGroupStatus(org.apache.nifi.controller.status.RemoteProcessGroupStatus) RemoteProcessGroup(org.apache.nifi.groups.RemoteProcessGroup) InstantiatedVersionedRemoteProcessGroup(org.apache.nifi.registry.flow.mapping.InstantiatedVersionedRemoteProcessGroup) ProcessGroupStatusDTO(org.apache.nifi.web.api.dto.status.ProcessGroupStatusDTO) RemoteProcessGroupStatusDTO(org.apache.nifi.web.api.dto.status.RemoteProcessGroupStatusDTO) Connection(org.apache.nifi.connectable.Connection) InstantiatedVersionedConnection(org.apache.nifi.registry.flow.mapping.InstantiatedVersionedConnection) RemoteProcessGroupStatusSnapshotDTO(org.apache.nifi.web.api.dto.status.RemoteProcessGroupStatusSnapshotDTO) ProcessGroupStatusSnapshotDTO(org.apache.nifi.web.api.dto.status.ProcessGroupStatusSnapshotDTO) RemoteProcessGroupStatus(org.apache.nifi.controller.status.RemoteProcessGroupStatus) ProcessorStatus(org.apache.nifi.controller.status.ProcessorStatus) ProcessorStatusSnapshotEntity(org.apache.nifi.web.api.entity.ProcessorStatusSnapshotEntity) ConnectionStatusDTO(org.apache.nifi.web.api.dto.status.ConnectionStatusDTO) RemoteProcessGroup(org.apache.nifi.groups.RemoteProcessGroup) ProcessGroup(org.apache.nifi.groups.ProcessGroup) InstantiatedVersionedProcessGroup(org.apache.nifi.registry.flow.mapping.InstantiatedVersionedProcessGroup) InstantiatedVersionedRemoteProcessGroup(org.apache.nifi.registry.flow.mapping.InstantiatedVersionedRemoteProcessGroup) RemoteProcessGroupStatusSnapshotEntity(org.apache.nifi.web.api.entity.RemoteProcessGroupStatusSnapshotEntity)

Aggregations

RemoteProcessGroupStatus (org.apache.nifi.controller.status.RemoteProcessGroupStatus)13 ProcessGroupStatus (org.apache.nifi.controller.status.ProcessGroupStatus)9 ConnectionStatus (org.apache.nifi.controller.status.ConnectionStatus)8 ProcessorStatus (org.apache.nifi.controller.status.ProcessorStatus)8 PortStatus (org.apache.nifi.controller.status.PortStatus)7 RemoteProcessGroup (org.apache.nifi.groups.RemoteProcessGroup)6 RemoteGroupPort (org.apache.nifi.remote.RemoteGroupPort)6 ArrayList (java.util.ArrayList)5 Port (org.apache.nifi.connectable.Port)5 ProcessGroup (org.apache.nifi.groups.ProcessGroup)5 RootGroupPort (org.apache.nifi.remote.RootGroupPort)5 Collection (java.util.Collection)3 Collator (java.text.Collator)2 NumberFormat (java.text.NumberFormat)2 Arrays (java.util.Arrays)2 Collections (java.util.Collections)2 Comparator (java.util.Comparator)2 Date (java.util.Date)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2