From 738236a41dc9f0f5f2c50dc425aa12948275aad6 Mon Sep 17 00:00:00 2001 From: Richard Miskin Date: Sat, 27 Feb 2016 15:18:22 +0000 Subject: [PATCH] NIFI-1573 Allow programmatic access to a Processor's name --- .../main/java/org/apache/nifi/processor/ProcessContext.java | 5 +++++ .../main/java/org/apache/nifi/util/MockProcessContext.java | 5 +++++ .../apache/nifi/documentation/mock/MockProcessContext.java | 5 +++++ .../controller/scheduling/ConnectableProcessContext.java | 5 +++++ .../org/apache/nifi/processor/StandardProcessContext.java | 5 +++++ .../org/apache/nifi/processor/StandardSchedulingContext.java | 5 +++++ 6 files changed, 30 insertions(+) diff --git a/nifi-api/src/main/java/org/apache/nifi/processor/ProcessContext.java b/nifi-api/src/main/java/org/apache/nifi/processor/ProcessContext.java index 91ea1a2c34..c112e8a697 100644 --- a/nifi-api/src/main/java/org/apache/nifi/processor/ProcessContext.java +++ b/nifi-api/src/main/java/org/apache/nifi/processor/ProcessContext.java @@ -160,4 +160,9 @@ public interface ProcessContext { * @return the StateManager that can be used to store and retrieve state for this component */ StateManager getStateManager(); + + /** + * @return the configured name of this processor + */ + String getName(); } diff --git a/nifi-mock/src/main/java/org/apache/nifi/util/MockProcessContext.java b/nifi-mock/src/main/java/org/apache/nifi/util/MockProcessContext.java index 02a1d8aa42..01b415f7c0 100644 --- a/nifi-mock/src/main/java/org/apache/nifi/util/MockProcessContext.java +++ b/nifi-mock/src/main/java/org/apache/nifi/util/MockProcessContext.java @@ -355,4 +355,9 @@ public class MockProcessContext extends MockControllerServiceLookup implements S public StateManager getStateManager() { return stateManager; } + + @Override + public String getName() { + return ""; + } } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessContext.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessContext.java index 1acdd49c18..22e972775a 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessContext.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessContext.java @@ -108,4 +108,9 @@ public class MockProcessContext implements ProcessContext { public StateManager getStateManager() { return null; } + + @Override + public String getName() { + return null; + } } \ No newline at end of file diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/ConnectableProcessContext.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/ConnectableProcessContext.java index 5e26c091fc..169cdee0a9 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/ConnectableProcessContext.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/ConnectableProcessContext.java @@ -243,4 +243,9 @@ public class ConnectableProcessContext implements ProcessContext { public StateManager getStateManager() { return stateManager; } + + @Override + public String getName() { + return connectable.getName(); + } } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/processor/StandardProcessContext.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/processor/StandardProcessContext.java index 5bb1a86bee..dae7d0ca02 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/processor/StandardProcessContext.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/processor/StandardProcessContext.java @@ -216,4 +216,9 @@ public class StandardProcessContext implements ProcessContext, ControllerService public StateManager getStateManager() { return stateManager; } + + @Override + public String getName() { + return procNode.getName(); + } } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/processor/StandardSchedulingContext.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/processor/StandardSchedulingContext.java index 4985fe6707..3ba71ad396 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/processor/StandardSchedulingContext.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/processor/StandardSchedulingContext.java @@ -147,4 +147,9 @@ public class StandardSchedulingContext implements SchedulingContext { public StateManager getStateManager() { return stateManager; } + + @Override + public String getName() { + return processorNode.getName(); + } }