incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r815356 - in /sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container: ./ internal/ internal/impl/ internal/request/
Date Tue, 15 Sep 2009 15:04:36 GMT
Author: cziegeler
Date: Tue Sep 15 15:04:36 2009
New Revision: 815356

URL: http://svn.apache.org/viewvc?rev=815356&view=rev
Log:
Add support for portlet window configurations

Modified:
    sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/PortletWindowManager.java
    sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/SlingPortletWindow.java
    sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/DefaultPortletWindowManager.java
    sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/PortletRenderResponseContextImpl.java
    sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/impl/PortletWindowImpl.java
    sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/request/PortalFilter.java

Modified: sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/PortletWindowManager.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/PortletWindowManager.java?rev=815356&r1=815355&r2=815356&view=diff
==============================================================================
--- sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/PortletWindowManager.java
(original)
+++ sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/PortletWindowManager.java
Tue Sep 15 15:04:36 2009
@@ -17,6 +17,7 @@
 package org.apache.sling.portal.container;
 
 import org.apache.pluto.container.PortletWindow;
+import org.apache.sling.api.resource.ValueMap;
 
 public interface PortletWindowManager {
 
@@ -24,14 +25,16 @@
      * Get the portlet window for the portlet entity and window id
      * @param id The portlet entity id.
      * @param windowId The window id - this is optional.
+     * @param config portlet window configuration
      * @return  The corresponding portlet window.
      */
-    PortletWindow getPortletWindow(PortletEntityId id, String windowId);
+    PortletWindow getPortletWindow(PortletEntityId id, String windowId, ValueMap config);
 
     /**
      * Get the portlet window for window id
      * @param windowId The complete window id.
+     * @param config portlet window configuration
      * @return  The corresponding portlet window.
      */
-    PortletWindow getPortletWindow(String windowId);
+    PortletWindow getPortletWindow(String windowId, ValueMap config);
 }

Modified: sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/SlingPortletWindow.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/SlingPortletWindow.java?rev=815356&r1=815355&r2=815356&view=diff
==============================================================================
--- sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/SlingPortletWindow.java
(original)
+++ sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/SlingPortletWindow.java
Tue Sep 15 15:04:36 2009
@@ -17,6 +17,7 @@
 package org.apache.sling.portal.container;
 
 import org.apache.pluto.container.PortletWindow;
+import org.apache.sling.api.resource.ValueMap;
 
 /**
  * This is an extension of the {@link PortletWindow} which
@@ -25,6 +26,8 @@
 public interface SlingPortletWindow extends PortletWindow {
 
     SlingPortletEntity getPortletEntity();
+
+    ValueMap getConfiguration();
 }
 
 

Modified: sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/DefaultPortletWindowManager.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/DefaultPortletWindowManager.java?rev=815356&r1=815355&r2=815356&view=diff
==============================================================================
--- sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/DefaultPortletWindowManager.java
(original)
+++ sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/DefaultPortletWindowManager.java
Tue Sep 15 15:04:36 2009
@@ -22,6 +22,7 @@
 import org.apache.pluto.container.PortletContainerException;
 import org.apache.pluto.container.PortletWindow;
 import org.apache.pluto.container.PortletWindowID;
+import org.apache.sling.api.resource.ValueMap;
 import org.apache.sling.portal.container.PortletEntityId;
 import org.apache.sling.portal.container.PortletRegistryService;
 import org.apache.sling.portal.container.PortletWindowManager;
@@ -48,22 +49,24 @@
     }
 
     /**
-     * @see org.apache.sling.portal.container.PortletWindowManager#getPortletWindow(org.apache.sling.portal.container.PortletEntityId,
java.lang.String)
+     * @see org.apache.sling.portal.container.PortletWindowManager#getPortletWindow(org.apache.sling.portal.container.PortletEntityId,
java.lang.String, org.apache.sling.api.resource.ValueMap)
      */
-    public PortletWindow getPortletWindow(PortletEntityId id, String window) {
+    public PortletWindow getPortletWindow(PortletEntityId id, String window, final ValueMap
configuration) {
         final PortletWindowID windowId = PortletWindowIDImpl.createFromIdentifier(id, window);
-        return this.getPortletWindow(id, windowId);
+        return this.getPortletWindow(id, windowId, configuration);
     }
 
     /**
-     * @see org.apache.sling.portal.container.PortletWindowManager#getPortletWindow(java.lang.String)
+     * @see org.apache.sling.portal.container.PortletWindowManager#getPortletWindow(java.lang.String,
org.apache.sling.api.resource.ValueMap)
      */
-    public PortletWindow getPortletWindow(String windowId) {
+    public PortletWindow getPortletWindow(final String windowId, final ValueMap configuration)
{
         final SlingPortletWindowId window = PortletWindowIDImpl.createFromString(windowId);
-        return this.getPortletWindow(window.getPortletEntityId(), window);
+        return this.getPortletWindow(window.getPortletEntityId(), window, configuration);
     }
 
-    protected PortletWindow getPortletWindow(final PortletEntityId id, final PortletWindowID
windowId) {
+    protected PortletWindow getPortletWindow(final PortletEntityId id,
+                                             final PortletWindowID windowId,
+                                             final ValueMap configuration) {
         SlingPortletEntity info = null;
         try {
             info = this.registry.getPortletEntity(id);
@@ -81,6 +84,7 @@
         return new PortletWindowImpl(info,
                 windowId,
                 portletMode == null ? PortletMode.VIEW : portletMode,
-                windowState == null ? WindowState.NORMAL : windowState);
+                windowState == null ? WindowState.NORMAL : windowState,
+                configuration);
     }
 }

Modified: sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/PortletRenderResponseContextImpl.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/PortletRenderResponseContextImpl.java?rev=815356&r1=815355&r2=815356&view=diff
==============================================================================
--- sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/PortletRenderResponseContextImpl.java
(original)
+++ sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/PortletRenderResponseContextImpl.java
Tue Sep 15 15:04:36 2009
@@ -52,7 +52,7 @@
     /** The next possible portlet modes set by the portlet. */
     private Collection<PortletMode> portletModes;
 
-    private boolean writeTitle = true;
+    private final boolean writeTitle;
 
     public PortletRenderResponseContextImpl(SlingPortletContainer container,
                                             HttpServletRequest containerRequest,
@@ -72,6 +72,7 @@
                 this.title = ((SlingPortletWindow)window).getPortletEntity().getPortletEntityId().getKey();
             }
         }
+        this.writeTitle = ((SlingPortletWindow)window).getConfiguration().get("showTitleBar",
true);
     }
 
     private boolean written() {

Modified: sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/impl/PortletWindowImpl.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/impl/PortletWindowImpl.java?rev=815356&r1=815355&r2=815356&view=diff
==============================================================================
--- sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/impl/PortletWindowImpl.java
(original)
+++ sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/impl/PortletWindowImpl.java
Tue Sep 15 15:04:36 2009
@@ -21,6 +21,7 @@
 
 import org.apache.pluto.container.PortletWindowID;
 import org.apache.pluto.container.om.portlet.PortletDefinition;
+import org.apache.sling.api.resource.ValueMap;
 import org.apache.sling.portal.container.SlingPortletEntity;
 import org.apache.sling.portal.container.SlingPortletWindow;
 
@@ -33,6 +34,7 @@
     private final WindowState windowState;
     private final PortletWindowID windowId;
     private final SlingPortletEntity entity;
+    private final ValueMap configuration;
 
     /**
      * Constructs an instance.
@@ -40,11 +42,13 @@
     public PortletWindowImpl(final SlingPortletEntity portletDef,
                              final PortletWindowID windowId,
                              final PortletMode portletMode,
-                             final WindowState windowState) {
+                             final WindowState windowState,
+                             final ValueMap configuration) {
         this.portletMode = portletMode;
         this.windowState = windowState;
         this.entity = portletDef;
         this.windowId = windowId;
+        this.configuration = (configuration != null ? configuration : ValueMap.EMPTY);
     }
 
     /**
@@ -81,4 +85,8 @@
     public PortletDefinition getPortletDefinition() {
         return this.entity.getPortletConfig().getPortletDefinition();
     }
+
+    public ValueMap getConfiguration() {
+        return this.configuration;
+    }
 }
\ No newline at end of file

Modified: sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/request/PortalFilter.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/request/PortalFilter.java?rev=815356&r1=815355&r2=815356&view=diff
==============================================================================
--- sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/request/PortalFilter.java
(original)
+++ sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/request/PortalFilter.java
Tue Sep 15 15:04:36 2009
@@ -25,11 +25,12 @@
 import javax.servlet.ServletException;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.pluto.container.PortletContainerException;
 import org.apache.pluto.container.PortletWindow;
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.resource.ResourceUtil;
 import org.apache.sling.commons.osgi.OsgiUtil;
 import org.apache.sling.portal.container.SlingPortletContainer;
 import org.apache.sling.portal.container.internal.impl.DefaultPortalURLFactory;
@@ -75,7 +76,7 @@
             chain.doFilter(request, response);
             return;
         }
-        final HttpServletRequest req = (HttpServletRequest)request;
+        final SlingHttpServletRequest req = (SlingHttpServletRequest)request;
         // we just instantiate a portal request context which might be used by the
         // portal
         PortalRequestContext.init(req, this.portalUrlFactory);
@@ -113,7 +114,7 @@
     /**
      * Perform portlet action.
      */
-    private boolean doPortletAction(HttpServletRequest request, HttpServletResponse response)
+    private boolean doPortletAction(SlingHttpServletRequest request, HttpServletResponse
response)
     throws IOException, ServletException {
         final PortalRequestContext portalRequestContext = PortalRequestContext.getContext();
 
@@ -122,7 +123,7 @@
 
         // the action window id shouldn't be null but we check it anyway.
         if (actionWindowId != null) {
-            final PortletWindow window = this.portletContainer.getPortletWindowManager().getPortletWindow(actionWindowId);
+            final PortletWindow window = this.portletContainer.getPortletWindowManager().getPortletWindow(actionWindowId,
ResourceUtil.getValueMap(request.getResource()));
             if ( window != null ) {
                 try {
                     this.portletContainer.doAction(window, request, response);
@@ -140,7 +141,7 @@
     /**
      * Perform portlet resource.
      */
-    private boolean doPortletResource(HttpServletRequest request, HttpServletResponse response)
+    private boolean doPortletResource(SlingHttpServletRequest request, HttpServletResponse
response)
     throws IOException, ServletException {
         final PortalRequestContext portalRequestContext = PortalRequestContext.getContext();
 
@@ -149,7 +150,7 @@
 
         // the resource window id shouldn't be null but we check it anyway.
         if (windowId != null) {
-            final PortletWindow window = this.portletContainer.getPortletWindowManager().getPortletWindow(windowId);
+            final PortletWindow window = this.portletContainer.getPortletWindowManager().getPortletWindow(windowId,
ResourceUtil.getValueMap(request.getResource()));
             if ( window != null ) {
                 try {
                     this.portletContainer.doServeResource(window, request, response);



Mime
View raw message