You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by pv...@apache.org on 2016/06/20 11:42:28 UTC
nifi git commit: NIFI-2009 port for 0.x
Repository: nifi
Updated Branches:
refs/heads/0.x a6e97740c -> 60e572a6b
NIFI-2009 port for 0.x
This closes #545.
Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/60e572a6
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/60e572a6
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/60e572a6
Branch: refs/heads/0.x
Commit: 60e572a6b724778b77f08d023702d53f4b4eb8dc
Parents: a6e9774
Author: Oleg Zhurakousky <ol...@suitcase.io>
Authored: Tue Jun 14 10:31:05 2016 -0400
Committer: Pierre Villard <pi...@gmail.com>
Committed: Mon Jun 20 13:38:31 2016 +0200
----------------------------------------------------------------------
.../controller/AbstractConfiguredComponent.java | 4 +++
.../nifi/controller/StandardProcessorNode.java | 31 ++++++--------------
2 files changed, 13 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/nifi/blob/60e572a6/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractConfiguredComponent.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractConfiguredComponent.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractConfiguredComponent.java
index 65e59ee..34b55e9 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractConfiguredComponent.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractConfiguredComponent.java
@@ -303,4 +303,8 @@ public abstract class AbstractConfiguredComponent implements ConfigurableCompone
ControllerServiceProvider getControllerServiceProvider() {
return this.serviceProvider;
}
+
+ protected ValidationContextFactory getValidationContextFactory() {
+ return this.validationContextFactory;
+ }
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/60e572a6/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java
index b544f38..5b45d2a 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java
@@ -78,6 +78,7 @@ import org.apache.nifi.util.ReflectionUtils;
import org.quartz.CronExpression;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.util.Assert;
/**
* ProcessorNode provides thread-safe access to a FlowFileProcessor as it exists
@@ -106,11 +107,7 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable
private final AtomicBoolean lossTolerant;
private final AtomicReference<String> comments;
private final AtomicReference<Position> position;
- private final AtomicReference<String> annotationData;
- private final AtomicReference<String> schedulingPeriod; // stored as string
- // so it's presented
- // to user as they
- // entered it
+ private final AtomicReference<String> schedulingPeriod; // stored as string so it's presented to user as they entered it
private final AtomicReference<String> yieldPeriod;
private final AtomicReference<String> penalizationPeriod;
private final AtomicReference<Map<String, String>> style;
@@ -124,7 +121,6 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable
private final boolean eventDrivenSupported;
private final boolean batchSupported;
private final Requirement inputRequirement;
- private final ValidationContextFactory validationContextFactory;
private final ProcessScheduler processScheduler;
private long runNanos = 0L;
@@ -155,7 +151,6 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable
style = new AtomicReference<>(Collections.unmodifiableMap(new HashMap<String, String>()));
this.processGroup = new AtomicReference<>();
processScheduler = scheduler;
- annotationData = new AtomicReference<>();
isolated = new AtomicBoolean(false);
penalizationPeriod = new AtomicReference<>(DEFAULT_PENALIZATION_PERIOD);
@@ -171,7 +166,6 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable
triggerWhenAnyDestinationAvailable = procClass.isAnnotationPresent(TriggerWhenAnyDestinationAvailable.class)
|| procClass.isAnnotationPresent(
org.apache.nifi.processor.annotation.TriggerWhenAnyDestinationAvailable.class);
- this.validationContextFactory = validationContextFactory;
eventDrivenSupported = (procClass.isAnnotationPresent(EventDriven.class)
|| procClass.isAnnotationPresent(org.apache.nifi.processor.annotation.EventDriven.class))
&& !triggeredSerially && !triggerWhenEmpty;
@@ -904,9 +898,9 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable
@Override
public boolean isValid() {
try {
- final ValidationContext validationContext = validationContextFactory.newValidationContext(getProperties(),
- getAnnotationData());
+ final ValidationContext validationContext = this.getValidationContextFactory()
+ .newValidationContext(getProperties(), getAnnotationData());
final Collection<ValidationResult> validationResults;
try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
validationResults = getProcessor().validate(validationContext);
@@ -951,8 +945,9 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable
public Collection<ValidationResult> getValidationErrors() {
final List<ValidationResult> results = new ArrayList<>();
try {
- final ValidationContext validationContext = validationContextFactory.newValidationContext(getProperties(),
- getAnnotationData());
+
+ final ValidationContext validationContext = this.getValidationContextFactory()
+ .newValidationContext(getProperties(), getAnnotationData());
final Collection<ValidationResult> validationResults;
try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
@@ -1067,16 +1062,8 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable
@Override
public void setAnnotationData(final String data) {
- if (isRunning()) {
- throw new IllegalStateException("Cannot set AnnotationData while processor is running");
- }
-
- this.annotationData.set(data);
- }
-
- @Override
- public String getAnnotationData() {
- return annotationData.get();
+ Assert.state(!isRunning(), "Cannot set AnnotationData while processor is running");
+ super.setAnnotationData(data);
}
@Override