You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by dj...@apache.org on 2009/12/24 03:58:19 UTC

svn commit: r893689 [1/2] - in /portals/pluto/trunk: pluto-container/src/main/java/org/apache/pluto/container/impl/ pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/config/impl/ pluto-portal-driver-impl/src/main/java/org/apache/pluto/driv...

Author: djencks
Date: Thu Dec 24 02:58:17 2009
New Revision: 893689

URL: http://svn.apache.org/viewvc?rev=893689&view=rev
Log:
PLUTO-585 Considerable refactoring to use DI techniques compatible with osgi blueprint.  The blueprint version works in geronimo, I don't know how to test the spring version

Added:
    portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/StaticServletContextResourceConfigFactory.java   (with props)
Removed:
    portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/PropertyConfigServiceImpl.java
    portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/ResourceSource.java
    portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/DriverConfigurationService.java
Modified:
    portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletContainerFactory.java
    portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletContainerImpl.java
    portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/config/impl/DriverConfigurationImpl.java
    portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/EventCoordinationServiceImpl.java
    portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/RenderConfigServiceImpl.java
    portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/ResourceConfig.java
    portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/SupportedModesServiceImpl.java
    portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/SupportedWindowStateServiceImpl.java
    portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/PortalStartupListener.java
    portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/config/DriverConfiguration.java
    portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/DefaultOptionalContainerServices.java
    portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/PortalDriverServicesImpl.java
    portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/PortletContextManager.java
    portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/PortletDescriptorRegistry.java
    portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/PageConfig.java
    portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/PropertyConfigService.java
    portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/RenderConfigService.java
    portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/SupportedModesService.java
    portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/SupportedWindowStateService.java
    portals/pluto/trunk/pluto-portal/src/main/webapp/WEB-INF/pluto-portal-driver-services-config.xml
    portals/pluto/trunk/pluto-portal/src/main/webapp/WEB-INF/web.xml

Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletContainerFactory.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletContainerFactory.java?rev=893689&r1=893688&r2=893689&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletContainerFactory.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletContainerFactory.java Thu Dec 24 02:58:17 2009
@@ -30,6 +30,7 @@
  *
  * @version 1.0
  * @since Sep 18, 2004
+ * @deprecated just use blueprint or spring to construct the PortletContainer
  */
 public class PortletContainerFactory {
 

Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletContainerImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletContainerImpl.java?rev=893689&r1=893688&r2=893689&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletContainerImpl.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletContainerImpl.java Thu Dec 24 02:58:17 2009
@@ -471,13 +471,13 @@
 
     /**
      * The method initialise the FilterManager for later use in the PortletServlet
-     * @param PortletWindow the PortletWindow
+     * @param portletWindow the PortletWindow
      * @param lifeCycle like ACTION_PHASE, RENDER_PHASE,...
      * @return FilterManager
      * @throws PortletContainerException
      */
-    private FilterManager filterInitialisation(PortletWindow portletWindow,String lifeCycle) throws PortletContainerException{
-        return getContainerServices().getFilterManagerService().getFilterManager(portletWindow,lifeCycle);
+    private FilterManager filterInitialisation(PortletWindow portletWindow, String lifeCycle) throws PortletContainerException{
+        return getContainerServices().getFilterManagerService().getFilterManager(portletWindow, lifeCycle);
     }
 }
 

Modified: portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/config/impl/DriverConfigurationImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/config/impl/DriverConfigurationImpl.java?rev=893689&r1=893688&r2=893689&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/config/impl/DriverConfigurationImpl.java (original)
+++ portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/config/impl/DriverConfigurationImpl.java Thu Dec 24 02:58:17 2009
@@ -31,7 +31,6 @@
 import org.apache.pluto.driver.services.portal.SupportedModesService;
 import org.apache.pluto.driver.services.portal.SupportedWindowStateService;
 import org.apache.pluto.driver.url.PortalURLParser;
-import org.apache.pluto.driver.container.ResourceSource;
 
 /**
  * Encapsulation of the Pluto Driver ResourceConfig.
@@ -64,27 +63,6 @@
         this.supportedWindowStateService = supportedWindowStateService;
     }
 
-    public void init(ResourceSource context) {
-        this.propertyService.init(context);
-        this.renderService.init(context);
-        this.supportedModesService.init(context);
-        this.supportedWindowStateService.init(context);
-    }
-
-    public void destroy() {
-        if(propertyService != null)
-            propertyService.destroy();
-
-        if(renderService != null)
-            renderService.destroy();
-
-        if (supportedModesService != null)
-            supportedModesService.destroy();
-
-        if (supportedWindowStateService != null)
-            supportedWindowStateService.destroy();
-    }
-
     /**
      * Standard Getter.
      * @return the name of the portal.

Modified: portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/EventCoordinationServiceImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/EventCoordinationServiceImpl.java?rev=893689&r1=893688&r2=893689&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/EventCoordinationServiceImpl.java (original)
+++ portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/EventCoordinationServiceImpl.java Thu Dec 24 02:58:17 2009
@@ -16,28 +16,10 @@
  */
 package org.apache.pluto.driver.services.container;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.portlet.Event;
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.namespace.QName;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.pluto.container.EventCoordinationService;
 import org.apache.pluto.container.PortletContainer;
 import org.apache.pluto.container.PortletContainerException;
 import org.apache.pluto.container.PortletWindow;
-import org.apache.pluto.container.driver.PlutoServices;
 import org.apache.pluto.container.driver.PortletContextService;
 import org.apache.pluto.container.driver.PortletRegistryService;
 import org.apache.pluto.container.om.portlet.EventDefinition;
@@ -52,6 +34,15 @@
 import org.apache.pluto.driver.services.portal.PortletWindowConfig;
 import org.apache.pluto.driver.url.PortalURL;
 import org.apache.pluto.driver.url.impl.PortalURLParserImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.portlet.Event;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+import java.util.*;
 
 public class EventCoordinationServiceImpl implements EventCoordinationService
 {
@@ -61,23 +52,19 @@
 	private static final long WAITING_CYCLE = 100;
 
 	/** PortletRegistryService used to obtain PortletApplicationConfig objects */
-	private PortletRegistryService portletRegistry;
+	private final PortletRegistryService portletRegistry;
 
 	/** PortletContextService used to obtain PortletContext objects */
-    private PortletContextService portletContextService;
-    
+    private final PortletContextService portletContextService;
+
+    public EventCoordinationServiceImpl(PortletRegistryService portletRegistry, PortletContextService portletContextService) {
+        this.portletRegistry = portletRegistry;
+        this.portletContextService = portletContextService;
+    }
+
     public void processEvents(PortletContainer container, PortletWindow portletWindow, HttpServletRequest request,
                               HttpServletResponse response, List<Event> events)
     {
-        if (portletRegistry == null)
-        {
-            portletRegistry = PlutoServices.getServices().getPortletRegistryService();
-        }
-        if (portletContextService == null)
-        {
-            portletContextService = PlutoServices.getServices().getPortletContextService();
-        }
-        
         ServletContext containerServletContext = PortalRequestContext.getContext(request).getServletContext();
 		DriverConfiguration driverConfig = (DriverConfiguration) containerServletContext
 				.getAttribute(AttributeKeys.DRIVER_CONFIG);

Modified: portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/RenderConfigServiceImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/RenderConfigServiceImpl.java?rev=893689&r1=893688&r2=893689&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/RenderConfigServiceImpl.java (original)
+++ portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/RenderConfigServiceImpl.java Thu Dec 24 02:58:17 2009
@@ -16,15 +16,12 @@
  */
 package org.apache.pluto.driver.services.impl.resource;
 
-import java.io.InputStream;
 import java.util.List;
 import java.util.Set;
 
-import org.apache.pluto.driver.config.DriverConfigurationException;
 import org.apache.pluto.driver.services.portal.PageConfig;
 import org.apache.pluto.driver.services.portal.RenderConfigService;
 import org.apache.pluto.driver.services.portal.admin.RenderConfigAdminService;
-import org.apache.pluto.driver.container.ResourceSource;
 
 /**
  * Default implementation of all of the portal Services.
@@ -37,40 +34,12 @@
     implements RenderConfigService, RenderConfigAdminService {
 
 
-    private ResourceConfig config;
-
-    public RenderConfigServiceImpl() {
-    }
+    private final ResourceConfig config;
 
     public RenderConfigServiceImpl(ResourceConfig config) {
         this.config = config;
     }
 
-    //
-// Lifecycle Methods
-//
-    /**
-     * Initialization Lifecycle Method
-     * @param resourceSource
-     */
-    public void init(ResourceSource resourceSource) {
-        try {
-            InputStream in = resourceSource.getResourceAsStream(ResourceConfigReader.CONFIG_FILE);
-            config = ResourceConfigReader.getFactory().parse(in);
-        }
-        catch(Exception e) {
-            throw new DriverConfigurationException(e);
-        }
-    }
-
-    /**
-     * Shutdown the ResourceService.
-     */
-    public void destroy() {
-        config = null;
-    }
-
-
     public String getPortalName() {
         return config.getPortalName();
     }

Modified: portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/ResourceConfig.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/ResourceConfig.java?rev=893689&r1=893688&r2=893689&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/ResourceConfig.java (original)
+++ portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/ResourceConfig.java Thu Dec 24 02:58:17 2009
@@ -23,6 +23,7 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.pluto.driver.services.portal.RenderConfig;
+import org.apache.pluto.driver.services.portal.PropertyConfigService;
 
 /**
  * Encapsulation of the Pluto Driver ResourceConfig Info.
@@ -30,7 +31,8 @@
  * @version 1.0
  * @since Sep 23, 2004
  */
-public class ResourceConfig {
+public class ResourceConfig implements PropertyConfigService
+{
 
     /** Internal Logger. */
     private static final Logger LOG =
@@ -46,27 +48,18 @@
     private String containerName;
 
     /** The portlet modes we will support. */
-    private Set supportedPortletModes;
+    private final Set<String> supportedPortletModes = new HashSet<String>();
 
     /** The window states we will support. */
-    private Set supportedWindowStates;
+    private final Set<String> supportedWindowStates = new HashSet<String>();
 
     /** The portlet applications registered with us. */
-    private final Map portletApplications;
+//    private final Map portletApplications;
 
     /** Encapsulation of render configuration data. */
     private RenderConfig renderConfig;
 
     /**
-     * Default Constructor.
-     */
-    public ResourceConfig() {
-        this.supportedWindowStates = new HashSet();
-        this.supportedPortletModes = new HashSet();
-        this.portletApplications = new java.util.HashMap();
-    }
-
-    /**
      * Standard Getter.
      * @return the name of the portal.
      */
@@ -118,7 +111,7 @@
      * Standard Getter.
      * @return the names of the supported portlet modes.
      */
-    public Set getSupportedPortletModes() {
+    public Set<String> getSupportedPortletModes() {
         return supportedPortletModes;
     }
 
@@ -126,8 +119,9 @@
      * Standard Setter.
      * @param supportedPortletModes the names of the supported portlet modes.
      */
-    public void setSupportedPortletModes(Set supportedPortletModes) {
-        this.supportedPortletModes = supportedPortletModes;
+    public void setSupportedPortletModes(Set<String> supportedPortletModes) {
+        this.supportedPortletModes.clear();
+        this.supportedPortletModes.addAll(supportedPortletModes);
     }
 
     /**
@@ -142,7 +136,7 @@
      * Standard Getter.
      * @return the names of the supported window states.
      */
-    public Set getSupportedWindowStates() {
+    public Set<String> getSupportedWindowStates() {
         return supportedWindowStates;
     }
 
@@ -150,8 +144,9 @@
      * Standard Setter.
      * @param supportedWindowStates the names of the supported window states.
      */
-    public void setSupportedWindowStates(Set supportedWindowStates) {
-        this.supportedWindowStates = supportedWindowStates;
+    public void setSupportedWindowStates(Set<String> supportedWindowStates) {
+        this.supportedWindowStates.clear();
+        this.supportedWindowStates.addAll(supportedWindowStates);
     }
 
     /**

Added: portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/StaticServletContextResourceConfigFactory.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/StaticServletContextResourceConfigFactory.java?rev=893689&view=auto
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/StaticServletContextResourceConfigFactory.java (added)
+++ portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/StaticServletContextResourceConfigFactory.java Thu Dec 24 02:58:17 2009
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package org.apache.pluto.driver.services.impl.resource;
+
+import org.apache.pluto.driver.config.DriverConfigurationException;
+import org.apache.pluto.driver.PortalStartupListener;
+
+import javax.servlet.ServletContext;
+import java.io.InputStream;
+
+/**
+ * gross DI component to work around Spring limitations
+ * @version $Rev$ $Date$
+ */
+public class StaticServletContextResourceConfigFactory
+{
+
+    private static ResourceConfig resourceConfig;
+
+    private static void init(ServletContext servletContext)
+    {
+        try
+        {
+            InputStream in = servletContext.getResourceAsStream(ResourceConfigReader.CONFIG_FILE);
+            resourceConfig = ResourceConfigReader.getFactory().parse(in);
+        }
+        catch (Exception e)
+        {
+            throw new DriverConfigurationException(e);
+        }
+    }
+
+    public static synchronized ResourceConfig getResourceConfig()
+    {
+        if (resourceConfig == null)
+        {
+            init(PortalStartupListener.getServletContext());
+        }
+        return resourceConfig;
+    }
+}

Propchange: portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/StaticServletContextResourceConfigFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/StaticServletContextResourceConfigFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/StaticServletContextResourceConfigFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/SupportedModesServiceImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/SupportedModesServiceImpl.java?rev=893689&r1=893688&r2=893689&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/SupportedModesServiceImpl.java (original)
+++ portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/SupportedModesServiceImpl.java Thu Dec 24 02:58:17 2009
@@ -16,35 +16,31 @@
  */
 package org.apache.pluto.driver.services.impl.resource;
 
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.portlet.PortletConfig;
-import javax.portlet.PortletMode;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.pluto.container.PortletContainerException;
-import org.apache.pluto.container.driver.PlutoServices;
 import org.apache.pluto.container.driver.PortletContextService;
 import org.apache.pluto.container.driver.PortletRegistryService;
 import org.apache.pluto.container.om.portlet.PortletApplicationDefinition;
 import org.apache.pluto.container.om.portlet.PortletDefinition;
 import org.apache.pluto.container.om.portlet.Supports;
 import org.apache.pluto.container.om.portlet.impl.CustomPortletModeType;
-import org.apache.pluto.driver.config.DriverConfigurationException;
 import org.apache.pluto.driver.services.portal.PortletWindowConfig;
 import org.apache.pluto.driver.services.portal.PropertyConfigService;
 import org.apache.pluto.driver.services.portal.SupportedModesService;
-import org.apache.pluto.driver.container.ResourceSource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletMode;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
 
 /**
  * Allows clients to determine if a particular PortletMode is supported
  * by the portal, a particular portlet, or both.
- *
+ * <p/>
  * This implementation depends on {@link PropertyConfigService}.
- *
+ * <p/>
  * The service implementations are injected by Spring.
  *
  * @version $Id$
@@ -52,118 +48,122 @@
  */
 public class SupportedModesServiceImpl implements SupportedModesService
 {
-    /** Logger */
+    /**
+     * Logger
+     */
     private static final Logger LOG = LoggerFactory.getLogger(SupportedModesServiceImpl.class);
 
-    
-    /** PortletMode objects supported by the portal */
+
+    /**
+     * PortletMode objects supported by the portal
+     */
     private Set<PortletMode> supportedPortletModesByPortal = new HashSet<PortletMode>();
 
-    /** PortletRegistryService used to obtain PortletApplicationConfig objects */
-    private PortletRegistryService portletRegistry;
+    /**
+     * PropertyConfig Service used to obtain supported portal modes
+     */
+    private final PropertyConfigService propertyService;
 
-    /** PropertyConfig Service used to obtain supported portal modes */
-    private PropertyConfigService propertyService;
+    private final PortletContextService portletContextService;
 
-    private PortletContextService portletContextService;
+    /**
+     * PortletRegistryService used to obtain PortletApplicationConfig objects
+     */
+    private final PortletRegistryService portletRegistry;
 
     /**
      * Constructs a SupportedModesService with its dependencies.
      *
      * @param propertyService the PropertyConfigService
      */
-    public SupportedModesServiceImpl(PropertyConfigService propertyService, PortletContextService portletContextService) {
+    public SupportedModesServiceImpl(PropertyConfigService propertyService, PortletContextService portletContextService, PortletRegistryService portletRegistry)
+    {
         this.propertyService = propertyService;
         this.portletContextService = portletContextService;
+        this.portletRegistry = portletRegistry;
         loadPortalModes();
     }
 
     //  SupportedModesService Implementation -----------------
 
-    public boolean isPortletModeSupported(String portletId, String mode)  {
+    public boolean isPortletModeSupported(String portletId, String mode)
+    {
         return (isPortletModeSupportedByPortal(mode) &&
-            isPortletModeSupportedByPortlet(portletId, mode)
-            || isPortletManagedMode(portletId, mode));
+                isPortletModeSupportedByPortlet(portletId, mode)
+                || isPortletManagedMode(portletId, mode));
     }
 
-    public boolean isPortletModeSupportedByPortal(String mode)  {
+    public boolean isPortletModeSupportedByPortal(String mode)
+    {
         return supportedPortletModesByPortal.contains(new PortletMode(mode));
     }
 
-    public boolean isPortletModeSupportedByPortlet(String portletId, String mode) {
+    public boolean isPortletModeSupportedByPortlet(String portletId, String mode)
+    {
         String applicationId = PortletWindowConfig.parseContextPath(portletId);
         String applicationName = applicationId;
-        if (applicationName.length() >0 )
+        if (applicationName.length() > 0)
         {
             applicationName = applicationName.substring(1);
         }
         String portletName = PortletWindowConfig.parsePortletName(portletId);
-        // since SupportedModesService is consulted per portal portal mode per portlet
-        // per render request, store a reference to the registry instead of looking
-        // it up each time.  Is this premature optimization?
-        if (portletRegistry == null) {
-            portletRegistry = PlutoServices.getServices().getPortletRegistryService();
-        }
 
-        try {
-            if (portletRegistry == null) {
+        try
+        {
+            if (portletRegistry == null)
+            {
                 LOG.error("Optional Portlet Registry Service not found.");
                 throw new PortletContainerException("Optional Portlet Registry Service not found.");
             }
             PortletApplicationDefinition ctx = portletRegistry.getPortletApplication(applicationName);
             Iterator i = ctx.getPortlets().iterator();
-            while(i.hasNext()) {
-                PortletDefinition dd = (PortletDefinition)i.next();
-                if(portletName.equals(dd.getPortletName())) {
+            while (i.hasNext())
+            {
+                PortletDefinition dd = (PortletDefinition) i.next();
+                if (portletName.equals(dd.getPortletName()))
+                {
                     Iterator i2 = dd.getSupports().iterator();
-                    while(i2.hasNext()) {
-                        Supports sd = (Supports)i2.next();
-                        if (sd.getPortletModes()==null){
-                        	if (mode.equalsIgnoreCase(PortletMode.VIEW.toString()))
-                        		return true;
-                        }
-                        else{
-	                        Iterator pd = sd.getPortletModes().iterator();
-	                        while(pd.hasNext()) {
-	                            if(mode.equalsIgnoreCase((String)pd.next())) {
-	                                return true;
-	                            }
-	                        }
+                    while (i2.hasNext())
+                    {
+                        Supports sd = (Supports) i2.next();
+                        if (sd.getPortletModes() == null)
+                        {
+                            if (mode.equalsIgnoreCase(PortletMode.VIEW.toString()))
+                                return true;
+                        } else
+                        {
+                            Iterator pd = sd.getPortletModes().iterator();
+                            while (pd.hasNext())
+                            {
+                                if (mode.equalsIgnoreCase((String) pd.next()))
+                                {
+                                    return true;
+                                }
+                            }
                         }
                     }
                 }
             }
 
-        } catch (PortletContainerException e) {
+        } catch (PortletContainerException e)
+        {
             LOG.error("Error determining mode support.", e);
         }
-        LOG.info("Portlet mode '"+mode+"' not found for portletId: '"+portletId+"'");
+        LOG.info("Portlet mode '" + mode + "' not found for portletId: '" + portletId + "'");
         return false;
     }
 
-    // DriverConfiguration Lifecycle Implementation ---------
-
-    public void destroy() throws DriverConfigurationException
-    {
-        LOG.debug("Destroying Supported Modes Service...");
-        supportedPortletModesByPortal = null;
-        portletRegistry = null;
-        propertyService = null;
-        LOG.debug("Supported Modes Service destroyed.");
-    }
-
-    public void init(ResourceSource resourceSource) throws DriverConfigurationException {
-    }
-    
-
-    /** Populates the supportedPortletModesByPortal set. */
+    /**
+     * Populates the supportedPortletModesByPortal set.
+     */
     private void loadPortalModes()
     {
         // Add the PortletModes supported by the portal to the
         // supportedPortletModesByPortal set.
         LOG.debug("Loading supported portal modes...");
         Iterator modes = propertyService.getSupportedPortletModes().iterator();
-        while (modes.hasNext()) {
+        while (modes.hasNext())
+        {
             String mode = (String) modes.next();
             LOG.debug("Loading mode [" + mode + "]");
             supportedPortletModesByPortal.add(new PortletMode(mode));
@@ -173,104 +173,100 @@
     }
 
 
-    
-	public boolean isPortletManagedMode(String portletId, String mode) {
-
-		if (portletRegistry == null) {
-            portletRegistry = PlutoServices.getServices().getPortletRegistryService();
-        }
-        //
-        
-        //
+    public boolean isPortletManagedMode(String portletId, String mode)
+    {
         String applicationId = PortletWindowConfig.parseContextPath(portletId);
         String applicationName = applicationId;
-        if (applicationName.length() > 0 )
+        if (applicationName.length() > 0)
         {
             applicationName = applicationName.substring(1);
         }
-        try {
-			PortletApplicationDefinition portletApp = portletRegistry.getPortletApplication(applicationName);
+        try
+        {
+            PortletApplicationDefinition portletApp = portletRegistry.getPortletApplication(applicationName);
             Iterator customModes = portletApp.getCustomPortletModes().iterator();
-            while (customModes.hasNext()) {
-				CustomPortletModeType customMode = (CustomPortletModeType)customModes.next();
-				boolean isPortletManagedMode = !customMode.isPortalManaged(); 
-				if (isPortletManagedMode && customMode.getPortletMode().equalsIgnoreCase(mode)) {
-					return true;
-				}
-			}
-		} catch (PortletContainerException e) {
+            while (customModes.hasNext())
+            {
+                CustomPortletModeType customMode = (CustomPortletModeType) customModes.next();
+                boolean isPortletManagedMode = !customMode.isPortalManaged();
+                if (isPortletManagedMode && customMode.getPortletMode().equalsIgnoreCase(mode))
+                {
+                    return true;
+                }
+            }
+        } catch (PortletContainerException e)
+        {
             LOG.error("Error determining portlet managed mode support, so we assume that it is false.", e);
-		}
+        }
 
-		
-		return false;
-	}
-
-
-	/**
-	 * Gets all modes supported by a portlet that are defined in the portlet's supports child element 
-	 * in portlet.xml.
-	 * 
-	 * @param portletId of interest.
-	 * @return all portlet modes supported by a portlet.
-	 */
-	public Set<PortletMode> getSupportedPortletModes(String portletId) throws PortletContainerException {
-		Set<PortletMode> modeSet = new HashSet<PortletMode>();
-
-	       String applicationId = PortletWindowConfig.parseContextPath(portletId);
-	        String applicationName = applicationId;
-	        if (applicationName.length() >0 )
-	        {
-	            applicationName = applicationName.substring(1);
-	        }
-	        String portletName = PortletWindowConfig.parsePortletName(portletId);
-	        // since SupportedModesService is consulted per portal portal mode per portlet
-	        // per render request, store a reference to the registry instead of looking
-	        // it up each time.  Is this premature optimization?
-	        if (portletRegistry == null) {
-	            portletRegistry = PlutoServices.getServices().getPortletRegistryService();
-	        }
 
-            if (portletRegistry == null) {
-                LOG.error("Optional Portlet Registry Service not found.");
-                throw new PortletContainerException("Optional Portlet Registry Service not found.");
-            }
-            PortletApplicationDefinition portletApp = portletRegistry.getPortletApplication(applicationName);
-            Iterator i =  portletApp.getPortlets().iterator();
-            while(i.hasNext()) {
-                PortletDefinition dd = (PortletDefinition)i.next();
-                if(portletName.equals(dd.getPortletName())) {
-                    Iterator i2 = dd.getSupports().iterator();
-                    while(i2.hasNext()) {
-                        Supports sd = (Supports)i2.next();
-                        if (sd.getPortletModes()== null){
-                        	modeSet.add(PortletMode.VIEW);
-                        }
-                        else{
-	                        Iterator<String> pd = sd.getPortletModes().iterator();
-	                        while(pd.hasNext()) {
-	                        	modeSet.add(new PortletMode(pd.next()));
-	                        }
+        return false;
+    }
+
+
+    /**
+     * Gets all modes supported by a portlet that are defined in the portlet's supports child element
+     * in portlet.xml.
+     *
+     * @param portletId of interest.
+     * @return all portlet modes supported by a portlet.
+     */
+    public Set<PortletMode> getSupportedPortletModes(String portletId) throws PortletContainerException
+    {
+        Set<PortletMode> modeSet = new HashSet<PortletMode>();
+
+        String applicationId = PortletWindowConfig.parseContextPath(portletId);
+        String applicationName = applicationId;
+        if (applicationName.length() > 0)
+        {
+            applicationName = applicationName.substring(1);
+        }
+        String portletName = PortletWindowConfig.parsePortletName(portletId);
+
+        if (portletRegistry == null)
+        {
+            LOG.error("Optional Portlet Registry Service not found.");
+            throw new PortletContainerException("Optional Portlet Registry Service not found.");
+        }
+        PortletApplicationDefinition portletApp = portletRegistry.getPortletApplication(applicationName);
+        Iterator i = portletApp.getPortlets().iterator();
+        while (i.hasNext())
+        {
+            PortletDefinition dd = (PortletDefinition) i.next();
+            if (portletName.equals(dd.getPortletName()))
+            {
+                Iterator i2 = dd.getSupports().iterator();
+                while (i2.hasNext())
+                {
+                    Supports sd = (Supports) i2.next();
+                    if (sd.getPortletModes() == null)
+                    {
+                        modeSet.add(PortletMode.VIEW);
+                    } else
+                    {
+                        Iterator<String> pd = sd.getPortletModes().iterator();
+                        while (pd.hasNext())
+                        {
+                            modeSet.add(new PortletMode(pd.next()));
                         }
                     }
                 }
             }
+        }
 
-		return modeSet;
-	}
-	
-	public PortletConfig getPortletConfig(String portletId) throws PortletContainerException {
-	       String applicationId = PortletWindowConfig.parseContextPath(portletId);
-	        String applicationName = applicationId;
-	        if (applicationName.length() >0 )
-	        {
-	            applicationName = applicationName.substring(1);
-	        }
-	        String portletName = PortletWindowConfig.parsePortletName(portletId);
-	        if (portletRegistry == null) {
-	            portletRegistry = PlutoServices.getServices().getPortletRegistryService();
-	        }
-	        
-		return portletContextService.getPortletConfig(applicationName, portletName);
-	}
+        return modeSet;
+    }
+
+    public PortletConfig getPortletConfig(String portletId) throws PortletContainerException
+    {
+        String applicationId = PortletWindowConfig.parseContextPath(portletId);
+        String applicationName = applicationId;
+        if (applicationName.length() > 0)
+        {
+            applicationName = applicationName.substring(1);
+        }
+        String portletName = PortletWindowConfig.parsePortletName(portletId);
+
+        return portletContextService.getPortletConfig(applicationName, portletName);
+    }
 }

Modified: portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/SupportedWindowStateServiceImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/SupportedWindowStateServiceImpl.java?rev=893689&r1=893688&r2=893689&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/SupportedWindowStateServiceImpl.java (original)
+++ portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/SupportedWindowStateServiceImpl.java Thu Dec 24 02:58:17 2009
@@ -16,17 +16,7 @@
  */
 package org.apache.pluto.driver.services.impl.resource;
 
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import javax.portlet.WindowState;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.pluto.container.PortletContainerException;
-import org.apache.pluto.container.driver.PlutoServices;
 import org.apache.pluto.container.driver.PortletRegistryService;
 import org.apache.pluto.container.om.portlet.CustomWindowState;
 import org.apache.pluto.container.om.portlet.PortletApplicationDefinition;
@@ -34,45 +24,55 @@
 import org.apache.pluto.driver.services.portal.PortletWindowConfig;
 import org.apache.pluto.driver.services.portal.PropertyConfigService;
 import org.apache.pluto.driver.services.portal.SupportedWindowStateService;
-import org.apache.pluto.driver.container.ResourceSource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.portlet.WindowState;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
 
 public class SupportedWindowStateServiceImpl implements
-        SupportedWindowStateService 
+        SupportedWindowStateService
 {
-    
-    /** Logger **/
+
+    /**
+     * Logger *
+     */
     private static final Logger LOG = LoggerFactory.getLogger(SupportedWindowStateServiceImpl.class);
-    
+
     /**
      * PropertyConfigService is injected by Spring.  We
      * use it to obtain the window states that the portal
      * supports.  It is protected only so that the unit
      * tests have access to the field.
      */
-    protected PropertyConfigService propertyService = null;
-    
+    protected final PropertyConfigService propertyService;
+
     /**
-     * PortletRegistry is obtained from the PortletContainer on 
+     * PortletRegistry is obtained from the PortletContainer on
      * this service's initialization.  It is protected only
      * so that the unit tests have access to the field.
-     * 
-     * Note that it is an optional container service, but 
+     * <p/>
+     * Note that it is an optional container service, but
      * this implmentation requires it.
      */
-    protected PortletRegistryService portletRegistry = null;
-    
+    protected final PortletRegistryService portletRegistry;
+
     /**
      * Contains String objects of window states supported
      * by the portal (obtained from PropertyConfigService).
-     * It is protected only so that the unit tests have 
+     * It is protected only so that the unit tests have
      * access to the field.
      */
     protected Set portalSupportedWindowStates = new HashSet(3);
-    
+
     /**
      * Window States that are specified in PLT.9
      */
     protected static final Set JSR168_WINDOW_STATES;
+
     static
     {
         JSR168_WINDOW_STATES = new HashSet(3);
@@ -80,24 +80,25 @@
         JSR168_WINDOW_STATES.add(WindowState.MINIMIZED);
         JSR168_WINDOW_STATES.add(WindowState.NORMAL);
     }
-    
-    public SupportedWindowStateServiceImpl( PropertyConfigService propertyService )
+
+    public SupportedWindowStateServiceImpl(PropertyConfigService propertyService, PortletRegistryService portletRegistry)
     {
         this.propertyService = propertyService;
-        LOG.debug( "Initializing SupportedWindowStateService... " );
+        this.portletRegistry = portletRegistry;
+        LOG.debug("Initializing SupportedWindowStateService... ");
 
         portalSupportedWindowStates = propertyService.getSupportedWindowStates();
-        if ( LOG.isDebugEnabled() )
+        if (LOG.isDebugEnabled())
         {
             StringBuffer msg = new StringBuffer();
 
-            if ( portalSupportedWindowStates != null )
+            if (portalSupportedWindowStates != null)
             {
-                msg.append( "Portal supports [" + portalSupportedWindowStates.size() + "] window states.  ");
-                for ( Iterator i = portalSupportedWindowStates.iterator(); i.hasNext(); )
+                msg.append("Portal supports [" + portalSupportedWindowStates.size() + "] window states.  ");
+                for (Iterator i = portalSupportedWindowStates.iterator(); i.hasNext();)
                 {
-                    msg.append( "[" + i.next() + "]" );
-                    if ( i.hasNext() )
+                    msg.append("[" + i.next() + "]");
+                    if (i.hasNext())
                     {
                         msg.append(", ");
                     }
@@ -106,28 +107,28 @@
             }
         }
 
-        if ( portalSupportedWindowStates == null )
+        if (portalSupportedWindowStates == null)
         {
             final String msg = "Portal supported window states is null!";
-            LOG.error( msg );
-            throw new DriverConfigurationException( msg );
+            LOG.error(msg);
+            throw new DriverConfigurationException(msg);
         }
-        LOG.debug( "SupportedWindowStateService initialized." );
+        LOG.debug("SupportedWindowStateService initialized.");
     }
-    
+
     public boolean isWindowStateSupported(String portletId, String state)
     {
         // If the supplied window state is a JSR 168 window state,
         // we can return immediately
-        if ( JSR168_WINDOW_STATES.contains(state) )
+        if (JSR168_WINDOW_STATES.contains(state))
         {
             return true;
         }
-        
+
         // Otherwise we need to check for custom window states
-        
-        return isWindowStateSupportedByPortal(state) && 
-            isWindowStateSupportedByPortlet(portletId, state);
+
+        return isWindowStateSupportedByPortal(state) &&
+                isWindowStateSupportedByPortlet(portletId, state);
     }
 
     public boolean isWindowStateSupportedByPortal(String state)
@@ -136,82 +137,68 @@
     }
 
     public boolean isWindowStateSupportedByPortlet(String portletId, String state)
-    {        
-        if ( portletId == null || 
-             state == null || 
-             portletId.trim().equals("") || 
-             state.trim().equals(""))
-        {
-            StringBuffer errMsg = new StringBuffer( "Cannot determine supported window " +
-                "states for portletId [" + portletId + "] and window state [" + state + "].  " );
-            String msg = errMsg.append( "One or both of the arguments is empty or null." ).toString();
+    {
+        if (portletId == null ||
+                state == null ||
+                portletId.trim().equals("") ||
+                state.trim().equals(""))
+        {
+            StringBuffer errMsg = new StringBuffer("Cannot determine supported window " +
+                    "states for portletId [" + portletId + "] and window state [" + state + "].  ");
+            String msg = errMsg.append("One or both of the arguments is empty or null.").toString();
             LOG.error(msg);
             throw new IllegalArgumentException(msg);
         }
-        
+
         // We can short-circut the registry lookup if the window state is
         // one from PLT.9
-        if ( JSR168_WINDOW_STATES.contains(new WindowState(state)) )
+        if (JSR168_WINDOW_STATES.contains(new WindowState(state)))
         {
             return true;
         }
-        
+
         // If the supplied window state isn't a JSR 168 window state,
         // we look to see if it is a custom window state.
-        
+
         String appId = PortletWindowConfig.parseContextPath(portletId);
         String applicationName = appId;
-        if (applicationName.length() >0 )
+        if (applicationName.length() > 0)
         {
             applicationName = applicationName.substring(1);
         }
         PortletApplicationDefinition portletAppDD = null;
-        
-        if (portletRegistry == null) 
-        {                        
-            portletRegistry = getPortletRegistryService();
-            if ( portletRegistry == null )
-            {
-                return false;
-            }
+
+        if (portletRegistry == null)
+        {
+            return false;
         }
-        
+
         try
         {
             portletAppDD = portletRegistry.getPortletApplication(applicationName);
         }
-        catch ( PortletContainerException e )
+        catch (PortletContainerException e)
         {
-            StringBuffer errMsg = new StringBuffer( "Cannot determine supported window " +
-                    "states for portletId [" + portletId + "] and window state [" + state + "].  " );
-            String msg = errMsg.append( "Unable to access the Portlet Registry Service." ).toString();
-            LOG.error( msg, e );
+            StringBuffer errMsg = new StringBuffer("Cannot determine supported window " +
+                    "states for portletId [" + portletId + "] and window state [" + state + "].  ");
+            String msg = errMsg.append("Unable to access the Portlet Registry Service.").toString();
+            LOG.error(msg, e);
         }
-        
+
         List customWindowStates = portletAppDD.getCustomWindowStates();
-        if ( customWindowStates != null )
+        if (customWindowStates != null)
         {
-            for ( Iterator i = customWindowStates.iterator(); i.hasNext(); )
+            for (Iterator i = customWindowStates.iterator(); i.hasNext();)
             {
-                CustomWindowState customState = (CustomWindowState)i.next();
-                if ( customState.getWindowState().equals(state))
+                CustomWindowState customState = (CustomWindowState) i.next();
+                if (customState.getWindowState().equals(state))
                 {
                     return true;
                 }
             }
         }
-        
-        return false;
-    }
 
-    private PortletRegistryService getPortletRegistryService()
-    {
-        return PlutoServices.getServices().getPortletRegistryService();
-    }
-
-    public void init(ResourceSource resourceSource) throws DriverConfigurationException {
+        return false;
     }
 
-    public void destroy() throws DriverConfigurationException {
-    }
 }

Modified: portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/PortalStartupListener.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/PortalStartupListener.java?rev=893689&r1=893688&r2=893689&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/PortalStartupListener.java (original)
+++ portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/PortalStartupListener.java Thu Dec 24 02:58:17 2009
@@ -16,11 +16,10 @@
  */
 package org.apache.pluto.driver;
 
-import java.io.InputStream;
-
 import javax.servlet.ServletContext;
 import javax.servlet.ServletContextEvent;
 import javax.servlet.ServletContextListener;
+
 import org.apache.pluto.container.PortletContainer;
 import org.apache.pluto.container.PortletContainerException;
 import org.apache.pluto.container.driver.PortalDriverServices;
@@ -28,10 +27,10 @@
 import org.apache.pluto.driver.config.AdminConfiguration;
 import org.apache.pluto.driver.config.DriverConfiguration;
 import org.apache.pluto.driver.config.DriverConfigurationException;
-import org.apache.pluto.driver.container.ResourceSource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.ContextLoaderListener;
 
 /**
  * Listener used to start up / shut down the Pluto Portal Driver upon startup /
@@ -50,7 +49,8 @@
  * @version $Revision$ $Date$
  * @since Sep 22, 2004
  */
-public class PortalStartupListener implements ServletContextListener {
+public class PortalStartupListener extends ContextLoaderListener
+{
 
     /**
      * Internal logger.
@@ -73,6 +73,13 @@
      */
     private static final String ADMIN_CONFIG_KEY = AttributeKeys.DRIVER_ADMIN_CONFIG;
 
+    private static ServletContext servletContext;
+
+    public static ServletContext getServletContext()
+    {
+        return servletContext;
+    }
+
     // ServletContextListener Impl ---------------------------------------------
 
     /**
@@ -91,33 +98,32 @@
      *
      * @param event the servlet context event.
      */
-    public void contextInitialized(ServletContextEvent event) {
+    public void contextInitialized(ServletContextEvent event)
+    {
         LOG.info("Starting up Pluto Portal Driver. . .");
 
         final ServletContext servletContext = event.getServletContext();
 
+        PortalStartupListener.servletContext = servletContext;
+        super.contextInitialized(event);
         WebApplicationContext springContext = null;
-        
-        try {
-        	springContext = (WebApplicationContext)
-        		servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
-        	
-        } catch (RuntimeException ex) {
-        	String msg = "Problem getting Spring context: " + ex.getMessage();
-        	LOG.error(msg, ex);
-        	throw ex;
+
+        try
+        {
+            springContext = (WebApplicationContext)
+                    servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
+
+        } catch (RuntimeException ex)
+        {
+            String msg = "Problem getting Spring context: " + ex.getMessage();
+            LOG.error(msg, ex);
+            throw ex;
         }
-     
+
         LOG.debug(" [1a] Loading DriverConfiguration. . . ");
         DriverConfiguration driverConfiguration = (DriverConfiguration)
                 springContext.getBean("DriverConfiguration");
 
-        driverConfiguration.init(new ResourceSource() {
-            public InputStream getResourceAsStream(String resourceName) {
-                return servletContext.getResourceAsStream(resourceName);
-            }
-        });
-
         LOG.debug(" [1b] Registering DriverConfiguration. . .");
         servletContext.setAttribute(DRIVER_CONFIG_KEY, driverConfiguration);
 
@@ -126,14 +132,25 @@
         AdminConfiguration adminConfiguration = (AdminConfiguration)
                 springContext.getBean("AdminConfiguration");
 
-        if (adminConfiguration != null) {
+        if (adminConfiguration != null)
+        {
             LOG.debug(" [2b] Registering Optional AdminConfiguration");
             servletContext.setAttribute(ADMIN_CONFIG_KEY, adminConfiguration);
-        } else {
+        } else
+        {
             LOG.info("Optional AdminConfiguration not found. Ignoring.");
         }
 
-        initContainer(servletContext);
+
+        LOG.info("Initializing Portlet Container. . .");
+
+        // Create portlet container.
+        LOG.debug(" [1] Creating portlet container...");
+        PortletContainer container = (PortletContainer) springContext.getBean("PortletContainer");
+
+        // Save portlet container to the servlet context scope.
+        servletContext.setAttribute(CONTAINER_KEY, container);
+        LOG.info("Pluto portlet container started.");
 
         LOG.info("********** Pluto Portal Driver Started **********\n\n");
     }
@@ -144,63 +161,24 @@
      *
      * @param event the destrubtion event.
      */
-    public void contextDestroyed(ServletContextEvent event) {
+    public void contextDestroyed(ServletContextEvent event)
+    {
         ServletContext servletContext = event.getServletContext();
-        if (LOG.isInfoEnabled()) {
+        if (LOG.isInfoEnabled())
+        {
             LOG.info("Shutting down Pluto Portal Driver...");
         }
         destroyContainer(servletContext);
         destroyAdminConfiguration(servletContext);
         destroyDriverConfiguration(servletContext);
-        if (LOG.isInfoEnabled()) {
+        if (LOG.isInfoEnabled())
+        {
             LOG.info("********** Pluto Portal Driver Shut Down **********\n\n");
         }
+        super.contextDestroyed(event);
     }
 
 
-    /**
-     * Initializes the portlet container. This method constructs and initializes
-     * the portlet container, and saves it to the servlet context scope.
-     *
-     * @param servletContext the servlet context.
-     */
-    private void initContainer(ServletContext servletContext) {
-
-        WebApplicationContext springContext = (WebApplicationContext)
-                servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
-
-        // Retrieve the driver configuration from servlet context.
-        DriverConfiguration driverConfig = (DriverConfiguration)
-                servletContext.getAttribute(DRIVER_CONFIG_KEY);
-
-        try {
-            LOG.info("Initializing Portlet Container. . .");
-           
-            // Create portlet container.
-            LOG.debug(" [1] Creating portlet container...");
-            PortletContainerFactory factory =
-                    PortletContainerFactory.getInstance();
-            PortletContainer container = factory.createContainer(
-                driverConfig.getContainerName(), (PortalDriverServices)springContext.getBean("PortalDriverServices")
-            );
-
-            // Initialize portlet container.
-            LOG.debug(" [2] Initializing portlet container...");
-            container.init();
-
-            // Save portlet container to the servlet context scope.
-            servletContext.setAttribute(CONTAINER_KEY, container);
-            LOG.info("Pluto portlet container started.");
-
-        } catch (DriverConfigurationException ex) {
-            LOG.error("Unable to retrieve driver configuration "
-                    + "due to configuration error: " + ex.getMessage(), ex);
-        } catch (PortletContainerException ex) {
-            LOG.error("Unable to start up portlet container: "
-                    + ex.getMessage(), ex);
-        }
-    }
-
     // Private Destruction Methods ---------------------------------------------
 
     /**
@@ -208,22 +186,29 @@
      *
      * @param servletContext the servlet context.
      */
-    private void destroyContainer(ServletContext servletContext) {
-        if (LOG.isInfoEnabled()) {
+    private void destroyContainer(ServletContext servletContext)
+    {
+        if (LOG.isInfoEnabled())
+        {
             LOG.info("Shutting down Pluto Portal Driver...");
         }
         PortletContainer container = (PortletContainer)
                 servletContext.getAttribute(CONTAINER_KEY);
-        if (container != null) {
-            try {
+        if (container != null)
+        {
+            try
+            {
                 container.destroy();
-                if (LOG.isInfoEnabled()) {
+                if (LOG.isInfoEnabled())
+                {
                     LOG.info("Pluto Portal Driver shut down.");
                 }
-            } catch (PortletContainerException ex) {
+            } catch (PortletContainerException ex)
+            {
                 LOG.error("Unable to shut down portlet container: "
                         + ex.getMessage(), ex);
-            } finally {
+            } finally
+            {
                 servletContext.removeAttribute(CONTAINER_KEY);
             }
         }
@@ -234,21 +219,13 @@
      *
      * @param servletContext the servlet context.
      */
-    private void destroyDriverConfiguration(ServletContext servletContext) {
+    private void destroyDriverConfiguration(ServletContext servletContext)
+    {
         DriverConfiguration driverConfig = (DriverConfiguration)
                 servletContext.getAttribute(DRIVER_CONFIG_KEY);
-        if (driverConfig != null) {
-            try {
-                driverConfig.destroy();
-                if (LOG.isInfoEnabled()) {
-                    LOG.info("Pluto Portal Driver Config destroyed.");
-                }
-            } catch (DriverConfigurationException ex) {
-                LOG.error("Unable to destroy portal driver config: "
-                        + ex.getMessage(), ex);
-            } finally {
-                servletContext.removeAttribute(DRIVER_CONFIG_KEY);
-            }
+        if (driverConfig != null)
+        {
+            servletContext.removeAttribute(DRIVER_CONFIG_KEY);
         }
     }
 
@@ -257,19 +234,25 @@
      *
      * @param servletContext the servlet context.
      */
-    private void destroyAdminConfiguration(ServletContext servletContext) {
+    private void destroyAdminConfiguration(ServletContext servletContext)
+    {
         AdminConfiguration adminConfig = (AdminConfiguration)
                 servletContext.getAttribute(ADMIN_CONFIG_KEY);
-        if (adminConfig != null) {
-            try {
+        if (adminConfig != null)
+        {
+            try
+            {
                 adminConfig.destroy();
-                if (LOG.isInfoEnabled()) {
+                if (LOG.isInfoEnabled())
+                {
                     LOG.info("Pluto Portal Admin Config destroyed.");
                 }
-            } catch (DriverConfigurationException ex) {
+            } catch (DriverConfigurationException ex)
+            {
                 LOG.error("Unable to destroy portal admin config: "
                         + ex.getMessage(), ex);
-            } finally {
+            } finally
+            {
                 servletContext.removeAttribute(ADMIN_CONFIG_KEY);
             }
         }

Modified: portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/config/DriverConfiguration.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/config/DriverConfiguration.java?rev=893689&r1=893688&r2=893689&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/config/DriverConfiguration.java (original)
+++ portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/config/DriverConfiguration.java Thu Dec 24 02:58:17 2009
@@ -21,14 +21,12 @@
 
 import javax.portlet.PortletConfig;
 import javax.portlet.PortletMode;
-import javax.servlet.ServletContext;
 
 import org.apache.pluto.container.PortletContainerException;
 import org.apache.pluto.container.PortletPreferencesService;
 import org.apache.pluto.driver.services.portal.PageConfig;
 import org.apache.pluto.driver.services.portal.RenderConfigService;
 import org.apache.pluto.driver.url.PortalURLParser;
-import org.apache.pluto.driver.container.ResourceSource;
 
 /**
  * Interface defining a means for retrieving driver services
@@ -44,25 +42,6 @@
 public interface DriverConfiguration {
 
 //
-// Lifecycle Methods
-//
-
-    /**
-     * Initialization method used to place the driver
-     * configuration into service.
-     * @throws DriverConfigurationException when an error occurs during startup.
-     * @param context
-     */
-    void init(ResourceSource context) throws DriverConfigurationException;
-
-    /**
-     * Shutdown method used to remove the driver
-     * configuration from service;
-     * @throws DriverConfigurationException when an error occurs during shutdown.
-     */
-    void destroy() throws DriverConfigurationException;
-
-//
 // Service / Configuration Methods
 //
 

Modified: portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/DefaultOptionalContainerServices.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/DefaultOptionalContainerServices.java?rev=893689&r1=893688&r2=893689&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/DefaultOptionalContainerServices.java (original)
+++ portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/DefaultOptionalContainerServices.java Thu Dec 24 02:58:17 2009
@@ -60,7 +60,7 @@
     public DefaultOptionalContainerServices() {
         rdService = new RequestDispatcherServiceImpl();
         portletPreferencesService = new DefaultPortletPreferencesService();
-        portletRegistryService = new PortletContextManager(rdService);
+        portletRegistryService = new PortletContextManager(rdService, new PortletAppDescriptorServiceImpl());
         portletContextService = (PortletContextManager)portletRegistryService;
         portletInvokerService = new DefaultPortletInvokerService(portletContextService);
         portletEnvironmentService = new PortletEnvironmentServiceImpl();

Modified: portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/PortalDriverServicesImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/PortalDriverServicesImpl.java?rev=893689&r1=893688&r2=893689&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/PortalDriverServicesImpl.java (original)
+++ portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/PortalDriverServicesImpl.java Thu Dec 24 02:58:17 2009
@@ -37,6 +37,7 @@
 import org.apache.pluto.container.driver.RequiredContainerServices;
 import org.apache.pluto.container.impl.PortletEnvironmentServiceImpl;
 import org.apache.pluto.container.impl.RequestDispatcherServiceImpl;
+import org.apache.pluto.container.impl.PortletAppDescriptorServiceImpl;
 
 
 public class PortalDriverServicesImpl implements RequiredContainerServices, OptionalContainerServices, PortalDriverServices
@@ -165,7 +166,7 @@
     protected void createDefaultServicesIfNeeded()
     {
         rdService = rdService == null ? new RequestDispatcherServiceImpl() : rdService;
-        portletRegistryService = portletRegistryService == null ? new PortletContextManager(rdService) : portletRegistryService;
+        portletRegistryService = portletRegistryService == null ? new PortletContextManager(rdService, new PortletAppDescriptorServiceImpl()) : portletRegistryService;
         portletContextService = portletContextService == null ? (PortletContextManager)portletRegistryService : portletContextService;
         portalAdministrationService = portalAdministrationService == null ? new DefaultPortalAdministrationService() : portalAdministrationService;
         ccppProfileService = ccppProfileService == null ? new DummyCCPPProfileServiceImpl() : ccppProfileService;

Modified: portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/PortletContextManager.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/PortletContextManager.java?rev=893689&r1=893688&r2=893689&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/PortletContextManager.java (original)
+++ portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/PortletContextManager.java Thu Dec 24 02:58:17 2009
@@ -33,6 +33,7 @@
 import org.apache.pluto.container.PortletContainerException;
 import org.apache.pluto.container.PortletWindow;
 import org.apache.pluto.container.RequestDispatcherService;
+import org.apache.pluto.container.PortletAppDescriptorService;
 import org.apache.pluto.container.driver.DriverPortletConfig;
 import org.apache.pluto.container.driver.DriverPortletContext;
 import org.apache.pluto.container.driver.PortletContextService;
@@ -89,12 +90,14 @@
      */
     private final Map<String,ClassLoader> classLoaders = new HashMap<String,ClassLoader>();
     
-    private RequestDispatcherService rdService;
+    private final RequestDispatcherService rdService;
+    private final PortletDescriptorRegistry portletRegistry;
 
     // Constructor -------------------------------------------------------------
 
-    public PortletContextManager(RequestDispatcherService rdService) {
+    public PortletContextManager(RequestDispatcherService rdService, PortletAppDescriptorService portletAppDescriptorService) {
         this.rdService = rdService;
+        portletRegistry = new PortletDescriptorRegistry(portletAppDescriptorService);
     }
 
 
@@ -113,7 +116,6 @@
 	    String contextPath = getContextPath(servletContext);
         String applicationName = contextPath.substring(1);
         if (!portletContexts.containsKey(applicationName)) {
-        	PortletDescriptorRegistry portletRegistry = PortletDescriptorRegistry.getRegistry();
 
             PortletApplicationDefinition portletApp = portletRegistry.getPortletAppDD(servletContext, applicationName, contextPath);
 

Modified: portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/PortletDescriptorRegistry.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/PortletDescriptorRegistry.java?rev=893689&r1=893688&r2=893689&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/PortletDescriptorRegistry.java (original)
+++ portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/container/PortletDescriptorRegistry.java Thu Dec 24 02:58:17 2009
@@ -52,15 +52,10 @@
     private static final StringManager EXCEPTIONS = StringManager.getManager(
             PortletDescriptorRegistry.class.getPackage().getName());
 
-    /** The static singleton registry instance. */
-    private static final PortletDescriptorRegistry REGISTRY =
-    		new PortletDescriptorRegistry();
-
-
     // Private Member Variables ------------------------------------------------
 
     /** The portlet application descriptor service. */
-    private PortletAppDescriptorService portletDDService;
+    private final PortletAppDescriptorService portletDDService;
 
     /**
      * Cache of descriptors.  WeakHashMap is used so that
@@ -69,45 +64,17 @@
      * point I'm wondering if we really want to add another
      * config requirement in the servlet xml? Hmm. . .
      */
-    private Map<ServletContext, PortletApplicationDefinition> cache = new WeakHashMap<ServletContext, PortletApplicationDefinition>();
+    private final Map<ServletContext, PortletApplicationDefinition> cache = new WeakHashMap<ServletContext, PortletApplicationDefinition>();
 
 
     // Constructor -------------------------------------------------------------
 
-    /**
-     * Returns the singleton registry instance.
-     * @return the singleton registry instance.
-     */
-    public static PortletDescriptorRegistry getRegistry() {
-        return REGISTRY;
+    //someone didn't want this accessible externally.
+    PortletDescriptorRegistry(PortletAppDescriptorService portletDDService)
+    {
+        this.portletDDService = portletDDService;
     }
 
-    /**
-     * Private constructor that prevents external instantiation.
-     * We must modify the context class loader in order for
-     * the Configuration utility to find the properties file.
-     * @throws PlutoConfigurationException  if fail to instantiate portlet
-     *         application descriptor service.
-     */
-    private PortletDescriptorRegistry()
-    throws PlutoConfigurationException {
-        String className = Configuration.getPortletAppDescriptorServiceImpl();
-        try {
-            Class<?> clazz = Class.forName(className);
-            portletDDService = (PortletAppDescriptorService) clazz.newInstance();
-        } catch (ClassNotFoundException ex) {
-            throw new PlutoConfigurationException(
-            		"Unable to find class " + className, ex);
-        } catch (InstantiationException ex) {
-            throw new PlutoConfigurationException(
-            		"Unable to instantiate class " + className, ex);
-        } catch (IllegalAccessException ex) {
-            throw new PlutoConfigurationException(
-            		"Unable to access class " + className, ex);
-        }
-    }
-
-
     // Public Methods ----------------------------------------------------------
 
     /**

Modified: portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/PageConfig.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/PageConfig.java?rev=893689&r1=893688&r2=893689&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/PageConfig.java (original)
+++ portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/PageConfig.java Thu Dec 24 02:58:17 2009
@@ -25,11 +25,11 @@
 
     private String name;
     private String uri;
-    private Collection portletIds;
+    private Collection<String> portletIds;
     private int orderNumber;
 
     public PageConfig() {
-        this.portletIds = new ArrayList();
+        this.portletIds = new ArrayList<String>();
     }
 
     public String getName() {
@@ -48,11 +48,11 @@
         this.uri = uri;
     }
 
-    public Collection getPortletIds() {
+    public Collection<String> getPortletIds() {
         return portletIds;
     }
 
-    public void setPortletIds(Collection ids) {
+    public void setPortletIds(Collection<String> ids) {
         this.portletIds = ids;
     }
 

Modified: portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/PropertyConfigService.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/PropertyConfigService.java?rev=893689&r1=893688&r2=893689&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/PropertyConfigService.java (original)
+++ portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/PropertyConfigService.java Thu Dec 24 02:58:17 2009
@@ -24,7 +24,7 @@
  *
  * @since Aug 10, 2005
  */
-public interface PropertyConfigService extends DriverConfigurationService {
+public interface PropertyConfigService {
 
     /**
      * Name of the portal driver.
@@ -53,7 +53,7 @@
      * {@link javax.portlet.PortletMode#HELP}
      * @return set of unique portlet modes.
      */
-    Set getSupportedPortletModes();
+    Set<String> getSupportedPortletModes();
 
     /**
      * Set of unique Window States.
@@ -63,5 +63,5 @@
      * {@link javax.portlet.WindowState#MINIMIZED}
      * @return set of unique window states.
      */
-    Set getSupportedWindowStates();
+    Set<String> getSupportedWindowStates();
 }

Modified: portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/RenderConfigService.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/RenderConfigService.java?rev=893689&r1=893688&r2=893689&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/RenderConfigService.java (original)
+++ portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/RenderConfigService.java Thu Dec 24 02:58:17 2009
@@ -24,7 +24,7 @@
  *
  * @since Aug 10, 2005
  */
-public interface RenderConfigService extends DriverConfigurationService {
+public interface RenderConfigService {
 
     /**
      * Retrieve an ordered list of all PageConfig instances.

Modified: portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/SupportedModesService.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/SupportedModesService.java?rev=893689&r1=893688&r2=893689&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/SupportedModesService.java (original)
+++ portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/SupportedModesService.java Thu Dec 24 02:58:17 2009
@@ -31,7 +31,7 @@
  * @since September 9, 2006
  * @see PortletMode
  */
-public interface SupportedModesService extends DriverConfigurationService {
+public interface SupportedModesService {
     
     /**
      * Returns true if the portlet and the portal support the supplied mode.

Modified: portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/SupportedWindowStateService.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/SupportedWindowStateService.java?rev=893689&r1=893688&r2=893689&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/SupportedWindowStateService.java (original)
+++ portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/SupportedWindowStateService.java Thu Dec 24 02:58:17 2009
@@ -24,7 +24,7 @@
  * @version $Id$
  * @see javax.portlet.WindowState
  */
-public interface SupportedWindowStateService extends DriverConfigurationService {
+public interface SupportedWindowStateService {
 
     /**
      * Returns true if the portlet and the portal support the supplied

Modified: portals/pluto/trunk/pluto-portal/src/main/webapp/WEB-INF/pluto-portal-driver-services-config.xml
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal/src/main/webapp/WEB-INF/pluto-portal-driver-services-config.xml?rev=893689&r1=893688&r2=893689&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-portal/src/main/webapp/WEB-INF/pluto-portal-driver-services-config.xml (original)
+++ portals/pluto/trunk/pluto-portal/src/main/webapp/WEB-INF/pluto-portal-driver-services-config.xml Thu Dec 24 02:58:17 2009
@@ -44,104 +44,194 @@
 
 <beans>
 
-	<bean id="PlutoServices"
-	      class="org.apache.pluto.container.driver.PlutoServices"
-          singleton="true">
-      <constructor-arg><ref bean="PortalDriverServices"/></constructor-arg>          	      
-	</bean>  
-	
-    <bean id="PortalDriverServices"
-          class="org.apache.pluto.driver.container.PortalDriverServicesImpl"
-          singleton="true">
-      <constructor-arg><ref bean="PortalContext"/></constructor-arg>
-      <constructor-arg><ref bean="PortletRequestContextService"/></constructor-arg>
-      <constructor-arg><ref bean="EventCoordinationService"/></constructor-arg>
-      <constructor-arg><ref bean="FilterManagerService"/></constructor-arg>
-      <constructor-arg><ref bean="PortletURLListenerService"/></constructor-arg>
-    </bean>
-
-    <bean id="PortalContext"
-          class="org.apache.pluto.driver.services.container.PortalContextImpl">
-        <constructor-arg><ref bean="DriverConfiguration"/></constructor-arg>
-    </bean>
-
-
-
-    <!-- ================================================ -->
-    <!-- The single top element of the configuration tree -->
-    <!-- ================================================ -->
-    <bean id="DriverConfiguration"
-          class="org.apache.pluto.driver.config.impl.DriverConfigurationImpl">
-
-      <!-- ===== Portal Services ===== -->
-      <constructor-arg><ref bean="PortalURLParser"/></constructor-arg>
-      <constructor-arg><ref bean="PropertyConfigService"/></constructor-arg>
-      <constructor-arg><ref bean="RenderConfigService"/></constructor-arg>
-      <constructor-arg><ref bean="SupportedModesService"/></constructor-arg>
-      <constructor-arg><ref bean="SupportedWindowStatesService"/></constructor-arg>
-
-      <!--
-      <property name="portletPreferencesService"><ref bean="PortletPreferencesService"/></property>
-      -->
-    </bean>
-
-    <!-- ================================================ -->
-    <!-- The single top element of the administration tree -->
-    <!-- ================================================ -->
-    <bean id="AdminConfiguration" class="org.apache.pluto.driver.config.impl.AdminConfigurationImpl">
-      <property name="renderConfigAdminService"><ref bean="RenderConfigService"/></property>
-    </bean>
-
-
-    <!-- ================================================ -->
-    <!-- Portal Services injected into the Configuration  -->
-    <!-- ================================================ -->
-    <bean id="PortalURLParser"
-          class="org.apache.pluto.driver.url.impl.PortalURLParserImpl"
-          factory-method="getParser"
-          singleton="true">
-    </bean>
-
-    <bean id="PropertyConfigService"
-          class="org.apache.pluto.driver.services.impl.resource.PropertyConfigServiceImpl"
-          singleton="true">
-    </bean>
-
-    <bean id="RenderConfigService"
-          class="org.apache.pluto.driver.services.impl.resource.RenderConfigServiceImpl"
-          singleton="true">
-    </bean>
-    
-    <bean id="SupportedModesService"
-          class="org.apache.pluto.driver.services.impl.resource.SupportedModesServiceImpl"
-          singleton="true">
-          <constructor-arg><ref bean="PropertyConfigService"/></constructor-arg>
-    </bean>
-
-    <bean id="SupportedWindowStatesService"
-          class="org.apache.pluto.driver.services.impl.resource.SupportedWindowStateServiceImpl"
-          singleton="true">
-          <constructor-arg><ref bean="PropertyConfigService"/></constructor-arg>
-    </bean>
-
-    <!-- ================================================ -->
-    <!-- Container Services injected into  Configuration  -->
-    <!-- ================================================ -->
-    <bean id="PortletRequestContextService"
-          class="org.apache.pluto.driver.services.container.PortletRequestContextServiceImpl"
-          singleton="true">
-    </bean>
-    <bean id="EventCoordinationService"
-          class="org.apache.pluto.driver.services.container.EventCoordinationServiceImpl"
-          singleton="true">
-    </bean>
-    <bean id="FilterManagerService"
-          class="org.apache.pluto.driver.services.container.FilterManagerServiceImpl"
-          singleton="true">
-    </bean>
-    <bean id="PortletURLListenerService"
-          class="org.apache.pluto.driver.services.container.PortletURLListenerServiceImpl"
-          singleton="true">
-    </bean>
+  <bean id="PortletContainer"
+        class="org.apache.pluto.container.impl.PortletContainerImpl"
+        init-method="init"
+        singleton="true">
+    <constructor-arg>
+      <bean factory-bean="DriverConfiguration" factory-method="getPortalName"/>
+    </constructor-arg>
+    <constructor-arg>
+      <ref bean="PortalDriverServices"/>
+    </constructor-arg>
+  </bean>
+
+  <bean id="PlutoServices"
+        class="org.apache.pluto.container.driver.PlutoServices"
+        singleton="true">
+    <constructor-arg>
+      <ref bean="PortalDriverServices"/>
+    </constructor-arg>
+  </bean>
+
+  <bean id="PortalDriverServices"
+        class="org.apache.pluto.driver.container.PortalDriverServicesImpl"
+        singleton="true">
+    <constructor-arg>
+      <ref bean="PortalContext"/>
+    </constructor-arg>
+    <constructor-arg>
+      <ref bean="PortletRequestContextService"/>
+    </constructor-arg>
+    <constructor-arg>
+      <ref bean="EventCoordinationService"/>
+    </constructor-arg>
+    <constructor-arg>
+      <ref bean="FilterManagerService"/>
+    </constructor-arg>
+    <constructor-arg>
+      <ref bean="PortletURLListenerService"/>
+    </constructor-arg>
+    <constructor-arg>
+      <null/>
+      <!--<bean class="org.apache.pluto.driver.container.DefaultOptionalContainerServices"/>-->
+    </constructor-arg>
+    <constructor-arg>
+      <ref bean="PortletContextService"/>
+    </constructor-arg>
+    <constructor-arg>
+      <ref bean="PortletContextService"/>
+    </constructor-arg>
+    <constructor-arg>
+      <bean class="org.apache.pluto.driver.container.DefaultPortalAdministrationService"/>
+    </constructor-arg>
+  </bean>
+
+  <bean id="PortalContext"
+        class="org.apache.pluto.driver.services.container.PortalContextImpl">
+    <constructor-arg>
+      <ref bean="DriverConfiguration"/>
+    </constructor-arg>
+  </bean>
+
+
+  <!-- ================================================ -->
+  <!-- The single top element of the configuration tree -->
+  <!-- ================================================ -->
+  <bean id="DriverConfiguration"
+        class="org.apache.pluto.driver.config.impl.DriverConfigurationImpl">
+
+    <!-- ===== Portal Services ===== -->
+    <constructor-arg>
+      <ref bean="PortalURLParser"/>
+    </constructor-arg>
+    <constructor-arg>
+      <ref bean="ResourceConfigFactory"/>
+    </constructor-arg>
+    <constructor-arg>
+      <ref bean="RenderConfigService"/>
+    </constructor-arg>
+    <constructor-arg>
+      <ref bean="SupportedModesService"/>
+    </constructor-arg>
+    <constructor-arg>
+      <ref bean="SupportedWindowStatesService"/>
+    </constructor-arg>
+
+    <!--
+    <property name="portletPreferencesService"><ref bean="PortletPreferencesService"/></property>
+    -->
+  </bean>
+
+  <!-- ================================================ -->
+  <!-- The single top element of the administration tree -->
+  <!-- ================================================ -->
+  <bean id="AdminConfiguration" class="org.apache.pluto.driver.config.impl.AdminConfigurationImpl">
+    <property name="renderConfigAdminService">
+      <ref bean="RenderConfigService"/>
+    </property>
+  </bean>
+
+
+  <!-- ================================================ -->
+  <!-- Portal Services injected into the Configuration  -->
+  <!-- ================================================ -->
+  <bean id="ResourceConfigFactory" class="org.apache.pluto.driver.services.impl.resource.StaticServletContextResourceConfigFactory"
+        factory-method="getResourceConfig">
+  </bean>
+  <bean id="PortalURLParser"
+        class="org.apache.pluto.driver.url.impl.PortalURLParserImpl"
+        factory-method="getParser"
+        singleton="true">
+  </bean>
+
+  <!--<bean id="ResourceConfigFactory"-->
+        <!--class="org.apache.pluto.driver.services.impl.resource.PropertyConfigServiceImpl"-->
+        <!--singleton="true">-->
+    <!--<constructor-arg>-->
+      <!--<ref bean="ResourceConfigFactory"/>-->
+    <!--</constructor-arg>-->
+  <!--</bean>-->
+
+  <bean id="RenderConfigService"
+        class="org.apache.pluto.driver.services.impl.resource.RenderConfigServiceImpl"
+        singleton="true">
+    <constructor-arg>
+      <ref bean="ResourceConfigFactory"/>
+    </constructor-arg>
+  </bean>
+
+  <bean id="SupportedModesService"
+        class="org.apache.pluto.driver.services.impl.resource.SupportedModesServiceImpl"
+        singleton="true">
+    <constructor-arg>
+      <ref bean="ResourceConfigFactory"/>
+    </constructor-arg>
+    <constructor-arg>
+      <ref bean="PortletContextService"/>
+    </constructor-arg>
+    <constructor-arg>
+      <ref bean="PortletContextService"/>
+    </constructor-arg>
+  </bean>
+
+  <bean id="SupportedWindowStatesService"
+        class="org.apache.pluto.driver.services.impl.resource.SupportedWindowStateServiceImpl"
+        singleton="true">
+    <constructor-arg>
+      <ref bean="ResourceConfigFactory"/>
+    </constructor-arg>
+    <constructor-arg>
+      <ref bean="PortletContextService"/>
+    </constructor-arg>
+  </bean>
+
+  <!-- ================================================ -->
+  <!-- Container Services injected into  Configuration  -->
+  <!-- ================================================ -->
+  <bean id="PortletRequestContextService"
+        class="org.apache.pluto.driver.services.container.PortletRequestContextServiceImpl"
+        singleton="true">
+  </bean>
+  <bean id="EventCoordinationService"
+        class="org.apache.pluto.driver.services.container.EventCoordinationServiceImpl"
+        singleton="true">
+    <constructor-arg>
+      <ref bean="PortletContextService"/>
+    </constructor-arg>
+    <constructor-arg>
+      <ref bean="PortletContextService"/>
+    </constructor-arg>
+  </bean>
+  <bean id="FilterManagerService"
+        class="org.apache.pluto.driver.services.container.FilterManagerServiceImpl"
+        singleton="true">
+  </bean>
+  <bean id="PortletURLListenerService"
+        class="org.apache.pluto.driver.services.container.PortletURLListenerServiceImpl"
+        singleton="true">
+  </bean>
+  <bean id="PortletContextService"
+        class="org.apache.pluto.driver.container.PortletContextManager">
+    <constructor-arg>
+      <ref bean="RequestDispatcherService"/>
+    </constructor-arg>
+    <constructor-arg>
+      <bean class="org.apache.pluto.container.impl.PortletAppDescriptorServiceImpl"/>
+    </constructor-arg>
+  </bean>
+  <bean id="RequestDispatcherService"
+        class="org.apache.pluto.container.impl.RequestDispatcherServiceImpl">
+  </bean>
 
 </beans>
\ No newline at end of file