nifi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scottyas...@apache.org
Subject nifi git commit: NIFI-4816: Allow name to be updated for ReportingTasks
Date Wed, 21 Feb 2018 14:43:40 GMT
Repository: nifi
Updated Branches:
  refs/heads/master 54b165970 -> b4b970b87


NIFI-4816: Allow name to be updated for ReportingTasks

This closes #2452

Signed-off-by: Scott Aslan <scottyaslan@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/b4b970b8
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/b4b970b8
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/b4b970b8

Branch: refs/heads/master
Commit: b4b970b8762262b51da6bb5fcfe56d026f17b2cb
Parents: 54b1659
Author: Matthew Burgess <mattyb149@apache.org>
Authored: Tue Feb 6 16:33:56 2018 -0500
Committer: Scott Aslan <scottyaslan@gmail.com>
Committed: Wed Feb 21 09:42:25 2018 -0500

----------------------------------------------------------------------
 .../org/apache/nifi/controller/ConfigurationContext.java |  6 ++++++
 .../org/apache/nifi/reporting/AbstractReportingTask.java | 11 +++++++++++
 .../org/apache/nifi/util/MockConfigurationContext.java   |  5 +++++
 .../controller/service/StandardConfigurationContext.java |  5 +++++
 .../org/apache/nifi/mock/MockConfigurationContext.java   |  5 +++++
 5 files changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/b4b970b8/nifi-api/src/main/java/org/apache/nifi/controller/ConfigurationContext.java
----------------------------------------------------------------------
diff --git a/nifi-api/src/main/java/org/apache/nifi/controller/ConfigurationContext.java b/nifi-api/src/main/java/org/apache/nifi/controller/ConfigurationContext.java
index e6b3cb2..c1316b5 100644
--- a/nifi-api/src/main/java/org/apache/nifi/controller/ConfigurationContext.java
+++ b/nifi-api/src/main/java/org/apache/nifi/controller/ConfigurationContext.java
@@ -52,4 +52,10 @@ public interface ConfigurationContext extends PropertyContext {
      *         period
      */
     Long getSchedulingPeriod(TimeUnit timeUnit);
+
+    /**
+     * Returns the component's (ControllerService, ReportingTask, e.g.) name
+     * @return the String name of this component
+     */
+    String getName();
 }

http://git-wip-us.apache.org/repos/asf/nifi/blob/b4b970b8/nifi-api/src/main/java/org/apache/nifi/reporting/AbstractReportingTask.java
----------------------------------------------------------------------
diff --git a/nifi-api/src/main/java/org/apache/nifi/reporting/AbstractReportingTask.java b/nifi-api/src/main/java/org/apache/nifi/reporting/AbstractReportingTask.java
index 93d23b2..339231a 100644
--- a/nifi-api/src/main/java/org/apache/nifi/reporting/AbstractReportingTask.java
+++ b/nifi-api/src/main/java/org/apache/nifi/reporting/AbstractReportingTask.java
@@ -18,7 +18,9 @@ package org.apache.nifi.reporting;
 
 import java.util.concurrent.TimeUnit;
 
+import org.apache.nifi.annotation.lifecycle.OnScheduled;
 import org.apache.nifi.components.AbstractConfigurableComponent;
+import org.apache.nifi.controller.ConfigurationContext;
 import org.apache.nifi.controller.ControllerServiceLookup;
 import org.apache.nifi.controller.NodeTypeProvider;
 import org.apache.nifi.logging.ComponentLog;
@@ -76,6 +78,15 @@ public abstract class AbstractReportingTask extends AbstractConfigurableComponen
     }
 
     /**
+     * Sets various component information using the given context
+     * @param context the context to use for this reporting task
+     */
+    @OnScheduled
+    public void setComponentInfo(ConfigurationContext context) {
+        this.name = context.getName();
+    }
+
+    /**
      * @param timeUnit of scheduling period
      * @return the amount of times that elapses between the moment that this
      * ReportingTask finishes its invocation of

http://git-wip-us.apache.org/repos/asf/nifi/blob/b4b970b8/nifi-mock/src/main/java/org/apache/nifi/util/MockConfigurationContext.java
----------------------------------------------------------------------
diff --git a/nifi-mock/src/main/java/org/apache/nifi/util/MockConfigurationContext.java b/nifi-mock/src/main/java/org/apache/nifi/util/MockConfigurationContext.java
index 91d805e..307f474 100644
--- a/nifi-mock/src/main/java/org/apache/nifi/util/MockConfigurationContext.java
+++ b/nifi-mock/src/main/java/org/apache/nifi/util/MockConfigurationContext.java
@@ -97,4 +97,9 @@ public class MockConfigurationContext implements ConfigurationContext {
     public Long getSchedulingPeriod(final TimeUnit timeUnit) {
         return 0L;
     }
+
+    @Override
+    public String getName() {
+        return null;
+    }
 }

http://git-wip-us.apache.org/repos/asf/nifi/blob/b4b970b8/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/service/StandardConfigurationContext.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/service/StandardConfigurationContext.java
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/service/StandardConfigurationContext.java
index c188d75..6e8ff6c 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/service/StandardConfigurationContext.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/service/StandardConfigurationContext.java
@@ -100,4 +100,9 @@ public class StandardConfigurationContext implements ConfigurationContext
{
     public Long getSchedulingPeriod(final TimeUnit timeUnit) {
         return schedulingNanos == null ? null : timeUnit.convert(schedulingNanos, TimeUnit.NANOSECONDS);
     }
+
+    @Override
+    public String getName() {
+        return component.getName();
+    }
 }

http://git-wip-us.apache.org/repos/asf/nifi/blob/b4b970b8/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/mock/MockConfigurationContext.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/mock/MockConfigurationContext.java
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/mock/MockConfigurationContext.java
index d9a1b37..4459d14 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/mock/MockConfigurationContext.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/mock/MockConfigurationContext.java
@@ -50,4 +50,9 @@ public class MockConfigurationContext implements ConfigurationContext {
     public Long getSchedulingPeriod(final TimeUnit timeUnit) {
         return 0L;
     }
+
+    @Override
+    public String getName() {
+        return null;
+    }
 }


Mime
View raw message