[Yanel-commits] rev 26027 - in public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/updatefinder: . utils

simon at wyona.com simon at wyona.com
Tue Jul 17 00:10:21 CEST 2007


Author: simon
Date: 2007-07-17 00:10:20 +0200 (Tue, 17 Jul 2007)
New Revision: 26027

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/utils/UpdateInfo.java
Log:
improved error handling, improved methodes to get reasonable updates

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-16 18:31:16 UTC (rev 26026)
+++ public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/updatefinder/UpdateFinder.java	2007-07-16 22:10:20 UTC (rev 26027)
@@ -61,6 +61,7 @@
 import org.xml.sax.helpers.XMLReaderFactory;
 
 
+
 import com.hp.hpl.jena.rdf.model.*;
 
 /**
@@ -248,88 +249,108 @@
     }
 
     private void plainRequest() {
+
         UpdateInfo updateInfo = null;
         InstallInfo installInfo = null;
+
         try {
             installInfo = getInstallInfo();
         } catch (Exception e) {
             log.error(e.getMessage(), e);
-            htmlBodyContent.append("<p>Failed to get install information. Exception: " + e.getMessage() + "</p>");
+            htmlBodyContent.append("<p>Could not get install information. " + e.getMessage() + "</p>");
             return;
         }
-        
+        try {
+            updateInfo = getUpdateInfo();
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            htmlBodyContent.append("<p>Could not get update information. " + e.getMessage() + "</p>");
+            return;
+        }
+
         if (!installInfo.getInstalltype().equals("bin-snapshot")) {
-
             htmlBodyContent.append("<p>");
             htmlBodyContent.append("This Yanel was not installed from binary. You can only use the updater if you installed yanel from binary. Please use svn up, build.sh");
             htmlBodyContent.append("</p>");
+            return;
+        }
+
+        String idVersionRevisionCurent = installInfo.getId() + "-v-" + installInfo.getVersion() + "-r-" + installInfo.getRevision();
+
+        // show installed version
+        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 and is not
+        // allready installed.
+
+        ArrayList updatebleYanelVersions = null;
+        try {
+            updatebleYanelVersions = getSuiteableYanelUpdates();
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            htmlBodyContent.append("<p>Could not get Updates. " + e.getMessage() + "</p>");
+        }
+
+        if (updatebleYanelVersions == null) {
+            htmlBodyContent.append("<p>");
+            htmlBodyContent.append("No updates found.");
+            htmlBodyContent.append("</p>");
         } else {
-            try {
-                updateInfo = getUpdateInfo();
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                htmlBodyContent.append("<p>Failed to get update information. Exception: " + e.getMessage() + "</p>");
-                return;
-            }
-            String idVersionRevisionCurent = installInfo.getId() + "-v-" + installInfo.getVersion() + "-r-" + installInfo.getRevision();
-            
+        
+        HashMap newestYanel = (HashMap) updatebleYanelVersions.get(updatebleYanelVersions.size() - 1);
+        String newestYanelName = (String) newestYanel.get("id") + "-v-"
+                + (String) newestYanel.get("version") + "-r-"
+                + (String) newestYanel.get("revision");
+        if (newestYanelName.equals(idVersionRevisionCurent)) {
             htmlBodyContent.append("<p>");
-            htmlBodyContent.append("Your installed yanel is: " + installInfo.getId() + "-v-" + installInfo.getVersion() + "-r-" + installInfo.getRevision());
+            htmlBodyContent.append("Your yanel is already the newest version.");
             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 and is not allready installed.
-            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)) {
-                htmlBodyContent.append("<p>");
-                htmlBodyContent.append("Your yanel is already the newest version.");
-                htmlBodyContent.append("</p>");
-            }else {
-                htmlBodyContent.append("<p>");
-                htmlBodyContent.append("Newest yanel is: " + idVersionRevisionNewest);
-                htmlBodyContent.append("<form method=\"post\"><input type=\"submit\" name=\"button\" value=\"update\"></input><input type=\"hidden\" name=\"update\" value=\"update\"></input><input type=\"hidden\" name=\"updatelink\" value=\""
-                        + newestYanel.get("updateLink") + "\"/></form>");
-                htmlBodyContent.append("</p>");
-            }
-
+        } else {
             htmlBodyContent.append("<p>");
-            htmlBodyContent.append("Other versions you can get:");
+            htmlBodyContent.append("Newest yanel is: " + newestYanelName);
+            htmlBodyContent.append("<form method=\"post\"><input type=\"submit\" name=\"button\" value=\"update\"></input><input type=\"hidden\" name=\"update\" value=\"update\"></input><input type=\"hidden\" name=\"updatelink\" value=\"" + newestYanel.get("updateLink") + "\"/></form>");
             htmlBodyContent.append("</p>");
-            htmlBodyContent.append("<ul>");
-            for (int i = 0; i < updateInfo.getUpdateVersions().size(); i++) {
-                HashMap versionDetails = (HashMap) updateInfo.getUpdateVersionsOf("id", "wyona-yanel-webapp").get(i);
-                String idVersionRevisionItem = (String) versionDetails.get("id") + "-v-" + (String) versionDetails.get("version") + "-r-" + (String) versionDetails.get("revision");
-                
-                if ( !idVersionRevisionItem.equals(idVersionRevisionCurent) && !idVersionRevisionItem.equals(idVersionRevisionNewest)) {
-                    htmlBodyContent.append("<li>"
-                            + versionDetails.get("title")
-                            + "<ul>"
-                            + "<li>Version: "
-                            + idVersionRevisionItem
-                            + "</li>"
-                            + "<li>Type: "
-                            + versionDetails.get("type")
-                            + "</li>"
-                            + "<li> ChangeLog: "
-                            + versionDetails.get("changeLog")
-                            + "</li>"
-                            + "<li> <form method=\"post\"><input type=\"submit\" name=\"button\" value=\"update\"></input><input type=\"hidden\" name=\"update\" value=\"update\"/><input type=\"hidden\" name=\"updatelink\" value=\""
-                            + versionDetails.get("updateLink") + "\"/></form></li>" + "</ul></li>");
-                }
-            }
-            htmlBodyContent.append("</ul>");
-            
+        }
+
+        htmlBodyContent.append("<p>");
+        htmlBodyContent.append("Other versions you can get:");
+        htmlBodyContent.append("</p>");
+        htmlBodyContent.append("<ul>");
+
+        for (int i = 0; i < updatebleYanelVersions.size(); i++) {
+            HashMap versionDetails = (HashMap) updatebleYanelVersions.get(i);
+            String idVersionRevisionItem = (String) versionDetails.get("id") + "-v-"
+                    + (String) versionDetails.get("version") + "-r-"
+                    + (String) versionDetails.get("revision");
+
+                htmlBodyContent.append("<li>"
+                        + versionDetails.get("title")
+                        + "<ul>"
+                        + "<li>Version: "
+                        + idVersionRevisionItem
+                        + "</li>"
+                        + "<li>Type: "
+                        + versionDetails.get("type")
+                        + "</li>"
+                        + "<li> ChangeLog: "
+                        + versionDetails.get("changeLog")
+                        + "</li>"
+                        + "<li> <form method=\"post\"><input type=\"submit\" name=\"button\" value=\"update\"></input><input type=\"hidden\" name=\"update\" value=\"update\"/><input type=\"hidden\" name=\"updatelink\" value=\""
+                        + versionDetails.get("updateLink") + "\"/></form></li>" + "</ul></li>");
+        }
+        htmlBodyContent.append("</ul>");
+        }
+        
+        // show installed versions
+        try {
             htmlBodyContent.append("<p>");
             htmlBodyContent.append("Installed versions:");
             htmlBodyContent.append("</p>");
-            TomcatContextHandler tomcatContextHandler = null;
-            Map contextAndWebapp = null;
-            try {
-                tomcatContextHandler = new TomcatContextHandler(request);
-                contextAndWebapp = tomcatContextHandler.getContextAndWebapp();
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                htmlBodyContent.append("<p>Lookup for context and webabs failed. Exception: " + e.getMessage() + "</p>");
-            }
+            TomcatContextHandler tomcatContextHandler = new TomcatContextHandler(request);
+            Map contextAndWebapp = tomcatContextHandler.getContextAndWebapp();
 
             htmlBodyContent.append("<table class=\"sortable\">");
             htmlBodyContent.append("<thead>");
@@ -337,15 +358,21 @@
             htmlBodyContent.append("</thead>");
             htmlBodyContent.append("<tbody>");
             Iterator iterator = contextAndWebapp.keySet().iterator();
-            
+
             while (iterator.hasNext()) {
                 String context = (String) iterator.next();
                 String webapp = (String) contextAndWebapp.get(context);
-                htmlBodyContent.append("<tr><td><a href=\"" + "http://" + request.getServerName() + ":"
-                    + request.getServerPort() + "/" + context.replaceAll("/", "") + "\">" + context + "</a></td><td>" + webapp + "</td></tr>");
+                htmlBodyContent.append("<tr><td><a href=\"" + "http://" + request.getServerName()
+                        + ":" + request.getServerPort() + "/" + context.replaceAll("/", "") + "\">"
+                        + context + "</a></td><td>" + webapp + "</td></tr>");
             }
             htmlBodyContent.append("</tbody>");
             htmlBodyContent.append("</table>");
+
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            htmlBodyContent.append("<p>Could not get installed versions. " + e.getMessage() + "</p>");
+            return;
         }
     }
 
@@ -435,8 +462,7 @@
         InstallInfo installInfo = getInstallInfo();
         UpdateInfo updateInfo = getUpdateInfo();
         
-        HashMap updateVersionDetails = updateInfo.getUpdateVersionDetail("updateLink",
-                request.getParameter("updatelink"));
+        HashMap updateVersionDetails = updateInfo.getUpdateVersionDetail("updateLink", request.getParameter("updatelink"));
         VersionComparator versionComparator = new VersionComparator();
         String updateId = (String) updateVersionDetails.get("id");
         String updateVersion = (String) updateVersionDetails.get("version");
@@ -458,14 +484,27 @@
         return (HashMap) bestUpdater.get(bestUpdater.size() - 1);
     }
     
-    private HashMap getBestYanelWebapp() throws Exception {
+    /**
+     * @return ArrayList with all updates which are matching the revision requirement and are not installed yet. or null if none.
+     * @throws Exception
+     */
+    private ArrayList getSuiteableYanelUpdates() throws Exception {
         InstallInfo installInfo = getInstallInfo();
         UpdateInfo updateInfo = getUpdateInfo();
-        for (int i = 0; i < updateInfo.getUpdateVersions().size(); i++) {
-            //TODO not implemented yet.
-            //TODO implement getBestYanelWebapp() to get all yanel-webapp version which has an yanel-updater which fits the targetRevision requirement of the current yanel and is not allready installed.
+        TomcatContextHandler tomcatContextHandler = new TomcatContextHandler(request);
+        
+        ArrayList updates = updateInfo.getYanelUpatesForYanelRevision(installInfo.getRevision());
+        if (updates == null) return null;
+        for (int i = 0; i < updates.size(); i++) {
+            HashMap versionDetail = (HashMap) updates.get(i);
+            for (int j = 0; j < tomcatContextHandler.getWebappNames().length; j++) {
+                if (tomcatContextHandler.getWebappNames()[j].equals(versionDetail.get("id") + "-v-" + versionDetail.get("version") + "-r-" + versionDetail.get("revision"))) {
+                    updates.remove(i);
+                }
+            }
         }
-        return null;
+        if (updates.size() < 1) return null;  
+        return updates;
     }
 
     /**

Modified: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/updatefinder/utils/UpdateInfo.java
===================================================================
--- public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/updatefinder/utils/UpdateInfo.java	2007-07-16 18:31:16 UTC (rev 26026)
+++ public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/updatefinder/utils/UpdateInfo.java	2007-07-16 22:10:20 UTC (rev 26027)
@@ -18,6 +18,8 @@
 import com.hp.hpl.jena.rdf.model.impl.PropertyImpl;
 import java.util.HashMap;
 
+import javax.servlet.http.HttpServletRequest;
+
 /**
  * 
  */
@@ -87,11 +89,6 @@
         while (iter2.hasNext()) {
             Resource versionResource = ((Resource) iter2.next());
             
-            
-            
-            
-            
-            
             HashMap updateVersionDetail = new HashMap();
             updateVersionDetail.put("type", typeResource.getProperty(typeProperty).getString());
             updateVersionDetail.put("title", versionResource.getProperty(titleProperty).getString());
@@ -106,55 +103,23 @@
             updateVersionDetail.put("targetApllicationMinRevision", versionResource.getProperty(targetApplicationminRevisionProperty).getString());
             updateVersionDetail.put("targetApllicationMaxRevision", versionResource.getProperty(targetApplicationmaxRevisionProperty).getString());
             this.updateVersions.add(updateVersionDetail);
-            
-            
-            
-            //check id
-            //if (versionResource.getProperty(idProperty).getString().equals(installInfo.getId())) {
-                //check for targetApplicationId
-//                Seq targetApplicationSeq = versionResource.getProperty(targetApplicationProperty).getSeq();
-//                NodeIterator targetApplicationIter = targetApplicationSeq.iterator();
-//                while (targetApplicationIter.hasNext()) {
-//                    Resource targetApplicationResource = ((Resource) targetApplicationIter.next());
-//                    String test1 = targetApplicationResource.getProperty(idProperty).getString();
-//                    String test2 = installInfo.getTargetApplicationId();
-//                    System.out.println("taid: "+test1 +" install: "+ test2);
-//                    
-//                    //if (targetApplicationResource.getProperty(idProperty).getString().equals(installInfo.getTargetApplicationId())) {
-//
-//                        //check for minorVersion
-//                        //String minVersion = targetApplicationResource.getProperty(minVersionProperty).getString();
-//                        //String installVersion = installInfo.getTargetApplicationVersion();
-//                        //VersionComparator versionComparator = new VersionComparator(); 
-//                        //if (versionComparator.compare(installVersion, minVersion) >= 0) {
-//                            //check for maxVersion
-//                            //String maxVersion = targetApplicationResource.getProperty(maxVersionProperty).getString();
-//                            //if (versionComparator.compare(maxVersion, installVersion) >= 0) {
-//                                HashMap updateVersionDetail = new HashMap();
-//                                updateVersionDetail.put("type", typeResource.getProperty(typeProperty).getString());
-//                                updateVersionDetail.put("title", versionResource.getProperty(titleProperty).getString());
-//                                updateVersionDetail.put("id", versionResource.getProperty(idProperty).getString());
-//                                updateVersionDetail.put("version", versionResource.getProperty(versionProperty).getString());
-//                                updateVersionDetail.put("revision", versionResource.getProperty(revisionProperty).getString());
-//                                updateVersionDetail.put("changeLog", versionResource.getProperty(changeLogProperty).getString());
-//                                updateVersionDetail.put("updateLink", targetApplicationResource.getProperty(updateLinkProperty).getString());
-//                                updateVersionDetail.put("targetApllication", targetApplicationResource.getProperty(idProperty).getString());
-//                                updateVersionDetail.put("targetApllicationMinVersion", targetApplicationResource.getProperty(minVersionProperty).getString());
-//                                updateVersionDetail.put("targetApllicationMaxVersion", targetApplicationResource.getProperty(maxVersionProperty).getString());
-//                                this.updateVersions.add(updateVersionDetail);
-//                            //}
-//                        //}
-//                    //}
-//                //}
-//                }
             }
         }
     }
-
+    
+    /**
+     * @return ArrayList with all update version
+     */
     public ArrayList getUpdateVersions() {
+        
         return updateVersions;
     }
     
+    /**
+     * @return HashMap with version details which are matching the value of the key
+     * @param String key
+     * @param String value 
+     */    
     public HashMap getUpdateVersionDetail(String key, String value) {
         for (int i = 0; i < updateVersions.size(); i++) {
             HashMap versionDetail = (HashMap) updateVersions.get(i);
@@ -172,25 +137,29 @@
      * @param String value 
      */
     public ArrayList getUpdateVersionsOf(String key, String value) {
-        ArrayList selectedUpdateVersions = updateVersions;
-        for (int i = 0; i < selectedUpdateVersions.size(); i++) {
-            HashMap versionDetail = (HashMap) selectedUpdateVersions.get(i);
-            if (!versionDetail.get(key).equals(value)) {
-                selectedUpdateVersions.remove(i);
+        ArrayList allUpdateVersions = getUpdateVersions();
+        ArrayList selectedUpdateVersions = new ArrayList();
+        if (allUpdateVersions == null) return null;
+        for (int i = 0; i < allUpdateVersions.size(); i++) {
+            HashMap versionDetail = (HashMap) allUpdateVersions.get(i);
+            if (versionDetail.get(key).equals(value)) {
+                selectedUpdateVersions.add(allUpdateVersions.get(i));
             }
         }
+        if (selectedUpdateVersions.size() < 1) return null;
         Collections.sort(selectedUpdateVersions, new UpdateInfoVersionComparator());
         return selectedUpdateVersions;
     }
 
     /**
-     * @return ArrayList with version which are matching the value of the key, and fits in the revision requirement
+     * @return ArrayList with version which are matching the value of the key, and fits in the revision requirement. Or null if none.
      * @param String key
      * @param String value 
      * @param String installInfoRevision 
      */
     public ArrayList getUpdateVersionsOf(String key, String value, String InstallInfoRevision) {
         ArrayList selectedUpdateVersions = getUpdateVersionsOf(key, value);
+        if (selectedUpdateVersions == null) return null;
         VersionComparator versionComparator = new VersionComparator();  
         for (int i = 0; i < selectedUpdateVersions.size(); i++) {
             HashMap versionDetail = (HashMap) selectedUpdateVersions.get(i);
@@ -201,6 +170,7 @@
                 selectedUpdateVersions.remove(i);
             }
         }
+        if (selectedUpdateVersions.size() < 1) return null;           
         Collections.sort(selectedUpdateVersions, new UpdateInfoVersionComparator());
         return selectedUpdateVersions;
     }
@@ -210,7 +180,7 @@
      * @param String key
      * @param String value 
      */
-    public HashMap getNewestUpdateVersionsOf(String key, String value) {
+/*    public HashMap getNewestUpdateVersionsOf(String key, String value) {
         ArrayList selectedUpdateVersions = getUpdateVersionsOf(key, value);
         for (int i = 0; i < selectedUpdateVersions.size(); i++) {
             HashMap versionDetail = (HashMap) selectedUpdateVersions.get(i);
@@ -218,18 +188,79 @@
                 selectedUpdateVersions.remove(i);
             }
         }
+        if (selectedUpdateVersions.size() < 1) {
+            throw new Exception("There are no newest update for key: " + key + ", value: " + value + ".");
+        }             
         Collections.sort(selectedUpdateVersions, new UpdateInfoVersionComparator());
         return (HashMap) selectedUpdateVersions.get(selectedUpdateVersions.size() - 1);
-    }    
+    }   */ 
 
     /**
-     * @return HashMap with the newest version which are matching the value of the key, and fits in the revision requirement
+     * @return ArrayList with all updaters which are installable within the given YanelRevision. return null if non.
+     * @param String YanelRevision
+     */
+    public ArrayList getUpdatersForYanelRevision(String yanelRevision) {
+        VersionComparator versionComparator = new VersionComparator();
+        ArrayList bestUpdater = getUpdateVersionsOf("type", "updater");
+        if (bestUpdater == null) return null;
+        for (int i = 0; i < bestUpdater.size(); i++) {
+            HashMap versionDetail = (HashMap) bestUpdater.get(i);
+            if (versionComparator.compare((String) versionDetail.get("targetApllicationMinRevision"), yanelRevision) > 0 ) {
+                bestUpdater.remove(i);
+            }
+            if (versionComparator.compare((String) versionDetail.get("targetApllicationMaxRevision"), yanelRevision) < 0 ) {
+                bestUpdater.remove(i);
+            }
+        }
+        Collections.sort(bestUpdater, new UpdateInfoVersionComparator());
+        if (bestUpdater.size() < 1)  return null;
+        return bestUpdater;
+    }
+
+    /**
+     * @return ArrayList with all yanelUpdates which are installable within the given YanelRevision. return null if non.
+     * @param String YanelRevision
+     */
+    public ArrayList getYanelUpatesForYanelRevision(String yanelRevision) {
+        ArrayList updaters = getUpdatersForYanelRevision(yanelRevision);
+        if (updaters == null) return null;
+        ArrayList allUpdates = getUpdateVersionsOf("type", "updates");
+        if (allUpdates == null) return null;
+        VersionComparator versionComparator = new VersionComparator();
+        
+        for (int i = 0; i < allUpdates.size(); i++) {
+            HashMap updatesVersionDetail = (HashMap) allUpdates.get(i);
+            String revision = (String) updatesVersionDetail.get("revision");
+            
+            
+            for (int j = 0; j < updaters.size(); j++) {
+                HashMap updatersVersionDetail = (HashMap) updaters.get(j);
+                if (versionComparator.compare((String) updatersVersionDetail.get("targetApllicationMinRevision"), revision) > 0 ) {
+                    allUpdates.remove(i);
+                }
+                if (versionComparator.compare((String) updatersVersionDetail.get("targetApllicationMaxRevision"), revision) < 0 ) {
+                    allUpdates.remove(i);
+                }
+            }
+        }
+        
+        Collections.sort(allUpdates, new UpdateInfoVersionComparator());
+        if (allUpdates.size() < 1) {
+            return null;
+        }
+        return allUpdates;
+    }
+    
+    /**
+     * @return ArrayList with the versions which are matching the value of the key, and fits in the revision requirement and is not allready installed. returns null if now version fits.
      * @param String key
      * @param String value 
+     * @param String installInfoRevision 
      */
-    public HashMap getNewestUpdateVersionsOf(String key, String value, String installInfoRevision) {
+/*    public ArrayList getUpdateVersionsOf(String key, String value, String installInfoRevision, HttpServletRequest request) throws Exception{
         ArrayList selectedUpdateVersions = getUpdateVersionsOf(key, value);
-        VersionComparator versionComparator = new VersionComparator();  
+        VersionComparator versionComparator = new VersionComparator();
+        TomcatContextHandler tomcatContextHandler = new TomcatContextHandler(request);
         for (int i = 0; i < selectedUpdateVersions.size(); i++) {
             HashMap versionDetail = (HashMap) selectedUpdateVersions.get(i);
             if (versionComparator.compare((String) versionDetail.get("targetApllicationMinRevision"), installInfoRevision) > 0 ) {
@@ -238,10 +269,17 @@
             if (versionComparator.compare((String) versionDetail.get("targetApllicationMaxRevision"), installInfoRevision) < 0 ) {
                 selectedUpdateVersions.remove(i);
             }
+            for (int j = 0; j < tomcatContextHandler.getWebappNames().length; j++) {
+                if (tomcatContextHandler.getWebappNames()[j].equals(versionDetail.get("id") + "-v-" + versionDetail.get("version") + "-r-" + versionDetail.get("revision"))) {
+                    selectedUpdateVersions.remove(i);
+                }
+            }
         }
+        if (selectedUpdateVersions.size() < 1) {
+            return null;
+        }                    
         Collections.sort(selectedUpdateVersions, new UpdateInfoVersionComparator());
-        return (HashMap) selectedUpdateVersions.get(selectedUpdateVersions.size() -1);
-    }    
+        return selectedUpdateVersions;
+    }    */
     
-    
 }




More information about the Yanel-commits mailing list