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 dd...@apache.org on 2006/12/04 05:12:39 UTC

svn commit: r482049 - /portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/SupportedModesServiceImpl.java

Author: ddewolf
Date: Sun Dec  3 20:12:37 2006
New Revision: 482049

URL: http://svn.apache.org/viewvc?view=rev&rev=482049
Log:
Fixing SupportedModesService

Modified:
    portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/SupportedModesServiceImpl.java

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?view=diff&rev=482049&r1=482048&r2=482049
==============================================================================
--- 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 Sun Dec  3 20:12:37 2006
@@ -18,7 +18,6 @@
 import org.apache.pluto.descriptors.portlet.PortletAppDD;
 import org.apache.pluto.descriptors.portlet.PortletDD;
 import org.apache.pluto.descriptors.portlet.SupportsDD;
-import org.apache.pluto.internal.InternalPortletContext;
 import org.apache.pluto.spi.optional.PortletRegistryService;
 import org.apache.pluto.driver.AttributeKeys;
 import org.apache.pluto.driver.config.DriverConfigurationException;
@@ -61,7 +60,6 @@
     /**
      * Constructs a SupportedModesService with its dependencies.
      * 
-     * @param portletRegistry the PortletRegistryService
      * @param propertySvc the PropertyConfigService
      */
     public SupportedModesServiceImpl(PropertyConfigService propertySvc) {
@@ -70,9 +68,7 @@
     
     //  SupportedModesService Implementation -----------------
     
-    public boolean isPortletModeSupported(String portletId, String mode) 
-    {
-
+    public boolean isPortletModeSupported(String portletId, String mode)  {
         return isPortletModeSupportedByPortal(mode) &&
             isPortletModeSupportedByPortlet(portletId, mode);
     }
@@ -107,6 +103,7 @@
         } catch (PortletContainerException e) {
             LOG.error("Error determining mode support.", e);
         }
+        LOG.info("Portlet mode '"+mode+"' not found for portletId: '"+portletId+"'");
         return false;
     }
 
@@ -126,7 +123,22 @@
         container = (PortletContainer)ctx.getAttribute(AttributeKeys.PORTLET_CONTAINER);
         OptionalContainerServices services = container.getOptionalContainerServices();
         portletRegistry = services.getPortletRegistryService();
+        loadPortalModes();
+    }
 
+        /** 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 = propertySvc.getSupportedPortletModes().iterator();
+        while (modes.hasNext()) {
+            String mode = (String) modes.next();
+            LOG.debug("Loading mode [" + mode + "]");
+            supportedPortletModesByPortal.add(new PortletMode(mode));
+        }
+        LOG.debug("Loaded [" + supportedPortletModesByPortal.size() + "] supported portal modes");
     }