henning     2003/03/12 14:57:56

  Modified:    xdocs/services pull-service.xml
               conf     TurbineResources.properties
               conf/master TurbineResources.master
               src/java/org/apache/turbine/services/pull PullService.java
                        TurbinePullService.java
  Log:
  Add a new tool scope: authorized Tools
  
  Revision  Changes    Path
  1.2       +26 -12    jakarta-turbine-2/xdocs/services/pull-service.xml
  
  Index: pull-service.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-2/xdocs/services/pull-service.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- pull-service.xml  16 Aug 2001 05:10:44 -0000      1.1
  +++ pull-service.xml  12 Mar 2003 22:57:56 -0000      1.2
  @@ -4,6 +4,7 @@
    <properties>
     <title>Turbine Services - Pull Service</title>
     <author email="[EMAIL PROTECTED]">Sean Legassick</author>
  +  <author email="[EMAIL PROTECTED]">Henning P. Schmiedehausen</author>
    </properties>
   
   <body>
  @@ -85,8 +86,8 @@
   #
   # tool.<scope>.<id> = <classname>
   #
  -# <scope>      is the tool scope: global, request, session
  -#              or persistent (see below for more details)
  +# <scope>      is the tool scope: global, request, session,
  +#              authorized or persistent (see below for more details)
   # <id>         is the name of the tool in the context
   #
   # For example:
  @@ -108,6 +109,7 @@
   # as $link and the TemplatePageAttributes as $page.
   #
   # Scopes:
  +#
   #   global:    tool is instantiated once and that instance is available
   #              to all templates for all requests. Tool must be threadsafe.
   #
  @@ -119,11 +121,15 @@
   #               stored in the user's temporary hashtable. Tool should be 
   #               threadsafe.
   #
  -#   persistent: tool is instantitated once for each use session, and
  -#               is stored in the user's permanent hashtable. This means
  -#               for a logged in user the tool will be persisted in the
  -#               user's objectdata. Tool should be threadsafe and 
  -#               Serializable.
  +# authorized: tool is instantiated once for each user session once the
  +#             user logs in. After this, it is a normal session tool.
  +#
  +# persistent: tool is instantitated once for each user session once
  +#             the user logs in and is is stored in the user's permanent 
  +#             hashtable. 
  +#             This means for a logged in user the tool will be persisted
  +#             in the user's objectdata. Tool should be threadsafe and
  +#             Serializable.
   #
   # Defaults: none
   
  @@ -162,11 +168,11 @@
   The next step is to decide what scope you need to give the tool.
   If the tool is retrieving global data in a threadsafe manner, you
   can make the tool global. If the tool holds data specific to the
  -user look at the session and persistent scopes (choose persistent
  -for a convenient way of having the tools fields persisted across
  -sessions for logged in users). If the tool needs to be instantiated
  -on each request to fulfill its function, or is not threadsafe, then
  -the request scope will be appropriate.
  +user look at the session, authorized  and persistent scopes 
  +(choose persistent for a convenient way of having the tools fields 
  +persisted across sessions for logged in users). If the tool needs to 
  +be instantiated on each request to fulfill its function, or is not
  +threadsafe, then the request scope will be appropriate.
   </p>
   
   <p>
  @@ -178,6 +184,14 @@
   For global tools the argument will be null; for session and persistent 
   scope tools, 'data' will be the current User object; and for request
   scope tools 'data' will be the current RunData instance.
  +</p>
  +
  +<p>
  +If you activate the RefreshToolsPerRequest property, every tool is
  +refreshed on each request. On Request Tools this makes no difference,
  +because here, the refresh() is never called (they're instantiated on
  +every request).  All other scopes get a call to refresh() on every
  +request.
   </p>
   
   <p>
  
  
  
  1.36      +9 -5      jakarta-turbine-2/conf/TurbineResources.properties
  
  Index: TurbineResources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-2/conf/TurbineResources.properties,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- TurbineResources.properties       12 Mar 2003 22:51:12 -0000      1.35
  +++ TurbineResources.properties       12 Mar 2003 22:57:56 -0000      1.36
  @@ -441,10 +441,14 @@
   #               stored in the user's temporary hashtable. Tool should be
   #               threadsafe.
   #
  -#   persistent: tool is instantitated once for each use session, and
  -#               is stored in the user's permanent hashtable. This means
  -#               for a logged in user the tool will be persisted in the
  -#               user's objectdata. Tool should be threadsafe and
  +#   authorized: tool is instantiated once for each user session once the
  +#               user logs in. After this, it is a normal session tool.
  +# 
  +#   persistent: tool is instantitated once for each user session once
  +#               the user logs in and is is stored in the user's permanent 
  +#               hashtable. 
  +#               This means for a logged in user the tool will be persisted
  +#               in the user's objectdata. Tool should be threadsafe and
   #               Serializable.
   #
   # Defaults: none
  
  
  
  1.35      +9 -5      jakarta-turbine-2/conf/master/TurbineResources.master
  
  Index: TurbineResources.master
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-2/conf/master/TurbineResources.master,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- TurbineResources.master   12 Mar 2003 22:51:32 -0000      1.34
  +++ TurbineResources.master   12 Mar 2003 22:57:56 -0000      1.35
  @@ -441,10 +441,14 @@
   #               stored in the user's temporary hashtable. Tool should be
   #               threadsafe.
   #
  -#   persistent: tool is instantitated once for each use session, and
  -#               is stored in the user's permanent hashtable. This means
  -#               for a logged in user the tool will be persisted in the
  -#               user's objectdata. Tool should be threadsafe and
  +#   authorized: tool is instantiated once for each user session once the
  +#               user logs in. After this, it is a normal session tool.
  +# 
  +#   persistent: tool is instantitated once for each user session once
  +#               the user logs in and is is stored in the user's permanent 
  +#               hashtable. 
  +#               This means for a logged in user the tool will be persisted
  +#               in the user's objectdata. Tool should be threadsafe and
   #               Serializable.
   #
   # Defaults: none
  
  
  
  1.6       +6 -3      
jakarta-turbine-2/src/java/org/apache/turbine/services/pull/PullService.java
  
  Index: PullService.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/pull/PullService.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PullService.java  12 Mar 2003 22:44:57 -0000      1.5
  +++ PullService.java  12 Mar 2003 22:57:56 -0000      1.6
  @@ -68,7 +68,7 @@
    * the TR.props file.
    *
    * These tools can have global scope, request scope,
  - * session scope (i.e. stored in user temp hashmap)
  + * authorized or session scope (i.e. stored in user temp hashmap)
    * or persistent scope (i.e. stored in user perm hashmap)
    *
    * The standard way of referencing these global
  @@ -105,6 +105,9 @@
       /** Property Key for the session tools */
       String SESSION_TOOL = "tool.session";
   
  +    /** Property Key for the authorized tools */
  +    String AUTHORIZED_TOOL = "tool.authorized";
  +
       /** Property Key for the persistent tools */
       String PERSISTENT_TOOL = "tool.persistent";
   
  @@ -131,7 +134,7 @@
       Context getGlobalContext();
   
       /**
  -     * Populate the given context with all request, session
  +     * Populate the given context with all request, session, authorized
        * and persistent scope tools (it is assumed that the context
        * already wraps the global context, and thus already contains
        * the global tools).
  
  
  
  1.15      +20 -9     
jakarta-turbine-2/src/java/org/apache/turbine/services/pull/TurbinePullService.java
  
  Index: TurbinePullService.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/pull/TurbinePullService.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- TurbinePullService.java   12 Mar 2003 22:44:57 -0000      1.14
  +++ TurbinePullService.java   12 Mar 2003 22:57:56 -0000      1.15
  @@ -89,7 +89,7 @@
    * tool.<scope>.<id> = <classname>
    *
    * <scope>      is the tool scope: global, request, session
  - *             or persistent (see below for more details)
  + *              authorized or persistent (see below for more details)
    * <id>         is the name of the tool in the context
    *
    * You can configure the tools in this way:
  @@ -133,10 +133,14 @@
    *              stored in the user's temporary hashtable. Tool should be
    *              threadsafe.
    *
  - *  persistent: tool is instantitated once for each use session, and
  - *              is stored in the user's permanent hashtable. This means
  - *              for a logged in user the tool will be persisted in the
  - *              user's objectdata. Tool should be threadsafe and
  + *  authorized: tool is instantiated once for each user session once the
  + *              user logs in. After this, it is a normal session tool.
  + *
  + *  persistent: tool is instantitated once for each user session once
  + *              the user logs in and is is stored in the user's permanent 
  + *              hashtable. 
  + *              This means for a logged in user the tool will be persisted
  + *              in the user's objectdata. Tool should be threadsafe and
    *              Serializable.
    *
    * Defaults: none
  @@ -195,6 +199,9 @@
       /** Internal list of session tools */
       private List sessionTools;
   
  +    /** Internal list of authorized tools */
  +    private List authorizedTools;
  +
       /** Internal list of persistent tools */
       private List persistentTools;
   
  @@ -283,8 +290,9 @@
           Configuration conf = Turbine.getConfiguration();
   
           // Grab each list of tools that are to be used (for global scope,
  -        // request scope, session scope and persistent scope tools).
  -        // They are specified respectively in the TR.props like this:
  +        // request scope, authorized scope, session scope and persistent 
  +        // scope tools). They are specified respectively in the TR.props 
  +        // like this:
           //
           // tool.global.ui = org.apache.turbine.util.pull.UIManager
           // tool.global.mm = org.apache.turbine.util.pull.MessageManager
  @@ -301,6 +309,8 @@
           requestTools    = getTools(conf.subset(REQUEST_TOOL));
           log.debug("Session Tools:");
           sessionTools    = getTools(conf.subset(SESSION_TOOL));
  +        log.debug("Authorized Tools:");
  +        authorizedTools = getTools(conf.subset(AUTHORIZED_TOOL));
           log.debug("Persistent Tools:");
           persistentTools = getTools(conf.subset(PERSISTENT_TOOL));
   
  @@ -363,7 +373,7 @@
       }
   
       /**
  -     * Populate the given context with all request, session
  +     * Populate the given context with all request, session, authorized
        * and persistent scope tools (it is assumed that the context
        * already wraps the global context, and thus already contains
        * the global tools).
  @@ -392,6 +402,7 @@
   
               if (user.hasLoggedIn())
               {
  +                populateWithSessionTools(authorizedTools, context, data, user, 
false);
                   populateWithSessionTools(persistentTools, context, data, user, 
true);
               }
           }
  
  
  

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

Reply via email to