=== 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 2016-01-08 16:27:29 +0000 +++ dhis-2/dhis-support/dhis-support-external/src/main/java/org/hisp/dhis/external/conf/DefaultDhisConfigurationProvider.java 2016-01-11 19:40:56 +0000 @@ -137,13 +137,19 @@ } @Override + public boolean isReadOnlyMode() + { + return ENABLED_VALUE.equals( getProperty( ConfigurationKey.SYSTEM_READ_ONLY_MODE ) ); + } + + @Override public boolean isLdapConfigured() { String ldapUrl = getProperty( ConfigurationKey.LDAP_URL ); String managerDn = getProperty( ConfigurationKey.LDAP_MANAGER_DN ); - return !(ConfigurationKey.LDAP_URL.getDefaultValue().equals( ldapUrl ) || - ldapUrl == null || managerDn == null); + return !( ConfigurationKey.LDAP_URL.getDefaultValue().equals( ldapUrl ) || + ldapUrl == null || managerDn == null ); } @Override === modified file 'dhis-2/dhis-support/dhis-support-external/src/main/java/org/hisp/dhis/external/conf/DhisConfigurationProvider.java' --- dhis-2/dhis-support/dhis-support-external/src/main/java/org/hisp/dhis/external/conf/DhisConfigurationProvider.java 2016-01-05 18:25:17 +0000 +++ dhis-2/dhis-support/dhis-support-external/src/main/java/org/hisp/dhis/external/conf/DhisConfigurationProvider.java 2016-01-11 19:40:56 +0000 @@ -75,6 +75,13 @@ boolean isEnabled( ConfigurationKey key ); /** + * Indicates whether the system is set to read-only mode. + * + * @return the if the system is in read-only mode. + */ + public boolean isReadOnlyMode(); + + /** * Indicates whether LDAP authentication is configured. * * @return true if LDAP authentication is configured. === 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 2016-01-04 02:27:49 +0000 +++ dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/DefaultHibernateConfigurationProvider.java 2016-01-11 19:40:56 +0000 @@ -150,6 +150,13 @@ Properties fileProperties = configurationProvider.getProperties(); mapToHibernateProperties( fileProperties ); + + if ( configurationProvider.isReadOnlyMode() ) + { + fileProperties.setProperty( "hibernate.hbm2ddl.auto", "validate" ); + + log.info( "Setting hibernate.hbm2ddl.auto to 'validate' due to read-only mode" ); + } configuration.addProperties( fileProperties ); } @@ -168,7 +175,7 @@ configuration.setProperty( "hibernate.cache.use_second_level_cache", "false" ); configuration.setProperty( "hibernate.cache.use_query_cache", "false" ); } - + log.info( "Hibernate configuration loaded, using dialect: " + configuration.getProperty( "hibernate.dialect" ) ); this.configuration = configuration; === modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/startup/DefaultStartupRoutineExecutor.java' --- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/startup/DefaultStartupRoutineExecutor.java 2016-01-04 02:27:49 +0000 +++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/startup/DefaultStartupRoutineExecutor.java 2016-01-11 19:40:56 +0000 @@ -30,7 +30,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.hisp.dhis.external.conf.ConfigurationKey; import org.hisp.dhis.external.conf.DhisConfigurationProvider; import org.springframework.beans.factory.annotation.Autowired; @@ -41,7 +40,7 @@ /** * Default implementation of StartupRoutineExecutor. The execute method will - * execute the added StartupRoutines ordered by their runlevels. Startup routines + * execute the added StartupRoutines ordered by their run levels. Startup routines * can be ignored from the command line by appending the below. * * -Ddhis.skip.startup=true @@ -102,14 +101,13 @@ private void execute( boolean testing ) throws Exception { - if ( TRUE.equalsIgnoreCase( System.getProperty( SKIP_PROP ) ) ) { LOG.info( "Skipping startup routines, system property " + SKIP_PROP + " is true" ); return; } - if ( config.isEnabled( ConfigurationKey.SYSTEM_READ_ONLY_MODE ) ) + if ( config.isReadOnlyMode() ) { LOG.info( "Skipping startup routines, read-only mode is enabled" ); return;