This commit is contained in:
Matt Gilman 2015-04-06 07:20:24 -04:00
commit e79db821b6
10 changed files with 23 additions and 22 deletions

View File

@ -130,7 +130,7 @@ import org.apache.nifi.controller.ReportingTaskNode;
import org.apache.nifi.controller.ScheduledState;
import org.apache.nifi.controller.StandardFlowSerializer;
import org.apache.nifi.controller.ValidationContextFactory;
import org.apache.nifi.controller.exception.ProcessorLifeCycleException;
import org.apache.nifi.controller.exception.ComponentLifeCycleException;
import org.apache.nifi.controller.reporting.ClusteredReportingTaskNode;
import org.apache.nifi.controller.reporting.ReportingTaskInstantiationException;
import org.apache.nifi.controller.reporting.ReportingTaskProvider;
@ -1070,7 +1070,7 @@ public class WebClusterManager implements HttpClusterManager, ProtocolHandler, C
try (final NarCloseable x = NarCloseable.withNarLoader()) {
ReflectionUtils.invokeMethodsWithAnnotation(OnAdded.class, task);
} catch (final Exception e) {
throw new ProcessorLifeCycleException("Failed to invoke On-Added Lifecycle methods of " + task, e);
throw new ComponentLifeCycleException("Failed to invoke On-Added Lifecycle methods of " + task, e);
}
}

View File

@ -16,15 +16,15 @@
*/
package org.apache.nifi.controller.exception;
public class ProcessorLifeCycleException extends RuntimeException {
public class ComponentLifeCycleException extends RuntimeException {
private static final long serialVersionUID = 8392341500511490941L;
public ProcessorLifeCycleException(final String message, final Throwable t) {
public ComponentLifeCycleException(final String message, final Throwable t) {
super(message, t);
}
public ProcessorLifeCycleException(final Throwable t) {
public ComponentLifeCycleException(final Throwable t) {
super(t);
}
}

View File

@ -75,7 +75,7 @@ import org.apache.nifi.connectable.Size;
import org.apache.nifi.connectable.StandardConnection;
import org.apache.nifi.controller.exception.CommunicationsException;
import org.apache.nifi.controller.exception.ProcessorInstantiationException;
import org.apache.nifi.controller.exception.ProcessorLifeCycleException;
import org.apache.nifi.controller.exception.ComponentLifeCycleException;
import org.apache.nifi.controller.label.Label;
import org.apache.nifi.controller.label.StandardLabel;
import org.apache.nifi.controller.reporting.ReportingTaskInstantiationException;
@ -830,7 +830,7 @@ public class FlowController implements EventAccess, ControllerServiceProvider, R
ReflectionUtils.invokeMethodsWithAnnotation(OnAdded.class, org.apache.nifi.processor.annotation.OnAdded.class, processor);
} catch (final Exception e) {
logRepository.removeObserver(StandardProcessorNode.BULLETIN_OBSERVER_ID);
throw new ProcessorLifeCycleException("Failed to invoke @OnAdded methods of " + procNode.getProcessor(), e);
throw new ComponentLifeCycleException("Failed to invoke @OnAdded methods of " + procNode.getProcessor(), e);
}
}
@ -2600,7 +2600,7 @@ public class FlowController implements EventAccess, ControllerServiceProvider, R
try (final NarCloseable x = NarCloseable.withNarLoader()) {
ReflectionUtils.invokeMethodsWithAnnotation(OnAdded.class, task);
} catch (final Exception e) {
throw new ProcessorLifeCycleException("Failed to invoke On-Added Lifecycle methods of " + task, e);
throw new ComponentLifeCycleException("Failed to invoke On-Added Lifecycle methods of " + task, e);
}
}

View File

@ -31,7 +31,7 @@ import org.apache.nifi.controller.ReportingTaskNode;
import org.apache.nifi.controller.ScheduledState;
import org.apache.nifi.controller.ValidationContextFactory;
import org.apache.nifi.controller.annotation.OnConfigured;
import org.apache.nifi.controller.exception.ProcessorLifeCycleException;
import org.apache.nifi.controller.exception.ComponentLifeCycleException;
import org.apache.nifi.controller.service.ControllerServiceNode;
import org.apache.nifi.controller.service.ControllerServiceProvider;
import org.apache.nifi.controller.service.StandardConfigurationContext;
@ -149,7 +149,7 @@ public abstract class AbstractReportingTaskNode extends AbstractConfiguredCompon
final ConfigurationContext configContext = new StandardConfigurationContext(this, serviceLookup);
ReflectionUtils.invokeMethodsWithAnnotation(OnConfigured.class, reportingTask, configContext);
} catch (final Exception e) {
throw new ProcessorLifeCycleException("Failed to invoke On-Configured Lifecycle methods of " + reportingTask, e);
throw new ComponentLifeCycleException("Failed to invoke On-Configured Lifecycle methods of " + reportingTask, e);
}
}

View File

@ -32,7 +32,7 @@ import org.apache.nifi.controller.ConfiguredComponent;
import org.apache.nifi.controller.ControllerService;
import org.apache.nifi.controller.ValidationContextFactory;
import org.apache.nifi.controller.annotation.OnConfigured;
import org.apache.nifi.controller.exception.ProcessorLifeCycleException;
import org.apache.nifi.controller.exception.ComponentLifeCycleException;
import org.apache.nifi.nar.NarCloseable;
import org.apache.nifi.util.ReflectionUtils;
@ -129,7 +129,7 @@ public class StandardControllerServiceNode extends AbstractConfiguredComponent i
final ConfigurationContext configContext = new StandardConfigurationContext(this, serviceProvider);
ReflectionUtils.invokeMethodsWithAnnotation(OnConfigured.class, implementation, configContext);
} catch (final Exception e) {
throw new ProcessorLifeCycleException("Failed to invoke On-Configured Lifecycle methods of " + implementation, e);
throw new ComponentLifeCycleException("Failed to invoke On-Configured Lifecycle methods of " + implementation, e);
}
}

View File

@ -47,7 +47,7 @@ import org.apache.nifi.controller.ReportingTaskNode;
import org.apache.nifi.controller.ScheduledState;
import org.apache.nifi.controller.ValidationContextFactory;
import org.apache.nifi.controller.exception.ControllerServiceInstantiationException;
import org.apache.nifi.controller.exception.ProcessorLifeCycleException;
import org.apache.nifi.controller.exception.ComponentLifeCycleException;
import org.apache.nifi.events.BulletinFactory;
import org.apache.nifi.logging.ComponentLog;
import org.apache.nifi.nar.ExtensionManager;
@ -186,7 +186,7 @@ public class StandardControllerServiceProvider implements ControllerServiceProvi
try (final NarCloseable x = NarCloseable.withNarLoader()) {
ReflectionUtils.invokeMethodsWithAnnotation(OnAdded.class, originalService);
} catch (final Exception e) {
throw new ProcessorLifeCycleException("Failed to invoke On-Added Lifecycle methods of " + originalService, e);
throw new ComponentLifeCycleException("Failed to invoke On-Added Lifecycle methods of " + originalService, e);
}
}

View File

@ -48,7 +48,7 @@ import org.apache.nifi.controller.ProcessScheduler;
import org.apache.nifi.controller.ProcessorNode;
import org.apache.nifi.controller.ScheduledState;
import org.apache.nifi.controller.Snippet;
import org.apache.nifi.controller.exception.ProcessorLifeCycleException;
import org.apache.nifi.controller.exception.ComponentLifeCycleException;
import org.apache.nifi.controller.label.Label;
import org.apache.nifi.controller.service.ControllerServiceNode;
import org.apache.nifi.controller.service.ControllerServiceProvider;
@ -674,7 +674,7 @@ public final class StandardProcessGroup implements ProcessGroup {
final StandardProcessContext processContext = new StandardProcessContext(processor, controllerServiceProvider, encryptor);
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnRemoved.class, org.apache.nifi.processor.annotation.OnRemoved.class, processor.getProcessor(), processContext);
} catch (final Exception e) {
throw new ProcessorLifeCycleException("Failed to invoke 'OnRemoved' methods of " + processor, e);
throw new ComponentLifeCycleException("Failed to invoke 'OnRemoved' methods of " + processor, e);
}
for ( final Map.Entry<PropertyDescriptor, String> entry : processor.getProperties().entrySet() ) {

View File

@ -32,7 +32,7 @@ import org.apache.nifi.controller.FlowController;
import org.apache.nifi.controller.ProcessorNode;
import org.apache.nifi.controller.ScheduledState;
import org.apache.nifi.controller.exception.ProcessorInstantiationException;
import org.apache.nifi.controller.exception.ProcessorLifeCycleException;
import org.apache.nifi.controller.exception.ComponentLifeCycleException;
import org.apache.nifi.controller.exception.ValidationException;
import org.apache.nifi.groups.ProcessGroup;
import org.apache.nifi.logging.LogLevel;
@ -124,7 +124,7 @@ public class StandardProcessorDAO extends ComponentDAO implements ProcessorDAO {
return processor;
} catch (ProcessorInstantiationException pse) {
throw new NiFiCoreException(String.format("Unable to create processor of type %s due to: %s", processorDTO.getType(), pse.getMessage()), pse);
} catch (IllegalStateException | ProcessorLifeCycleException ise) {
} catch (IllegalStateException | ComponentLifeCycleException ise) {
throw new NiFiCoreException(ise.getMessage(), ise);
}
}
@ -460,7 +460,7 @@ public class StandardProcessorDAO extends ComponentDAO implements ProcessorDAO {
parentGroup.disableProcessor(processor);
break;
}
} catch (IllegalStateException | ProcessorLifeCycleException ise) {
} catch (IllegalStateException | ComponentLifeCycleException ise) {
throw new NiFiCoreException(ise.getMessage(), ise);
} catch (RejectedExecutionException ree) {
throw new NiFiCoreException("Unable to schedule all tasks for the specified processor.", ree);
@ -496,7 +496,7 @@ public class StandardProcessorDAO extends ComponentDAO implements ProcessorDAO {
try {
// attempt remove the processor
group.removeProcessor(processor);
} catch (ProcessorLifeCycleException plce) {
} catch (ComponentLifeCycleException plce) {
throw new NiFiCoreException(plce.getMessage(), plce);
}
}

View File

@ -26,7 +26,7 @@ import java.util.regex.Matcher;
import org.apache.commons.lang3.StringUtils;
import org.apache.nifi.controller.ReportingTaskNode;
import org.apache.nifi.controller.ScheduledState;
import org.apache.nifi.controller.exception.ProcessorLifeCycleException;
import org.apache.nifi.controller.exception.ComponentLifeCycleException;
import org.apache.nifi.controller.exception.ValidationException;
import org.apache.nifi.controller.reporting.ReportingTaskInstantiationException;
@ -166,7 +166,7 @@ public class StandardReportingTaskDAO extends ComponentDAO implements ReportingT
reportingTaskProvider.disableReportingTask(reportingTask);
break;
}
} catch (IllegalStateException | ProcessorLifeCycleException ise) {
} catch (IllegalStateException | ComponentLifeCycleException ise) {
throw new NiFiCoreException(ise.getMessage(), ise);
} catch (RejectedExecutionException ree) {
throw new NiFiCoreException("Unable to schedule all tasks for the specified reporting task.", ree);

View File

@ -269,6 +269,7 @@ public class EvaluateJsonPath extends AbstractJsonPathProcessor {
switch (destination) {
case DESTINATION_ATTRIBUTE:
jsonPathResults.put(jsonPathAttrKey, resultRepresentation);
break;
case DESTINATION_CONTENT:
flowFile = processSession.write(flowFile, new OutputStreamCallback() {
@Override