dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #41268
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21015: Hibernate configuration provider. Using DhisConfigurationProvider.
------------------------------------------------------------
revno: 21015
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-11-10 18:36:28 +0100
message:
Hibernate configuration provider. Using DhisConfigurationProvider.
modified:
dhis-2/dhis-support/dhis-support-external/src/main/java/org/hisp/dhis/external/conf/ConfigurationKey.java
dhis-2/dhis-support/dhis-support-external/src/main/java/org/hisp/dhis/external/conf/DefaultDhisConfigurationProvider.java
dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/DefaultHibernateConfigurationProvider.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-support/dhis-support-external/src/main/java/org/hisp/dhis/external/conf/ConfigurationKey.java'
--- dhis-2/dhis-support/dhis-support-external/src/main/java/org/hisp/dhis/external/conf/ConfigurationKey.java 2015-11-10 16:07:44 +0000
+++ dhis-2/dhis-support/dhis-support-external/src/main/java/org/hisp/dhis/external/conf/ConfigurationKey.java 2015-11-10 17:36:28 +0000
@@ -34,6 +34,12 @@
public enum ConfigurationKey
{
SYSTEM_NAME( "system.name" ),
+ CONNECTION_DIALECT( "connection.dialect" ),
+ CONNECTION_DRIVER_CLASS( "connection.driver_class" ),
+ CONNECTION_URL( "connection.url" ),
+ CONNECTION_USERNAME( "connection.username" ),
+ CONNECTION_PASSWORD( "connection.password" ),
+ CONNECTION_SCHEMA( "connection.schema" ),
LDAP_URL( "ldap.url", "ldaps://0:1" ),
LDAP_MANAGER_DN( "ldap.manager.dn" ),
LDAP_MANAGER_PASSWORD( "ldap.manager.password" ),
=== modified file 'dhis-2/dhis-support/dhis-support-external/src/main/java/org/hisp/dhis/external/conf/DefaultDhisConfigurationProvider.java'
--- dhis-2/dhis-support/dhis-support-external/src/main/java/org/hisp/dhis/external/conf/DefaultDhisConfigurationProvider.java 2015-11-10 16:37:04 +0000
+++ dhis-2/dhis-support/dhis-support-external/src/main/java/org/hisp/dhis/external/conf/DefaultDhisConfigurationProvider.java 2015-11-10 17:36:28 +0000
@@ -73,7 +73,7 @@
}
catch ( LocationManagerException ex1 )
{
- log.debug( "Could not load dhis.conf" );
+ log.debug( "Could not load dhis.conf, looking for hibernate.properties" );
try // Deprecated
{
=== modified file 'dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/DefaultHibernateConfigurationProvider.java'
--- dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/DefaultHibernateConfigurationProvider.java 2015-11-10 16:37:04 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/DefaultHibernateConfigurationProvider.java 2015-11-10 17:36:28 +0000
@@ -43,7 +43,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.cfg.Configuration;
-import org.hisp.dhis.external.location.LocationManager;
+import org.hisp.dhis.external.conf.DhisConfigurationProvider;
import org.hisp.dhis.external.location.LocationManagerException;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.FileSystemResource;
@@ -67,7 +67,6 @@
// -------------------------------------------------------------------------
private String defaultPropertiesFile = "hibernate-default.properties";
- private String propertiesFile = "hibernate.properties";
private List<Resource> jarResources = new ArrayList<>();
private List<Resource> dirResources = new ArrayList<>();
@@ -76,11 +75,11 @@
// Dependencies
// -------------------------------------------------------------------------
- private LocationManager locationManager;
+ private DhisConfigurationProvider configurationProvider;
- public void setLocationManager( LocationManager locationManager )
+ public void setConfigurationProvider( DhisConfigurationProvider configurationProvider )
{
- this.locationManager = locationManager;
+ this.configurationProvider = configurationProvider;
}
// -------------------------------------------------------------------------
@@ -143,7 +142,9 @@
try
{
- configuration.addProperties( getProperties( locationManager.getInputStream( propertiesFile ) ) );
+ Properties fileProperties = configurationProvider.getProperties();
+
+ configuration.addProperties( fileProperties );
}
catch ( LocationManagerException ex )
{
=== 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 2014-12-04 06:39:46 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/META-INF/dhis/beans.xml 2015-11-10 17:36:28 +0000
@@ -27,7 +27,7 @@
</bean>
<bean id="hibernateConfigurationProvider" class="org.hisp.dhis.hibernate.DefaultHibernateConfigurationProvider">
- <property name="locationManager" ref="locationManager" />
+ <property name="configurationProvider" ref="dhisConfigurationProvider" />
</bean>
<bean id="hibernateMappingDirectoryLocations" class="org.hisp.dhis.hibernate.HibernateMappingDirectoryLocationsFactoryBean">