portals-pluto-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r653115 - /portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/PortletContextManager.java
Date Sat, 03 May 2008 19:52:23 GMT
Author: ate
Date: Sat May  3 12:52:23 2008
New Revision: 653115

URL: http://svn.apache.org/viewvc?rev=653115&view=rev
Log:
merge and optimize the two register methods

Modified:
    portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/PortletContextManager.java

Modified: portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/PortletContextManager.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/PortletContextManager.java?rev=653115&r1=653114&r2=653115&view=diff
==============================================================================
--- portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/PortletContextManager.java
(original)
+++ portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/PortletContextManager.java
Sat May  3 12:52:23 2008
@@ -122,39 +122,15 @@
      * @throws PortletContainerException
      */
 	public String register(ServletConfig config) throws PortletContainerException {
-        InternalPortletContext portletContext = register(config.getServletContext());
-
-        PortletApp portletApp = portletContext.getPortletApplicationDefinition();
-
-        LOG.info("Registering "+portletApp.getPortlets().size()+" portlets for context "+portletContext.getApplicationId());
-
-        classLoaders.put(portletApp.getId(), Thread.currentThread().getContextClassLoader());
-        for (Portlet portlet: portletApp.getPortlets()) {
-            portletConfigs.put(
-                portletContext.getApplicationId() + "/" + portlet.getPortletName(),
-                new PortletConfigImpl(config, portletContext, portlet, portletApp)
-            );
-        }
-        return portletContext.getApplicationId();
-    }
-
-    /**
-     * @param servletContext
-     * @return
-     * @throws PortletContainerException
-     * @deprecated Use {@link #register(ServletConfig)}
-     */
-    public InternalPortletContext register(ServletContext servletContext)
-        throws PortletContainerException {
+	    ServletContext servletContext = config.getServletContext();
         String applicationId = getContextPath(servletContext);
-        InternalPortletContext portletContext = portletContexts.get(applicationId);
-        if (portletContext == null) {
+        if (!portletContexts.containsKey(applicationId)) {
 
             PortletApp portletApp = PortletDescriptorRegistry.getRegistry().getPortletAppDD(servletContext);
             portletApp.setId(applicationId);
             portletApp.setName(applicationId.substring(1));
 
-            portletContext = new PortletContextImpl(servletContext, portletApp);
+            InternalPortletContext portletContext = new PortletContextImpl(servletContext,
portletApp);
 
             portletContexts.put(applicationId, portletContext);
 
@@ -162,15 +138,25 @@
 
             if (LOG.isInfoEnabled()) {
                 LOG.info("Registered portlet application with application id '" + applicationId
+ "'");
+
+                LOG.info("Registering "+portletApp.getPortlets().size()+" portlets for context
"+portletContext.getApplicationId());
+
+                classLoaders.put(portletApp.getId(), Thread.currentThread().getContextClassLoader());
+                for (Portlet portlet: portletApp.getPortlets()) {
+                    portletConfigs.put(
+                        portletContext.getApplicationId() + "/" + portlet.getPortletName(),
+                        new PortletConfigImpl(config, portletContext, portlet, portletApp)
+                    );
+                }
             }
         } else {
              if (LOG.isInfoEnabled()) {
                 LOG.info("Portlet application with application id '" + applicationId + "'
already registered.");
             }
         }
-        return portletContext;
+        return applicationId;
     }
-    
+
     public void remove(InternalPortletContext context) {
         portletContexts.remove(context.getApplicationId());
         classLoaders.remove(context.getApplicationId());



Mime
View raw message