portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/profiler/containers profiler-container.groovy
Date Wed, 17 Mar 2004 22:19:53 GMT
taylor      2004/03/17 14:19:53

  Modified:    portal/src/java/org/apache/jetspeed/aggregator
                        PortletValve.java PortletRenderer.java
                        Aggregator.java AggregatorValve.java
               portal/src/java/org/apache/jetspeed/aggregator/impl
                        ContentDispatcherImpl.java PortletRendererImpl.java
                        BasicAggregator.java
               portal/src/java/org/apache/jetspeed/capability/containers
                        capability-container.groovy
               portal/src/java/org/apache/jetspeed/cache/file
                        filecache.container.groovy
               portal/src/java/org/apache/jetspeed/profiler/impl
                        ProfilerValveImpl.java
               portal/src/java/org/apache/jetspeed/tools/pamanager/containers
                        pa-container.groovy
               portal/src/java/org/apache/jetspeed/profiler/containers
                        profiler-container.groovy
  Added:       portal/src/java/org/apache/jetspeed/aggregator
                        PageAggregator.java PortletAggregator.java
               portal/src/java/org/apache/jetspeed/aggregator/impl
                        PortletAggregatorImpl.java PageAggregatorImpl.java
               portal/src/java/org/apache/jetspeed/containers
                        renderer-container.groovy
                        window-accessor-container.groovy
                        aggregator-container.groovy
               portal/src/java/org/apache/jetspeed/pipeline/containers
                        portlet-pipeline-container.groovy
  Removed:     portal/src/java/org/apache/jetspeed/aggregator/impl
                        PageAggregator.java PortletAggregator.java
  Log:
  Componentization of:
  - PageAggregator
  - PortletAggregator
  - Renderer
  
  PR:
  Obtained from:
  Submitted by:	
  Reviewed by:	
  CVS: ----------------------------------------------------------------------
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  Changes    Path
  1.4       +4 -3      jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/PortletValve.java
  
  Index: PortletValve.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/PortletValve.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PortletValve.java	16 Mar 2004 05:49:01 -0000	1.3
  +++ PortletValve.java	17 Mar 2004 22:19:52 -0000	1.4
  @@ -17,7 +17,7 @@
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  -import org.apache.jetspeed.cps.CommonPortletServices;
  +import org.apache.jetspeed.Jetspeed;
   import org.apache.jetspeed.pipeline.PipelineException;
   import org.apache.jetspeed.pipeline.valve.AbstractValve;
   import org.apache.jetspeed.pipeline.valve.ValveContext;
  @@ -38,7 +38,8 @@
       {
           try
           {
  -            Aggregator aggregator = (Aggregator)CommonPortletServices.getPortalService(Aggregator.PORTLET_SERVICE_NAME);
  +            // TODO: move valves to component, or make component a valve..., deprecate
CM
  +            PortletAggregator aggregator = (PortletAggregator)Jetspeed.getComponentManager().getComponent(PortletAggregator.class);
     
               aggregator.build(request);
           }
  
  
  
  1.5       +2 -6      jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/PortletRenderer.java
  
  Index: PortletRenderer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/PortletRenderer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PortletRenderer.java	8 Mar 2004 00:22:31 -0000	1.4
  +++ PortletRenderer.java	17 Mar 2004 22:19:52 -0000	1.5
  @@ -17,7 +17,6 @@
   
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
  -import org.apache.jetspeed.cps.CommonService;
   import org.apache.jetspeed.om.page.Fragment;
   import org.apache.jetspeed.request.RequestContext;
   
  @@ -30,11 +29,8 @@
    * @author <a href="mailto:raphael@apache.org">RaphaŽl Luta</a>
    * @version $Id$
    */
  -public interface PortletRenderer extends CommonService
  +public interface PortletRenderer 
   {
  -    /** The name of this service */
  -    public String SERVICE_NAME = "PortletRenderer";
  -
       /**
           Render the specified Page fragment.
           Result is returned in the PortletResponse.
  
  
  
  1.7       +2 -5      jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/Aggregator.java
  
  Index: Aggregator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/Aggregator.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Aggregator.java	17 Mar 2004 01:50:13 -0000	1.6
  +++ Aggregator.java	17 Mar 2004 22:19:52 -0000	1.7
  @@ -19,16 +19,13 @@
   import org.apache.jetspeed.request.RequestContext;
   
   /**
  - * This service handles the generation of first step of agregation process
  + * Basic aggregation interface
    *
    * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
    * @version $Id$
    */
   public interface Aggregator 
   {
  -    public String SERVICE_NAME = "Aggregator";
  -    public String PORTLET_SERVICE_NAME = "PortletAggregator";
  -
       /**
        * Builds the portlet set defined in the context into a portlet tree.
        *
  
  
  
  1.4       +5 -4      jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/AggregatorValve.java
  
  Index: AggregatorValve.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/AggregatorValve.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AggregatorValve.java	8 Mar 2004 00:22:31 -0000	1.3
  +++ AggregatorValve.java	17 Mar 2004 22:19:52 -0000	1.4
  @@ -19,8 +19,8 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   
  +import org.apache.jetspeed.Jetspeed;
   import org.apache.jetspeed.request.RequestContext;
  -import org.apache.jetspeed.cps.CommonPortletServices;
   import org.apache.jetspeed.pipeline.PipelineException;
   import org.apache.jetspeed.pipeline.valve.AbstractValve;
   import org.apache.jetspeed.pipeline.valve.ValveContext;
  @@ -41,8 +41,9 @@
       {
           try
           {
  -            Aggregator aggregator = (Aggregator)CommonPortletServices.getPortalService(Aggregator.SERVICE_NAME);
  -  
  +            // TODO: move valves to component, or make component a valve..., deprecate
CM
  +            Aggregator aggregator = (Aggregator)Jetspeed.getComponentManager().getComponent(PageAggregator.class);
  +              
               aggregator.build(request);
           }
           catch (Exception e)
  
  
  
  1.11      +5 -239    jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/PageAggregator.java
  
  
  
  
  1.5       +4 -43     jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/PortletAggregator.java
  
  
  
  
  1.4       +6 -13     jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/impl/ContentDispatcherImpl.java
  
  Index: ContentDispatcherImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/impl/ContentDispatcherImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ContentDispatcherImpl.java	8 Mar 2004 00:22:00 -0000	1.3
  +++ ContentDispatcherImpl.java	17 Mar 2004 22:19:53 -0000	1.4
  @@ -20,7 +20,6 @@
   import java.util.Map;
   import java.util.Hashtable;
   
  -import javax.servlet.ServletOutputStream;
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
   import javax.servlet.http.HttpServletRequestWrapper;
  @@ -31,7 +30,6 @@
   import org.apache.jetspeed.aggregator.ContentDispatcher;
   import org.apache.jetspeed.aggregator.ContentDispatcherCtrl;
   import org.apache.jetspeed.aggregator.PortletRenderer;
  -import org.apache.jetspeed.cps.CommonPortletServices;
   import org.apache.jetspeed.om.page.Fragment;
   import org.apache.jetspeed.request.RequestContext;
   import org.apache.jetspeed.util.JetspeedObjectID;
  @@ -56,12 +54,11 @@
   
       private static int debugLevel = 1;
   
  -    public ContentDispatcherImpl()
  -    {
  -    }
  -
  -    public ContentDispatcherImpl(boolean isParallel)
  +    private PortletRenderer renderer;
  +    
  +    public ContentDispatcherImpl(boolean isParallel, PortletRenderer renderer)
       {
  +        this.renderer = renderer;
           this.isParallel = isParallel;
       }
   
  @@ -87,7 +84,6 @@
               {
                   log.debug("Synchronous rendering for OID "+ oid);
               }
  -            PortletRenderer renderer = (PortletRenderer)CommonPortletServices.getPortalService(PortletRenderer.SERVICE_NAME);
               renderer.renderNow(fragment,req,rsp);
               return;
           }
  @@ -162,7 +158,6 @@
                   log.debug("Content is null for OID "+oid);
               }
   
  -            PortletRenderer renderer = (PortletRenderer)CommonPortletServices.getPortalService(PortletRenderer.SERVICE_NAME);
               renderer.renderNow(fragment,req,rsp);
               return;
           }
  @@ -253,8 +248,6 @@
                   log.debug("Content is null for OID "+oid);
               }
   
  -            PortletRenderer renderer = (PortletRenderer)CommonPortletServices.getPortalService(PortletRenderer.SERVICE_NAME);
  -
               //unwrap the RenderRequest and RenderResponse to avoid having to cascade several
               // portlet requests/responses
               HttpServletRequest request = (HttpServletRequest)((HttpServletRequestWrapper)req).getRequest();
  @@ -288,7 +281,7 @@
   
           synchronized (contents)
           {
  -            contents.put(window.getId(),myContent);
  +            contents.put(window.getId(), myContent);
           }
   
           return new HttpBufferedResponse(request.getResponse(),myContent.getWriter());
  
  
  
  1.16      +21 -26    jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java
  
  Index: PortletRendererImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- PortletRendererImpl.java	17 Mar 2004 01:50:12 -0000	1.15
  +++ PortletRendererImpl.java	17 Mar 2004 22:19:53 -0000	1.16
  @@ -20,14 +20,11 @@
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  -import org.apache.fulcrum.InitializationException;
  -import org.apache.jetspeed.Jetspeed;
   import org.apache.jetspeed.aggregator.ContentDispatcher;
   import org.apache.jetspeed.aggregator.ContentDispatcherCtrl;
   import org.apache.jetspeed.aggregator.PortletRenderer;
   import org.apache.jetspeed.aggregator.UnknownPortletDefinitionException;
   import org.apache.jetspeed.container.window.PortletWindowAccessor;
  -import org.apache.jetspeed.cps.BaseCommonService;
   import org.apache.jetspeed.om.page.Fragment;
   import org.apache.jetspeed.request.RequestContext;
   import org.apache.jetspeed.util.JetspeedObjectID;
  @@ -35,6 +32,7 @@
   import org.apache.pluto.om.common.ObjectID;
   import org.apache.pluto.om.entity.PortletEntity;
   import org.apache.pluto.om.window.PortletWindow;
  +import org.picocontainer.Startable;
   
   /**
    * <h4>PortletRendererService<br />
  @@ -45,33 +43,33 @@
    * @author <a href="mailto:raphael@apache.org">RaphaŽl Luta</a>
    * @version $Id$
    */
  -public class PortletRendererImpl extends BaseCommonService implements PortletRenderer
  +public class PortletRendererImpl implements PortletRenderer, Startable
   {
  -    /** Commons logging */
       protected final static Log log = LogFactory.getLog(PortletRendererImpl.class);
   
       private WorkerMonitor monitor;
   
  -    private PortletContainer container = null;
  +    private PortletContainer container;
  +    private PortletWindowAccessor windowAccessor;
   
  -    /**
  -     */
  -    public void init() throws InitializationException
  +    public PortletRendererImpl(PortletContainer container, 
  +                               PortletWindowAccessor windowAccessor)
  +    {
  +        this.container = container;
  +        this.windowAccessor = windowAccessor;
  +    }
  +        
  +    public void start()
       {
           this.monitor = new WorkerMonitor();
           this.monitor.init();
  -
  -        // TODO: deprecate this when converted to component
  -        this.container = (PortletContainer)Jetspeed.getComponentManager().getComponent(PortletContainer.class);
  -        setInit(true);
       }
  -
  -    /**
  -     */
  -    public void shutdown()
  +    
  +    public void stop()
       {
  +        // this.monitor.shutdown ?
       }
  -
  +          
       /**
           Render the specified Page fragment.
           Result is returned in the PortletResponse.
  @@ -167,9 +165,9 @@
        */
       protected ContentDispatcherCtrl getDispatcherCtrl(RequestContext request, boolean isParallel)
       {
  -        if (request.getContentDispatcher()==null)
  +        if (request.getContentDispatcher() == null)
           {
  -            request.setContentDispatcher(new ContentDispatcherImpl(isParallel));
  +            request.setContentDispatcher(new ContentDispatcherImpl(isParallel, this));
           }
   
           return (ContentDispatcherCtrl)request.getContentDispatcher();
  @@ -178,11 +176,8 @@
       protected PortletWindow getPortletWindow(Fragment fragment) throws UnknownPortletDefinitionException
       {
           ObjectID oid = JetspeedObjectID.createFromString(fragment.getId());
  -                
  -        // TODO: make renderer a component, assemble window accessor in constructor
  -        PortletWindowAccessor windowAccess = (PortletWindowAccessor)Jetspeed.getComponentManager().getComponent(PortletWindowAccessor.class);
  -        
  -        PortletWindow portletWindow = windowAccess.getPortletWindow(fragment);
  +                        
  +        PortletWindow portletWindow = windowAccessor.getPortletWindow(fragment);
           if (portletWindow == null)
           {
               throw new UnknownPortletDefinitionException("Portlet Window creation failed
for fragment: " + fragment.getId() + ", " + fragment.getName());
  
  
  
  1.3       +7 -22     jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/impl/BasicAggregator.java
  
  Index: BasicAggregator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/impl/BasicAggregator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BasicAggregator.java	17 Mar 2004 01:50:12 -0000	1.2
  +++ BasicAggregator.java	17 Mar 2004 22:19:53 -0000	1.3
  @@ -30,8 +30,6 @@
   import org.apache.jetspeed.exception.JetspeedException;
   import org.apache.jetspeed.om.page.Fragment;
   import org.apache.jetspeed.om.page.Page;
  -import org.apache.jetspeed.profiler.ProfileLocator;
  -import org.apache.jetspeed.profiler.Profiler;
   import org.apache.jetspeed.request.RequestContext;
   import org.apache.pluto.PortletContainer;
   import org.apache.pluto.om.portlet.PortletDefinition;
  @@ -47,38 +45,31 @@
   public class BasicAggregator implements Aggregator, Startable
   {
       private final static Log log = LogFactory.getLog(BasicAggregator.class);
  -    private final static String DEFAULT_STRATEGY = "strategy.default";
   
       public final static int STRATEGY_SEQUENTIAL = 0;
       public final static int STRATEGY_PARALLEL = 1;
  -    private final static String CONFIG_STRATEGY_SEQUENTIAL = "sequential";
  -    private final static String CONFIG_STRATEGY_PARALLEL = "parallel";
       private int strategy = STRATEGY_SEQUENTIAL;
       
  -    private Profiler profiler;
       private PortletRegistryComponent registry;
       private PortletWindowAccessor windowAccessor;
       private PortletContainer portletContainer;
   
  -    public BasicAggregator(Profiler profiler, 
  -                           PortletRegistryComponent registry, 
  +    public BasicAggregator(PortletRegistryComponent registry, 
                              PortletWindowAccessor windowAccessor,
                              PortletContainer portletContainer,
                              int strategy)
       {
  -        this.profiler = profiler;
           this.registry = registry;
           this.windowAccessor = windowAccessor;
           this.strategy = strategy;
           this.portletContainer = portletContainer;
       }
       
  -    public BasicAggregator(Profiler profiler, 
  -            PortletRegistryComponent registry, 
  -            PortletWindowAccessor windowAccessor,
  -            PortletContainer portletContainer)            
  +    public BasicAggregator(PortletRegistryComponent registry, 
  +                           PortletWindowAccessor windowAccessor,
  +                           PortletContainer portletContainer)            
       {
  -        this(profiler, registry, windowAccessor, portletContainer, STRATEGY_SEQUENTIAL);
  +        this(registry, windowAccessor, portletContainer, STRATEGY_SEQUENTIAL);
       }
       
       public void start()
  @@ -97,13 +88,7 @@
        */
       public void build(RequestContext request) throws JetspeedException
       {
  -        ProfileLocator locator = request.getProfileLocator();
  -        if (null == locator)
  -        {
  -            throw new JetspeedException("Failed to find ProfileLocator in BasicAggregator.build");
  -        }
  -
  -        Page page = profiler.getPage(locator);
  +        Page page = request.getPage();
           if (null == page)
           {
               throw new JetspeedException("Failed to find PSML Pin BasicAggregator.build");
  
  
  
  1.1                  jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorImpl.java
  
  Index: PortletAggregatorImpl.java
  ===================================================================
  /*
   * Copyright 2000-2004 The Apache Software Foundation.
   * 
   * Licensed 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.jetspeed.aggregator.impl;
  
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  import org.apache.jetspeed.PortalReservedParameters;
  import org.apache.jetspeed.aggregator.PortletAggregator;
  import org.apache.jetspeed.aggregator.PortletRenderer;
  import org.apache.jetspeed.exception.JetspeedException;
  import org.apache.jetspeed.om.page.Fragment;
  import org.apache.jetspeed.om.page.psml.FragmentImpl;
  import org.apache.jetspeed.request.RequestContext;
  import org.picocontainer.Startable;
  
  /**
   * PortletAggregator builds the content required to render a single portlet.
   *
   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
   * @version $Id: PortletAggregatorImpl.java,v 1.1 2004/03/17 22:19:53 taylor Exp $
   */
  public class PortletAggregatorImpl implements PortletAggregator, Startable
  {
      private final static Log log = LogFactory.getLog(PortletAggregatorImpl.class);    
      
      private PortletRenderer renderer;
  
      public PortletAggregatorImpl(PortletRenderer renderer) 
      {
          this.renderer = renderer;
      }
      
      public void start()
      {
      }
      
      public void stop()
      {
          
      }
      
      
      /* (non-Javadoc)
       * @see org.apache.jetspeed.aggregator.Aggregator#build(org.apache.jetspeed.request.RequestContext)
       */
      public void build(RequestContext context) throws JetspeedException
      {
          Fragment fragment = new FragmentImpl(); // TODO: fragment factory
          fragment.setType(Fragment.PORTLET);
          fragment.setName(context.getRequestParameter(PortalReservedParameters.PORTLET));
          fragment.setId(context.getRequestParameter(PortalReservedParameters.PORTLET_ENTITY));
           
          renderer.renderNow(fragment, context);
      }
  }
  
  
  
  1.1                  jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/impl/PageAggregatorImpl.java
  
  Index: PageAggregatorImpl.java
  ===================================================================
  /*
   * Copyright 2000-2004 The Apache Software Foundation.
   * 
   * Licensed 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.jetspeed.aggregator.impl;
  
  import java.util.ArrayList;
  import java.util.Iterator;
  import java.util.List;
  import java.util.Stack;
  
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  import org.apache.jetspeed.aggregator.ContentDispatcher;
  import org.apache.jetspeed.aggregator.PageAggregator;
  import org.apache.jetspeed.aggregator.PortletRenderer;
  import org.apache.jetspeed.contentserver.ContentFilter;
  import org.apache.jetspeed.exception.JetspeedException;
  import org.apache.jetspeed.om.page.Page;
  import org.apache.jetspeed.om.page.Fragment;
  import org.apache.jetspeed.request.RequestContext;
  import org.picocontainer.Startable;
  
  /**
   * PageAggregator builds the content required to render a page of portlets.
   *
   * @author <a href="mailto:raphael@apache.org">RaphaŽl Luta</a>
   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
   * @version $Id: PageAggregatorImpl.java,v 1.1 2004/03/17 22:19:53 taylor Exp $
   */
  public class PageAggregatorImpl implements PageAggregator, Startable
  {
      private final static Log log = LogFactory.getLog(PageAggregatorImpl.class);
  
      public final static int STRATEGY_SEQUENTIAL = 0;
      public final static int STRATEGY_PARALLEL = 1;
  
      private int strategy = STRATEGY_SEQUENTIAL;
      private PortletRenderer renderer;
  
      public PageAggregatorImpl( PortletRenderer renderer, 
                             int strategy)
      {
          this.renderer = renderer;
          this.strategy = strategy;        
      }
      
      public PageAggregatorImpl(PortletRenderer renderer) 
      {
          this(renderer, STRATEGY_SEQUENTIAL);
      }
      
      public void start()
      {
      }
      
      public void stop()
      {
          
      }
      
      /**
       * Builds the portlet set defined in the context into a portlet tree.
       *
       * @return Unique Portlet Entity ID
       */
      public void build(RequestContext context)
          throws JetspeedException
      {
          Page page = context.getPage();
          if (null == page)
          {
              throw new JetspeedException("Failed to find PSML Pin PageAggregator.build");
          }
          
          //Set default acl
          String acl = page.getAcl();
          if (acl == null)
          {
              //TBD get system default acl;
          }
  
          // Initialize fragment
          Stack stack = new Stack();
          Fragment currentFragment = page.getRootFragment();
  
          if (currentFragment == null)
          {
              throw new JetspeedException("No root Fragment found in Page");
          }
          
          String layoutDecorator = currentFragment.getDecorator();
          if(layoutDecorator == null)
          {
              layoutDecorator = page.getDefaultDecorator(currentFragment.getType());
          }
          
          //TODO: Remove hard coding of locations and use CM + TL
          List contentPathes = (List) context.getSessionAttribute(ContentFilter.SESSION_CONTENT_PATH_ATTR);
          
          if(contentPathes == null)
          {
              contentPathes = new ArrayList(2);
              context.setSessionAttribute(ContentFilter.SESSION_CONTENT_PATH_ATTR, contentPathes);
          }
          
          if(contentPathes.size() < 1)
          {
              // define the lookup order
              contentPathes.add(currentFragment.getType()+"/html/"+layoutDecorator);
              contentPathes.add("portlet/html");
              contentPathes.add("generic/html");
              contentPathes.add("/html");
          }
          else
          {
              contentPathes.set(0, currentFragment.getType()+"/html/"+layoutDecorator);
          }
          
  
          if (checkAccess(context,(currentFragment.getAcl()!=null)?currentFragment.getAcl():acl,
"render"))
          {
              if (strategy == STRATEGY_PARALLEL)
              {
                  // initializes the rendering stack with root children
                  // root fragement is always treated synchronously
                  for(Iterator i = currentFragment.getFragments().iterator(); i.hasNext();)
                  {
                      Fragment f = (Fragment)i.next();
  
                      if (!"hidden".equals(f.getState()))
                      {
                          stack.push(f);
                      }
                  }
  
                  // Walk through the Fragment tree, and start rendering "portlet" type
                  // fragment
                  while (!stack.isEmpty())
                  {
                      currentFragment = (Fragment)stack.pop();
  
                      if (checkAccess(context,
                                      ((currentFragment.getAcl()!=null)?currentFragment.getAcl():acl),
                                      "render"))
                      {
                          if (currentFragment.getType().equals("portlet"))
                          {
                          	// make the page aggreator less fragile
                          	// by preventing failed rendering from screwing up the
                          	// whole process
                             try
                              {
                                   renderer.render(currentFragment,context);
                              }
                              catch (Exception e)
                              {
                                  log.error("Failed to render portlet \""+currentFragment+"\":
"+e.toString());
                              }
                          }
  
                          // push the children frgaments on the rendering stack
                          for(Iterator i = currentFragment.getFragments().iterator(); i.hasNext();)
                          {
                              Fragment f = (Fragment)i.next();
  
                              if (!"hidden".equals(f.getState()))
                              {
                                  stack.push(f);
                              }
                          }
                      }
                      else
                      {
                          log.warn("Access denied RENDER fragment "+currentFragment);
                      }
                  }
              }
  
              // Retrieves the content dispatcher appropriate for sequential
              // or parallel rendering
  
              ContentDispatcher dispatcher = renderer.getDispatcher(context,(strategy==STRATEGY_PARALLEL));
  
  
              // Now synchronously trigger the rendering of the whole page
              renderer.renderNow(page.getRootFragment(), context);
  
              // DEBUG Testing: Use ContentDispatcher to display all children
              // of root fragment
  /*
              for(Iterator i = page.getRootFragment().getFragments().iterator(); i.hasNext();)
              {
                  Fragment fragment = (Fragment)i.next();
  
                  if (!"hidden".equals(fragment.getState()))
                  {
                      dispatcher.include(fragment, context.getRequest(), context.getResponse());
                  }
              }
  */            
          }
          else
          {
              log.warn("Access denied RENDER page "+page);
          }
          
      }
  
      public boolean checkAccess(RequestContext context, String acl, String action)
      {
          // This methid needs to be moved a secuity module.
          // Does nothing right now
          return true;
      }
  }
  
  
  
  1.6       +16 -0     jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/capability/containers/capability-container.groovy
  
  Index: capability-container.groovy
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/capability/containers/capability-container.groovy,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- capability-container.groovy	4 Mar 2004 21:16:55 -0000	1.5
  +++ capability-container.groovy	17 Mar 2004 22:19:53 -0000	1.6
  @@ -1,3 +1,19 @@
  +/*
  + * Copyright 2000-2004 The Apache Software Foundation.
  + * 
  + * Licensed 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.
  + */
  +
   import org.picocontainer.defaults.DefaultPicoContainer
   import org.picocontainer.ComponentAdapter
   import org.picocontainer.defaults.ConstructorComponentAdapter
  
  
  
  1.1                  jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/containers/renderer-container.groovy
  
  Index: renderer-container.groovy
  ===================================================================
  /*
   * Copyright 2000-2004 The Apache Software Foundation.
   * 
   * Licensed 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.
   */
  
  import org.picocontainer.defaults.DefaultPicoContainer
  import org.picocontainer.defaults.ConstantParameter
  import org.picocontainer.defaults.ComponentParameter
  import org.picocontainer.Parameter
  import org.apache.jetspeed.components.util.NanoQuickAssembler
   
  import org.apache.pluto.PortletContainer
  import org.apache.jetspeed.aggregator.PortletRenderer
  import org.apache.jetspeed.aggregator.impl.PortletRendererImpl
  import org.apache.jetspeed.container.window.PortletWindowAccessor
  import org.apache.jetspeed.container.window.impl.PortletWindowAccessorImpl
  import org.apache.jetspeed.components.portletentity.PortletEntityAccessComponent
  import org.apache.jetspeed.components.portletregistry.PortletRegistryComponent
  
  if (parent != null)
  {
      container = new DefaultPicoContainer(parent)            
  
  	parent.registerComponentImplementation(PortletRenderer, 
                                            PortletRendererImpl,
                                new Parameter[] {new ComponentParameter(PortletContainer),
new ComponentParameter(PortletWindowAccessor)} )
                                                    
  }
  else
  {
      container = new DefaultPicoContainer()                           	        
  	container.registerComponentImplementation(PortletRenderer, 
                                            PortletRendererImpl,
                                new Parameter[] {new ComponentParameter(PortletContainer),
new ComponentParameter(PortletWindowAccessor)} )
  }
  
  return container
  
  
  
  
  
  1.1                  jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/containers/window-accessor-container.groovy
  
  Index: window-accessor-container.groovy
  ===================================================================
  /*
   * Copyright 2000-2004 The Apache Software Foundation.
   * 
   * Licensed 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.
   */
  
  import org.picocontainer.defaults.DefaultPicoContainer
  import org.picocontainer.defaults.ConstantParameter
  import org.picocontainer.defaults.ComponentParameter
  import org.picocontainer.Parameter
  
  import org.apache.jetspeed.components.portletentity.PortletEntityAccessComponent
  import org.apache.jetspeed.components.portletregistry.PortletRegistryComponent
  import org.apache.jetspeed.container.window.PortletWindowAccessor
  import org.apache.jetspeed.container.window.impl.PortletWindowAccessorImpl
   
  
  if(parent != null)
  {
      container = new DefaultPicoContainer(parent)
  	parent.registerComponentImplementation(PortletWindowAccessor, 
  	                                       PortletWindowAccessorImpl, 
            	    new Parameter[] {new ComponentParameter(PortletEntityAccessComponent), 
            	                     new ComponentParameter(PortletRegistryComponent)} )
                                            
  
  }
  else
  {
      container = new DefaultPicoContainer()
  	container.registerComponentImplementation(PortletWindowAccessor, 
  	                                       PortletWindowAccessorImpl, 
            	    new Parameter[] {new ComponentParameter(PortletEntityAccessComponent), 
                             	    new ComponentParameter(PortletRegistryComponent)} )
  
  }
  
  return container
  
  
  
  
  1.1                  jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/containers/aggregator-container.groovy
  
  Index: aggregator-container.groovy
  ===================================================================
  /*
   * Copyright 2000-2004 The Apache Software Foundation.
   * 
   * Licensed 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.
   */
  
  import org.picocontainer.defaults.DefaultPicoContainer
  import org.picocontainer.defaults.ConstantParameter
  import org.picocontainer.defaults.ComponentParameter
  import org.picocontainer.Parameter
  
  import org.apache.jetspeed.aggregator.PageAggregator
  import org.apache.jetspeed.aggregator.impl.PageAggregatorImpl
  import org.apache.jetspeed.aggregator.PortletAggregator
  import org.apache.jetspeed.aggregator.impl.PortletAggregatorImpl
  import org.apache.jetspeed.aggregator.PortletRenderer
  
  
  // sequential = 0, parallel = 1
  strategy = 1
  
  if(parent != null)
  {
      container = new DefaultPicoContainer(parent)
  	parent.registerComponentImplementation(PageAggregator, 
                                             PageAggregatorImpl,
                                new Parameter[] {new ComponentParameter(PortletRenderer),

                                                 new ConstantParameter(strategy)} )      
                    	    
  	parent.registerComponentImplementation(PortletAggregator, 
                                             PortletAggregatorImpl,
                                new Parameter[] {new ComponentParameter(PortletRenderer)})
                                            
  }
  else
  {
      container = new DefaultPicoContainer()                           	    
  	container.registerComponentImplementation(PageAggregator, 
                                             PageAggregatorImpl,
                                new Parameter[] {new ComponentParameter(PortletRenderer),

                                                 new ConstantParameter(strategy)} )      
                    	    
  	container.registerComponentImplementation(PortletAggregator, 
                                             PortletAggregatorImpl,
                                new Parameter[] {new ComponentParameter(PortletRenderer)})
                              
  }
  
  return container
  
  
  
  
  
  1.2       +16 -0     jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/cache/file/filecache.container.groovy
  
  Index: filecache.container.groovy
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/cache/file/filecache.container.groovy,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- filecache.container.groovy	24 Feb 2004 05:34:01 -0000	1.1
  +++ filecache.container.groovy	17 Mar 2004 22:19:53 -0000	1.2
  @@ -1,3 +1,19 @@
  +/*
  + * Copyright 2000-2004 The Apache Software Foundation.
  + * 
  + * Licensed 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.
  + */
  +
   import org.picocontainer.defaults.DefaultPicoContainer
   import org.apache.jetspeed.cache.file.FileCache
   
  
  
  
  1.4       +4 -2      jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/profiler/impl/ProfilerValveImpl.java
  
  Index: ProfilerValveImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/profiler/impl/ProfilerValveImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ProfilerValveImpl.java	8 Mar 2004 00:31:55 -0000	1.3
  +++ ProfilerValveImpl.java	17 Mar 2004 22:19:53 -0000	1.4
  @@ -44,7 +44,9 @@
               Profiler profiler = (Profiler)Jetspeed.getComponentManager().getComponent(Profiler.class);
               
               ProfileLocator locator = profiler.getProfile(request);
  -            request.setProfileLocator(locator);
  +            request.setProfileLocator(locator);                        
  +            request.setPage(profiler.getPage(locator));
  +            
           }
           catch (ProfilerException e)
           {
  
  
  
  1.4       +16 -0     jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager/containers/pa-container.groovy
  
  Index: pa-container.groovy
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager/containers/pa-container.groovy,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- pa-container.groovy	9 Mar 2004 19:35:46 -0000	1.3
  +++ pa-container.groovy	17 Mar 2004 22:19:53 -0000	1.4
  @@ -1,3 +1,19 @@
  +/*
  + * Copyright 2000-2004 The Apache Software Foundation.
  + * 
  + * Licensed 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.
  + */
  +
   import org.picocontainer.defaults.DefaultPicoContainer
   import org.picocontainer.defaults.ConstantParameter
   import org.picocontainer.ComponentAdapter
  
  
  
  1.1                  jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/pipeline/containers/portlet-pipeline-container.groovy
  
  Index: portlet-pipeline-container.groovy
  ===================================================================
  import org.apache.jetspeed.pipeline.JetspeedPipeline
  
  // create the root container
  container = new DefaultPicoContainer()
  
  pipelineClass = org.apache.jetspeed.pipeline.JetspeedPipeline
  pipelineDirectory = "/WEB-INF/conf/pipelines/"
  pipelineDescriptor = "portlet-pipeline"
  
  
  
  
  
  1.5       +16 -0     jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/profiler/containers/profiler-container.groovy
  
  Index: profiler-container.groovy
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/profiler/containers/profiler-container.groovy,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- profiler-container.groovy	4 Mar 2004 21:16:55 -0000	1.4
  +++ profiler-container.groovy	17 Mar 2004 22:19:53 -0000	1.5
  @@ -1,3 +1,19 @@
  +/*
  + * Copyright 2000-2004 The Apache Software Foundation.
  + * 
  + * Licensed 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.
  + */
  +
   import org.picocontainer.defaults.DefaultPicoContainer
   import org.picocontainer.ComponentAdapter
   import org.picocontainer.defaults.ConstructorComponentAdapter
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message