You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by mc...@apache.org on 2015/02/11 15:22:37 UTC
incubator-nifi git commit: NIFI-250: - Additionally refactoring of
removal of ControllerServiceProvider usage.
Repository: incubator-nifi
Updated Branches:
refs/heads/NIFI-250 0d2041b05 -> ed4d22c1f
NIFI-250:
- Additionally refactoring of removal of ControllerServiceProvider usage.
Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/ed4d22c1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/ed4d22c1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/ed4d22c1
Branch: refs/heads/NIFI-250
Commit: ed4d22c1ff17395a683a83d9f57dfdc842ce175f
Parents: 0d2041b
Author: Matt Gilman <ma...@gmail.com>
Authored: Wed Feb 11 09:22:18 2015 -0500
Committer: Matt Gilman <ma...@gmail.com>
Committed: Wed Feb 11 09:22:18 2015 -0500
----------------------------------------------------------------------
.../spring/ControllerServiceDAOFactoryBean.java | 70 ---------------
.../ControllerServiceProviderFactoryBean.java | 69 +++++++++++++++
.../web/spring/NiFiWebContextFactoryBean.java | 93 --------------------
.../src/main/resources/nifi-web-api-context.xml | 11 ++-
4 files changed, 77 insertions(+), 166 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ed4d22c1/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/spring/ControllerServiceDAOFactoryBean.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/spring/ControllerServiceDAOFactoryBean.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/spring/ControllerServiceDAOFactoryBean.java
deleted file mode 100644
index 040de0d..0000000
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/spring/ControllerServiceDAOFactoryBean.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.web.spring;
-
-import org.apache.nifi.cluster.manager.impl.WebClusterManager;
-import org.apache.nifi.controller.FlowController;
-import org.apache.nifi.util.NiFiProperties;
-import org.apache.nifi.web.dao.ControllerServiceDAO;
-import org.apache.nifi.web.dao.impl.StandardControllerServiceDAO;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.FactoryBean;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-
-/**
- *
- */
-public class ControllerServiceDAOFactoryBean implements FactoryBean, ApplicationContextAware {
-
- private ApplicationContext context;
- private StandardControllerServiceDAO controllerServiceDao;
- private NiFiProperties properties;
-
- @Override
- public Object getObject() throws Exception {
- if (controllerServiceDao == null) {
- controllerServiceDao = new StandardControllerServiceDAO();
- if (properties.isClusterManager()) {
- controllerServiceDao.setServiceProvider(context.getBean("clusterManager", WebClusterManager.class));
- } else {
- controllerServiceDao.setServiceProvider(context.getBean("flowController", FlowController.class));
- }
- }
-
- return controllerServiceDao;
- }
-
- @Override
- public Class getObjectType() {
- return ControllerServiceDAO.class;
- }
-
- @Override
- public boolean isSingleton() {
- return true;
- }
-
- public void setProperties(NiFiProperties properties) {
- this.properties = properties;
- }
-
- @Override
- public void setApplicationContext(ApplicationContext context) throws BeansException {
- this.context = context;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ed4d22c1/nifi/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/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/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/spring/ControllerServiceProviderFactoryBean.java
new file mode 100644
index 0000000..6433510
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/spring/ControllerServiceProviderFactoryBean.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.web.spring;
+
+import org.apache.nifi.cluster.manager.impl.WebClusterManager;
+import org.apache.nifi.controller.FlowController;
+import org.apache.nifi.controller.service.ControllerServiceProvider;
+import org.apache.nifi.util.NiFiProperties;
+import org.apache.nifi.web.dao.ControllerServiceDAO;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.FactoryBean;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+/**
+ *
+ */
+public class ControllerServiceProviderFactoryBean implements FactoryBean, ApplicationContextAware {
+
+ private ApplicationContext context;
+ private ControllerServiceProvider controllerServiceProvider;
+ private NiFiProperties properties;
+
+ @Override
+ public Object getObject() throws Exception {
+ if (controllerServiceProvider == null) {
+ if (properties.isClusterManager()) {
+ controllerServiceProvider = context.getBean("clusterManager", WebClusterManager.class);
+ } else {
+ controllerServiceProvider = context.getBean("flowController", FlowController.class);
+ }
+ }
+
+ return controllerServiceProvider;
+ }
+
+ @Override
+ public Class getObjectType() {
+ return ControllerServiceDAO.class;
+ }
+
+ @Override
+ public boolean isSingleton() {
+ return true;
+ }
+
+ public void setProperties(NiFiProperties properties) {
+ this.properties = properties;
+ }
+
+ @Override
+ public void setApplicationContext(ApplicationContext context) throws BeansException {
+ this.context = context;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ed4d22c1/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/spring/NiFiWebContextFactoryBean.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/spring/NiFiWebContextFactoryBean.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/spring/NiFiWebContextFactoryBean.java
deleted file mode 100644
index 8dc9f57..0000000
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/spring/NiFiWebContextFactoryBean.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.web.spring;
-
-import org.apache.nifi.admin.service.AuditService;
-import org.apache.nifi.cluster.manager.impl.WebClusterManager;
-import org.apache.nifi.controller.FlowController;
-import org.apache.nifi.util.NiFiProperties;
-import org.apache.nifi.web.NiFiServiceFacade;
-import org.apache.nifi.web.NiFiWebContext;
-import org.apache.nifi.web.StandardNiFiWebContext;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.FactoryBean;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-
-/**
- *
- */
-public class NiFiWebContextFactoryBean implements FactoryBean, ApplicationContextAware {
-
- private ApplicationContext context;
- private StandardNiFiWebContext webContext;
-
- private NiFiProperties properties;
- private NiFiServiceFacade serviceFacade;
- private WebClusterManager clusterManager;
- private AuditService auditService;
-
- @Override
- public Object getObject() throws Exception {
- if (webContext == null) {
- webContext = new StandardNiFiWebContext();
- if (properties.isClusterManager()) {
- webContext.setControllerServiceLookup(context.getBean("clusterManager", WebClusterManager.class));
- } else {
- webContext.setControllerServiceLookup(context.getBean("flowController", FlowController.class));
- }
- webContext.setAuditService(auditService);
- webContext.setClusterManager(clusterManager);
- webContext.setProperties(properties);
- webContext.setServiceFacade(serviceFacade);
- }
-
- return webContext;
- }
-
- @Override
- public Class getObjectType() {
- return NiFiWebContext.class;
- }
-
- @Override
- public boolean isSingleton() {
- return true;
- }
-
- @Override
- public void setApplicationContext(ApplicationContext context) throws BeansException {
- this.context = context;
- }
-
- public void setProperties(NiFiProperties properties) {
- this.properties = properties;
- }
-
- public void setServiceFacade(NiFiServiceFacade serviceFacade) {
- this.serviceFacade = serviceFacade;
- }
-
- public void setClusterManager(WebClusterManager clusterManager) {
- this.clusterManager = clusterManager;
- }
-
- public void setAuditService(AuditService auditService) {
- this.auditService = auditService;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ed4d22c1/nifi/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/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/nifi-web-api-context.xml b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/nifi-web-api-context.xml
index a4ee88c..8a12352 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/nifi-web-api-context.xml
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/nifi-web-api-context.xml
@@ -24,6 +24,10 @@
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd">
+ <bean id="controllerServiceProvider" class="org.apache.nifi.web.spring.ControllerServiceProviderFactoryBean" depends-on="clusterManagerOptimisticLockingManager">
+ <property name="properties" ref="nifiProperties"/>
+ </bean>
+
<!-- optimistic locking manager -->
<bean id="webOptimisticLockingManager" class="org.apache.nifi.web.spring.OptimisticLockingManagerFactoryBean" depends-on="clusterManagerOptimisticLockingManager">
<property name="properties" ref="nifiProperties"/>
@@ -66,8 +70,8 @@
<bean id="processorDAO" class="org.apache.nifi.web.dao.impl.StandardProcessorDAO">
<property name="flowController" ref="flowController"/>
</bean>
- <bean id="controllerServiceDAO" class="org.apache.nifi.web.spring.ControllerServiceDAOFactoryBean" depends-on="clusterManager flowController">
- <property name="properties" ref="nifiProperties"/>
+ <bean id="controllerServiceDAO" class="org.apache.nifi.web.dao.impl.StandardControllerServiceDAO">
+ <property name="serviceProvider" ref="controllerServiceProvider"/>
</bean>
<bean id="templateDAO" class="org.apache.nifi.web.dao.impl.StandardTemplateDAO">
<property name="flowController" ref="flowController"/>
@@ -106,11 +110,12 @@
<property name="clusterManager" ref="clusterManager"/>
</bean>
- <bean id="nifiWebContext" class="org.apache.nifi.web.spring.NiFiWebContextFactoryBean" depends-on="clusterManager flowController">
+ <bean id="nifiWebContext" class="org.apache.nifi.web.StandardNiFiWebContext">
<property name="serviceFacade" ref="serviceFacade"/>
<property name="properties" ref="nifiProperties"/>
<property name="clusterManager" ref="clusterManager"/>
<property name="auditService" ref="auditService"/>
+ <property name="controllerServiceLookup" ref="controllerServiceProvider"/>
</bean>
<!-- rest endpoints -->