You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ma...@apache.org on 2015/01/19 02:26:22 UTC

[6/6] incubator-nifi git commit: NIFI-4: Updates to provide proper lifecycle support via annotations for controller services and reporting tasks

NIFI-4: Updates to provide proper lifecycle support via annotations for controller services and reporting tasks


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

Branch: refs/heads/annotations
Commit: 850396cc979173e2f20ab08004f1983024d66b00
Parents: d8e1f57
Author: Mark Payne <ma...@hotmail.com>
Authored: Sun Jan 18 20:25:32 2015 -0500
Committer: Mark Payne <ma...@hotmail.com>
Committed: Sun Jan 18 20:25:32 2015 -0500

----------------------------------------------------------------------
 .../org/apache/nifi/controller/ReportingTaskNode.java   |  4 ++++
 .../nifi/controller/service/ControllerServiceNode.java  |  2 ++
 .../java/org/apache/nifi/controller/FlowController.java | 12 ++++++++++++
 .../controller/reporting/AbstractReportingTaskNode.java |  1 +
 .../service/StandardControllerServiceProvider.java      |  1 -
 5 files changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/850396cc/nifi/nar-bundles/framework-bundle/framework/core-api/src/main/java/org/apache/nifi/controller/ReportingTaskNode.java
----------------------------------------------------------------------
diff --git a/nifi/nar-bundles/framework-bundle/framework/core-api/src/main/java/org/apache/nifi/controller/ReportingTaskNode.java b/nifi/nar-bundles/framework-bundle/framework/core-api/src/main/java/org/apache/nifi/controller/ReportingTaskNode.java
index f456ddd..0db49bd 100644
--- a/nifi/nar-bundles/framework-bundle/framework/core-api/src/main/java/org/apache/nifi/controller/ReportingTaskNode.java
+++ b/nifi/nar-bundles/framework-bundle/framework/core-api/src/main/java/org/apache/nifi/controller/ReportingTaskNode.java
@@ -68,5 +68,9 @@ public interface ReportingTaskNode extends ConfiguredComponent {
     
     void setScheduledState(ScheduledState state);
     
+    void verifyCanStart();
+    void verifyCanStop();
+    void verifyCanDisable();
+    void verifyCanEnable();
     void verifyCanDelete();
 }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/850396cc/nifi/nar-bundles/framework-bundle/framework/core-api/src/main/java/org/apache/nifi/controller/service/ControllerServiceNode.java
----------------------------------------------------------------------
diff --git a/nifi/nar-bundles/framework-bundle/framework/core-api/src/main/java/org/apache/nifi/controller/service/ControllerServiceNode.java b/nifi/nar-bundles/framework-bundle/framework/core-api/src/main/java/org/apache/nifi/controller/service/ControllerServiceNode.java
index dd4b49a..357d4de 100644
--- a/nifi/nar-bundles/framework-bundle/framework/core-api/src/main/java/org/apache/nifi/controller/service/ControllerServiceNode.java
+++ b/nifi/nar-bundles/framework-bundle/framework/core-api/src/main/java/org/apache/nifi/controller/service/ControllerServiceNode.java
@@ -40,5 +40,7 @@ public interface ControllerServiceNode extends ConfiguredComponent {
 
     void removeReference(ConfiguredComponent referringComponent);
     
+    void verifyCanEnable();
+    void verifyCanDisable();
     void verifyCanDelete();
 }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/850396cc/nifi/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/FlowController.java
----------------------------------------------------------------------
diff --git a/nifi/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/FlowController.java b/nifi/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/FlowController.java
index 1d90a3a..1b7a3c0 100644
--- a/nifi/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/FlowController.java
+++ b/nifi/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/FlowController.java
@@ -2522,6 +2522,8 @@ public class FlowController implements EventAccess, ControllerServiceProvider, H
             throw new IllegalStateException("Cannot start reporting task " + reportingTaskNode + " because the controller is terminated");
         }
 
+        reportingTaskNode.verifyCanStart();
+        
         processScheduler.schedule(reportingTaskNode);
     }
 
@@ -2530,6 +2532,8 @@ public class FlowController implements EventAccess, ControllerServiceProvider, H
             return;
         }
 
+        reportingTaskNode.verifyCanStop();
+        
         processScheduler.unschedule(reportingTaskNode);
     }
 
@@ -2554,18 +2558,26 @@ public class FlowController implements EventAccess, ControllerServiceProvider, H
 
 
     public void enableReportingTask(final ReportingTaskNode reportingTaskNode) {
+        reportingTaskNode.verifyCanEnable();
+        
         processScheduler.enableReportingTask(reportingTaskNode);
     }
     
     public void disableReportingTask(final ReportingTaskNode reportingTaskNode) {
+        reportingTaskNode.verifyCanDisable();
+        
         processScheduler.disableReportingTask(reportingTaskNode);
     }
     
     public void enableControllerService(final ControllerServiceNode serviceNode) {
+        serviceNode.verifyCanEnable();
+        
         processScheduler.enableControllerService(serviceNode);
     }
     
     public void disableControllerService(final ControllerServiceNode serviceNode) {
+        serviceNode.verifyCanDisable();
+        
         processScheduler.disableControllerService(serviceNode);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/850396cc/nifi/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/reporting/AbstractReportingTaskNode.java
----------------------------------------------------------------------
diff --git a/nifi/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/reporting/AbstractReportingTaskNode.java b/nifi/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/reporting/AbstractReportingTaskNode.java
index 8b10a84..f299781 100644
--- a/nifi/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/reporting/AbstractReportingTaskNode.java
+++ b/nifi/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/reporting/AbstractReportingTaskNode.java
@@ -159,4 +159,5 @@ public abstract class AbstractReportingTaskNode extends AbstractConfiguredCompon
             throw new IllegalStateException(this + " is running");
         }
     }
+    
 }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/850396cc/nifi/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceProvider.java
----------------------------------------------------------------------
diff --git a/nifi/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceProvider.java b/nifi/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceProvider.java
index bf0039a..1deed59 100644
--- a/nifi/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceProvider.java
+++ b/nifi/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceProvider.java
@@ -34,7 +34,6 @@ import org.apache.nifi.annotation.lifecycle.OnAdded;
 import org.apache.nifi.annotation.lifecycle.OnRemoved;
 import org.apache.nifi.controller.ConfigurationContext;
 import org.apache.nifi.controller.ControllerService;
-import org.apache.nifi.controller.ReportingTaskNode;
 import org.apache.nifi.controller.ValidationContextFactory;
 import org.apache.nifi.controller.exception.ControllerServiceAlreadyExistsException;
 import org.apache.nifi.controller.exception.ControllerServiceNotFoundException;