Java Code Examples for org.apache.nifi.controller.ProcessorNode#getIdentifier()

The following examples show how to use org.apache.nifi.controller.ProcessorNode#getIdentifier() . 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: StandardProcessGroup.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
@Override
public void stopProcessor(final ProcessorNode processor) {
    readLock.lock();
    try {
        if (!processors.containsKey(processor.getIdentifier())) {
            throw new IllegalStateException("No processor with ID " + processor.getIdentifier() + " belongs to this Process Group");
        }

        final ScheduledState state = processor.getScheduledState();
        if (state == ScheduledState.DISABLED) {
            throw new IllegalStateException("Processor is disabled");
        } else if (state == ScheduledState.STOPPED) {
            return;
        }

        scheduler.stopProcessor(processor);
    } finally {
        readLock.unlock();
    }
}
 
Example 2
Source File: StandardProcessGroup.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
@Override
public void enableProcessor(final ProcessorNode processor) {
    readLock.lock();
    try {
        if (!processors.containsKey(processor.getIdentifier())) {
            throw new IllegalStateException("No Processor with ID " + processor.getIdentifier() + " belongs to this Process Group");
        }

        final ScheduledState state = processor.getScheduledState();
        if (state == ScheduledState.STOPPED) {
            return;
        } else if (state == ScheduledState.RUNNING) {
            throw new IllegalStateException("Processor is currently running");
        }

        scheduler.enableProcessor(processor);
    } finally {
        readLock.unlock();
    }
}
 
Example 3
Source File: StandardProcessGroup.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
@Override
public void disableProcessor(final ProcessorNode processor) {
    readLock.lock();
    try {
        if (!processors.containsKey(processor.getIdentifier())) {
            throw new IllegalStateException("No Processor with ID " + processor.getIdentifier() + " belongs to this Process Group");
        }

        final ScheduledState state = processor.getScheduledState();
        if (state == ScheduledState.DISABLED) {
            return;
        } else if (state == ScheduledState.RUNNING) {
            throw new IllegalStateException("Processor is currently running");
        }

        scheduler.disableProcessor(processor);
    } finally {
        readLock.unlock();
    }
}
 
Example 4
Source File: NiFiRegistryFlowMapper.java    From nifi with Apache License 2.0 5 votes vote down vote up
public VersionedProcessor mapProcessor(final ProcessorNode procNode, final ControllerServiceProvider serviceProvider, final Set<String> includedGroupIds,
                                       final Map<String, ExternalControllerServiceReference> externalControllerServiceReferences) {
    final VersionedProcessor processor = new InstantiatedVersionedProcessor(procNode.getIdentifier(), procNode.getProcessGroupIdentifier());
    processor.setIdentifier(getId(procNode.getVersionedComponentId(), procNode.getIdentifier()));
    processor.setGroupIdentifier(getGroupId(procNode.getProcessGroupIdentifier()));
    processor.setType(procNode.getCanonicalClassName());
    processor.setAnnotationData(procNode.getAnnotationData());
    processor.setAutoTerminatedRelationships(procNode.getAutoTerminatedRelationships().stream().map(Relationship::getName).collect(Collectors.toSet()));
    processor.setBulletinLevel(procNode.getBulletinLevel().name());
    processor.setBundle(mapBundle(procNode.getBundleCoordinate()));
    processor.setComments(procNode.getComments());
    processor.setConcurrentlySchedulableTaskCount(procNode.getMaxConcurrentTasks());
    processor.setExecutionNode(procNode.getExecutionNode().name());
    processor.setName(procNode.getName());
    processor.setPenaltyDuration(procNode.getPenalizationPeriod());
    processor.setPosition(mapPosition(procNode.getPosition()));
    processor.setProperties(mapProperties(procNode, serviceProvider));
    processor.setPropertyDescriptors(mapPropertyDescriptors(procNode, serviceProvider, includedGroupIds, externalControllerServiceReferences));
    processor.setRunDurationMillis(procNode.getRunDuration(TimeUnit.MILLISECONDS));
    processor.setSchedulingPeriod(procNode.getSchedulingPeriod());
    processor.setSchedulingStrategy(procNode.getSchedulingStrategy().name());
    processor.setStyle(procNode.getStyle());
    processor.setYieldDuration(procNode.getYieldPeriod());
    processor.setScheduledState(procNode.getScheduledState() == ScheduledState.DISABLED ? org.apache.nifi.registry.flow.ScheduledState.DISABLED
        : org.apache.nifi.registry.flow.ScheduledState.ENABLED);

    return processor;
}
 
Example 5
Source File: StandardFlowManager.java    From nifi with Apache License 2.0 4 votes vote down vote up
public void onProcessorRemoved(final ProcessorNode procNode) {
    String identifier = procNode.getIdentifier();
    flowFileEventRepository.purgeTransferEvents(identifier);
    allProcessors.remove(identifier);
}