You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jv...@apache.org on 2002/02/08 03:49:06 UTC

cvs commit: jakarta-turbine-3/src/java/org/apache/turbine/services/rundata DefaultTurbineRunData.java TurbineRunDataService.java SessionBindingEventProxy.java TurbineRunData.java TurbineSession.java TurbineSessionBindingEvent.java

jvanzyl     02/02/07 18:49:06

  Modified:    src/java/org/apache/turbine Tag: rundata_security_changes
                        RunData.java Turbine.java TurbineConstants.java
               src/java/org/apache/turbine/modules Tag:
                        rundata_security_changes ModuleLoader.java
               src/java/org/apache/turbine/pipeline Tag:
                        rundata_security_changes
                        DefaultSessionTimeoutValve.java
                        DefaultTargetValve.java
               src/java/org/apache/turbine/services/pull Tag:
                        rundata_security_changes TurbinePullService.java
               src/java/org/apache/turbine/services/rundata Tag:
                        rundata_security_changes DefaultTurbineRunData.java
                        TurbineRunDataService.java
  Removed:     src/java/org/apache/turbine/modules/actions Tag:
                        rundata_security_changes NullSessionValidator.java
                        SessionValidator.java
               src/java/org/apache/turbine/pipeline Tag:
                        rundata_security_changes
                        DefaultSessionValidationValve.java
               src/java/org/apache/turbine/services/rundata Tag:
                        rundata_security_changes
                        SessionBindingEventProxy.java TurbineRunData.java
                        TurbineSession.java TurbineSessionBindingEvent.java
  Log:
  - merging some of the Configuration changes into this branch so that
    i could work against the latest versions of fulcrum and stratum.
  
  - moving the anything security related and requiring fulcrum into a
    separate package. this is still a work in progress as i'm still
    trying to determine the best way to use a rundata variant. jetspeed
    is really the only example right now and they upcast when they require
    the needs of their rundata variant. i'm not too keen on that but that's
    what i did for now so that i could get my changes in.
  
    i will work on this over the weekend and see what i can come up with,
    i know what i want to see but i'm not 100% sure on how to do it so that
    it's relatively painless to use. i can get things to work but haven't
    been thrilled with what's required by users to get things to work. as
    i said, a work in progress.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.5.2.2   +7 -7      jakarta-turbine-3/src/java/org/apache/turbine/RunData.java
  
  Index: RunData.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/src/java/org/apache/turbine/RunData.java,v
  retrieving revision 1.5.2.1
  retrieving revision 1.5.2.2
  diff -u -r1.5.2.1 -r1.5.2.2
  --- RunData.java	5 Feb 2002 15:41:31 -0000	1.5.2.1
  +++ RunData.java	8 Feb 2002 02:49:04 -0000	1.5.2.2
  @@ -63,10 +63,7 @@
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
   import javax.servlet.http.HttpSession;
  -import org.apache.fulcrum.util.parser.CookieParser;
   import org.apache.turbine.ParameterParser;
  -import org.apache.fulcrum.security.entity.User;
  -import org.apache.fulcrum.security.util.AccessControlList;
   
   /**
    * RunData is an interface to run-rime information that is passed
  @@ -80,7 +77,7 @@
    * @author <a href="mailto:bhoeneis@ee.ethz.ch">Bernie Hoeneisen</a>
    * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
    * @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
  - * @version $Id: RunData.java,v 1.5.2.1 2002/02/05 15:41:31 jvanzyl Exp $
  + * @version $Id: RunData.java,v 1.5.2.2 2002/02/08 02:49:04 jvanzyl Exp $
    */
   public interface RunData
   {
  @@ -123,11 +120,14 @@
       public void setSession(HttpSession r);
       public HttpSession getSession();
   
  -    public ParameterParser getParameters();
  -    public void setParameterParser(ParameterParser paramterParser);
  -
  +    public void setServletConfig(ServletConfig servletConfig);
       public ServletConfig getServletConfig();
  +
  +    //public void setServletContext(ServletContext servletContext);
       public ServletContext getServletContext();
  +
  +    public ParameterParser getParameters();
  +    public void setParameterParser(ParameterParser paramterParser);
   
       public PrintWriter getOut()
           throws IOException;
  
  
  
  1.24.2.2  +22 -14    jakarta-turbine-3/src/java/org/apache/turbine/Turbine.java
  
  Index: Turbine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/src/java/org/apache/turbine/Turbine.java,v
  retrieving revision 1.24.2.1
  retrieving revision 1.24.2.2
  diff -u -r1.24.2.1 -r1.24.2.2
  --- Turbine.java	5 Feb 2002 15:41:31 -0000	1.24.2.1
  +++ Turbine.java	8 Feb 2002 02:49:04 -0000	1.24.2.2
  @@ -3,7 +3,7 @@
   /* ====================================================================
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -72,10 +72,11 @@
   import javax.servlet.http.HttpServletResponse;
   import org.apache.commons.util.StringUtils;
   import org.apache.commons.util.http.HttpUtils;
  -import org.apache.commons.collections.ExtendedProperties;
   import org.apache.fulcrum.ServiceManager;
   import org.apache.fulcrum.TurbineServices;
   import org.apache.log4j.Category;
  +import org.apache.stratum.configuration.Configuration;
  +import org.apache.stratum.configuration.PropertiesConfiguration;
   import org.apache.stratum.xo.Mapper;
   import org.apache.turbine.modules.ModuleLoader;
   import org.apache.turbine.pipeline.DefaultTargetValve;
  @@ -121,7 +122,8 @@
    * @author <a href="mailto:krzewski@e-point.pl">Rafal Krzewski</a>
    * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
    * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
  - * @version $Id: Turbine.java,v 1.24.2.1 2002/02/05 15:41:31 jvanzyl Exp $
  + * @author <a href="mailto:mpoeschl@marmot.at">Martin Poeschl</a>
  + * @version $Id: Turbine.java,v 1.24.2.2 2002/02/08 02:49:04 jvanzyl Exp $
    */
   public class Turbine
       extends HttpServlet
  @@ -148,7 +150,7 @@
       /**
        * Turbine application configuration.
        */
  -    private static ExtendedProperties configuration;
  +    private static Configuration configuration;
   
       /**
        * This init method will load the default resources from a
  @@ -378,7 +380,7 @@
           Log.error("Turbine.handleException: " + t.getMessage());
           Log.error(t);
   
  -        if ( INTEGRATED.equals(configuration.getProperty(MODE)) ||
  +        if ( INTEGRATED.equals(configuration.getString(MODE)) ||
                req.getAttribute(INTEGRATED_REQUEST_KEY) != null )
           {
               // leave error handling to the invoking application
  @@ -567,7 +569,7 @@
           // runtime. Right now this creates the directories
           // for logging but we might have more of these
           // directories in the future.
  -        createRuntimeDirectories();
  +        createRuntimeDirectories(config.getInitParameter(LOGGING_ROOT));
   
           // Get the full path to the properties file.
           if (propsFile == null)
  @@ -614,7 +616,7 @@
           // This should eventually be a Configuration
           // interface so that service and app configuration
           // can be stored anywhere.
  -        configuration = new ExtendedProperties(propsPath);
  +        configuration = (Configuration) new PropertiesConfiguration(propsPath);
   
           // We want to set a few values in the configuration so
           // that ${variable} interpolation will work for
  @@ -644,14 +646,14 @@
           // set up the resolver, should be done before the pipeline
           String resolverClass;
           resolverClass = configuration.getString(RESOLVER,
  -                            "org.apache.turbine.pipeline.DefaultResolver");
  +            "org.apache.turbine.pipeline.DefaultResolver");
   
           Log.debug("[Turbine] Using Resolver: " + resolverClass);
           resolver = (Resolver) Class.forName(resolverClass).newInstance();
           resolver.init();
   
           // Set some system properties
  -        ExtendedProperties systemProperties = configuration.subset(SYSTEM);
  +        Configuration systemProperties = configuration.subset(SYSTEM);
   
           if (systemProperties != null)
           {
  @@ -704,14 +706,21 @@
        *
        * i) directories for logging
        *
  +     * @param path The directory to write log files to (relative to
  +     * the web application root), or <code>null</code> for the default
  +     * of <code>/logs</code>.
        */
  -    private static void createRuntimeDirectories()
  +    private static void createRuntimeDirectories(String path)
       {
  -        // Create the logging directory
  -        File logDir = new File(getRealPath("/logs"));
  +        if (StringUtils.isEmpty(path))
  +        {
  +            path = "/logs";
  +        }
   
  +        File logDir = new File(getRealPath(path));
           if (!logDir.exists())
           {
  +            // Create the logging directory
               if (!logDir.mkdirs())
               {
                   System.err.println("Cannot create directory for logs!");
  @@ -749,7 +758,6 @@
        */
       public static synchronized void saveServletInfo(RunData data)
       {
  -        System.out.println("RunData -> " + data.getRequest());
           serverName = data.getRequest().getServerName();
           serverPort = new Integer(data.getRequest().getServerPort()).toString();
           serverScheme = data.getRequest().getScheme();
  @@ -873,7 +881,7 @@
        *
        * @return Turbine configuration.
        */
  -    public static ExtendedProperties getConfiguration()
  +    public static Configuration getConfiguration()
       {
           return configuration;
       }
  
  
  
  1.12.2.1  +1 -0      jakarta-turbine-3/src/java/org/apache/turbine/TurbineConstants.java
  
  Index: TurbineConstants.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/src/java/org/apache/turbine/TurbineConstants.java,v
  retrieving revision 1.12
  retrieving revision 1.12.2.1
  diff -u -r1.12 -r1.12.2.1
  --- TurbineConstants.java	11 Jan 2002 23:44:21 -0000	1.12
  +++ TurbineConstants.java	8 Feb 2002 02:49:04 -0000	1.12.2.1
  @@ -336,6 +336,7 @@
       public static final String APPLICATION_ROOT = "applicationRoot";
       public static final String WEBAPP_ROOT = "webappRoot";
       public static final String WEB_CONTEXT = "webContext";
  +    public static final String LOGGING_ROOT = "loggingRoot";
       
       /**
        * configuration subset
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.7.2.1   +19 -18    jakarta-turbine-3/src/java/org/apache/turbine/modules/ModuleLoader.java
  
  Index: ModuleLoader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/src/java/org/apache/turbine/modules/ModuleLoader.java,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- ModuleLoader.java	30 Dec 2001 08:38:52 -0000	1.7
  +++ ModuleLoader.java	8 Feb 2002 02:49:05 -0000	1.7.2.1
  @@ -3,7 +3,7 @@
   /* ====================================================================
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2002 The Apache Software Foundation. All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -59,13 +59,13 @@
   import java.util.List;
   import java.util.Vector;
   import java.util.Map;
  +import org.apache.stratum.configuration.Configuration;
   import org.apache.turbine.RunData;
   import org.apache.turbine.Turbine;
   import org.apache.turbine.TurbineException;
   import org.apache.turbine.Resolver;
   import org.apache.commons.collections.FastArrayList;
   import org.apache.commons.collections.FastHashMap;
  -import org.apache.commons.collections.ExtendedProperties;
   import org.apache.turbine.Log;
   
   import org.apache.turbine.pipeline.PipelineUtil;
  @@ -74,7 +74,8 @@
    * Load modules for use in the view pipeline.
    *
    * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
  - * @version $Id: ModuleLoader.java,v 1.7 2001/12/30 08:38:52 dlr Exp $
  + * @author <a href="mailto:mpoeschl@marmot.at">Martin Poeschl</a>
  + * @version $Id: ModuleLoader.java,v 1.7.2.1 2002/02/08 02:49:05 jvanzyl Exp $
    */
   public class ModuleLoader
   {
  @@ -106,7 +107,7 @@
        */
       protected boolean scriptingEnabled;
   
  -    protected ExtendedProperties configuration;
  +    protected Configuration configuration;
   
       /**
        * Default constructor.
  @@ -133,7 +134,7 @@
       /**
        * Set the configuration for the module loader
        */
  -    public void setConfiguration(ExtendedProperties configuration)
  +    public void setConfiguration(Configuration configuration)
       {
           this.configuration = configuration;
       }
  @@ -144,7 +145,7 @@
       public void init()
           throws TurbineException
       {
  -        ExtendedProperties moduleTypes = configuration.subset("module.default");
  +        Configuration moduleTypes = configuration.subset("module.default");
   
           if (moduleTypes == null)
           {
  @@ -174,7 +175,7 @@
           {
               addModulePackage((String) i.next());
           }
  -        
  +
           // Add the package for Turbine's default modules.
           // This package must be added last so it is searched
           // for last.
  @@ -196,8 +197,8 @@
       public Module getModule(String type, String name)
           throws Exception
       {
  -        Module module = null; 
  -        
  +        Module module = null;
  +
           Iterator k;
           if (type.equals("actions"))
           {
  @@ -210,18 +211,18 @@
               List names = getPossibleModules(sb.toString());
               k = getAllPossibleModules(names, type);
           }
  -        
  +
           while (k.hasNext())
           {
               String moduleClass = (String) k.next();
  -          
  +
               try
               {
                   Log.debug("[ModuleLoader] Looking for " + moduleClass);
                   module = (Module) Class.forName(moduleClass).newInstance();
                   Log.debug("[ModuleLoader] " + name + " => " + moduleClass);
                   break;
  -            }                        
  +            }
               catch (Exception ignored)
               {
                   // Likely a non-existant class name combination.
  @@ -258,12 +259,12 @@
               {
                   String module = modulePackage + "." + type + "." + m.next();
                   modules.add(module);
  -                
  +
               }
  -            
  +
               // Add default for type
               defaultModules.add(modulePackage + "." + getDefaultModule(type));
  -        }            
  +        }
   
           modules.addAll(defaultModules);
   
  @@ -283,8 +284,8 @@
           {
               String action = (String) i.next() + ".actions." + name;
               actions.add(action);
  -        }            
  -        
  +        }
  +
           return actions.iterator();
       }
   
  @@ -354,7 +355,7 @@
                   }
               }
           }
  - 
  +
           // Remove a possible file extension.
           for (int j = i + 1; j < pckage.length(); j++)
           {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.3.2.1   +5 -4      jakarta-turbine-3/src/java/org/apache/turbine/pipeline/DefaultSessionTimeoutValve.java
  
  Index: DefaultSessionTimeoutValve.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/src/java/org/apache/turbine/pipeline/DefaultSessionTimeoutValve.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- DefaultSessionTimeoutValve.java	24 Jan 2002 03:55:26 -0000	1.3
  +++ DefaultSessionTimeoutValve.java	8 Feb 2002 02:49:05 -0000	1.3.2.1
  @@ -57,7 +57,6 @@
   import java.io.IOException;
   import java.util.Enumeration;
   
  -import org.apache.commons.collections.ExtendedProperties;
   import org.apache.turbine.Turbine;
   import org.apache.turbine.TurbineConstants;
   import org.apache.turbine.RunData;
  @@ -66,12 +65,14 @@
   import org.apache.turbine.ValveContext;
   import org.apache.log4j.Category;
   
  +import org.apache.stratum.configuration.Configuration;
  +
   /**
    * Implements the action portion of the "Turbine classic" processing
    * pipeline (from the Turbine 2.x series).
    *
    * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
  - * @version $Id: DefaultSessionTimeoutValve.java,v 1.3 2002/01/24 03:55:26 jvanzyl Exp $
  + * @version $Id: DefaultSessionTimeoutValve.java,v 1.3.2.1 2002/02/08 02:49:05 jvanzyl Exp $
    */
   public class DefaultSessionTimeoutValve
       extends AbstractValve
  @@ -79,7 +80,7 @@
   {
       private static final Category log =
           Category.getInstance(DefaultSessionTimeoutValve.class);
  -        
  +
       /**
        * The default session timeout.
        */
  @@ -94,7 +95,7 @@
       public DefaultSessionTimeoutValve()
           throws Exception
       {
  -        ExtendedProperties cfg = Turbine.getConfiguration();
  +        Configuration cfg = Turbine.getConfiguration();
           if (cfg != null)
           {
               // Get the session timeout.
  
  
  
  1.8.2.2   +4 -3      jakarta-turbine-3/src/java/org/apache/turbine/pipeline/DefaultTargetValve.java
  
  Index: DefaultTargetValve.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/src/java/org/apache/turbine/pipeline/DefaultTargetValve.java,v
  retrieving revision 1.8.2.1
  retrieving revision 1.8.2.2
  diff -u -r1.8.2.1 -r1.8.2.2
  --- DefaultTargetValve.java	5 Feb 2002 15:37:42 -0000	1.8.2.1
  +++ DefaultTargetValve.java	8 Feb 2002 02:49:05 -0000	1.8.2.2
  @@ -57,7 +57,6 @@
   import java.io.IOException;
   import java.util.Enumeration;
   
  -import org.apache.commons.collections.ExtendedProperties;
   import org.apache.turbine.DynamicURI;
   import org.apache.turbine.Turbine;
   import org.apache.turbine.TurbineConstants;
  @@ -70,6 +69,8 @@
   import org.apache.turbine.modules.Module;
   import org.apache.log4j.Category;
   
  +import org.apache.stratum.configuration.Configuration;
  +
   /**
    * Implements the RunData target portion of the "Turbine classic"
    * processing pipeline (from the Turbine 2.x series).
  @@ -79,7 +80,7 @@
    * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
    * @author <a href="mailto:mikeh@apache.org">Mike Haberman</a>
    * @author <a href="mailto:james@jamestaylor.org">James Taylor</a>
  - * @version $Id: DefaultTargetValve.java,v 1.8.2.1 2002/02/05 15:37:42 jvanzyl Exp $
  + * @version $Id: DefaultTargetValve.java,v 1.8.2.2 2002/02/08 02:49:05 jvanzyl Exp $
    */
   public class DefaultTargetValve
       extends AbstractValve
  @@ -98,7 +99,7 @@
        */
       public DefaultTargetValve()
       {
  -        ExtendedProperties cfg = Turbine.getConfiguration();
  +        Configuration cfg = Turbine.getConfiguration();
   
           if (cfg != null)
           {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.9.2.2   +3 -3      jakarta-turbine-3/src/java/org/apache/turbine/services/pull/TurbinePullService.java
  
  Index: TurbinePullService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/src/java/org/apache/turbine/services/pull/TurbinePullService.java,v
  retrieving revision 1.9.2.1
  retrieving revision 1.9.2.2
  diff -u -r1.9.2.1 -r1.9.2.2
  --- TurbinePullService.java	5 Feb 2002 15:41:31 -0000	1.9.2.1
  +++ TurbinePullService.java	8 Feb 2002 02:49:05 -0000	1.9.2.2
  @@ -71,7 +71,7 @@
   import org.apache.turbine.TemplateContext;
   import org.apache.turbine.modules.DefaultTemplateContext;
   
  -import org.apache.commons.collections.ExtendedProperties;
  +import org.apache.stratum.configuration.Configuration;
   
   /**
    * <p>
  @@ -144,7 +144,7 @@
    *
    * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
    * @author <a href="mailto:sean@informage.net">Sean Legassick</a>
  - * @version $Id: TurbinePullService.java,v 1.9.2.1 2002/02/05 15:41:31 jvanzyl Exp $
  + * @version $Id: TurbinePullService.java,v 1.9.2.2 2002/02/08 02:49:05 jvanzyl Exp $
    */
   public class TurbinePullService
       extends BaseService
  @@ -310,7 +310,7 @@
       {
           List classes = new ArrayList();
   
  -        ExtendedProperties toolResources =
  +        Configuration toolResources =
               getConfiguration().subset(keyPrefix);
   
           // There might not be any tools for this prefix
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.7.2.2   +2 -276    jakarta-turbine-3/src/java/org/apache/turbine/services/rundata/DefaultTurbineRunData.java
  
  Index: DefaultTurbineRunData.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/src/java/org/apache/turbine/services/rundata/DefaultTurbineRunData.java,v
  retrieving revision 1.7.2.1
  retrieving revision 1.7.2.2
  diff -u -r1.7.2.1 -r1.7.2.2
  --- DefaultTurbineRunData.java	5 Feb 2002 15:41:31 -0000	1.7.2.1
  +++ DefaultTurbineRunData.java	8 Feb 2002 02:49:05 -0000	1.7.2.2
  @@ -97,12 +97,11 @@
    * @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
    * @author <a href="mailto:bhoeneis@ee.ethz.ch">Bernie Hoeneisen</a>
    * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
  - * @version $Id: DefaultTurbineRunData.java,v 1.7.2.1 2002/02/05 15:41:31 jvanzyl Exp $
  + * @version $Id: DefaultTurbineRunData.java,v 1.7.2.2 2002/02/08 02:49:05 jvanzyl Exp $
    */
   public class DefaultTurbineRunData
       extends RecyclableSupport
  -    implements TurbineRunData,
  -               Recyclable
  +    implements Recyclable
   {
       /**
        * The default locale.
  @@ -357,13 +356,6 @@
           // Clear all the values from the temporary
           // storage.
           temp.clear();
  -
  -        //serverName = null;
  -        //serverPort = 80;
  -        //serverScheme = null;
  -        //scriptName = null;
  -        //contextPath = null;
  -
           super.dispose();
       }
   
  @@ -542,190 +534,6 @@
       }
   
       /**
  -     * Checks if a user exists in this session.
  -     *
  -     * @return true if a user exists in this session.
  -     */
  -    public boolean userExists()
  -    {
  -        user = getUserFromSession();
  -        return (user != null);
  -    }
  -
  -    /**
  -     * Gets the user.
  -     *
  -     * @return a user.
  -     */
  -    public User getUser()
  -    {
  -        return this.user;
  -    }
  -
  -    /**
  -     * Sets the user.
  -     *
  -     * @param user a user.
  -     */
  -    public void setUser(User user)
  -    {
  -        this.user = user;
  -    }
  -
  -    /**
  -     * Attempts to get the User object from the session.  If the user
  -     * does not exist in the session, <code>null</code> is returned.
  -     *
  -     * <p> Anyone overriding this method should be sure to leverage
  -     * the <code>SessionBindingEventProxy</code> when pulling the
  -     * <code>User</code> object from the session, allowing hook
  -     * functions to be called on the listener when it is removed from
  -     * the session (which happens on session timeout).
  -     *
  -     * @param session The session to retrieve a <code>User</code>
  -     * object from.
  -     * @return The retreived user, or <code>null</code> if errors
  -     * occur.
  -     * @see org.apache.turbine.services.SessionBindingEventProxy
  -     * @see org.apache.fulcrum.security.entity.User
  -     * @see org.apache.fulcrum.session.SessionBindingListener
  -     */
  -    public static User getUserFromSession(HttpSession session)
  -    {
  -        try
  -        {
  -            SessionBindingEventProxy proxy =
  -                (SessionBindingEventProxy) session.getValue(User.SESSION_KEY);
  -
  -            // If the user isn't yet logged in, return null so that
  -            // the session validator can take the correct action
  -            // (i.e. make a temporary anonymous user).
  -            return (proxy == null ? null : (User) proxy.getListener());
  -        }
  -        catch (ClassCastException e)
  -        {
  -            Category category = Category.getInstance(
  -                "org.apache.turbine.services.rundata.DefaultTurbineRunData");
  -            String message = "User object did not implement User interface.  "
  -                + "if you are sure the interface is implemented, the user " +
  -                "object in the session and this class may be loaded from " +
  -                "different classloaders.  This has been known to happen " +
  -                "when using multiple turbine apps in tomcat that interact " +
  -                "through the use of RequestDispatcher.include or forward.";
  -            if ( category != null )
  -            {
  -                category.error(message, e);
  -            }
  -            else
  -            {
  -                System.err.println(message);
  -                e.printStackTrace();
  -            }
  -
  -            return null;
  -        }
  -    }
  -
  -    /**
  -     * Allows one to invalidate the user in a session.
  -     *
  -     * @param session An HttpSession.
  -     * @return True if user was invalidated.
  -     */
  -    public static boolean removeUserFromSession(HttpSession session)
  -    {
  -        try
  -        {
  -            session.removeValue(User.SESSION_KEY);
  -        }
  -        catch (Exception e)
  -        {
  -            return false;
  -        }
  -        return true;
  -    }
  -
  -    /**
  -     * Retrieves the ACL from the session
  -     */
  -    public static AccessControlList getACLFromSession(HttpSession session)
  -    {
  -        try
  -        {
  -            AccessControlList acl = (AccessControlList)
  -                session.getValue(AccessControlList.SESSION_KEY);
  -
  -            // If the acl isn't yet defined, return null
  -            return (acl == null ? null : acl);
  -        }
  -        catch (ClassCastException e)
  -        {
  -            return null;
  -        }
  -    }
  -
  -    /**
  -     * Allows one to invalidate the acl in a session.
  -     *
  -     * @param session An HttpSession.
  -     * @return True if acl was invalidated.
  -     */
  -    public static boolean removeACLFromSession(HttpSession session)
  -    {
  -        try
  -        {
  -            session.removeValue(AccessControlList.SESSION_KEY);
  -        }
  -        catch (Exception e)
  -        {
  -            return false;
  -        }
  -        return true;
  -    }
  -
  -    /**
  -     * Attempts to get the user from the session. If it does
  -     * not exist, it returns null.
  -     *
  -     * @return a user.
  -     */
  -    public User getUserFromSession()
  -    {
  -        return getUserFromSession(session);
  -    }
  -
  -    /**
  -     * Allows one to invalidate the user in the default session.
  -     *
  -     * @return true if user was invalidated.
  -     */
  -    public boolean removeUserFromSession()
  -    {
  -        return removeUserFromSession(session);
  -    }
  -
  -    /**
  -     * Attempts to get the ACL from the session. If it does
  -     * not exist, it returns null.
  -     *
  -     * @return a acl.
  -     */
  -    public AccessControlList getACLFromSession()
  -    {
  -        return getACLFromSession(session);
  -    }
  -
  -    /**
  -     * Allows one to invalidate the acl in the default session.
  -     *
  -     * @return true if acl was invalidated.
  -     */
  -    public boolean removeACLFromSession()
  -    {
  -        return removeACLFromSession(session);
  -    }
  -
  -    /**
        * Gets the print writer.     *
        * @return a print writer.
        * @throws IOException.
  @@ -1046,44 +854,6 @@
       }
   
       /**
  -     * Pulls a user and ACL object from the session and increments the access
  -     * counter and sets the last access date for the object.
  -     */
  -    public void populate()
  -    {
  -        user = getUserFromSession();
  -
  -        if (user != null)
  -        {
  -            user.setLastAccessDate();
  -            user.incrementAccessCounter();
  -            user.incrementAccessCounterForSession();
  -        }
  -    }
  -
  -    /**
  -     * <p>Saves this user object and ACL to the session.</p>
  -     *
  -     * <p>Anyone overriding this method should be sure to leverage
  -     * the <code>SessionBindingEventProxy</code> when adding the user
  -     * and acl into the session.  This allows hook functions to be called on
  -     * the <code>User</code> and <code>AccessControlList</code> when it is
  -     * removed from the session (which happens on session timeout).</p>
  -     *
  -     * @see #setUser(User)
  -     * @see #setAcl(AccessControlList)
  -     * @see org.apache.turbine.services.SessionBindingEventProxy
  -     * @see org.apache.fulcrum.security.entity.User
  -     * @see org.apache.fulcrum.security.util.AccessControlList
  -     * @see org.apache.fulcrum.session.SessionBindingListener
  -     */
  -    public void save()
  -    {
  -        session.putValue(User.SESSION_KEY, new SessionBindingEventProxy(user));
  -        session.putValue(AccessControlList.SESSION_KEY, (Object) acl);
  -    }
  -
  -    /**
        * Gets the stack trace if set.
        *
        * @return the stack trace.
  @@ -1124,50 +894,6 @@
       public Hashtable getVarDebug()
       {
           return varDebug;
  -    }
  -
  -    // **********************************************
  -    // Implementation of the TurbineRunData interface
  -    // **********************************************
  -
  -    /**
  -     * Gets the parameter parser without parsing the parameters.
  -     *
  -     * @return the parameter parser.
  -     */
  -    public ParameterParser getParameterParser()
  -    {
  -        return parameters;
  -    }
  -
  -    /**
  -     * Sets the parameter parser.
  -     *
  -     * @param parser a parameter parser.
  -     */
  -    public void setParameterParser(ParameterParser parser)
  -    {
  -        parameters = parser;
  -    }
  -
  -    /**
  -     * Gets the cookie parser without parsing the cookies.
  -     *
  -     * @return the cookie parser.
  -     */
  -    public CookieParser getCookieParser()
  -    {
  -        return cookies;
  -    }
  -
  -    /**
  -     * Sets the cookie parser.
  -     *
  -     * @param parser a cookie parser.
  -     */
  -    public void setCookieParser(CookieParser parser)
  -    {
  -        cookies = parser;
       }
   
       /**
  
  
  
  1.6.2.2   +15 -22    jakarta-turbine-3/src/java/org/apache/turbine/services/rundata/TurbineRunDataService.java
  
  Index: TurbineRunDataService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/src/java/org/apache/turbine/services/rundata/TurbineRunDataService.java,v
  retrieving revision 1.6.2.1
  retrieving revision 1.6.2.2
  diff -u -r1.6.2.1 -r1.6.2.2
  --- TurbineRunDataService.java	5 Feb 2002 15:41:31 -0000	1.6.2.1
  +++ TurbineRunDataService.java	8 Feb 2002 02:49:05 -0000	1.6.2.2
  @@ -79,7 +79,7 @@
    * the implementations should implement the Recyclable interface.
    *
    * @author <a href="mailto:ilkka.priha@simsoft.fi">Ilkka Priha</a>
  - * @version $Id: TurbineRunDataService.java,v 1.6.2.1 2002/02/05 15:41:31 jvanzyl Exp $
  + * @version $Id: TurbineRunDataService.java,v 1.6.2.2 2002/02/08 02:49:05 jvanzyl Exp $
    */
   public class TurbineRunDataService
       extends BaseService
  @@ -116,26 +116,10 @@
       private HashMap configurations = new HashMap();
   
       /**
  -     * The getContextPath method from servet API >2.0.
  -     */
  -    private Method getContextPath;
  -
  -    /**
        * Constructs a RunData Service.
        */
       public TurbineRunDataService()
       {
  -        // Allow Turbine to work with both 2.2 (and 2.1) and 2.0 Servlet API.
  -        try
  -        {
  -            getContextPath =
  -                HttpServletRequest.class.getDeclaredMethod("getContextPath",null);
  -        }
  -        catch (NoSuchMethodException x)
  -        {
  -            // Ignore a NoSuchMethodException because
  -            // it means we are using Servlet API 2.0.
  -        }
       }
   
       /**
  @@ -166,6 +150,7 @@
                   PARAMETER_PARSER,
                   COOKIE_PARSER
               };
  +            
               for (Iterator i = getConfiguration().getKeys(); i.hasNext();)
               {
                   key = (String) i.next();
  @@ -235,7 +220,8 @@
           if (req == null || res == null || config == null)
           {
               throw new IllegalArgumentException(
  -                "RunDataFactory fatal error: HttpServletRequest, HttpServletResponse or ServletConfig was null.");
  +                "RunDataFactory fatal error: HttpServletRequest, " +
  +                    "HttpServletResponse or ServletConfig was null.");
           }
   
           // Get the specified configuration.
  @@ -251,12 +237,15 @@
           PoolService pool = (PoolService)
               TurbineServices.getInstance().getService(PoolService.SERVICE_NAME);
   
  -        TurbineRunData data;
  +        //!!! How to use a generic rundata object here
  +        RunData data;
           try
           {
  -            data = (TurbineRunData) pool.getInstance(cfg[0]);
  -            data.setParameterParser((ParameterParser) pool.getInstance(cfg[1]));
  -            data.setCookieParser((CookieParser) pool.getInstance(cfg[2]));
  +            // Need to deal with populating Rundata in a more configurable
  +            // fashion.
  +            data = (RunData) pool.getInstance(cfg[0]);
  +            //data.setParameterParser((ParameterParser) pool.getInstance(cfg[1]));
  +            //data.setCookieParser((CookieParser) pool.getInstance(cfg[2]));
           }
           catch (ClassCastException x)
           {
  @@ -285,6 +274,9 @@
        */
       public boolean putRunData(RunData data)
       {
  +        //!!! Figure out how to deal with arbitrary rundata implementations.
  +        return false;
  +        /*
           if (data instanceof TurbineRunData)
           {
               PoolService pool = (PoolService)
  @@ -297,5 +289,6 @@
           {
               return false;
           }
  +        */
       }
   }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>