portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggol...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/services/rundata DefaultJetspeedRunData.java JetspeedRunData.java
Date Fri, 03 May 2002 15:05:56 GMT
ggolden     02/05/03 08:05:56

  Modified:    src/java/org/apache/jetspeed/services/rundata
                        DefaultJetspeedRunData.java JetspeedRunData.java
  Log:
  Added SateManager related methods that work with the StateManagerService
  See proposals/StateManager.txt for more details.
  
  Revision  Changes    Path
  1.9       +103 -10   jakarta-jetspeed/src/java/org/apache/jetspeed/services/rundata/DefaultJetspeedRunData.java
  
  Index: DefaultJetspeedRunData.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/rundata/DefaultJetspeedRunData.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DefaultJetspeedRunData.java	17 Apr 2002 02:04:56 -0000	1.8
  +++ DefaultJetspeedRunData.java	3 May 2002 15:05:56 -0000	1.9
  @@ -60,9 +60,12 @@
   import org.apache.jetspeed.om.profile.Profile;
   import org.apache.jetspeed.capability.CapabilityMap;
   import org.apache.jetspeed.capability.CapabilityMapFactory;
  +import org.apache.jetspeed.services.statemanager.SessionState;
  +import org.apache.jetspeed.services.statemanager.StateManagerService;
   import org.apache.turbine.services.rundata.DefaultTurbineRunData;
   import org.apache.turbine.om.security.TurbineUser;
   import org.apache.turbine.om.ObjectKey;
  +import org.apache.turbine.services.TurbineServices;
   
   import java.util.Stack;
   
  @@ -76,7 +79,7 @@
    * @author <a href="mailto:raphael@apache.org">RaphaŽl Luta</a>
    * @author <a href="mailto:sgala@apache.org">Santiago Gala</a>
    * @author <a href="mailto:paulsp@apache.org">Paul Spencer</a>
  - * @version $Id: DefaultJetspeedRunData.java,v 1.8 2002/04/17 02:04:56 taylor Exp $
  + * @version $Id: DefaultJetspeedRunData.java,v 1.9 2002/05/03 15:05:56 ggolden Exp $
    */
   public class DefaultJetspeedRunData extends DefaultTurbineRunData
       implements JetspeedRunData
  @@ -278,15 +281,15 @@
        */
       public Profile getProfile()
       {
  -	try
  -	{
  -	    return (Profile)this.getUser().getTemp("profile");
  -	} catch (Throwable t)
  -	{
  -	    Log.error( "Captured Exception: " );
  -	    Log.error( t );
  -	}
  -	return null;
  +    try
  +    {
  +        return (Profile)this.getUser().getTemp("profile");
  +    } catch (Throwable t)
  +    {
  +        Log.error( "Captured Exception: " );
  +        Log.error( t );
  +    }
  +    return null;
       }
   
       /** Clears the state of this object for recycling... */
  @@ -343,5 +346,95 @@
           }
           return ((Number)(okey.getValue())).intValue();
       }
  +
  +    /**
  +     * Access an identifier for the current request's PageSession.
  +     * A PageSession is a specific portal page being viewed in a specific
  +     * user session (and perhaps, but not yet [@todo] in a specific browser window).
  +     * @return the identifier for the current request's PageSession.
  +     */
  +    public String getPageSessionId()
  +    {
  +        // form based on the session and page's profile's id
  +        // session
  +        String sessionId = "?";
  +        if (getSession() != null)
  +        {
  +            sessionId = getSession().getId();
  +        }
  +        else
  +        {
  +            Log.warn("DefaultJetspeedRunData.getPageSessionId: no session");
  +        }
  +
  +        // profile
  +        String profileId = "?";
  +        if (getProfile() != null)
  +        {
  +            profileId = getProfile().getId();
  +        }
  +        else
  +        {
  +            Log.warn("DefaultJetspeedRunData.getPageSessionId: no profile");
  +        }
  +        
  +        return sessionId + profileId;
  +
  +    }   // getPageSessionId
  +
  +    /**
  +     * Access the current request's UserSession state object.
  +     * @return the current request's UserSession state object (may be null).
  +     */
  +    public SessionState getUserSessionState()
  +    {
  +        // get the StateManagerService
  +        StateManagerService service = (StateManagerService)TurbineServices
  +                .getInstance().getService(StateManagerService.SERVICE_NAME);
  +
  +        // handle no service
  +        if (service == null) return null;
  +
  +        return service.getSessionState(getSession().getId());
  +
  +    }   // getUserSessionState
  +
  +    /**
  +     * Access the current request's PageSession state object.
  +     * @return the current request's PageSession state object (may be null).
  +     */
  +    public SessionState getPageSessionState()
  +    {
  +        // get the StateManagerService
  +        StateManagerService service = (StateManagerService)TurbineServices
  +                .getInstance().getService(StateManagerService.SERVICE_NAME);
  +
  +        // handle no service
  +        if (service == null) return null;
  +
  +        return service.getSessionState(getPageSessionId());
  +
  +    }   // getPageSessionState
  +
  +    /**
  +     * Access the current request's PortletSession state object.
  +     * @param id The Portlet's unique id.
  +     * @return the current request's PortletSession state object. (may be null).
  +     */
  +    public SessionState getPortletSessionState(String id)
  +    {
  +        // get the StateManagerService
  +        StateManagerService service = (StateManagerService)TurbineServices
  +                .getInstance().getService(StateManagerService.SERVICE_NAME);
  +
  +        // handle no service
  +        if (service == null) return null;
  +
  +        // PageSession key
  +        String pageInstanceId = getPageSessionId();
  +
  +        return service.getSessionState(pageInstanceId + id);
  +
  +    }   // getPortletSessionState
   
   }
  
  
  
  1.6       +30 -1     jakarta-jetspeed/src/java/org/apache/jetspeed/services/rundata/JetspeedRunData.java
  
  Index: JetspeedRunData.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/rundata/JetspeedRunData.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JetspeedRunData.java	16 Apr 2002 18:12:47 -0000	1.5
  +++ JetspeedRunData.java	3 May 2002 15:05:56 -0000	1.6
  @@ -57,6 +57,7 @@
   import org.apache.jetspeed.portal.Portlet;
   import org.apache.jetspeed.om.profile.Profile;
   import org.apache.jetspeed.capability.CapabilityMap;
  +import org.apache.jetspeed.services.statemanager.SessionState;
   import org.apache.turbine.services.rundata.TurbineRunData;
   
   /**
  @@ -67,7 +68,7 @@
    * interface in future releases of Turbine</note>
    *
    * @author <a href="mailto:raphael@apache.org">RaphaŽl Luta</a>
  - * @version $Id: JetspeedRunData.java,v 1.5 2002/04/16 18:12:47 taylor Exp $
  + * @version $Id: JetspeedRunData.java,v 1.6 2002/05/03 15:05:56 ggolden Exp $
    */
   public interface JetspeedRunData extends TurbineRunData
   {
  @@ -179,4 +180,32 @@
        */
       public int getUserId();
   
  +    /**
  +     * Access an identifier for the current request's PageSession.
  +     * A PageSession is a specific portal page being viewed in a specific
  +     * user session (and perhaps, but not yet [@todo] in a specific browser window).
  +     * @return the identifier for the current request's PageSession.
  +     */
  +    public String getPageSessionId();
  +
  +    /**
  +     * Access the current request's UserSession state object.
  +     * @return the current request's UserSession state object (may be null).
  +     */
  +    public SessionState getUserSessionState();
  +
  +    /**
  +     * Access the current request's PageSession state object.
  +     * @return the current request's PageSession state object (may be null).
  +     */
  +    public SessionState getPageSessionState();
  +
  +    /**
  +     * Access the current request's PortletSession state object.
  +     * @param id The Portlet's unique id.
  +     * @return the current request's PortletSession state object. (may be null).
  +     */
  +    public SessionState getPortletSessionState(String id);
  +
   }
  +
  
  
  

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


Mime
View raw message