Java Code Examples for org.apache.nifi.controller.ReportingTaskNode#verifyCanDelete()

The following examples show how to use org.apache.nifi.controller.ReportingTaskNode#verifyCanDelete() . 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: StandardFlowManager.java    From nifi with Apache License 2.0 5 votes vote down vote up
@Override
public void removeReportingTask(final ReportingTaskNode reportingTaskNode) {
    final ReportingTaskNode existing = allReportingTasks.get(reportingTaskNode.getIdentifier());
    if (existing == null || existing != reportingTaskNode) {
        throw new IllegalStateException("Reporting Task " + reportingTaskNode + " does not exist in this Flow");
    }

    reportingTaskNode.verifyCanDelete();

    final Class<?> taskClass = reportingTaskNode.getReportingTask().getClass();
    try (final NarCloseable x = NarCloseable.withComponentNarLoader(flowController.getExtensionManager(), taskClass, reportingTaskNode.getReportingTask().getIdentifier())) {
        ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnRemoved.class, reportingTaskNode.getReportingTask(), reportingTaskNode.getConfigurationContext());
    }

    for (final Map.Entry<PropertyDescriptor, String> entry : reportingTaskNode.getEffectivePropertyValues().entrySet()) {
        final PropertyDescriptor descriptor = entry.getKey();
        if (descriptor.getControllerServiceDefinition() != null) {
            final String value = entry.getValue() == null ? descriptor.getDefaultValue() : entry.getValue();
            if (value != null) {
                final ControllerServiceNode serviceNode = flowController.getControllerServiceProvider().getControllerServiceNode(value);
                if (serviceNode != null) {
                    serviceNode.removeReference(reportingTaskNode, descriptor);
                }
            }
        }
    }

    allReportingTasks.remove(reportingTaskNode.getIdentifier());
    LogRepositoryFactory.removeRepository(reportingTaskNode.getIdentifier());
    processScheduler.onReportingTaskRemoved(reportingTaskNode);

    flowController.getExtensionManager().removeInstanceClassLoader(reportingTaskNode.getIdentifier());
}
 
Example 2
Source File: StandardFlowManager.java    From nifi with Apache License 2.0 5 votes vote down vote up
private void verifyCanPurge() {
    for (final ControllerServiceNode serviceNode : getAllControllerServices()) {
        serviceNode.verifyCanDelete();
    }

    for (final ReportingTaskNode reportingTask : getAllReportingTasks()) {
        reportingTask.verifyCanDelete();
    }

    final ProcessGroup rootGroup = getRootGroup();
    rootGroup.verifyCanDelete(true, true);
}
 
Example 3
Source File: StandardReportingTaskDAO.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
@Override
public void verifyDelete(final String reportingTaskId) {
    final ReportingTaskNode reportingTask = locateReportingTask(reportingTaskId);
    reportingTask.verifyCanDelete();
}
 
Example 4
Source File: StandardReportingTaskDAO.java    From nifi with Apache License 2.0 4 votes vote down vote up
@Override
public void verifyDelete(final String reportingTaskId) {
    final ReportingTaskNode reportingTask = locateReportingTask(reportingTaskId);
    reportingTask.verifyCanDelete();
}