incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r960455 - in /sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container: ./ internal/ internal/impl/ internal/services/
Date Mon, 05 Jul 2010 06:31:05 GMT
Author: cziegeler
Date: Mon Jul  5 06:31:05 2010
New Revision: 960455

URL: http://svn.apache.org/viewvc?rev=960455&view=rev
Log:
Some cleanup

Modified:
    sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/ApplicationRegistryListener.java
    sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/DummyCCPPProfileServiceImpl.java
    sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/DummyProfile.java
    sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/impl/FilterChainImpl.java
    sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/impl/FilterConfigImpl.java
    sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/services/FilterManagerImpl.java
    sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/services/FilterManagerServiceImpl.java

Modified: sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/ApplicationRegistryListener.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/ApplicationRegistryListener.java?rev=960455&r1=960454&r2=960455&view=diff
==============================================================================
--- sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/ApplicationRegistryListener.java
(original)
+++ sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/ApplicationRegistryListener.java
Mon Jul  5 06:31:05 2010
@@ -20,7 +20,7 @@ package org.apache.sling.portal.containe
 
 /**
  * A listener for the portlet registry.
- * The listener are called synchronously, so they should not block the
+ * The listeners are called synchronously, so they should not block the
  * current operation!
  */
 public interface ApplicationRegistryListener {

Modified: sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/DummyCCPPProfileServiceImpl.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/DummyCCPPProfileServiceImpl.java?rev=960455&r1=960454&r2=960455&view=diff
==============================================================================
--- sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/DummyCCPPProfileServiceImpl.java
(original)
+++ sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/DummyCCPPProfileServiceImpl.java
Mon Jul  5 06:31:05 2010
@@ -22,16 +22,16 @@ import javax.servlet.http.HttpServletReq
 import org.apache.pluto.container.CCPPProfileService;
 
 /**
- * This is a dummy implementation - TODO!
+ * This is a dummy implementation
  */
 public class DummyCCPPProfileServiceImpl implements CCPPProfileService {
 
+    private final Profile SINGLETON = new DummyProfile();
+
 	/**
-	 * @see org.apache.pluto.spi.CCPPProfileService#getCCPPProfile()
+	 * @see org.apache.pluto.container.CCPPProfileService#getCCPPProfile(javax.servlet.http.HttpServletRequest)
 	 */
 	public Profile getCCPPProfile(HttpServletRequest httpServletRequest) {
-		return new DummyProfile();
-		// FIXME: Here we have to return a "real" javax.ccpp.Profile
+		return SINGLETON;
 	}
-
 }

Modified: sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/DummyProfile.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/DummyProfile.java?rev=960455&r1=960454&r2=960455&view=diff
==============================================================================
--- sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/DummyProfile.java
(original)
+++ sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/DummyProfile.java
Mon Jul  5 06:31:05 2010
@@ -24,18 +24,18 @@ import javax.ccpp.Profile;
 import javax.ccpp.ProfileDescription;
 
 /**
- * A dummy replace for a real CCPP Implementation (TBD)
+ * A dummy replace for a real CCPP Implementation
  */
 public class DummyProfile implements Profile {
 
-	/* (non-Javadoc)
+	/**
 	 * @see javax.ccpp.Profile#getAttribute(java.lang.String)
 	 */
 	public Attribute getAttribute(String arg0) {
 		return null;
 	}
 
-	/* (non-Javadoc)
+	/**
 	 * @see javax.ccpp.Profile#getAttributes()
 	 */
 	@SuppressWarnings("unchecked")
@@ -43,14 +43,14 @@ public class DummyProfile implements Pro
 		return null;
 	}
 
-	/* (non-Javadoc)
+	/**
 	 * @see javax.ccpp.Profile#getComponent(java.lang.String)
 	 */
 	public Component getComponent(String arg0) {
 		return null;
 	}
 
-	/* (non-Javadoc)
+	/**
 	 * @see javax.ccpp.Profile#getComponents()
 	 */
 	@SuppressWarnings("unchecked")
@@ -58,11 +58,10 @@ public class DummyProfile implements Pro
 		return null;
 	}
 
-	/* (non-Javadoc)
+	/**
 	 * @see javax.ccpp.Profile#getDescription()
 	 */
 	public ProfileDescription getDescription() {
 		return null;
 	}
-
 }

Modified: sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/impl/FilterChainImpl.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/impl/FilterChainImpl.java?rev=960455&r1=960454&r2=960455&view=diff
==============================================================================
--- sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/impl/FilterChainImpl.java
(original)
+++ sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/impl/FilterChainImpl.java
Mon Jul  5 06:31:05 2010
@@ -46,35 +46,66 @@ import javax.portlet.filter.ResourceFilt
  * filtered request for a portlet. Filters use the <code>FilterChain</code>
  * to invoke the next filter in the chain, or if the calling filter is the
  * last filter in the chain, to invoke the portlet at the end of the chain.
- *@since 29/05/2007
- *@version 2.0
  */
 public class FilterChainImpl implements FilterChain {
 
-	private List<PortletFilter> filterList = new ArrayList<PortletFilter>();
+    /** The list of portlet filters - will be instantiated lazy! */
+	private List<PortletFilter> filterList;
+
+    /** Index for the next filter to invoke from the list. */
+    private int filterListIndex = 0;
+
+    /** Portlet for render and action phase. */
 	private Portlet portlet;
+
+	/** Portlet for the event phase. */
 	private EventPortlet eventPortlet;
+
+	/** Portlet for the resource phase. */
 	private ResourceServingPortlet resourceServingPortlet;
-	private int filterListIndex = 0;
 
-	public void processFilter(EventRequest req, EventResponse res, EventPortlet eventPortlet)
throws IOException, PortletException{
+	/**
+	 * Process the filters for the event phase.
+	 */
+	public void processFilter(final EventRequest req,
+	                          final EventResponse res,
+	                          final EventPortlet eventPortlet)
+	throws IOException, PortletException{
 		this.eventPortlet = eventPortlet;
-		doFilter(req,res);
+		this.doFilter(req, res);
 	}
 
-	public void processFilter(ResourceRequest req, ResourceResponse res, ResourceServingPortlet
resourceServingPortlet) throws IOException, PortletException{
+    /**
+     * Process the filters for the resource phase.
+     */
+	public void processFilter(final ResourceRequest req,
+	                          final ResourceResponse res,
+	                          final ResourceServingPortlet resourceServingPortlet)
+	throws IOException, PortletException{
 		this.resourceServingPortlet = resourceServingPortlet;
-		doFilter(req,res);
+		this.doFilter(req, res);
 	}
 
-	public void processFilter(ActionRequest req, ActionResponse res, Portlet portlet) throws
IOException, PortletException{
+    /**
+     * Process the filters for the action phase.
+     */
+	public void processFilter(final ActionRequest req,
+	                          final ActionResponse res,
+	                          final Portlet portlet)
+	throws IOException, PortletException{
 		this.portlet = portlet;
-		doFilter(req,res);
+		this.doFilter(req, res);
 	}
 
-    public void processFilter(RenderRequest req, RenderResponse res, Portlet portlet) throws
IOException, PortletException{
+    /**
+     * Process the filters for the render phase.
+     */
+    public void processFilter(final RenderRequest req,
+                              final RenderResponse res,
+                              final Portlet portlet)
+    throws IOException, PortletException{
         this.portlet = portlet;
-        doFilter(req, res);
+        this.doFilter(req, res);
     }
 
     /**
@@ -83,46 +114,59 @@ public class FilterChainImpl implements 
      */
     public void addFilter(PortletFilter filter) {
         if ( filter != null ) {
-		    filterList.add(filter);
+            if ( this.filterList == null ) {
+                this.filterList = new ArrayList<PortletFilter>();
+            }
+            this.filterList.add(filter);
         }
 	}
 
-    public int size() {
-        return filterList.size();
+    /**
+     * Is the filter list empty?
+     */
+    public boolean isEmpty() {
+        return this.filterList == null || this.filterList.isEmpty();
     }
+
 	/**
 	 * @see javax.portlet.filter.FilterChain#doFilter(javax.portlet.ActionRequest, javax.portlet.ActionResponse)
 	 */
-	public void doFilter(ActionRequest request, ActionResponse response) throws IOException,
PortletException {
-		if (filterListIndex < filterList.size()){
-		    ActionFilter ActionFilter = (ActionFilter) filterList.get(filterListIndex);
-            filterListIndex++;
+	public void doFilter(final ActionRequest request,
+	                     final ActionResponse response)
+	throws IOException, PortletException {
+		if (this.filterListIndex < this.filterList.size()){
+		    ActionFilter ActionFilter = (ActionFilter) this.filterList.get(this.filterListIndex);
+		    this.filterListIndex++;
             ActionFilter.doFilter(request, response, this);
 		} else {
-			portlet.processAction(request, response);
+		    this.portlet.processAction(request, response);
 		}
 	}
 
 	/**
 	 * @see javax.portlet.filter.FilterChain#doFilter(javax.portlet.EventRequest, javax.portlet.EventResponse)
 	 */
-	public void doFilter(EventRequest request, EventResponse response) throws IOException, PortletException
{
-		if (filterListIndex <filterList.size()){
-            EventFilter eventFilter = (EventFilter) filterList.get(filterListIndex);
-            filterListIndex++;
+	public void doFilter(final EventRequest request,
+	                     final EventResponse response)
+	throws IOException, PortletException {
+		if (this.filterListIndex < this.filterList.size()){
+            EventFilter eventFilter = (EventFilter) this.filterList.get(this.filterListIndex);
+            this.filterListIndex++;
 			eventFilter.doFilter(request, response, this);
 		} else {
-			eventPortlet.processEvent(request, response);
+		    this.eventPortlet.processEvent(request, response);
 		}
 	}
 
 	/**
 	 * @see javax.portlet.filter.FilterChain#doFilter(javax.portlet.RenderRequest, javax.portlet.RenderResponse)
 	 */
-	public void doFilter(RenderRequest request, RenderResponse response) throws IOException,
PortletException {
-		if (filterListIndex <filterList.size()){
-			RenderFilter renderFilter = (RenderFilter) filterList.get(filterListIndex);
-			filterListIndex++;
+	public void doFilter(final RenderRequest request,
+	                     final RenderResponse response)
+	throws IOException, PortletException {
+		if (this.filterListIndex < this.filterList.size()){
+			RenderFilter renderFilter = (RenderFilter) this.filterList.get(this.filterListIndex);
+			this.filterListIndex++;
 			renderFilter.doFilter(request, response, this);
 		} else {
 			portlet.render(request, response);
@@ -132,13 +176,15 @@ public class FilterChainImpl implements 
 	/**
 	 * @see javax.portlet.filter.FilterChain#doFilter(javax.portlet.ResourceRequest, javax.portlet.ResourceResponse)
 	 */
-	public void doFilter(ResourceRequest request, ResourceResponse response) throws IOException,
PortletException {
-		if (filterListIndex <filterList.size()){
-		    ResourceFilter resourceFilter = (ResourceFilter) filterList.get(filterListIndex);
-            filterListIndex++;
+	public void doFilter(final ResourceRequest request,
+	                     final ResourceResponse response)
+	throws IOException, PortletException {
+		if (this.filterListIndex < this.filterList.size()){
+		    ResourceFilter resourceFilter = (ResourceFilter) this.filterList.get(this.filterListIndex);
+		    this.filterListIndex++;
             resourceFilter.doFilter(request, response, this);
 		} else {
-			resourceServingPortlet.serveResource(request, response);
+		    this.resourceServingPortlet.serveResource(request, response);
 		}
 	}
 }

Modified: sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/impl/FilterConfigImpl.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/impl/FilterConfigImpl.java?rev=960455&r1=960454&r2=960455&view=diff
==============================================================================
--- sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/impl/FilterConfigImpl.java
(original)
+++ sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/impl/FilterConfigImpl.java
Mon Jul  5 06:31:05 2010
@@ -35,7 +35,7 @@ public class FilterConfigImpl implements
     /** The filter name. */
 	private final String filterName;
 	/** The init parameters. */
-	private final Map<String, String> initParameters = new HashMap<String, String>();
+	private final Map<String, String> initParameters;
 	/** The portlet context. */
 	private final PortletContext portletContext;
 
@@ -45,14 +45,18 @@ public class FilterConfigImpl implements
 	 * @param initParameters
 	 * @param portletContext
 	 */
-	public FilterConfigImpl(String filterName,
+    @SuppressWarnings("unchecked")
+    public FilterConfigImpl(String filterName,
 	                        List<? extends InitParam> initParameters,
 	                        PortletContext portletContext){
 		this.filterName = filterName;
 		if ( initParameters != null ) {
+		    this.initParameters = new HashMap<String, String>();
 		    for(final InitParam param : initParameters) {
 		        this.initParameters.put(param.getParamName(), param.getParamValue());
 		    }
+		} else {
+		    this.initParameters = Collections.EMPTY_MAP;
 		}
 		this.portletContext = portletContext;
 	}

Modified: sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/services/FilterManagerImpl.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/services/FilterManagerImpl.java?rev=960455&r1=960454&r2=960455&view=diff
==============================================================================
--- sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/services/FilterManagerImpl.java
(original)
+++ sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/services/FilterManagerImpl.java
Mon Jul  5 06:31:05 2010
@@ -37,59 +37,82 @@ import org.apache.sling.portal.container
 
 
 /**
- * Manage the initialization and doFilter {@link FilterChainImpl} for the filter which are
- * declareted in the deployment descriptor.
+ * Manage the initialization and doFilter {@link FilterChainImpl}
+ * for the filters that are declareted in the deployment descriptor.
  */
 public class FilterManagerImpl implements FilterManager {
 
+    /** The filter chain. */
     private final FilterChainImpl filterchain;
 
+    /** Empty filter list. */
     public static final FilterManager EMPTY_FILTER_LIST = new FilterManagerImpl(null);
-	public FilterManagerImpl(final FilterChainImpl chain) {
+
+    /**
+     * Constructor.
+     * @param chain The filter chain.
+     */
+    public FilterManagerImpl(final FilterChainImpl chain) {
 		this.filterchain = chain;
 	}
 
 	/**
-	 * @see org.apache.pluto.container.FilterManager#processFilter(javax.portlet.EventRequest,
javax.portlet.EventResponse, javax.portlet.EventPortlet, javax.portlet.PortletContext)
+	 * @see org.apache.pluto.container.FilterManager#processFilter(EventRequest, EventResponse,
EventPortlet, PortletContext)
 	 */
-	public void processFilter(EventRequest req, EventResponse res, EventPortlet eventPortlet,PortletContext
portletContext)throws PortletException, IOException{
+	public void processFilter(final EventRequest req,
+	                          final EventResponse res,
+	                          final EventPortlet eventPortlet,
+	                          final PortletContext portletContext)
+	throws PortletException, IOException{
 	    if ( filterchain == null ) {
 	        eventPortlet.processEvent(req, res);
-	        return;
+	    } else {
+		    filterchain.processFilter(req, res, eventPortlet);
 	    }
-		filterchain.processFilter(req, res, eventPortlet);
 	}
 
 	/**
-	 * @see org.apache.pluto.container.FilterManager#processFilter(javax.portlet.ResourceRequest,
javax.portlet.ResourceResponse, javax.portlet.ResourceServingPortlet, javax.portlet.PortletContext)
+	 * @see org.apache.pluto.container.FilterManager#processFilter(ResourceRequest, ResourceResponse,
ResourceServingPortlet, PortletContext)
 	 */
-	public void processFilter(ResourceRequest req, ResourceResponse res, ResourceServingPortlet
resourceServingPortlet,PortletContext portletContext)throws PortletException, IOException{
+	public void processFilter(final ResourceRequest req,
+	                          final ResourceResponse res,
+	                          final ResourceServingPortlet resourceServingPortlet,
+	                          final PortletContext portletContext)
+	throws PortletException, IOException{
         if ( filterchain == null ) {
             resourceServingPortlet.serveResource(req, res);
-            return;
+        } else {
+            filterchain.processFilter(req, res, resourceServingPortlet);
         }
-		filterchain.processFilter(req, res, resourceServingPortlet);
 	}
 
 	/**
-	 * @see org.apache.pluto.container.FilterManager#processFilter(javax.portlet.RenderRequest,
javax.portlet.RenderResponse, javax.portlet.Portlet, javax.portlet.PortletContext)
+	 * @see org.apache.pluto.container.FilterManager#processFilter(RenderRequest, RenderResponse,
Portlet, PortletContext)
 	 */
-	public void processFilter(RenderRequest req, RenderResponse res, Portlet portlet,PortletContext
portletContext) throws PortletException, IOException{
+	public void processFilter(final RenderRequest req,
+	                          final RenderResponse res,
+	                          final Portlet portlet,
+	                          final PortletContext portletContext)
+	throws PortletException, IOException{
         if ( filterchain == null ) {
             portlet.render(req, res);
-            return;
+        } else {
+            filterchain.processFilter(req, res, portlet);
         }
-		filterchain.processFilter(req, res, portlet);
 	}
 
     /**
-     * @see org.apache.pluto.container.FilterManager#processFilter(javax.portlet.ActionRequest,
javax.portlet.ActionResponse, javax.portlet.Portlet, javax.portlet.PortletContext)
+     * @see org.apache.pluto.container.FilterManager#processFilter(ActionRequest, ActionResponse,
Portlet, PortletContext)
      */
-    public void processFilter(ActionRequest req, ActionResponse res, Portlet portlet,PortletContext
portletContext) throws PortletException, IOException{
+    public void processFilter(final ActionRequest req,
+                              final ActionResponse res,
+                              final Portlet portlet,
+                              final PortletContext portletContext)
+    throws PortletException, IOException{
         if ( filterchain == null ) {
             portlet.processAction(req, res);
-            return;
+        } else {
+            filterchain.processFilter(req, res, portlet);
         }
-        filterchain.processFilter(req, res, portlet);
     }
 }

Modified: sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/services/FilterManagerServiceImpl.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/services/FilterManagerServiceImpl.java?rev=960455&r1=960454&r2=960455&view=diff
==============================================================================
--- sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/services/FilterManagerServiceImpl.java
(original)
+++ sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/services/FilterManagerServiceImpl.java
Mon Jul  5 06:31:05 2010
@@ -93,7 +93,7 @@ public class FilterManagerServiceImpl
                 }
             }
             // check if there are any filters
-            if ( filterchain.size() > 0 ) {
+            if ( !filterchain.isEmpty() ) {
                 return new FilterManagerImpl(filterchain);
             }
         }



Mime
View raw message