← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21577: App install, checking if system base url is set

 

------------------------------------------------------------
revno: 21577
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2016-01-04 17:58:59 +0100
message:
  App install, checking if system base url is set
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/appmanager/DefaultAppManager.java
  dhis-2/dhis-support/dhis-support-external/src/main/java/org/hisp/dhis/external/conf/ConfigurationKey.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ConfigurationController.java


--
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-core/src/main/java/org/hisp/dhis/appmanager/DefaultAppManager.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/appmanager/DefaultAppManager.java	2016-01-04 12:22:42 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/appmanager/DefaultAppManager.java	2016-01-04 16:58:59 +0000
@@ -148,6 +148,11 @@
         {
             String baseUrl = config.getProperty( ConfigurationKey.SYSTEM_BASE_URL );
             
+            if ( baseUrl == null )
+            {
+                return AppStatus.MISSING_SYSTEM_BASE_URL;
+            }
+            
             // -----------------------------------------------------------------
             // Parse ZIP file and it's manifest.webapp file.
             // -----------------------------------------------------------------

=== 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	2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-support/dhis-support-external/src/main/java/org/hisp/dhis/external/conf/ConfigurationKey.java	2016-01-04 16:58:59 +0000
@@ -33,7 +33,7 @@
  */
 public enum ConfigurationKey
 {
-    SYSTEM_BASE_URL( "system.base_url", "http://localhost:8080/dhis"; ),
+    SYSTEM_BASE_URL( "system.base_url" ),
     SYSTEM_READ_ONLY_MODE( "system.read_only_mode", "off" ),
     CONNECTION_DIALECT( "connection.dialect" ),
     CONNECTION_DRIVER_CLASS( "connection.driver_class" ),

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ConfigurationController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ConfigurationController.java	2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ConfigurationController.java	2016-01-04 16:58:59 +0000
@@ -40,6 +40,8 @@
 import org.hisp.dhis.configuration.ConfigurationService;
 import org.hisp.dhis.dataelement.DataElementGroup;
 import org.hisp.dhis.dxf2.render.RenderService;
+import org.hisp.dhis.external.conf.ConfigurationKey;
+import org.hisp.dhis.external.conf.DhisConfigurationProvider;
 import org.hisp.dhis.indicator.IndicatorGroup;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
@@ -69,6 +71,9 @@
     private ConfigurationService configurationService;
 
     @Autowired
+    private DhisConfigurationProvider config;
+    
+    @Autowired
     private IdentifiableObjectManager identifiableObjectManager;
 
     @Autowired
@@ -374,6 +379,18 @@
         
         configurationService.setConfiguration( config );
     }
+    
+    @RequestMapping( value = "/systemBaseUrl", method = RequestMethod.GET )
+    public String getSystemBaseUrl( Model model, HttpServletRequest request )
+    {
+        return setModel( model, config.getProperty( ConfigurationKey.SYSTEM_BASE_URL ) );
+    }
+
+    @RequestMapping( value = "/systemReadOnlyMode", method = RequestMethod.GET )
+    public String getSystemReadOnlyMode( Model model, HttpServletRequest request )
+    {
+        return setModel( model, config.getProperty( ConfigurationKey.SYSTEM_READ_ONLY_MODE ) );
+    }
 
     // -------------------------------------------------------------------------
     // Supportive methods