← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13605: expose reloadApp in appManager, reload apps on pageload/save-settings in appSettings

 

------------------------------------------------------------
revno: 13605
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-01-07 11:21:09 +0100
message:
  expose reloadApp in appManager, reload apps on pageload/save-settings in appSettings
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppManager.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/appmanager/DefaultAppManager.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AppSettingsAction.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-api/src/main/java/org/hisp/dhis/appmanager/AppManager.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppManager.java	2014-01-07 09:55:49 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppManager.java	2014-01-07 10:21:09 +0000
@@ -113,4 +113,9 @@
      * @param appBaseUrl
      */
     void setAppBaseUrl( String appBaseUrl );
+
+    /**
+     * Reload list of apps.
+     */
+    void reloadApps();
 }

=== 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	2013-10-22 15:02:04 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/appmanager/DefaultAppManager.java	2014-01-07 10:21:09 +0000
@@ -66,7 +66,7 @@
     @PostConstruct
     private void init()
     {
-        reloadAppsInternal();
+        reloadApps();
         
         log.info( "Detecting apps: " + apps );
     }
@@ -142,7 +142,7 @@
 
         zip.close();
                 
-        reloadAppsInternal(); // Reload app state
+        reloadApps(); // Reload app state
     }
 
     @Override
@@ -166,7 +166,7 @@
                 }
                 finally
                 {
-                    reloadAppsInternal(); // Reload app state
+                    reloadApps(); // Reload app state
                 }
             }
         }
@@ -221,7 +221,8 @@
     /**
      * Sets the list of apps with detected apps from the file system.
      */
-    private void reloadAppsInternal()
+    @Override
+    public void reloadApps()
     {
         List<App> appList = new ArrayList<App>();
         ObjectMapper mapper = new ObjectMapper();

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AppSettingsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AppSettingsAction.java	2013-10-22 15:02:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AppSettingsAction.java	2014-01-07 10:21:09 +0000
@@ -28,11 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.io.File;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-
+import com.opensymphony.xwork2.Action;
 import org.apache.struts2.ServletActionContext;
 import org.hisp.dhis.appmanager.App;
 import org.hisp.dhis.appmanager.AppManager;
@@ -40,7 +36,9 @@
 import org.hisp.dhis.util.ContextUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import com.opensymphony.xwork2.Action;
+import javax.servlet.http.HttpServletRequest;
+import java.io.File;
+import java.util.List;
 
 /**
  * @author Saptarshi Purkayastha
@@ -78,7 +76,7 @@
             {
                 appFolderPath = realPath + File.separatorChar + "apps";
             }
-            
+
             appManager.setAppFolderPath( appFolderPath );
         }
 
@@ -156,6 +154,8 @@
     public String execute()
     {
         message = i18n.getString( "appmanager_saved_settings" );
+        appManager.reloadApps();
+
         return isSaved ? SUCCESS : "getSuccess";
     }
 }