dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #05947
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1875: Replaced databaseInfoProvider bean with annotations
------------------------------------------------------------
revno: 1875
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Tue 2010-05-18 15:42:38 +0200
message:
Replaced databaseInfoProvider bean with annotations
modified:
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/startup/OpenHealthDataSourceWriter.java
dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/database/HibernateDatabaseInfoProvider.java
dhis-2/dhis-support/dhis-support-system/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/database/DatabaseInfoProviderTest.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/about/action/AboutAction.java
dhis-2/dhis-web/dhis-web-commons/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-services/dhis-service-reporting/src/main/java/org/hisp/dhis/startup/OpenHealthDataSourceWriter.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/startup/OpenHealthDataSourceWriter.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/startup/OpenHealthDataSourceWriter.java 2010-05-18 13:42:38 +0000
@@ -37,6 +37,7 @@
import org.hisp.dhis.system.database.DatabaseInfoProvider;
import org.hisp.dhis.system.startup.AbstractStartupRoutine;
import org.hisp.dhis.system.util.StreamUtils;
+import org.springframework.beans.factory.annotation.Autowired;
/**
* @author Lars Helge Overland
@@ -73,13 +74,9 @@
// Dependencies
// -------------------------------------------------------------------------
+ @Autowired
private DatabaseInfoProvider databaseInfoProvider;
-
- public void setDatabaseInfoProvider( DatabaseInfoProvider databaseInfoProvider )
- {
- this.databaseInfoProvider = databaseInfoProvider;
- }
-
+
// -------------------------------------------------------------------------
// AbstractStartupRoutine 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 22:56:52 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml 2010-05-18 13:42:38 +0000
@@ -81,7 +81,6 @@
value="reports"/>
<property name="reportConfigFile"
value="reportConfiguration.xml"/>
- <property name="jdbcConfiguration" ref="jdbcConfiguration"/>
</bean>
<!-- Chart -->
@@ -241,8 +240,6 @@
class="org.hisp.dhis.startup.OpenHealthDataSourceWriter">
<property name="environmentVariable" value="OPENHEALTH_HOME"/>
<property name="dataSourceFile" value="datasources.xml"/>
- <property name="databaseInfoProvider"
- ref="org.hisp.dhis.system.database.DatabaseInfoProvider"/>
</bean>
<bean id="org.hisp.dhis.startup.ReportTableUpgrader"
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/database/HibernateDatabaseInfoProvider.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/database/HibernateDatabaseInfoProvider.java 2010-05-17 21:31:03 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/database/HibernateDatabaseInfoProvider.java 2010-05-18 13:42:38 +0000
@@ -27,14 +27,18 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import javax.annotation.PostConstruct;
+
import org.hibernate.cfg.Configuration;
import org.hisp.dhis.hibernate.HibernateConfigurationProvider;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
/**
* @author Lars Helge Overland
* @version $Id$
*/
+@Component("databaseInfoProvider")
public class HibernateDatabaseInfoProvider
implements DatabaseInfoProvider
{
@@ -60,6 +64,7 @@
@Autowired
private HibernateConfigurationProvider configurationProvider;
+ @PostConstruct
public void init()
{
Configuration config = configurationProvider.getConfiguration();
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-support/dhis-support-system/src/main/resources/META-INF/dhis/beans.xml 2010-05-17 22:56:52 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/resources/META-INF/dhis/beans.xml 2010-05-18 13:42:38 +0000
@@ -14,10 +14,5 @@
<bean id="deletionInterceptor"
class="org.hisp.dhis.system.deletion.DeletionInterceptor">
</bean>
-
- <bean id="org.hisp.dhis.system.database.DatabaseInfoProvider"
- class="org.hisp.dhis.system.database.HibernateDatabaseInfoProvider"
- init-method="init">
- </bean>
-
+
</beans>
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/database/DatabaseInfoProviderTest.java'
--- dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/database/DatabaseInfoProviderTest.java 2010-05-10 17:50:39 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/database/DatabaseInfoProviderTest.java 2010-05-18 13:42:38 +0000
@@ -31,6 +31,7 @@
import org.hisp.dhis.DhisSpringTest;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
/**
* @author Lars Helge Overland
@@ -39,17 +40,8 @@
public class DatabaseInfoProviderTest
extends DhisSpringTest
{
- private DatabaseInfoProvider provider;
-
- // -------------------------------------------------------------------------
- // Fixture
- // -------------------------------------------------------------------------
-
- @Override
- public void setUpTest()
- {
- provider = (DatabaseInfoProvider) getBean( DatabaseInfoProvider.ID );
- }
+ @Autowired
+ private DatabaseInfoProvider databaseInfoProvider;
// -------------------------------------------------------------------------
// Tests
@@ -58,7 +50,7 @@
@Test
public void testGetDatabaseInfo()
{
- DatabaseInfo info = provider.getDatabaseInfo();
+ DatabaseInfo info = databaseInfoProvider.getDatabaseInfo();
assertNotNull( info );
assertNotNull( info.getType() );
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/about/action/AboutAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/about/action/AboutAction.java 2010-05-17 21:05:26 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/about/action/AboutAction.java 2010-05-18 13:42:38 +0000
@@ -62,12 +62,8 @@
@Autowired
private LocationManager locationManager;
- private DatabaseInfoProvider provider;
-
- public void setProvider( DatabaseInfoProvider provider )
- {
- this.provider = provider;
- }
+ @Autowired
+ private DatabaseInfoProvider databaseInfoProvider;
private I18n i18n;
@@ -211,7 +207,7 @@
// Database
// ---------------------------------------------------------------------
- info = provider.getDatabaseInfo();
+ info = databaseInfoProvider.getDatabaseInfo();
try
{
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2010-05-17 21:05:26 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2010-05-18 13:42:38 +0000
@@ -558,11 +558,7 @@
<!-- About -->
- <bean id="org.hisp.dhis.about.action.AboutAction" class="org.hisp.dhis.about.action.AboutAction"
- scope="prototype">
- <property name="provider"
- ref="org.hisp.dhis.system.database.DatabaseInfoProvider" />
- </bean>
+ <bean id="org.hisp.dhis.about.action.AboutAction" class="org.hisp.dhis.about.action.AboutAction" scope="prototype"/>
<bean id="org.hisp.dhis.about.action.HelpAction" class="org.hisp.dhis.about.action.HelpAction"
scope="prototype">