Search in sources :

Example 21 with BundleDTO

use of org.apache.nifi.web.api.dto.BundleDTO in project nifi by apache.

the class StandardReportingTaskDAO method updateBundle.

private void updateBundle(ReportingTaskNode reportingTask, ReportingTaskDTO reportingTaskDTO) {
    final BundleDTO bundleDTO = reportingTaskDTO.getBundle();
    if (bundleDTO != null) {
        final BundleCoordinate incomingCoordinate = BundleUtils.getBundle(reportingTask.getCanonicalClassName(), bundleDTO);
        final BundleCoordinate existingCoordinate = reportingTask.getBundleCoordinate();
        if (!existingCoordinate.getCoordinate().equals(incomingCoordinate.getCoordinate())) {
            try {
                // we need to use the property descriptors from the temp component here in case we are changing from a ghost component to a real component
                final ConfigurableComponent tempComponent = ExtensionManager.getTempComponent(reportingTask.getCanonicalClassName(), incomingCoordinate);
                final Set<URL> additionalUrls = reportingTask.getAdditionalClasspathResources(tempComponent.getPropertyDescriptors());
                reloadComponent.reload(reportingTask, reportingTask.getCanonicalClassName(), incomingCoordinate, additionalUrls);
            } catch (ReportingTaskInstantiationException e) {
                throw new NiFiCoreException(String.format("Unable to update reporting task %s from %s to %s due to: %s", reportingTaskDTO.getId(), reportingTask.getBundleCoordinate().getCoordinate(), incomingCoordinate.getCoordinate(), e.getMessage()), e);
            }
        }
    }
}
Also used : NiFiCoreException(org.apache.nifi.web.NiFiCoreException) ReportingTaskInstantiationException(org.apache.nifi.controller.reporting.ReportingTaskInstantiationException) ConfigurableComponent(org.apache.nifi.components.ConfigurableComponent) BundleDTO(org.apache.nifi.web.api.dto.BundleDTO) BundleCoordinate(org.apache.nifi.bundle.BundleCoordinate) URL(java.net.URL)

Aggregations

BundleDTO (org.apache.nifi.web.api.dto.BundleDTO)21 BundleCoordinate (org.apache.nifi.bundle.BundleCoordinate)16 ConfigurableComponent (org.apache.nifi.components.ConfigurableComponent)4 ProcessorConfigDTO (org.apache.nifi.web.api.dto.ProcessorConfigDTO)4 URL (java.net.URL)3 Stateful (org.apache.nifi.annotation.behavior.Stateful)3 ValidationException (org.apache.nifi.controller.exception.ValidationException)3 ReportingTaskInstantiationException (org.apache.nifi.controller.reporting.ReportingTaskInstantiationException)3 UiExtension (org.apache.nifi.ui.extension.UiExtension)3 UiExtensionMapping (org.apache.nifi.ui.extension.UiExtensionMapping)3 NiFiCoreException (org.apache.nifi.web.NiFiCoreException)3 PositionDTO (org.apache.nifi.web.api.dto.PositionDTO)3 ProcessorDTO (org.apache.nifi.web.api.dto.ProcessorDTO)3 Element (org.w3c.dom.Element)3 ScheduledState (org.apache.nifi.controller.ScheduledState)2 ProcessorInstantiationException (org.apache.nifi.controller.exception.ProcessorInstantiationException)2 ControllerServiceNode (org.apache.nifi.controller.service.ControllerServiceNode)2 DummyProcessor (org.apache.nifi.controller.service.mock.DummyProcessor)2 ControllerServiceDTO (org.apache.nifi.web.api.dto.ControllerServiceDTO)2 FlowSnippetDTO (org.apache.nifi.web.api.dto.FlowSnippetDTO)2