[portal-commits] JBoss Portal SVN: r6073 - trunk/server/src/main/org/jboss/portal/server/deployment.

portal-commits at lists.jboss.org portal-commits at lists.jboss.org
Mon Jan 22 20:32:28 EST 2007


Author: julien at jboss.com
Date: 2007-01-22 20:32:28 -0500 (Mon, 22 Jan 2007)
New Revision: 6073

Modified:
   trunk/server/src/main/org/jboss/portal/server/deployment/WebAppIntercepter.java
Log:
JBPORTAL-1214 : Use the same URL key for the map of web app to deployed portlet applications

Modified: trunk/server/src/main/org/jboss/portal/server/deployment/WebAppIntercepter.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/deployment/WebAppIntercepter.java	2007-01-23 00:42:45 UTC (rev 6072)
+++ trunk/server/src/main/org/jboss/portal/server/deployment/WebAppIntercepter.java	2007-01-23 01:32:28 UTC (rev 6073)
@@ -96,6 +96,23 @@
       return new ArrayList(deployments.keySet());
    }
 
+   private WebApplication findWebApp(DeploymentInfo info) throws Exception
+   {
+      // Get all the deployed web applications, our must be among these
+      Iterator iterator = (Iterator)server.getAttribute(interceptedDeployer, "DeployedApplications");
+      while (iterator.hasNext())
+      {
+         WebApplication webApp = (WebApplication)iterator.next();
+         if (info == webApp.getDeploymentInfo())
+         {
+            return webApp;
+         }
+      }
+
+      // Not found
+      return null;
+   }
+
    /** Only take care of start notifications. */
    public void handleNotification(Notification notification, Object handback)
    {
@@ -118,31 +135,28 @@
             // Create the portal web app
             DeploymentInfo info = (DeploymentInfo)notification.getUserData();
 
+
+            //
+            URL keyURL = info.url;
+
+            //
             if (start)
             {
-               // Get all the deployed web applications, our must be among these
-               Iterator iterator = (Iterator)server.getAttribute(interceptedDeployer, "DeployedApplications");
-               while (iterator.hasNext())
-               {
-                  WebApplication webApp = (WebApplication)iterator.next();
-                  if (info == webApp.getDeploymentInfo())
-                  {
-                     PortalWebApp pwa = factory.create(webApp);
-                     URL url = info.url;
-                     deployments.put(url, pwa);
-                     log.debug("Seen URL " + url + " about to deploy");
-                     deploy(pwa);
-                  }
-               }
+               WebApplication webApp = findWebApp(info);
+               PortalWebApp pwa = factory.create(webApp);
+               deployments.put(keyURL, pwa);
+               log.debug("Seen URL " + keyURL + " about to deploy");
+               deploy(pwa);
             }
             if (stop)
             {
                // Look if we have something for that url
-               PortalWebApp pwa = (PortalWebApp)deployments.remove(info.url);
+               PortalWebApp pwa = (PortalWebApp)deployments.remove(keyURL);
 
                // Notify
                if (pwa != null)
                {
+                  log.debug("Undeploying URL " + keyURL);
                   undeploy(pwa);
                }
             }
@@ -180,11 +194,12 @@
          while (iterator.hasNext())
          {
             WebApplication webApp = (WebApplication)iterator.next();
-            if (!deployments.containsKey(webApp.getURL()))
+            URL keyURL = webApp.getDeploymentInfo().url;
+            if (!deployments.containsKey(keyURL))
             {
                PortalWebApp pwa = factory.create(webApp);
-               deployments.put(pwa.getURL(), pwa);
-               log.debug("Seen URL " + pwa.getURL() + " about to deploy");
+               deployments.put(keyURL, pwa);
+               log.debug("Seen URL " + keyURL + " about to deploy");
                deploy(pwa);
             }
          }
@@ -202,11 +217,13 @@
       if (currentInterceptedDeployer != null)
       {
          // Remove all previously deployed applications
-         for (Iterator i = deployments.values().iterator(); i.hasNext();)
+         for (Iterator i = deployments.entrySet().iterator(); i.hasNext();)
          {
-            PortalWebApp pwa = (PortalWebApp)i.next();
+            Map.Entry entry = (Map.Entry)i.next();
+            URL keyURL = (URL)entry.getKey();
+            PortalWebApp pwa = (PortalWebApp)entry.getValue();
             i.remove();
-            log.debug("Removing URL " + pwa.getURL());
+            log.debug("Removing web application with URL " + keyURL);
             undeploy(pwa);
          }
 




More information about the portal-commits mailing list