You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by mc...@apache.org on 2017/08/17 14:43:26 UTC
[9/9] nifi git commit: NIFI-4224: - Initial implementation of Process
Group level Variable Registry - Updated to incorporate PR Feedback - Changed
log message because slf4j-simple apparently has a memory leak;
passing a String instead of passing in the C
NIFI-4224:
- Initial implementation of Process Group level Variable Registry
- Updated to incorporate PR Feedback
- Changed log message because slf4j-simple apparently has a memory leak; passing a String instead of passing in the Controller Service object as an argument addresses this.
- This closes #2051
Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/5cd8e93b
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/5cd8e93b
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/5cd8e93b
Branch: refs/heads/master
Commit: 5cd8e93beb30075ebe8623c2a278a5c9cf1afc75
Parents: c1b99d5
Author: Mark Payne <ma...@hotmail.com>
Authored: Tue Jul 25 13:46:10 2017 -0400
Committer: Matt Gilman <ma...@gmail.com>
Committed: Thu Aug 17 10:42:29 2017 -0400
----------------------------------------------------------------------
.../registry/ComponentVariableRegistry.java | 24 +
.../nifi/registry/VariableDescriptor.java | 77 +-
.../expression/language/EmptyPreparedQuery.java | 6 +
.../language/InvalidPreparedQuery.java | 6 +
.../language/NamedVariableImpact.java | 34 +
.../language/NoVariablesImpacted.java | 25 +
.../expression/language/PreparedQuery.java | 10 +
.../attribute/expression/language/Query.java | 1082 +----------------
.../language/StandardPreparedQuery.java | 85 +-
.../expression/language/ValueLookup.java | 1 +
.../expression/language/VariableImpact.java | 26 +
.../language/compile/CompiledExpression.java | 53 +
.../language/compile/ExpressionCompiler.java | 1122 ++++++++++++++++++
.../functions/AttributeEvaluator.java | 45 -
.../selection/AllAttributesEvaluator.java | 4 +
.../selection/AnyAttributeEvaluator.java | 4 +
.../selection/AttributeEvaluator.java | 49 +
.../evaluation/selection/MappingEvaluator.java | 4 +
.../selection/MultiNamedAttributeEvaluator.java | 4 +
.../expression/language/TestQuery.java | 44 +-
.../language/TestStandardPreparedQuery.java | 41 +
.../expression/language/TestValueLookup.java | 4 +-
.../nifi/web/api/dto/AffectedComponentDTO.java | 59 +
.../nifi/web/api/dto/ProcessGroupDTO.java | 16 +
.../apache/nifi/web/api/dto/VariableDTO.java | 69 ++
.../nifi/web/api/dto/VariableRegistryDTO.java | 50 +
.../dto/VariableRegistryUpdateRequestDTO.java | 115 ++
.../api/dto/VariableRegistryUpdateStepDTO.java | 59 +
.../ActivateControllerServicesEntity.java | 66 ++
.../api/entity/ScheduleComponentsEntity.java | 12 +-
.../nifi/web/api/entity/VariableEntity.java | 51 +
.../web/api/entity/VariableRegistryEntity.java | 50 +
.../VariableRegistryUpdateRequestEntity.java | 49 +
.../http/StandardHttpResponseMapper.java | 19 +-
.../controller/AbstractConfiguredComponent.java | 42 +-
.../nifi/controller/ConfiguredComponent.java | 7 +
.../nifi/controller/ProcessScheduler.java | 9 +-
.../apache/nifi/controller/ProcessorNode.java | 19 +-
.../service/ControllerServiceNode.java | 2 +-
.../service/ControllerServiceProvider.java | 6 +-
.../service/ControllerServiceReference.java | 10 +
.../org/apache/nifi/groups/ProcessGroup.java | 51 +-
.../apache/nifi/controller/FlowController.java | 46 +-
.../controller/StandardFlowSynchronizer.java | 70 +-
.../nifi/controller/StandardProcessorNode.java | 77 +-
.../reporting/AbstractReportingTaskNode.java | 22 +-
.../reporting/StandardReportingTaskNode.java | 8 +-
.../scheduling/EventDrivenSchedulingAgent.java | 9 +-
.../scheduling/QuartzSchedulingAgent.java | 8 +-
.../scheduling/StandardProcessScheduler.java | 42 +-
.../scheduling/TimerDrivenSchedulingAgent.java | 6 +-
.../serialization/FlowFromDOMFactory.java | 10 +
.../serialization/StandardFlowSerializer.java | 16 +-
.../service/ServiceStateTransition.java | 68 ++
.../service/StandardControllerServiceNode.java | 71 +-
.../StandardControllerServiceProvider.java | 76 +-
.../StandardControllerServiceReference.java | 33 +
.../nifi/fingerprint/FingerprintFactory.java | 69 +-
.../nifi/groups/StandardProcessGroup.java | 189 ++-
.../nifi/processor/StandardProcessContext.java | 12 +-
.../processor/StandardValidationContext.java | 7 +-
.../variable/FileBasedVariableRegistry.java | 89 ++
.../variable/MutableVariableRegistry.java | 52 +
.../StandardComponentVariableRegistry.java | 94 ++
.../nifi/util/FileBasedVariableRegistry.java | 88 --
.../src/main/resources/FlowConfiguration.xsd | 6 +
.../src/main/resources/nifi-context.xml | 2 +-
.../controller/StandardFlowServiceTest.java | 2 +-
.../nifi/controller/TestFlowController.java | 2 +-
.../controller/TestStandardProcessorNode.java | 48 +-
.../reporting/TestStandardReportingContext.java | 20 +-
.../scheduling/TestProcessorLifecycle.java | 2 +-
.../TestStandardProcessScheduler.java | 10 +-
.../StandardFlowSerializerTest.java | 2 +-
.../StandardControllerServiceProviderTest.java | 2 +-
.../TestStandardControllerServiceProvider.java | 41 +-
.../service/mock/MockProcessGroup.java | 32 +-
.../util/TestFileBasedVariableRegistry.java | 1 +
.../apache/nifi/audit/ProcessGroupAuditor.java | 63 +-
.../variable/VariableRegistryUpdateRequest.java | 109 ++
.../variable/VariableRegistryUpdateStep.java | 48 +
.../org/apache/nifi/web/NiFiServiceFacade.java | 126 +-
.../apache/nifi/web/NiFiServiceFacadeLock.java | 12 +
.../nifi/web/StandardNiFiServiceFacade.java | 257 +++-
.../nifi/web/api/ApplicationResource.java | 52 +-
.../org/apache/nifi/web/api/FlowResource.java | 149 ++-
.../nifi/web/api/ProcessGroupResource.java | 1034 +++++++++++++++-
.../org/apache/nifi/web/api/dto/DtoFactory.java | 217 +++-
.../apache/nifi/web/api/dto/EntityFactory.java | 13 +
.../nifi/web/dao/ControllerServiceDAO.java | 2 +-
.../apache/nifi/web/dao/ProcessGroupDAO.java | 44 +-
.../dao/impl/StandardControllerServiceDAO.java | 9 +-
.../web/dao/impl/StandardProcessGroupDAO.java | 80 +-
.../java/org/apache/nifi/web/util/Pause.java | 30 +
.../src/main/resources/nifi-web-api-context.xml | 1 +
95 files changed, 5258 insertions(+), 1831 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/nifi/blob/5cd8e93b/nifi-api/src/main/java/org/apache/nifi/registry/ComponentVariableRegistry.java
----------------------------------------------------------------------
diff --git a/nifi-api/src/main/java/org/apache/nifi/registry/ComponentVariableRegistry.java b/nifi-api/src/main/java/org/apache/nifi/registry/ComponentVariableRegistry.java
new file mode 100644
index 0000000..7284b77
--- /dev/null
+++ b/nifi-api/src/main/java/org/apache/nifi/registry/ComponentVariableRegistry.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.registry;
+
+public interface ComponentVariableRegistry extends VariableRegistry {
+ VariableRegistry getParent();
+
+ void setParent(VariableRegistry parentRegistry);
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/5cd8e93b/nifi-api/src/main/java/org/apache/nifi/registry/VariableDescriptor.java
----------------------------------------------------------------------
diff --git a/nifi-api/src/main/java/org/apache/nifi/registry/VariableDescriptor.java b/nifi-api/src/main/java/org/apache/nifi/registry/VariableDescriptor.java
index 5b1e88f..f9e9ce2 100644
--- a/nifi-api/src/main/java/org/apache/nifi/registry/VariableDescriptor.java
+++ b/nifi-api/src/main/java/org/apache/nifi/registry/VariableDescriptor.java
@@ -66,6 +66,44 @@ public final class VariableDescriptor implements Comparable<VariableDescriptor>
return getName().compareTo(o.getName());
}
+ public String getName() {
+ return name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public boolean isSensitive() {
+ return sensitive;
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (other == null) {
+ return false;
+ }
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof VariableDescriptor)) {
+ return false;
+ }
+
+ final VariableDescriptor desc = (VariableDescriptor) other;
+ return this.name.equals(desc.name);
+ }
+
+ @Override
+ public int hashCode() {
+ return 797 + this.name.hashCode() * 97;
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[" + name + "]";
+ }
+
public static final class Builder {
private String name = null;
@@ -112,43 +150,4 @@ public final class VariableDescriptor implements Comparable<VariableDescriptor>
return new VariableDescriptor(this);
}
}
-
- public String getName() {
- return name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public boolean isSensitive() {
- return sensitive;
- }
-
- @Override
- public boolean equals(final Object other) {
- if (other == null) {
- return false;
- }
- if (!(other instanceof VariableDescriptor)) {
- return false;
- }
- if (this == other) {
- return true;
- }
-
- final VariableDescriptor desc = (VariableDescriptor) other;
- return this.name.equals(desc.name);
- }
-
- @Override
- public int hashCode() {
- return 797 + this.name.hashCode() * 97;
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[" + name + "]";
- }
-
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/5cd8e93b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/EmptyPreparedQuery.java
----------------------------------------------------------------------
diff --git a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/EmptyPreparedQuery.java b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/EmptyPreparedQuery.java
index a435b08..e9ac03b 100644
--- a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/EmptyPreparedQuery.java
+++ b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/EmptyPreparedQuery.java
@@ -18,6 +18,7 @@ package org.apache.nifi.attribute.expression.language;
import java.util.Map;
+
import org.apache.nifi.expression.AttributeValueDecorator;
import org.apache.nifi.processor.exception.ProcessException;
@@ -43,4 +44,9 @@ public class EmptyPreparedQuery implements PreparedQuery {
public boolean isExpressionLanguagePresent() {
return false;
}
+
+ @Override
+ public VariableImpact getVariableImpact() {
+ return VariableImpact.NEVER_IMPACTED;
+ }
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/5cd8e93b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/InvalidPreparedQuery.java
----------------------------------------------------------------------
diff --git a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/InvalidPreparedQuery.java b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/InvalidPreparedQuery.java
index ce0dec3..8ef996b 100644
--- a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/InvalidPreparedQuery.java
+++ b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/InvalidPreparedQuery.java
@@ -18,6 +18,7 @@ package org.apache.nifi.attribute.expression.language;
import java.util.Map;
+
import org.apache.nifi.attribute.expression.language.exception.AttributeExpressionLanguageException;
import org.apache.nifi.expression.AttributeValueDecorator;
import org.apache.nifi.processor.exception.ProcessException;
@@ -52,4 +53,9 @@ public class InvalidPreparedQuery implements PreparedQuery {
public boolean isExpressionLanguagePresent() {
return false;
}
+
+ @Override
+ public VariableImpact getVariableImpact() {
+ return VariableImpact.NEVER_IMPACTED;
+ }
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/5cd8e93b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/NamedVariableImpact.java
----------------------------------------------------------------------
diff --git a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/NamedVariableImpact.java b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/NamedVariableImpact.java
new file mode 100644
index 0000000..730c6ec
--- /dev/null
+++ b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/NamedVariableImpact.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.attribute.expression.language;
+
+import java.util.Set;
+
+public class NamedVariableImpact implements VariableImpact {
+ private final Set<String> impactedVariableNames;
+
+ public NamedVariableImpact(final Set<String> impactedVariableNames) {
+ this.impactedVariableNames = impactedVariableNames;
+ }
+
+ @Override
+ public boolean isImpacted(final String variableName) {
+ return impactedVariableNames.contains(variableName);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/5cd8e93b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/NoVariablesImpacted.java
----------------------------------------------------------------------
diff --git a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/NoVariablesImpacted.java b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/NoVariablesImpacted.java
new file mode 100644
index 0000000..669a532
--- /dev/null
+++ b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/NoVariablesImpacted.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.attribute.expression.language;
+
+public class NoVariablesImpacted implements VariableImpact {
+ @Override
+ public boolean isImpacted(final String variableName) {
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/5cd8e93b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/PreparedQuery.java
----------------------------------------------------------------------
diff --git a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/PreparedQuery.java b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/PreparedQuery.java
index 5552cac..c51656d 100644
--- a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/PreparedQuery.java
+++ b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/PreparedQuery.java
@@ -18,6 +18,7 @@ package org.apache.nifi.attribute.expression.language;
import java.util.Map;
+
import org.apache.nifi.expression.AttributeValueDecorator;
import org.apache.nifi.processor.exception.ProcessException;
@@ -28,4 +29,13 @@ public interface PreparedQuery {
String evaluateExpressions(final Map<String, String> valueLookup, final AttributeValueDecorator decorator, final Map<String, String> stateVariables) throws ProcessException;
boolean isExpressionLanguagePresent();
+
+ /**
+ * Returns a {@link VariableImpact} that can be used to determine whether or not a given
+ * variable impacts this Expression.
+ *
+ * @return a {@link VariableImpact} that can be used to determine whether or not a given
+ * variable impacts this Expression.
+ */
+ VariableImpact getVariableImpact();
}