geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r614122 - /geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/BaseImportExportHandler.java
Date Tue, 22 Jan 2008 05:42:15 GMT
Author: gawor
Date: Mon Jan 21 21:42:12 2008
New Revision: 614122

URL: http://svn.apache.org/viewvc?rev=614122&view=rev
Log:
reuse cached plugin list only if the repository locations match. otherwise, plugin list might
not match the selected repository

Modified:
    geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/BaseImportExportHandler.java

Modified: geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/BaseImportExportHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/BaseImportExportHandler.java?rev=614122&r1=614121&r2=614122&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/BaseImportExportHandler.java
(original)
+++ geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/BaseImportExportHandler.java
Mon Jan 21 21:42:12 2008
@@ -21,6 +21,7 @@
 
 import javax.portlet.PortletRequest;
 import javax.portlet.PortletException;
+import javax.portlet.PortletSession;
 import javax.portlet.RenderRequest;
 import javax.security.auth.login.FailedLoginException;
 
@@ -39,6 +40,7 @@
  */
 public abstract class BaseImportExportHandler extends MultiPageAbstractHandler {
     protected static final String CONFIG_LIST_SESSION_KEY = "console.plugins.ConfigurationList";
+    protected static final String CONFIG_LIST_REPO_SESSION_KEY = "console.plugins.ConfigurationListRepo";
     protected static final String SERVER_CONFIG_LIST_SESSION_KEY = "console.plugins.ServerConfigurationList";
     public static final String DOWNLOAD_RESULTS_SESSION_KEY = "console.plugins.DownloadResults";
     protected static final String INDEX_MODE = "index";
@@ -60,14 +62,18 @@
     }
 
     protected PluginListType getRepoPluginList(PortletRequest request, PluginInstaller pluginInstaller,
String repo, String user, String pass) throws IOException, PortletException {
-        PluginListType list = (PluginListType) request.getPortletSession(true).getAttribute(CONFIG_LIST_SESSION_KEY);
-        if (list == null) {
+        PortletSession session = request.getPortletSession(true);
+        PluginListType list = (PluginListType) session.getAttribute(CONFIG_LIST_SESSION_KEY);
+        String listRepo = (String) session.getAttribute(CONFIG_LIST_REPO_SESSION_KEY);
+
+        if (list == null || !repo.equals(listRepo)) {
             try {
                 list = pluginInstaller.listPlugins(new URL(repo), user, pass);
             } catch (FailedLoginException e) {
                 throw new PortletException("Invalid login for repository '" + repo + "'",
e);
             }
-            request.getPortletSession(true).setAttribute(CONFIG_LIST_SESSION_KEY, list);
+            session.setAttribute(CONFIG_LIST_SESSION_KEY, list);
+            session.setAttribute(CONFIG_LIST_REPO_SESSION_KEY, repo);
         }
         return list;
     }



Mime
View raw message