[Yanel-commits] rev 25840 - public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/updatefinder

simon at wyona.com simon at wyona.com
Mon Jul 9 17:45:09 CEST 2007


Author: simon
Date: 2007-07-09 17:45:08 +0200 (Mon, 09 Jul 2007)
New Revision: 25840

Modified:
   public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/updatefinder/UpdateFinder.java
Log:
-getBestYanelWebapp() started. 
-overgive webapp so the update knows which webapp requested the update

Modified: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/updatefinder/UpdateFinder.java
===================================================================
--- public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/updatefinder/UpdateFinder.java	2007-07-09 12:44:36 UTC (rev 25839)
+++ public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/updatefinder/UpdateFinder.java	2007-07-09 15:45:08 UTC (rev 25840)
@@ -274,6 +274,7 @@
             htmlBodyContent.append("<p>");
             htmlBodyContent.append("Your installed yanel is: " + installInfo.getId() + "-v-" + installInfo.getVersion() + "-r-" + installInfo.getRevision());
             htmlBodyContent.append("</p>");
+            //TODO implement getBestYanelWebapp() to get all yanel-webapp version which has an yanel-updater which fits the targetRevision requirement of the current yanel.
             HashMap newestYanel = updateInfo.getNewestUpdateVersionsOf("id", "wyona-yanel-webapp");
             String idVersionRevisionNewest = (String) newestYanel.get("id") + "-v-" + (String) newestYanel.get("version") + "-r-" + (String) newestYanel.get("revision");
             if (idVersionRevisionNewest.equals(idVersionRevisionCurent)) {
@@ -349,6 +350,7 @@
     private void getUpdateConfirmScreen() {
         try {
             UpdateInfo updateInfo = getUpdateInfo();
+            InstallInfo installInfo = getInstallInfo();
             Map bestUpdater = getBestUpdater();
             TomcatContextHandler tomcatContextHandler = new TomcatContextHandler(request);
             
@@ -365,19 +367,21 @@
                 htmlBodyContent.append("<input type=\"submit\" name=\"button\" value=\"YES\"/>");
                 htmlBodyContent.append("<input type=\"hidden\" name=\"updateconfirmed\" value=\"updateconfirmed\"/>");
                 htmlBodyContent.append("<input type=\"hidden\" name=\"updatelink\" value=\"" + request.getParameter("updatelink") + "\"/>");
+                htmlBodyContent.append("<input type=\"hidden\" name=\"requestingwebapp\" value=\"" + installInfo.getWebaName() + "\"/>");
                 htmlBodyContent.append("</form>");
                 htmlBodyContent.append("<form method=\"post\">");
                 htmlBodyContent.append("<input type=\"submit\" name=\"button\" value=\"Cancel\"></input>");
                 htmlBodyContent.append("</form>");
                 htmlBodyContent.append("</p>");
             } else {
-                htmlBodyContent.append("<p>Yanel will download the update-manager (" + tomcatContextHandler.getWebappOfContext(bestUpdater.get("id") + "-v-" + bestUpdater.get("version") + "-r-" + bestUpdater.get("revision")) + ") which will download and install " + id + "-v-" + version + "-r-" + revision  + "</p>");
+                htmlBodyContent.append("<p>Yanel will download the update-manager (" + bestUpdater.get("id") + "-v-" + bestUpdater.get("version") + "-r-" + bestUpdater.get("revision") + ") which will download and install " + id + "-v-" + version + "-r-" + revision  + "</p>");
                 htmlBodyContent.append("<p>Do you want to continue?</p>");
                 htmlBodyContent.append("<p>");
                 htmlBodyContent.append("<form method=\"post\">");
                 htmlBodyContent.append("<input type=\"submit\" name=\"button\" value=\"YES\"/>");
                 htmlBodyContent.append("<input type=\"hidden\" name=\"updateconfirmed\" value=\"updateconfirmed\"/>");
                 htmlBodyContent.append("<input type=\"hidden\" name=\"updatelink\" value=\"" + request.getParameter("updatelink") + "\"/>");
+                htmlBodyContent.append("<input type=\"hidden\" name=\"requestingwebapp\" value=\"" + installInfo.getWebaName() + "\"/>");
                 htmlBodyContent.append("</form>");
                 htmlBodyContent.append("<form method=\"post\">");
                 htmlBodyContent.append("<input type=\"submit\" name=\"button\" value=\"Cancel\"></input>");
@@ -388,7 +392,6 @@
             log.error(e.getMessage(), e);
             htmlBodyContent.append("<p>An error occoured. Exception: " + e.getMessage() + "</p>");
         }
-
     }
     
     private void getUpdateScreen() {
@@ -407,7 +410,7 @@
             htmlBodyContent.append("You will be redirected to the updater which will automaticaly download and install the requested yanel.");
             htmlBodyContent.append("</p>");
             
-            htmlHeadContent.append("<meta http-equiv=\"refresh\" content=\"10; URL=" + "http://" + request.getServerName() + ":" + request.getServerPort() + "/" + bestUpdater.get("id") + "-v-" + bestUpdater.get("version") + "-r-" + bestUpdater.get("revision") + "/" + "?updatelink=" + request.getParameter("updatelink") + "\"/>");
+            htmlHeadContent.append("<meta http-equiv=\"refresh\" content=\"10; URL=" + "http://" + request.getServerName() + ":" + request.getServerPort() + "/" + bestUpdater.get("id") + "-v-" + bestUpdater.get("version") + "-r-" + bestUpdater.get("revision") + "/" + "?updatelink=" + request.getParameter("updatelink") + "&amp;requestingwebapp=" + request.getParameter("requestingwebapp") + "\"/>");
         } catch (Exception e) {
             log.error(e.getMessage(), e);
             htmlBodyContent.append("<p>Update failed. Exception: " + e.getMessage() + "</p>");
@@ -453,6 +456,15 @@
         }
         return (HashMap) bestUpdater.get(bestUpdater.size() - 1);
     }
+    
+    private HashMap getBestYanelWebapp() throws Exception {
+        InstallInfo installInfo = getInstallInfo();
+        UpdateInfo updateInfo = getUpdateInfo();
+        for (int i = 0; i < updateInfo.getUpdateVersions().size(); i++) {
+            //TODO not implemented yet.
+        }
+        return null;
+    }
 
     /**
      * Get XSLT path




More information about the Yanel-commits mailing list