Repository: nifi Updated Branches: refs/heads/master 59e102ad4 -> 931bb0bc3
http://git-wip-us.apache.org/repos/asf/nifi/blob/931bb0bc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardProcessorDAO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardProcessorDAO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardProcessorDAO.java index 1de4bff..3b93921 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardProcessorDAO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardProcessorDAO.java @@ -58,7 +58,6 @@ import java.util.Set; import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; -import java.util.stream.Collectors; public class StandardProcessorDAO extends ComponentDAO implements ProcessorDAO { @@ -67,7 +66,7 @@ public class StandardProcessorDAO extends ComponentDAO implements ProcessorDAO { private ComponentStateDAO componentStateDAO; private ProcessorNode locateProcessor(final String processorId) { - final ProcessGroup rootGroup = flowController.getGroup(flowController.getRootGroupId()); + final ProcessGroup rootGroup = flowController.getFlowManager().getRootGroup(); final ProcessorNode processor = rootGroup.findProcessor(processorId); if (processor == null) { @@ -79,7 +78,7 @@ public class StandardProcessorDAO extends ComponentDAO implements ProcessorDAO { @Override public boolean hasProcessor(String id) { - final ProcessGroup rootGroup = flowController.getGroup(flowController.getRootGroupId()); + final ProcessGroup rootGroup = flowController.getFlowManager().getRootGroup(); return rootGroup.findProcessor(id) != null; } @@ -90,7 +89,7 @@ public class StandardProcessorDAO extends ComponentDAO implements ProcessorDAO { @Override public ProcessorNode createProcessor(final String groupId, ProcessorDTO processorDTO) { - if (processorDTO.getParentGroupId() != null && !flowController.areGroupsSame(groupId, processorDTO.getParentGroupId())) { + if (processorDTO.getParentGroupId() != null && !flowController.getFlowManager().areGroupsSame(groupId, processorDTO.getParentGroupId())) { throw new IllegalArgumentException("Cannot specify a different Parent Group ID than the Group to which the Processor is being added."); } @@ -105,7 +104,7 @@ public class StandardProcessorDAO extends ComponentDAO implements ProcessorDAO { try { // attempt to create the processor final BundleCoordinate bundleCoordinate = BundleUtils.getBundle(flowController.getExtensionManager(), processorDTO.getType(), processorDTO.getBundle()); - ProcessorNode processor = flowController.createProcessor(processorDTO.getType(), processorDTO.getId(), bundleCoordinate); + ProcessorNode processor = flowController.getFlowManager().createProcessor(processorDTO.getType(), processorDTO.getId(), bundleCoordinate); // ensure we can perform the update before we add the processor to the flow verifyUpdate(processor, processorDTO); @@ -117,8 +116,6 @@ public class StandardProcessorDAO extends ComponentDAO implements ProcessorDAO { configureProcessor(processor, processorDTO); return processor; - } catch (ProcessorInstantiationException pse) { - throw new NiFiCoreException(String.format("Unable to create processor of type %s due to: %s", processorDTO.getType(), pse.getMessage()), pse); } catch (IllegalStateException | ComponentLifeCycleException ise) { throw new NiFiCoreException(ise.getMessage(), ise); } @@ -317,7 +314,7 @@ public class StandardProcessorDAO extends ComponentDAO implements ProcessorDAO { public Set<ProcessorNode> getProcessors(String groupId, boolean includeDescendants) { ProcessGroup group = locateProcessGroup(flowController, groupId); if (includeDescendants) { - return group.findAllProcessors().stream().collect(Collectors.toSet()); + return new HashSet<>(group.findAllProcessors()); } else { return new HashSet<>(group.getProcessors()); } @@ -488,7 +485,7 @@ public class StandardProcessorDAO extends ComponentDAO implements ProcessorDAO { // we need to use the property descriptors from the temp component here in case we are changing from a ghost component to a real component final ConfigurableComponent tempComponent = extensionManager.getTempComponent(processor.getCanonicalClassName(), incomingCoordinate); final Set<URL> additionalUrls = processor.getAdditionalClasspathResources(tempComponent.getPropertyDescriptors()); - flowController.reload(processor, processor.getCanonicalClassName(), incomingCoordinate, additionalUrls); + flowController.getReloadComponent().reload(processor, processor.getCanonicalClassName(), incomingCoordinate, additionalUrls); } catch (ProcessorInstantiationException e) { throw new NiFiCoreException(String.format("Unable to update processor %s from %s to %s due to: %s", processorDTO.getId(), processor.getBundleCoordinate().getCoordinate(), incomingCoordinate.getCoordinate(), e.getMessage()), e); http://git-wip-us.apache.org/repos/asf/nifi/blob/931bb0bc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardRemoteProcessGroupDAO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardRemoteProcessGroupDAO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardRemoteProcessGroupDAO.java index 05a983c..b8399f7 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardRemoteProcessGroupDAO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardRemoteProcessGroupDAO.java @@ -16,8 +16,6 @@ */ package org.apache.nifi.web.dao.impl; -import static org.apache.nifi.util.StringUtils.isEmpty; - import org.apache.commons.lang3.StringUtils; import org.apache.nifi.connectable.Position; import org.apache.nifi.controller.FlowController; @@ -40,12 +38,14 @@ import java.util.List; import java.util.Set; import java.util.regex.Matcher; +import static org.apache.nifi.util.StringUtils.isEmpty; + public class StandardRemoteProcessGroupDAO extends ComponentDAO implements RemoteProcessGroupDAO { private FlowController flowController; private RemoteProcessGroup locateRemoteProcessGroup(final String remoteProcessGroupId) { - final ProcessGroup rootGroup = flowController.getGroup(flowController.getRootGroupId()); + final ProcessGroup rootGroup = flowController.getFlowManager().getRootGroup(); final RemoteProcessGroup remoteProcessGroup = rootGroup.findRemoteProcessGroup(remoteProcessGroupId); if (remoteProcessGroup == null) { @@ -57,7 +57,7 @@ public class StandardRemoteProcessGroupDAO extends ComponentDAO implements Remot @Override public boolean hasRemoteProcessGroup(String remoteProcessGroupId) { - final ProcessGroup rootGroup = flowController.getGroup(flowController.getRootGroupId()); + final ProcessGroup rootGroup = flowController.getFlowManager().getRootGroup(); return rootGroup.findRemoteProcessGroup(remoteProcessGroupId) != null; } @@ -71,7 +71,7 @@ public class StandardRemoteProcessGroupDAO extends ComponentDAO implements Remot public RemoteProcessGroup createRemoteProcessGroup(String groupId, RemoteProcessGroupDTO remoteProcessGroupDTO) { ProcessGroup group = locateProcessGroup(flowController, groupId); - if (remoteProcessGroupDTO.getParentGroupId() != null && !flowController.areGroupsSame(groupId, remoteProcessGroupDTO.getParentGroupId())) { + if (remoteProcessGroupDTO.getParentGroupId() != null && !flowController.getFlowManager().areGroupsSame(groupId, remoteProcessGroupDTO.getParentGroupId())) { throw new IllegalArgumentException("Cannot specify a different Parent Group ID than the Group to which the Remote Process Group is being added."); } @@ -81,7 +81,7 @@ public class StandardRemoteProcessGroupDAO extends ComponentDAO implements Remot } // create the remote process group - RemoteProcessGroup remoteProcessGroup = flowController.createRemoteProcessGroup(remoteProcessGroupDTO.getId(), targetUris); + RemoteProcessGroup remoteProcessGroup = flowController.getFlowManager().createRemoteProcessGroup(remoteProcessGroupDTO.getId(), targetUris); remoteProcessGroup.initialize(); // set other properties http://git-wip-us.apache.org/repos/asf/nifi/blob/931bb0bc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardSnippetDAO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardSnippetDAO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardSnippetDAO.java index e604a1d..4b26f09 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardSnippetDAO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardSnippetDAO.java @@ -62,7 +62,7 @@ public class StandardSnippetDAO implements SnippetDAO { public FlowSnippetDTO copySnippet(final String groupId, final String snippetId, final Double originX, final Double originY, final String idGenerationSeed) { try { // ensure the parent group exist - final ProcessGroup processGroup = flowController.getGroup(groupId); + final ProcessGroup processGroup = flowController.getFlowManager().getGroup(groupId); if (processGroup == null) { throw new IllegalArgumentException("The specified parent process group could not be found"); } @@ -71,7 +71,7 @@ public class StandardSnippetDAO implements SnippetDAO { Snippet existingSnippet = getSnippet(snippetId); // get the process group - ProcessGroup existingSnippetProcessGroup = flowController.getGroup(existingSnippet.getParentGroupId()); + ProcessGroup existingSnippetProcessGroup = flowController.getFlowManager().getGroup(existingSnippet.getParentGroupId()); // ensure the group could be found if (existingSnippetProcessGroup == null) { @@ -94,7 +94,7 @@ public class StandardSnippetDAO implements SnippetDAO { try { // instantiate the snippet and return the contents - flowController.instantiateSnippet(processGroup, snippetContents); + flowController.getFlowManager().instantiateSnippet(processGroup, snippetContents); return snippetContents; } catch (IllegalStateException ise) { // illegal state will be thrown from instantiateSnippet when there is an issue with the snippet _before_ any of the @@ -143,7 +143,7 @@ public class StandardSnippetDAO implements SnippetDAO { } // ensure the parent group exist - final ProcessGroup processGroup = flowController.getGroup(snippet.getParentGroupId()); + final ProcessGroup processGroup = flowController.getFlowManager().getGroup(snippet.getParentGroupId()); if (processGroup == null) { throw new IllegalArgumentException("The specified parent process group could not be found."); } @@ -158,7 +158,7 @@ public class StandardSnippetDAO implements SnippetDAO { final Snippet snippet = locateSnippet(snippetId); // ensure the parent group exist - final ProcessGroup processGroup = flowController.getGroup(snippet.getParentGroupId()); + final ProcessGroup processGroup = flowController.getFlowManager().getGroup(snippet.getParentGroupId()); if (processGroup == null) { throw new IllegalArgumentException("The specified parent process group could not be found."); } @@ -176,7 +176,7 @@ public class StandardSnippetDAO implements SnippetDAO { final Snippet snippet = locateSnippet(snippetId); // remove the contents - final ProcessGroup processGroup = flowController.getGroup(snippet.getParentGroupId()); + final ProcessGroup processGroup = flowController.getFlowManager().getGroup(snippet.getParentGroupId()); if (processGroup == null) { throw new IllegalArgumentException("The specified parent process group could not be found."); } @@ -209,13 +209,13 @@ public class StandardSnippetDAO implements SnippetDAO { // if the group is changing move it if (snippetDTO.getParentGroupId() != null && !snippet.getParentGroupId().equals(snippetDTO.getParentGroupId())) { // get the current process group - final ProcessGroup processGroup = flowController.getGroup(snippet.getParentGroupId()); + final ProcessGroup processGroup = flowController.getFlowManager().getGroup(snippet.getParentGroupId()); if (processGroup == null) { throw new IllegalArgumentException("The specified parent process group could not be found."); } // get the new process group - final ProcessGroup newProcessGroup = flowController.getGroup(snippetDTO.getParentGroupId()); + final ProcessGroup newProcessGroup = flowController.getFlowManager().getGroup(snippetDTO.getParentGroupId()); if (newProcessGroup == null) { throw new IllegalArgumentException("The new process group could not be found."); } @@ -235,12 +235,12 @@ public class StandardSnippetDAO implements SnippetDAO { // if the group is changing move it if (snippetDTO.getParentGroupId() != null && !snippet.getParentGroupId().equals(snippetDTO.getParentGroupId())) { - final ProcessGroup currentProcessGroup = flowController.getGroup(snippet.getParentGroupId()); + final ProcessGroup currentProcessGroup = flowController.getFlowManager().getGroup(snippet.getParentGroupId()); if (currentProcessGroup == null) { throw new IllegalArgumentException("The current process group could not be found."); } - final ProcessGroup newProcessGroup = flowController.getGroup(snippetDTO.getParentGroupId()); + final ProcessGroup newProcessGroup = flowController.getFlowManager().getGroup(snippetDTO.getParentGroupId()); if (newProcessGroup == null) { throw new IllegalArgumentException("The new process group could not be found."); } @@ -277,7 +277,7 @@ public class StandardSnippetDAO implements SnippetDAO { } private void lookupSensitiveProcessorProperties(final Set<ProcessorDTO> processors) { - final ProcessGroup rootGroup = flowController.getGroup(flowController.getRootGroupId()); + final ProcessGroup rootGroup = flowController.getFlowManager().getRootGroup(); // go through each processor for (final ProcessorDTO processorDTO : processors) { @@ -313,7 +313,7 @@ public class StandardSnippetDAO implements SnippetDAO { final Map<String, String> serviceProperties = serviceDTO.getProperties(); if (serviceProperties != null) { // find the corresponding controller service - final ControllerServiceNode serviceNode = flowController.getControllerServiceNode(serviceDTO.getId()); + final ControllerServiceNode serviceNode = flowController.getFlowManager().getControllerServiceNode(serviceDTO.getId()); if (serviceNode == null) { throw new IllegalArgumentException(String.format("Unable to create snippet because Controller Service '%s' could not be found", serviceDTO.getId())); } http://git-wip-us.apache.org/repos/asf/nifi/blob/931bb0bc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardTemplateDAO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardTemplateDAO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardTemplateDAO.java index ce7b0c3..a4d4530 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardTemplateDAO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardTemplateDAO.java @@ -18,6 +18,7 @@ package org.apache.nifi.web.dao.impl; import org.apache.commons.lang3.StringUtils; import org.apache.nifi.controller.FlowController; +import org.apache.nifi.controller.StandardFlowSnippet; import org.apache.nifi.controller.Template; import org.apache.nifi.controller.TemplateUtils; import org.apache.nifi.controller.exception.ProcessorInstantiationException; @@ -45,7 +46,7 @@ public class StandardTemplateDAO extends ComponentDAO implements TemplateDAO { private Template locateTemplate(String templateId) { // get the template - Template template = flowController.getGroup(flowController.getRootGroupId()).findTemplate(templateId); + Template template = flowController.getFlowManager().getRootGroup().findTemplate(templateId); // ensure the template exists if (template == null) { @@ -57,7 +58,7 @@ public class StandardTemplateDAO extends ComponentDAO implements TemplateDAO { @Override public void verifyCanAddTemplate(String name, String groupId) { - final ProcessGroup processGroup = flowController.getGroup(groupId); + final ProcessGroup processGroup = flowController.getFlowManager().getGroup(groupId); if (processGroup == null) { throw new ResourceNotFoundException("Could not find Process Group with ID " + groupId); } @@ -70,13 +71,14 @@ public class StandardTemplateDAO extends ComponentDAO implements TemplateDAO { } @Override - public void verifyComponentTypes(FlowSnippetDTO snippet) { - flowController.verifyComponentTypesInSnippet(snippet); + public void verifyComponentTypes(FlowSnippetDTO snippetDto) { + final StandardFlowSnippet flowSnippet = new StandardFlowSnippet(snippetDto, flowController.getExtensionManager()); + flowSnippet.verifyComponentTypesInSnippet(); } @Override public Template createTemplate(TemplateDTO templateDTO, String groupId) { - final ProcessGroup processGroup = flowController.getGroup(groupId); + final ProcessGroup processGroup = flowController.getFlowManager().getGroup(groupId); if (processGroup == null) { throw new ResourceNotFoundException("Could not find Process Group with ID " + groupId); } @@ -123,7 +125,7 @@ public class StandardTemplateDAO extends ComponentDAO implements TemplateDAO { childProcessGroups.stream().forEach(processGroup -> org.apache.nifi.util.SnippetUtils.scaleSnippet(processGroup.getContents(), factorX, factorY)); // instantiate the template into this group - flowController.instantiateSnippet(group, snippet); + flowController.getFlowManager().instantiateSnippet(group, snippet); return snippet; } catch (ProcessorInstantiationException pie) { @@ -149,7 +151,7 @@ public class StandardTemplateDAO extends ComponentDAO implements TemplateDAO { @Override public Set<Template> getTemplates() { final Set<Template> templates = new HashSet<>(); - for (final Template template : flowController.getGroup(flowController.getRootGroupId()).findAllTemplates()) { + for (final Template template : flowController.getFlowManager().getRootGroup().findAllTemplates()) { templates.add(template); } return templates; http://git-wip-us.apache.org/repos/asf/nifi/blob/931bb0bc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/spring/ControllerServiceProviderFactoryBean.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/spring/ControllerServiceProviderFactoryBean.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/spring/ControllerServiceProviderFactoryBean.java index cb44d47..78f5729 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/spring/ControllerServiceProviderFactoryBean.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/spring/ControllerServiceProviderFactoryBean.java @@ -34,7 +34,7 @@ public class ControllerServiceProviderFactoryBean implements FactoryBean<Control @Override public ControllerServiceProvider getObject() throws Exception { if (controllerServiceProvider == null) { - controllerServiceProvider = context.getBean("flowController", FlowController.class); + controllerServiceProvider = context.getBean("flowController", FlowController.class).getControllerServiceProvider(); } return controllerServiceProvider; http://git-wip-us.apache.org/repos/asf/nifi/blob/931bb0bc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/util/SnippetUtils.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/util/SnippetUtils.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/util/SnippetUtils.java index 5bebe9a..f603284 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/util/SnippetUtils.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/util/SnippetUtils.java @@ -102,7 +102,7 @@ public final class SnippetUtils { public FlowSnippetDTO populateFlowSnippet(final Snippet snippet, final boolean recurse, final boolean includeControllerServices, boolean removeInstanceId) { final FlowSnippetDTO snippetDto = new FlowSnippetDTO(removeInstanceId); final String groupId = snippet.getParentGroupId(); - final ProcessGroup processGroup = flowController.getGroup(groupId); + final ProcessGroup processGroup = flowController.getFlowManager().getGroup(groupId); // ensure the group could be found if (processGroup == null) { @@ -366,7 +366,7 @@ public final class SnippetUtils { if (descriptor.getControllerServiceDefinition() != null) { final String controllerServiceId = entry.getValue(); if (controllerServiceId != null) { - final ControllerServiceNode serviceNode = flowController.getControllerServiceNode(controllerServiceId); + final ControllerServiceNode serviceNode = flowController.getFlowManager().getControllerServiceNode(controllerServiceId); if (serviceNode != null) { serviceDtos.add(dtoFactory.createControllerServiceDto(serviceNode)); http://git-wip-us.apache.org/repos/asf/nifi/blob/931bb0bc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/nifi-web-api-context.xml ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/nifi-web-api-context.xml b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/nifi-web-api-context.xml index 7802229..efc9dd9 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/nifi-web-api-context.xml +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/nifi-web-api-context.xml @@ -34,7 +34,7 @@ <!-- revision manager --> <bean id="revisionManager" class="org.apache.nifi.web.revision.NaiveRevisionManager"> </bean> - + <!-- content access --> <bean id="contentAccess" class="org.apache.nifi.web.StandardNiFiContentAccess"> <property name="serviceFacade" ref="serviceFacade"/> @@ -61,7 +61,7 @@ <property name="flowController" ref="flowController"/> <property name="accessPolicyDAO" ref="policyBasedAuthorizerDAO"/> </bean> - + <bean id="clusterComponentLifecycle" class="org.apache.nifi.web.util.ClusterReplicationComponentLifecycle"> <property name="clusterCoordinator" ref="clusterCoordinator" /> <property name="requestReplicator" ref="requestReplicator" /> @@ -108,10 +108,13 @@ <property name="componentStateDAO" ref="componentStateDAO"/> <property name="flowController" ref="flowController" /> </bean> + <bean id="reloadComponent" class="org.apache.nifi.controller.StandardReloadComponent"> + <constructor-arg index="0" ref="flowController" /> + </bean> <bean id="reportingTaskDAO" class="org.apache.nifi.web.dao.impl.StandardReportingTaskDAO"> <property name="reportingTaskProvider" ref="reportingTaskProvider"/> <property name="componentStateDAO" ref="componentStateDAO"/> - <property name="reloadComponent" ref="flowController" /> + <property name="reloadComponent" ref="reloadComponent" /> </bean> <bean id="componentStateDAO" class="org.apache.nifi.web.dao.impl.StandardComponentStateDAO"> <property name="stateManagerProvider" ref="stateManagerProvider"/> @@ -192,7 +195,7 @@ <property name="flowRegistryClient" ref="flowRegistryClient" /> <property name="registryDAO" ref="flowRegistryDAO" /> </bean> - + <!-- component ui extension configuration context --> <bean id="nifiWebConfigurationContext" class="org.apache.nifi.web.StandardNiFiWebConfigurationContext"> <property name="serviceFacade" ref="serviceFacade"/> @@ -451,7 +454,7 @@ </bean> <!-- enable aop --> - <!-- + <!-- By setting '-target-class' to 'true' Spring will use CGLIB for proxying instead of JDK dynamic proxy. CGLIB uses class extension so at runtime we can cast to the concrete class. With JDK dynamic proxy, @@ -542,7 +545,7 @@ <property name="auditService" ref="auditService"/> <property name="processGroupDAO" ref="processGroupDAO"/> </bean> - + <!-- NiFi locking --> <bean id="serviceFacadeLock" class="org.apache.nifi.web.NiFiServiceFacadeLock"/> http://git-wip-us.apache.org/repos/asf/nifi/blob/931bb0bc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/groovy/org/apache/nifi/web/dao/impl/StandardTemplateDAOSpec.groovy ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/groovy/org/apache/nifi/web/dao/impl/StandardTemplateDAOSpec.groovy b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/groovy/org/apache/nifi/web/dao/impl/StandardTemplateDAOSpec.groovy index de136fc..605f33c 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/groovy/org/apache/nifi/web/dao/impl/StandardTemplateDAOSpec.groovy +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/groovy/org/apache/nifi/web/dao/impl/StandardTemplateDAOSpec.groovy @@ -18,6 +18,7 @@ package org.apache.nifi.web.dao.impl import org.apache.nifi.authorization.Authorizer import org.apache.nifi.controller.FlowController +import org.apache.nifi.controller.flow.FlowManager import org.apache.nifi.controller.serialization.FlowEncodingVersion import org.apache.nifi.controller.service.ControllerServiceProvider import org.apache.nifi.groups.ProcessGroup @@ -39,6 +40,8 @@ class StandardTemplateDAOSpec extends Specification { def "test InstantiateTemplate moves and scales templates"() { given: def flowController = Mock FlowController + def flowManager = Mock FlowManager + flowController.flowManager >> flowManager def snippetUtils = new SnippetUtils() snippetUtils.flowController = flowController def dtoFactory = new DtoFactory() @@ -68,7 +71,7 @@ class StandardTemplateDAOSpec extends Specification { def instantiatedTemplate = standardTemplateDAO.instantiateTemplate(rootGroupId, newOriginX, newOriginY, encodingVersion, snippet, idGenerationSeed) then: - flowController.getGroup(_) >> { String gId -> + flowManager.getGroup(_) >> { String gId -> def pg = Mock ProcessGroup pg.identifier >> gId pg.inputPorts >> [] @@ -76,9 +79,8 @@ class StandardTemplateDAOSpec extends Specification { pg.processGroups >> [] return pg } - flowController.rootGroupId >> rootGroupId - flowController.instantiateSnippet(*_) >> {} - 0 * _ + flowManager.rootGroupId >> rootGroupId + flowManager.instantiateSnippet(*_) >> {} def instantiatedComponents = [instantiatedTemplate.connections + instantiatedTemplate.inputPorts + instantiatedTemplate.outputPorts + instantiatedTemplate.labels + instantiatedTemplate.processGroups + instantiatedTemplate.processGroups + instantiatedTemplate.processors + instantiatedTemplate.funnels + @@ -119,7 +121,7 @@ class StandardTemplateDAOSpec extends Specification { processors: [new ProcessorDTO(id:"c81f6810-0155-1000-0001-c4af042cb1559", name: 'proc2', bundle: new BundleDTO("org.apache.nifi", "standard", "1.0"), config: new ProcessorConfigDTO(), position: new PositionDTO(x: 10, y: 10))], processGroups: [ - new ProcessGroupDTO(id:"c81f6810-0a55-1000-0000-c4af042cb1559", + new ProcessGroupDTO(id:"c81f6810-0a55-1000-0000-c4af042cb1559", name: 'g2', position: new PositionDTO(x: 105, y: -10), contents: new FlowSnippetDTO(processors: [new ProcessorDTO(id:"c81f6810-0155-1000-0002-c4af042cb1559", name: 'proc3', bundle: new BundleDTO("org.apache.nifi", "standard", "1.0"), http://git-wip-us.apache.org/repos/asf/nifi/blob/931bb0bc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/dao/impl/TestStandardRemoteProcessGroupDAO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/dao/impl/TestStandardRemoteProcessGroupDAO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/dao/impl/TestStandardRemoteProcessGroupDAO.java index d8840ec..97b04ae 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/dao/impl/TestStandardRemoteProcessGroupDAO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/dao/impl/TestStandardRemoteProcessGroupDAO.java @@ -18,6 +18,7 @@ package org.apache.nifi.web.dao.impl; import org.apache.nifi.controller.FlowController; import org.apache.nifi.controller.exception.ValidationException; +import org.apache.nifi.controller.flow.FlowManager; import org.apache.nifi.groups.ProcessGroup; import org.apache.nifi.groups.RemoteProcessGroup; import org.apache.nifi.remote.RemoteGroupPort; @@ -66,12 +67,16 @@ public class TestStandardRemoteProcessGroupDAO { final String remoteProcessGroupInputPortId = "remote-process-group-input-port-id"; final FlowController flowController = mock(FlowController.class); + final FlowManager flowManager = mock(FlowManager.class); + when(flowController.getFlowManager()).thenReturn(flowManager); + final ProcessGroup processGroup = mock(ProcessGroup.class); final RemoteProcessGroup remoteProcessGroup = mock(RemoteProcessGroup.class); final RemoteGroupPort remoteGroupPort = mock(RemoteGroupPort.class); dao.setFlowController(flowController); - when(flowController.getGroup(any())).thenReturn(processGroup); + when(flowManager.getRootGroup()).thenReturn(processGroup); + when(flowManager.getGroup(any())).thenReturn(processGroup); when(processGroup.findRemoteProcessGroup(eq(remoteProcessGroupId))).thenReturn(remoteProcessGroup); when(remoteProcessGroup.getInputPort(remoteProcessGroupInputPortId)).thenReturn(remoteGroupPort); when(remoteGroupPort.getName()).thenReturn("remote-group-port");