taylor      2004/03/30 14:00:20

  Modified:    portal/src/java/org/apache/jetspeed/container/session
                        NavigationalState.java
               portal/src/java/org/apache/jetspeed/request
                        JetspeedRequestContext.java RequestContext.java
               portal/src/java/org/apache/jetspeed/engine/core
                        PortletActionProviderImpl.java
               portal/src/java/org/apache/jetspeed/container/session/impl
                        PathNavigationalState.java
                        SessionNavigationalState.java
               portal/src/java/org/apache/jetspeed/engine
                        JetspeedServlet.java
  Added:       portal/src/java/org/apache/jetspeed/container/session
                        NavigationalStateComponent.java
               portal/src/java/org/apache/jetspeed/request
                        JetspeedRequestContextComponent.java
                        RequestContextComponent.java
               portal/src/java/org/apache/jetspeed/container/session/impl
                        JetspeedNavigationalStateComponent.java
  Removed:     portal/src/java/org/apache/jetspeed/container/session
                        NavigationalStateContext.java
               portal/src/java/org/apache/jetspeed/request
                        RequestContextFactory.java
               portal/src/java/org/apache/jetspeed/container/session/impl
                        PathNavigationalStateContext.java
                        SessionNavigationalStateContext.java
  Log:
  refactoring of RequestContext to a component

  continued refactoring of Nav State

  

  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       +21 -35    
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/session/NavigationalState.java
  
  Index: NavigationalState.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/session/NavigationalState.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- NavigationalState.java    24 Mar 2004 23:31:19 -0000      1.3
  +++ NavigationalState.java    30 Mar 2004 22:00:19 -0000      1.4
  @@ -1,5 +1,5 @@
   /*
  - * Copyright 2000-2004 The Apache Software Foundation.
  + * Copyright 2000-2001,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.
  @@ -15,44 +15,30 @@
    */
   package org.apache.jetspeed.container.session;
   
  -import org.apache.jetspeed.request.RequestContext;
  +import javax.portlet.PortletMode;
  +import javax.portlet.WindowState;
  +
  +import org.apache.pluto.om.window.PortletWindow;
   
   /**
  - * NavigationalState
  + * NavigationalStateContext
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
    * @version $Id$
    */
  -public interface NavigationalState
  -{        
  -    /**
  -     * Creates a navigational state context for the given request context.
  -     * Depending on the implementation, navigational state can be retrieved from 
  -     * a persistence store to recover the state of a page such as portlet modes 
  -     * and window states of portlets on a page.
  -     *  
  -     * @param context The request context for which this navigational state is 
valid.
  -     * @return A new navigational state context for the given request.
  -     */
  -    NavigationalStateContext createContext(RequestContext context);
  -    
  -    /**
  -     * Save the navigational state to persistence store for the given context.
  -     *   
  -     * @param context The request context for retrieving user and other information.
  -     * @param navContext The current navigational state context for the given 
request.
  -     */
  -    void storeContext(RequestContext context, NavigationalStateContext navContext);
  -     
  -    /**
  -     * Keys for URL encoding
  -     * @return
  -     */
  -    String getActionKey();
  -    String getRenderParamKey();    
  -    String getModeKey();    
  -    String getPreviousModeKey();        
  -    String getStateKey();    
  -    String getPreviousStateKey();
  +public interface NavigationalState 
  +{
  +    WindowState getState(PortletWindow window);
  +    
  +    void setState(PortletWindow window, WindowState state);
  +    
  +    PortletMode getMode(PortletWindow window);
  +    
  +    void setMode(PortletWindow window, PortletMode mode);
  +    
  +    PortletMode getPreviousMode(PortletWindow window);
  +    
  +    WindowState getPreviousState(PortletWindow window);
       
  +    boolean isNavigationalParameter(String token);
   }
  
  
  
  1.1                  
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/session/NavigationalStateComponent.java
  
  Index: NavigationalStateComponent.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.container.session;
  
  import org.apache.jetspeed.request.RequestContext;
  
  /**
   * NavigationalState
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
   * @version $Id: NavigationalStateComponent.java,v 1.1 2004/03/30 22:00:19 taylor 
Exp $
   */
  public interface NavigationalStateComponent
  {        
      /**
       * Creates a navigational state context for the given request context.
       * Depending on the implementation, navigational state can be retrieved from 
       * a persistence store to recover the state of a page such as portlet modes 
       * and window states of portlets on a page.
       *  
       * @param context The request context for which this navigational state is valid.
       * @return A new navigational state context for the given request.
       */
      NavigationalState create(RequestContext context);
  
      /**
       * Release a navigational state context back to the pool.
       * 
       * @param context
       */
      void release(NavigationalState state);
      
      /**
       * Save the navigational state to persistence store for the given context.
       *   
       * @param context The request context for retrieving user and other information.
       * @param navContext The current navigational state context for the given 
request.
       */
      void store(RequestContext context, NavigationalState navContext);
       
      /**
       * Keys for URL encoding
       * @return
       */
      String getActionKey();
      String getRenderParamKey();    
      String getModeKey();    
      String getPreviousModeKey();        
      String getStateKey();    
      String getPreviousStateKey();
      
  }
  
  
  
  1.11      +21 -18    
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContext.java
  
  Index: JetspeedRequestContext.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContext.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- JetspeedRequestContext.java       8 Mar 2004 00:33:12 -0000       1.10
  +++ JetspeedRequestContext.java       30 Mar 2004 22:00:19 -0000      1.11
  @@ -24,13 +24,13 @@
   import javax.servlet.http.HttpServletResponse;
   import javax.servlet.ServletConfig;
   
  -import org.apache.jetspeed.PortalContext;
   import org.apache.jetspeed.profiler.ProfileLocator;
   import org.apache.jetspeed.aggregator.ContentDispatcher;
   import org.apache.jetspeed.om.page.Page;
   import org.apache.jetspeed.services.factory.FactoryManager;
   import org.apache.jetspeed.capability.CapabilityMap;
  -import org.apache.jetspeed.engine.core.PortalControlParameter;
  +import org.apache.jetspeed.container.session.NavigationalState;
  +import org.apache.jetspeed.container.session.NavigationalStateComponent;
   import org.apache.jetspeed.engine.core.PortalURL;
   import org.apache.jetspeed.engine.core.PortalURLImpl;
   import org.apache.jetspeed.engine.servlet.ServletRequestFactory;
  @@ -49,7 +49,6 @@
    */
   public class JetspeedRequestContext implements RequestContext
   {
  -    private PortalContext pc;
       private HttpServletRequest request;
       private HttpServletResponse response;
       private ServletConfig config;
  @@ -63,6 +62,7 @@
       private CapabilityMap capabilityMap;
       private String mimeType;
       private String mediaType;
  +    private NavigationalState navstate;
       private PortalURL requestedPortalURL;
       private PortletWindow actionWindow;
       private String encoding;
  @@ -77,9 +77,12 @@
        * @param response
        * @param config
        */
  -    public JetspeedRequestContext(PortalContext pc, HttpServletRequest request, 
HttpServletResponse response, ServletConfig config)
  +    public JetspeedRequestContext( 
  +                                  HttpServletRequest request, 
  +                                  HttpServletResponse response, 
  +                                  ServletConfig config,
  +                                  NavigationalStateComponent navcomponent)
       {
  -        this.pc = pc;
           this.request = request;
           this.response = response;
           this.config = config;
  @@ -90,6 +93,12 @@
               this.request.setAttribute(REQUEST_PORTALENV, this);
           }
           requestedPortalURL = new PortalURLImpl(this);
  +        
  +        if (navcomponent != null)
  +        {
  +            navstate = navcomponent.create(this);
  +        }
  +        
       }
   
       private JetspeedRequestContext()
  @@ -108,11 +117,6 @@
           return (RequestContext) request.getAttribute(REQUEST_PORTALENV);
       }
   
  -    public PortalContext getPortalContext()
  -    {
  -        return pc;
  -    }
  -
       public HttpServletRequest getRequest()
       {
           return request;
  @@ -219,15 +223,14 @@
           return this.mediaType;
       }
   
  -    public PortalURL getRequestedPortalURL()
  +    public NavigationalState getNavigationalState()
       {
  -        return requestedPortalURL;
  +        return navstate;
       }
  -
  -    public void changeRequestedPortalURL(PortalURL url, PortalControlParameter 
control)
  +    
  +    public PortalURL getRequestedPortalURL()
       {
  -        requestedPortalURL = url;
  -        requestedPortalURL.analyzeControlInformation(control);
  +        return requestedPortalURL;
       }
   
       /**
  @@ -410,7 +413,7 @@
           while (tokenizer.hasMoreTokens())
           {
               String token = tokenizer.nextToken();
  -            if (PortalControlParameter.isControlParameter(token))
  +            if (this.navstate.isNavigationalParameter(token))
               {
                   break;            
               }
  
  
  
  1.9       +10 -18    
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/request/RequestContext.java
  
  Index: RequestContext.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/request/RequestContext.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- RequestContext.java       8 Mar 2004 00:33:12 -0000       1.8
  +++ RequestContext.java       30 Mar 2004 22:00:19 -0000      1.9
  @@ -23,10 +23,9 @@
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
   
  -import org.apache.jetspeed.PortalContext;
   import org.apache.jetspeed.aggregator.ContentDispatcher;
   import org.apache.jetspeed.capability.CapabilityMap;
  -import org.apache.jetspeed.engine.core.PortalControlParameter;
  +import org.apache.jetspeed.container.session.NavigationalState;
   import org.apache.jetspeed.engine.core.PortalURL;
   import org.apache.jetspeed.profiler.ProfileLocator;
   import org.apache.jetspeed.om.page.Page;
  @@ -67,13 +66,6 @@
       public ServletConfig getConfig();
   
       /**
  -     * Gets the Jetspeed Portal Context
  -     *
  -     * @return HttpServletRequest
  -     */
  -    public PortalContext getPortalContext();
  -
  -    /**
        * Gets the profile locator for this request
        *
        * @return Profile
  @@ -154,20 +146,20 @@
        */
       public String getMediaType();
   
  +    
  +    /**
  +     * Gets the navigational state for this current request.
  +     * 
  +     * @return The navigational state context object for the current request.
  +     */
  +    public NavigationalState getNavigationalState();
  +    
       /**
        * Get the requested Portlet URL for this request
        *
        * @return PortletURL the requested Portlet URL
        */
       public PortalURL getRequestedPortalURL();
  -
  -    /**
  -     * Change the Portlet URL to a new portal URL
  -     *
  -     * @param url
  -     * @param control
  -     */
  -    public void changeRequestedPortalURL(PortalURL url, PortalControlParameter 
control);
   
       /**
        * Get the target Action Window
  
  
  
  1.1                  
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContextComponent.java
  
  Index: JetspeedRequestContextComponent.java
  ===================================================================
  /*
   * Copyright 2000-2001,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.request;
  
  import java.lang.reflect.Constructor;
  
  import javax.servlet.ServletConfig;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  import org.apache.jetspeed.container.session.NavigationalStateComponent;
  
  /**
   * JetspeedRequestContextComponent
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
   * @version $Id: JetspeedRequestContextComponent.java,v 1.1 2004/03/30 22:00:19 
taylor Exp $
   */
  public class JetspeedRequestContextComponent implements RequestContextComponent 
  {
      private String contextClassName = null;
      private Class contextClass = null;
      private NavigationalStateComponent nav;
      
      private final static Log log = 
LogFactory.getLog(JetspeedRequestContextComponent.class);
  
      
      public JetspeedRequestContextComponent(NavigationalStateComponent nav, String 
contextClassName)
      {
          this.nav = nav;        
          this.contextClassName = contextClassName;        
      }
      
      public RequestContext create(HttpServletRequest req,
                                   HttpServletResponse resp, 
                                   ServletConfig config)
      {
          RequestContext context = null;
  
          try
          {
              if (null == contextClass)
              {
                  contextClass = Class.forName(contextClassName);
              }
  
              // TODO: we could use a pooled object implementation here
              Constructor constructor = contextClass.getConstructor(new Class[] 
                            {HttpServletRequest.class, HttpServletResponse.class, 
ServletConfig.class, NavigationalStateComponent.class});
              context = (RequestContext) constructor.newInstance(new Object[] {req, 
resp, config, nav});
  
          }
          catch(Exception e)
          {
              e.printStackTrace();
              
              String msg = "RequestContextFactory: Failed to create a Class object for 
RequestContext: " + e.toString();
              log.error(msg);
          }
  
          return context;
      }
  
      public void release(RequestContext context) 
      {
      }
      
  }
  
  
  
  1.1                  
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/request/RequestContextComponent.java
  
  Index: RequestContextComponent.java
  ===================================================================
  /*
   * Copyright 2000-2001,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.request;
  
  import javax.servlet.ServletConfig;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  
  /**
   * RequestContextComponent
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
   * @version $Id: RequestContextComponent.java,v 1.1 2004/03/30 22:00:19 taylor Exp $
   */
  public interface RequestContextComponent 
  {
      /**
       * Creates a request context for the given servlet request.
       * 
       * @param req
       * @param resp
       * @param config
       * @return
       */
      RequestContext create(HttpServletRequest req, HttpServletResponse resp, 
ServletConfig config);
  
      /**
       * Release a request context back to the context pool.
       * 
       * @param context
       */
      void release(RequestContext context);
      
  }
  
  
  
  1.5       +8 -15     
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/core/PortletActionProviderImpl.java
  
  Index: PortletActionProviderImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/core/PortletActionProviderImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PortletActionProviderImpl.java    8 Mar 2004 00:26:09 -0000       1.4
  +++ PortletActionProviderImpl.java    30 Mar 2004 22:00:20 -0000      1.5
  @@ -22,6 +22,7 @@
   
   import org.apache.pluto.om.window.PortletWindow;
   import org.apache.pluto.services.information.PortletActionProvider;
  +import org.apache.jetspeed.container.session.NavigationalState;
   import org.apache.jetspeed.request.RequestContext;
   import org.apache.jetspeed.request.JetspeedRequestContext;
   
  @@ -51,15 +52,11 @@
       public void changePortletMode(PortletMode mode)
       {
           RequestContext context = JetspeedRequestContext.getRequestContext(request);
  -
  -        PortalURL url = context.getRequestedPortalURL();
  -        PortalControlParameter controlURL = new PortalControlParameter(url);
  -        if (!(controlURL.getMode(portletWindow).equals(mode)) && mode != null)
  +        NavigationalState state = context.getNavigationalState();
  +        if (!(state.getMode(portletWindow).equals(mode)) && mode != null)
           {
  -            controlURL.setMode(portletWindow, mode);
  -            context.changeRequestedPortalURL(url, controlURL);
  +            state.setMode(portletWindow, mode);
           }
  -
       }
   
       /* (non-Javadoc)
  @@ -68,14 +65,10 @@
       public void changePortletWindowState(WindowState state)
       {
           RequestContext context = JetspeedRequestContext.getRequestContext(request);
  -
  -        PortalURL url = context.getRequestedPortalURL();
  -        PortalControlParameter controlURL = new PortalControlParameter(url);
  -
  -        if (!(controlURL.getState(portletWindow).equals(state)) && state != null)
  +        NavigationalState navstate = context.getNavigationalState();
  +        if (!(navstate.getState(portletWindow).equals(state)) && state != null)
           {
  -            controlURL.setState(portletWindow, state);
  -            context.changeRequestedPortalURL(url, controlURL);
  +            navstate.setState(portletWindow, state);            
           }
       }
   
  
  
  
  1.4       +36 -44    
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/session/impl/PathNavigationalState.java
  
  Index: PathNavigationalState.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/session/impl/PathNavigationalState.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PathNavigationalState.java        24 Mar 2004 23:31:19 -0000      1.3
  +++ PathNavigationalState.java        30 Mar 2004 22:00:20 -0000      1.4
  @@ -1,5 +1,5 @@
   /*
  - * Copyright 2000-2004 The Apache Software Foundation.
  + * Copyright 2000-2001,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.
  @@ -15,83 +15,75 @@
    */
   package org.apache.jetspeed.container.session.impl;
   
  +import javax.portlet.PortletMode;
  +import javax.portlet.WindowState;
  +
   import org.apache.jetspeed.container.session.NavigationalState;
  -import org.apache.jetspeed.container.session.NavigationalStateContext;
  +import org.apache.jetspeed.engine.core.PortalControlParameter;
  +import org.apache.jetspeed.engine.core.PortalURL;
   import org.apache.jetspeed.request.RequestContext;
  -import org.picocontainer.Startable;
  +import org.apache.pluto.om.window.PortletWindow;
   
   /**
  - * PathNavigationalState is based on Pluto navigational state.
  + * PathNavigationalStateContext is based on Pluto navigational state.
    * All nav state is stored as path parameters in the URL.
    * This implementation does not currently support persisting navigational state
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
    * @version $Id$
    */
  -public class PathNavigationalState implements NavigationalState, Startable
  +public class PathNavigationalState implements NavigationalState 
   {
  -    static private final String ACTION = "ac";
  -    static private final String MODE = "md";
  -    static private final String PREFIX = "_";
  -    static private final String PREV_MODE = "pm";
  -    static private final String PREV_STATE = "ps";
  -    static private final String RENDER_PARAM = "rp";
  -    static private final String STATE = "st";
  -    static private final String KEY_DELIMITER = ":";
  -    static private final String PORTLET_ID = "pid";
  -
  -    public PathNavigationalState()
  -    {   
  -    }
  -            
  -    public void start()
  -    {
  -    }
  +    RequestContext context;
  +    PortalURL url;
  +    PortalControlParameter pcp;
       
  -    public void stop()
  +    public PathNavigationalState(RequestContext context)
       {
  +        init(context);
       }
       
  -    public NavigationalStateContext createContext(RequestContext context)
  +    public void init(RequestContext context)
       {
  -        // TODO: pool
  -        return new PathNavigationalStateContext(context);
  +        this.context = context;
  +        this.url = context.getRequestedPortalURL();
  +        this.pcp = new PortalControlParameter(url);        
       }
       
  -    public void storeContext(RequestContext context, NavigationalStateContext 
navContext)
  +    public WindowState getState(PortletWindow window) 
       {
  -        // TODO: implement
  +        return pcp.getState(window);
       }
  -
  -    public String getActionKey()
  +    
  +    public void setState(PortletWindow window, WindowState state) 
       {
  -        return ACTION;
  +        pcp.setState(window, state);
       }
  -
  -    public String getRenderParamKey()
  +    
  +    public PortletMode getMode(PortletWindow window) 
       {
  -        return RENDER_PARAM;
  +        return pcp.getMode(window);
       }
       
  -    public String getModeKey()
  +    public void setMode(PortletWindow window, PortletMode mode) 
       {
  -        return MODE;
  +        pcp.setMode(window, mode);
       }
       
  -    public String getPreviousModeKey()
  +    public PortletMode getPreviousMode(PortletWindow window) 
       {
  -        return PREV_MODE;
  +        return pcp.getPrevMode(window);
       }
       
  -    
  -    public String getStateKey()
  +    public WindowState getPreviousState(PortletWindow window) 
       {
  -        return STATE;
  +        return pcp.getPrevState(window);
       }
       
  -    public String getPreviousStateKey()
  +    public boolean isNavigationalParameter(String token)
       {
  -        return PREV_STATE;
  +        return PortalControlParameter.isControlParameter(token);
       }
  +    
       
   }
  
  
  
  1.4       +28 -44    
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/session/impl/SessionNavigationalState.java
  
  Index: SessionNavigationalState.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/session/impl/SessionNavigationalState.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SessionNavigationalState.java     24 Mar 2004 23:31:19 -0000      1.3
  +++ SessionNavigationalState.java     30 Mar 2004 22:00:20 -0000      1.4
  @@ -1,5 +1,5 @@
   /*
  - * Copyright 2000-2004 The Apache Software Foundation.
  + * Copyright 2000-2001,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.
  @@ -15,82 +15,66 @@
    */
   package org.apache.jetspeed.container.session.impl;
   
  +import javax.portlet.PortletMode;
  +import javax.portlet.WindowState;
  +
   import org.apache.jetspeed.container.session.NavigationalState;
  -import org.apache.jetspeed.container.session.NavigationalStateContext;
   import org.apache.jetspeed.request.RequestContext;
  -import org.picocontainer.Startable;
  +import org.apache.pluto.om.window.PortletWindow;
   
   /**
  - * NavigationalStateComponent
  + * SessionNavigationalStateContext
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
    * @version $Id$
    */
  -public class SessionNavigationalState implements NavigationalState, Startable
  +public class SessionNavigationalState
  +        implements
  +            NavigationalState 
   {
  -    static private final String ACTION = "ac";
  -    static private final String MODE = "md";
  -    static private final String PREFIX = "_";
  -    static private final String PREV_MODE = "pm";
  -    static private final String PREV_STATE = "ps";
  -    static private final String RENDER_PARAM = "rp";
  -    static private final String STATE = "st";
  -    static private final String KEY_DELIMITER = ":";
  -    static private final String PORTLET_ID = "pid";
  -
  -    public SessionNavigationalState()  
  -    {
  -    }
  -
  +    RequestContext context;
       
  -    public void start()
  +    public SessionNavigationalState(RequestContext context)
       {
  +        init(context);        
       }
       
  -    public void stop()
  +    public void init(RequestContext context)
       {
  -    }
  -
  -    public NavigationalStateContext createContext(RequestContext context)
  -    {
  -        // TODO: pool
  -        return new SessionNavigationalStateContext(context);
  +        this.context = context;
       }
       
  -    public void storeContext(RequestContext context, NavigationalStateContext 
navContext)
  +    public WindowState getState(PortletWindow window) 
       {
  -        // TODO: implement
  +        return null;
       }
       
  -    public String getActionKey()
  +    public void setState(PortletWindow window, WindowState state) 
       {
  -        return ACTION;
       }
  -
  -    public String getRenderParamKey()
  +    
  +    public PortletMode getMode(PortletWindow window) 
       {
  -        return RENDER_PARAM;
  +        return null;
       }
       
  -    public String getModeKey()
  +    public void setMode(PortletWindow window, PortletMode mode) 
       {
  -        return MODE;
       }
       
  -    public String getPreviousModeKey()
  +    public PortletMode getPreviousMode(PortletWindow window) 
       {
  -        return PREV_MODE;
  +        return null;
       }
       
  -    
  -    public String getStateKey()
  +    public WindowState getPreviousState(PortletWindow window) 
       {
  -        return STATE;
  +        return null;
       }
       
  -    public String getPreviousStateKey()
  +    public boolean isNavigationalParameter(String token)
       {
  -        return PREV_STATE;
  +        return false;
       }
       
   }
  
  
  
  1.1                  
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/session/impl/JetspeedNavigationalStateComponent.java
  
  Index: JetspeedNavigationalStateComponent.java
  ===================================================================
  /*
   * Copyright 2000-2001,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.container.session.impl;
  
  import java.lang.reflect.Constructor;
  
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  import org.apache.jetspeed.container.session.NavigationalState;
  import org.apache.jetspeed.container.session.NavigationalStateComponent;
  import org.apache.jetspeed.request.RequestContext;
  
  /**
   * JetspeedNavigationalStateComponent
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
   * @version $Id: JetspeedNavigationalStateComponent.java,v 1.1 2004/03/30 22:00:20 
taylor Exp $
   */
  public class JetspeedNavigationalStateComponent implements 
NavigationalStateComponent 
  {
      static private final String ACTION = "ac";
      static private final String MODE = "md";
      static private final String PREFIX = "_";
      static private final String PREV_MODE = "pm";
      static private final String PREV_STATE = "ps";
      static private final String RENDER_PARAM = "rp";
      static private final String STATE = "st";
      static private final String KEY_DELIMITER = ":";
      static private final String PORTLET_ID = "pid";
      
      private String contextClassName = null;
      private Class contextClass = null;
      private final static Log log = 
LogFactory.getLog(JetspeedNavigationalStateComponent.class);
      
      public JetspeedNavigationalStateComponent(String contextClassName)
      {
          this.contextClassName = contextClassName;
      }
              
      public void start()
      {
      }
      
      public void stop()
      {
      }
      
      public NavigationalState create(RequestContext context)
      {
          NavigationalState state = null;
          try
          {
              if (null == contextClass)
              {
                  contextClass = Class.forName(contextClassName);
              }
  
              // TODO: we could use a pooled object implementation here
              Constructor constructor = contextClass.getConstructor(new Class[] 
{RequestContext.class});
              
              state = (NavigationalState) constructor.newInstance(new Object[] 
{context});
              
          }
          catch(Exception e)
          {
              String msg = "RequestContextFactory: Failed to create a Class object for 
RequestContext: " + e.toString();
              log.error(msg);
          }
          return state;
      }
      
      public void store(RequestContext context, NavigationalState navContext)
      {
          // TODO: implement
      }
  
      public void release(NavigationalState navContext)
      {
          
      }
  
      public String getActionKey()
      {
          return ACTION;
      }
  
      public String getRenderParamKey()
      {
          return RENDER_PARAM;
      }
      
      public String getModeKey()
      {
          return MODE;
      }
      
      public String getPreviousModeKey()
      {
          return PREV_MODE;
      }
      
      
      public String getStateKey()
      {
          return STATE;
      }
      
      public String getPreviousStateKey()
      {
          return PREV_STATE;
      }
  }
  
  
  
  1.5       +6 -4      
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/JetspeedServlet.java
  
  Index: JetspeedServlet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/JetspeedServlet.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JetspeedServlet.java      8 Mar 2004 00:26:46 -0000       1.4
  +++ JetspeedServlet.java      30 Mar 2004 22:00:20 -0000      1.5
  @@ -35,7 +35,7 @@
   import org.apache.jetspeed.engine.servlet.ServletHelper;
   import org.apache.jetspeed.exception.JetspeedException;
   import org.apache.jetspeed.request.RequestContext;
  -import org.apache.jetspeed.request.RequestContextFactory;
  +import org.apache.jetspeed.request.RequestContextComponent;
   
   /**
    * Jetspeed Servlet entry point.
  @@ -202,9 +202,11 @@
                   init(req, res);
               }
   
  -            RequestContext context = RequestContextFactory.getInstance(req, res, 
getServletConfig());
  -
  +            //RequestContext context = RequestContextFactory.getInstance(req, res, 
getServletConfig());
  +            RequestContextComponent contextComponent = 
(RequestContextComponent)Jetspeed.getComponentManager().getComponent(RequestContextComponent.class);
  +            RequestContext context = contextComponent.create(req, res, 
getServletConfig());
               engine.service(context);
  +            contextComponent.release(context);
   
           }
           catch (Throwable t)
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to