You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by jp...@apache.org on 2016/09/28 19:10:52 UTC

nifi git commit: NIFI-2758: - Updating move verification to account for Controller Service moving out of scope.

Repository: nifi
Updated Branches:
  refs/heads/master cfc738ec1 -> 833ec4409


NIFI-2758: - Updating move verification to account for Controller Service moving out of scope.

This closes #1064

Signed-off-by: jpercivall <jo...@yahoo.com>


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

Branch: refs/heads/master
Commit: 833ec4409c20c5f2323b61b87bab7c10557f7041
Parents: cfc738e
Author: Matt Gilman <ma...@gmail.com>
Authored: Mon Sep 26 10:17:02 2016 -0400
Committer: jpercivall <jo...@yahoo.com>
Committed: Wed Sep 28 15:01:38 2016 -0400

----------------------------------------------------------------------
 .../nifi/groups/StandardProcessGroup.java       | 25 ++++++++++++++++++++
 1 file changed, 25 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/833ec440/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java
index 901c42e..6f0dd84 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java
@@ -39,6 +39,7 @@ import org.apache.nifi.connectable.Port;
 import org.apache.nifi.connectable.Position;
 import org.apache.nifi.connectable.Positionable;
 import org.apache.nifi.controller.ConfigurationContext;
+import org.apache.nifi.controller.ControllerService;
 import org.apache.nifi.controller.FlowController;
 import org.apache.nifi.controller.ProcessorNode;
 import org.apache.nifi.controller.ScheduledState;
@@ -2470,6 +2471,30 @@ public final class StandardProcessGroup implements ProcessGroup {
                     throw new IllegalStateException("Cannot perform Move Operation because of a naming conflict with another port in the destination Process Group");
                 }
             }
+
+            for (final String id : snippet.getProcessors().keySet()) {
+                final ProcessorNode processorNode = getProcessor(id);
+                for (final PropertyDescriptor descriptor : processorNode.getProperties().keySet()) {
+                    final Class<? extends ControllerService> serviceDefinition = descriptor.getControllerServiceDefinition();
+
+                    // if this descriptor identifies a controller service
+                    if (serviceDefinition != null) {
+                        final String serviceId = processorNode.getProperty(descriptor);
+
+                        // if the processor is configured with a service
+                        if (serviceId != null) {
+                            // get all the available services
+                            final Set<String> currentControllerServiceIds = controllerServiceProvider.getControllerServiceIdentifiers(serviceDefinition, getIdentifier());
+                            final Set<String> proposedControllerServiceIds = controllerServiceProvider.getControllerServiceIdentifiers(serviceDefinition, newProcessGroup.getIdentifier());
+
+                            // ensure the configured service is an allowed service if it's still a valid service
+                            if (currentControllerServiceIds.contains(serviceId) && !proposedControllerServiceIds.contains(serviceId)) {
+                                throw new IllegalStateException("Cannot perform Move Operation because a Processor references a service that is not available in the destination Process Group");
+                            }
+                        }
+                    }
+                }
+            }
         } finally {
             readLock.unlock();
         }