← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1866: Replaced configurationManager bean xml definition with annotations

 

------------------------------------------------------------
revno: 1866
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Mon 2010-05-17 22:22:43 +0200
message:
  Replaced configurationManager bean xml definition with annotations
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/external/configuration/ConfigurationManager.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/configuration/DefaultIbatisConfigurationManager.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ixf/config/XMLIXFConfigurationManager.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/impl/AbstractDataSetCompletenessService.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/manager/DefaultReportManager.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-support/dhis-support-external/pom.xml
  dhis-2/dhis-support/dhis-support-external/src/main/java/org/hisp/dhis/external/configuration/DefaultConfigurationManager.java
  dhis-2/dhis-support/dhis-support-external/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-support/dhis-support-external/src/test/java/org/hisp/dhis/external/configuration/ConfigurationManagerTest.java
  dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/META-INF/dhis/beans.xml


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/external/configuration/ConfigurationManager.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/external/configuration/ConfigurationManager.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/external/configuration/ConfigurationManager.java	2010-05-17 20:22:43 +0000
@@ -35,9 +35,7 @@
  * @version $Id$
  */
 public interface ConfigurationManager<T>
-{
-    String ID = ConfigurationManager.class.getName();
-    
+{    
     /**
      * Writes a configuration object to an XML file. The outputstream will
      * be closed after use.

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/configuration/DefaultIbatisConfigurationManager.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/configuration/DefaultIbatisConfigurationManager.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/configuration/DefaultIbatisConfigurationManager.java	2010-05-17 20:22:43 +0000
@@ -38,6 +38,7 @@
 import org.hisp.dhis.external.location.LocationManagerException;
 import org.hisp.dhis.importexport.IbatisConfiguration;
 import org.hisp.dhis.importexport.IbatisConfigurationManager;
+import org.springframework.beans.factory.annotation.Autowired;
 
 /**
  * @author Lars Helge Overland
@@ -82,13 +83,9 @@
         this.locationManager = locationManager;
     }
 
+    @Autowired
     private ConfigurationManager<IbatisConfiguration> configurationManager;
     
-    public void setConfigurationManager( ConfigurationManager<IbatisConfiguration> configurationManager )
-    {
-        this.configurationManager = configurationManager;
-    }
-
     // -------------------------------------------------------------------------
     // IbatisConfigurationManager implementation
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ixf/config/XMLIXFConfigurationManager.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ixf/config/XMLIXFConfigurationManager.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ixf/config/XMLIXFConfigurationManager.java	2010-05-17 20:22:43 +0000
@@ -41,6 +41,7 @@
 import org.hisp.dhis.external.location.LocationManager;
 import org.hisp.dhis.external.location.LocationManagerException;
 import org.hisp.dhis.system.util.StreamUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 
 import com.thoughtworks.xstream.XStream;
 
@@ -82,12 +83,8 @@
         this.locationManager = locationManager;
     }
 
+    @Autowired
     private ConfigurationManager<IXFConfiguration> configurationManager;
-    
-    public void setConfigurationManager( ConfigurationManager<IXFConfiguration> configurationManager )
-    {
-        this.configurationManager = configurationManager;
-    }
 
     // -------------------------------------------------------------------------
     // IXFConfigurationManager implementation

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml	2010-05-17 14:19:14 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml	2010-05-17 20:22:43 +0000
@@ -224,8 +224,6 @@
 		<property name="configFile" value="ibatisConfiguration.xml" />
 		<property name="locationManager"
 			ref="org.hisp.dhis.external.location.LocationManager" />
-		<property name="configurationManager"
-			ref="org.hisp.dhis.external.configuration.ConfigurationManager" />
 	</bean>
 
 	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
@@ -365,8 +363,6 @@
 		<property name="configFile" value="ixfConfiguration.xml" />
 		<property name="locationManager"
 			ref="org.hisp.dhis.external.location.LocationManager" />
-		<property name="configurationManager"
-			ref="org.hisp.dhis.external.configuration.ConfigurationManager" />
 	</bean>
 
 	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/impl/AbstractDataSetCompletenessService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/impl/AbstractDataSetCompletenessService.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/impl/AbstractDataSetCompletenessService.java	2010-05-17 20:22:43 +0000
@@ -52,6 +52,7 @@
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.source.Source;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 
 /**
@@ -121,19 +122,15 @@
         this.locationManager = locationManager;
     }
 
-    protected ConfigurationManager<DataSetCompletenessConfiguration> configurationManager;
-    
-    public void setConfigurationManager( ConfigurationManager<DataSetCompletenessConfiguration> configurationManager )
-    {
-        this.configurationManager = configurationManager;
-    }
-
     protected DataSetCompletenessStore completenessStore;
 
     public void setCompletenessStore( DataSetCompletenessStore completenessStore )
     {
         this.completenessStore = completenessStore;
     }
+
+    @Autowired
+    protected ConfigurationManager<DataSetCompletenessConfiguration> configurationManager;
     
     // -------------------------------------------------------------------------
     // DataSetCompletenessService implementation

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/manager/DefaultReportManager.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/manager/DefaultReportManager.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/manager/DefaultReportManager.java	2010-05-17 20:22:43 +0000
@@ -39,6 +39,7 @@
 import org.hisp.dhis.external.location.LocationManagerException;
 import org.hisp.dhis.report.ReportManager;
 import org.hisp.dhis.system.util.CodecUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 
 /**
  * @author Lars Helge Overland
@@ -95,13 +96,9 @@
         this.locationManager = locationManager;
     }
 
+    @Autowired
     private ConfigurationManager<ReportConfiguration> configurationManager;
     
-    public void setConfigurationManager( ConfigurationManager<ReportConfiguration> configurationManager )
-    {
-        this.configurationManager = configurationManager;
-    }
-
     // -------------------------------------------------------------------------
     // ReportManager implementation
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml	2010-05-17 14:19:14 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml	2010-05-17 20:22:43 +0000
@@ -83,8 +83,6 @@
       value="reportConfiguration.xml"/>
     <property name="locationManager"
       ref="org.hisp.dhis.external.location.LocationManager"/>
-    <property name="configurationManager"
-      ref="org.hisp.dhis.external.configuration.ConfigurationManager"/>
     <property name="jdbcConfiguration" ref="jdbcConfiguration"/>
   </bean>
   
@@ -155,8 +153,6 @@
       ref="org.hisp.dhis.period.PeriodService"/>
     <property name="locationManager"
       ref="org.hisp.dhis.external.location.LocationManager"/>
-    <property name="configurationManager"
-      ref="org.hisp.dhis.external.configuration.ConfigurationManager"/>
     <property name="completenessStore"
       ref="org.hisp.dhis.completeness.DataSetCompletenessStore"/>
   </bean>

=== modified file 'dhis-2/dhis-support/dhis-support-external/pom.xml'
--- dhis-2/dhis-support/dhis-support-external/pom.xml	2010-04-08 16:55:35 +0000
+++ dhis-2/dhis-support/dhis-support-external/pom.xml	2010-05-17 20:22:43 +0000
@@ -27,7 +27,11 @@
     </dependency>
     
     <!-- Other -->
-    
+	
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-context</artifactId>
+	</dependency>
     <dependency>
       <groupId>commons-logging</groupId>
       <artifactId>commons-logging</artifactId>

=== modified file 'dhis-2/dhis-support/dhis-support-external/src/main/java/org/hisp/dhis/external/configuration/DefaultConfigurationManager.java'
--- dhis-2/dhis-support/dhis-support-external/src/main/java/org/hisp/dhis/external/configuration/DefaultConfigurationManager.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-support/dhis-support-external/src/main/java/org/hisp/dhis/external/configuration/DefaultConfigurationManager.java	2010-05-17 20:22:43 +0000
@@ -31,12 +31,15 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 
+import org.springframework.stereotype.Component;
+
 import com.thoughtworks.xstream.XStream;
 
 /**
  * @author Lars Helge Overland
  * @version $Id$
  */
+@Component("configurationManager")
 public class DefaultConfigurationManager<T>
     implements ConfigurationManager<T>
 {

=== modified file 'dhis-2/dhis-support/dhis-support-external/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-support/dhis-support-external/src/main/resources/META-INF/dhis/beans.xml	2010-05-17 14:19:14 +0000
+++ dhis-2/dhis-support/dhis-support-external/src/main/resources/META-INF/dhis/beans.xml	2010-05-17 20:22:43 +0000
@@ -1,8 +1,17 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns="http://www.springframework.org/schema/beans";
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-       xsi:schemaLocation="
-http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd";>
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
+  xmlns:context="http://www.springframework.org/schema/context";
+  xmlns:tx="http://www.springframework.org/schema/tx";
+  xmlns:aop="http://www.springframework.org/schema/aop";
+  xsi:schemaLocation="
+    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
+    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
+    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd";
+    default-autowire="byName">
+
+  <context:component-scan base-package="org.hisp.dhis"/>
   
   <bean id="org.hisp.dhis.external.location.LocationManager"
     class="org.hisp.dhis.external.location.DefaultLocationManager"
@@ -15,8 +24,5 @@
     class="org.hisp.dhis.external.location.DefaultLocationManagerResolver">
     <property name="locationManager" ref="org.hisp.dhis.external.location.LocationManager"/>
   </bean>
-
-  <bean id="org.hisp.dhis.external.configuration.ConfigurationManager"
-    class="org.hisp.dhis.external.configuration.DefaultConfigurationManager"/>
-    
+   
 </beans>

=== modified file 'dhis-2/dhis-support/dhis-support-external/src/test/java/org/hisp/dhis/external/configuration/ConfigurationManagerTest.java'
--- dhis-2/dhis-support/dhis-support-external/src/test/java/org/hisp/dhis/external/configuration/ConfigurationManagerTest.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-support/dhis-support-external/src/test/java/org/hisp/dhis/external/configuration/ConfigurationManagerTest.java	2010-05-17 20:22:43 +0000
@@ -37,6 +37,7 @@
 import org.hisp.dhis.external.location.LocationManager;
 import org.hisp.dhis.external.location.LocationManagerException;
 import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.annotation.NotTransactional;
 
 /**
@@ -46,6 +47,7 @@
 public class ConfigurationManagerTest
     extends DhisSpringTest
 {
+    @Autowired
     private ConfigurationManager<DummyConfiguration> configurationManager;
     
     private LocationManager locationManager;
@@ -53,12 +55,9 @@
     private DummyConfiguration configurationA;
     private DummyConfiguration configurationB;
     
-    @SuppressWarnings( "unchecked" )
     @Override
     public void setUpTest()
     {
-        configurationManager = (ConfigurationManager<DummyConfiguration>) getBean( ConfigurationManager.ID );
-        
         locationManager = (LocationManager) getBean( LocationManager.ID );
         
         configurationA = new DummyConfiguration( "homeA", "directoryA" );

=== modified file 'dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/META-INF/dhis/beans.xml	2010-05-17 19:31:07 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/META-INF/dhis/beans.xml	2010-05-17 20:22:43 +0000
@@ -1,18 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns="http://www.springframework.org/schema/beans";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
-  xmlns:context="http://www.springframework.org/schema/context";
   xmlns:tx="http://www.springframework.org/schema/tx";
   xmlns:aop="http://www.springframework.org/schema/aop";
   xsi:schemaLocation="
-   http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
-   http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
-   http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
-   http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd";
-   default-autowire="byName">
+    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
+    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd";>
 
-  <context:component-scan base-package="org.hisp.dhis"/>
-		   
   <!-- Transactions -->
 
   <tx:annotation-driven transaction-manager="transactionManager"/>