taylor      2004/09/17 13:06:53

  Modified:    jetspeed-api/src/java/org/apache/jetspeed/profiler
                        ProfileLocator.java ProfileLocatorProperty.java
                        Profiler.java
               jetspeed-api/src/java/org/apache/jetspeed/profiler/rules
                        RuleCriterionResolver.java
               jetspeed-api/src/java/org/apache/jetspeed/page
                        PageManager.java
  Added:       jetspeed-api/src/java/org/apache/jetspeed/profiler
                        ProfiledPageContext.java
  Log:
  decoupled profiler from page manager
  created new profiler module
  implementation by Randy Watler
  
  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.2       +57 -3     
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/profiler/ProfileLocator.java
  
  Index: ProfileLocator.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/profiler/ProfileLocator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ProfileLocator.java       28 May 2004 18:51:55 -0000      1.1
  +++ ProfileLocator.java       17 Sep 2004 20:06:53 -0000      1.2
  @@ -17,6 +17,7 @@
   
   import java.util.Iterator;
   
  +import org.apache.jetspeed.profiler.ProfileLocatorProperty;
   import org.apache.jetspeed.profiler.rules.RuleCriterion;
   
   /**
  @@ -42,8 +43,16 @@
       public final static String PATH_SEPARATOR = ":";
           
       /**
  +     * Initialize this page context.
  +     *
  +     * @param profiler The profiler initializing this locator.
  +     * @param requestPath The request path used to create this locator.
  +     */
  +    void init(Profiler profiler, String requestPath);
  +
  +    /**
        * Get an iterator over the locator's properties.
  -     * Elements are returned as @link ProfileLocatorProperty 
  +     * Elements are returned as @link ProfileLocatorProperty array. 
        *  
        * @return an iterator over the profile locator properties
        */
  @@ -55,14 +64,25 @@
        * The value is combined with the rule to create a property.
        * 
        * @param criterion The rule criterion on which this property is based.
  +     * @param isControl The control classification for property.
        * @param value The value to set on the property.
        */        
  -    void add(RuleCriterion criterion, String value);
  +    void add(RuleCriterion criterion, boolean isControl, String value);
   
       /**
        * Add a property based on a simple name and value.
        * 
        * @param name The name of the property.
  +     * @param isControl The control classification for property.
  +     * @param value The value to set on the property.
  +     */            
  +    void add(String name, boolean isControl, String value);
  +    
  +    /**
  +     * Add a property based on a simple name and value assumed
  +     * to be control property.
  +     * 
  +     * @param name The name of the property.
        * @param value The value to set on the property.
        */            
       void add(String name, String value);
  @@ -76,8 +96,17 @@
       String getValue(String name);
       
       /**
  +     * For a given property name, return control status of property.
  +     *  
  +     * @param name The name of the property
  +     * @return control classification flag
  +     */
  +    boolean isControl(String name);
  +    
  +    /**
        * <p>Profiles can be created from a normalized <i>Profile Locator Path</i>
        * The format of the path is name:value pairs of all property, separated by a 
<i>path separator</i>.
  +     * Note: all locator property elements are assumed to be control properties.
        * An example locator path:</p>
        * 
        *      
<pre>:desktop:default-desktop.psml:page:default.psml:artist:air:song:all-i-need</pre>
  @@ -98,10 +127,35 @@
       String getLocatorPath();
           
       /**
  +     * <p>Normalize profile properties obtained from profile locator iterators
  +     * into a <i>Profile Locator Path</i>.</p>
  +     * 
  +     * @param properties The array of profile properties.
  +     * @return The normalized path for properties.
  +     */
  +    String getLocatorPath(ProfileLocatorProperty [] properties);
  +        
  +    /**
        * Returns a normalized path. @see #getLocatorPath()
        * 
        * @return The normalized path representation of this locator.
        */
       String toString();
       
  +    /**
  +     * <p>Locators are intended to be sufficient to locate managed pages, so the 
request
  +     * path must be generally available in the event it is not otherwise captured 
in a
  +     * rule criterion.</p>
  +     * 
  +     * @return The request path.
  +     */
  +    String getRequestPath();
  +
  +    /**
  +      * Creates a new ProfiledPageContext object that can be
  +      * managed by the current Profiler implementation
  +      *
  +      * @return A new ProfiledPageContext object
  +      */
  +    ProfiledPageContext createProfiledPageContext();
   }
  
  
  
  1.2       +7 -2      
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/profiler/ProfileLocatorProperty.java
  
  Index: ProfileLocatorProperty.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/profiler/ProfileLocatorProperty.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ProfileLocatorProperty.java       28 May 2004 18:51:55 -0000      1.1
  +++ ProfileLocatorProperty.java       17 Sep 2004 20:06:53 -0000      1.2
  @@ -68,5 +68,10 @@
       /**
        * @param string
        */
  -    public void setType(String type);    
  +    void setType(String type);    
  +
  +    /**
  +     * @return control classification flag
  +     */
  +    boolean isControl();
   }
  
  
  
  1.4       +15 -36    
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/profiler/Profiler.java
  
  Index: Profiler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/profiler/Profiler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Profiler.java     3 Sep 2004 13:24:05 -0000       1.3
  +++ Profiler.java     17 Sep 2004 20:06:53 -0000      1.4
  @@ -18,11 +18,6 @@
   import java.security.Principal;
   import java.util.Collection;
   
  -import org.apache.jetspeed.om.desktop.Desktop;
  -import org.apache.jetspeed.om.page.Fragment;
  -import org.apache.jetspeed.om.page.Page;
  -import org.apache.jetspeed.page.PageNotFoundException;
  -import org.apache.jetspeed.page.document.NodeException;
   import org.apache.jetspeed.profiler.rules.ProfilingRule;
   import org.apache.jetspeed.request.RequestContext;
   
  @@ -52,8 +47,7 @@
        * @param context The request context
        * @return a new Profile Locator object or null if failed to find a appropriate 
locator.
        */
  -    ProfileLocator getProfile(RequestContext context)
  -        throws ProfilerException;
  +    ProfileLocator getProfile(RequestContext context) throws ProfilerException;
   
       /**
        *  Get the Profile object using the request parameters and the rule.
  @@ -61,41 +55,26 @@
        * @param context The request context
        * @return a new Profile Locator object or null if failed to find a appropriate 
locator.
        */        
  -    ProfileLocator getProfile(RequestContext context, ProfilingRule rule)
  -        throws ProfilerException;        
  +    ProfileLocator getProfile(RequestContext context, ProfilingRule rule) throws 
ProfilerException;        
       
       /**
  -     * @param locator
  -     * @return
  -     */
  -    Desktop getDesktop(ProfileLocator locator);
  -    
  -    /**
  -     * 
  -     * <p>
  -     * getPage
  -     * </p>
  -     *
  -     * @param locator
  -     * @return
  -     * @throws PageNotFoundException
  -     * @throws NodeException
  -     */
  -    Page getPage(ProfileLocator locator) throws PageNotFoundException, 
NodeException;
  -    
  -    /**
  -     * @param locator
  -     * @return
  -     */
  -    Fragment getFragment(ProfileLocator locator);
  -      
  -    /**
         * Creates a new ProfileLocator object that can be managed by
         * the current Profiler implementation
         *
  +      * @param context The request context
         * @return A new ProfileLocator object
         */
  -    ProfileLocator createLocator();
  +    ProfileLocator createLocator(RequestContext context);
  +        
  +    /**
  +      * Creates a new ProfiledPageContext object that references
  +      * the specified locator and can be managed by the current
  +      * Profiler implementation
  +      *
  +      * @param locator ProfileLocator object used to select page
  +      * @return A new ProfiledPageContext object
  +      */
  +    ProfiledPageContext createProfiledPageContext(ProfileLocator locator);
           
       /**
        * For a given principal, lookup the associated profiling rule to that 
principal name.
  
  
  
  1.1                  
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/profiler/ProfiledPageContext.java
  
  Index: ProfiledPageContext.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.profiler;
  
  import org.apache.jetspeed.om.folder.Folder;
  import org.apache.jetspeed.om.page.Page;
  import org.apache.jetspeed.page.document.NodeSet;
  
  /**
   * <p>The ProfiledPageContext is used to capture the page and navigation
   * elements associated with a profiled page. This information is intended
   * to reflect the entire context of the displayed page.</p> 
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]">Randy Watler</a>
   * @version $Id: ProfiledPageContext.java,v 1.1 2004/09/17 20:06:53 taylor Exp $
   */
  public interface ProfiledPageContext
  {
      /**
       * Initialize this page context.
       *
       * @param profiler The profiler initializing this page context.
       * @param locator The profile locator used to create this page context.
       */
      void init(Profiler profiler, ProfileLocator locator);
  
      /**
       * Return ProfileLocator used to generate this page context.
       *  
       * @return The ProfileLocator instance.
       */
      ProfileLocator getLocator();
  
      /**
       * Return profiled Page.
       *  
       * @return The Page instance.
       */
      Page getPage();
  
      /**
       * Set profiled Page.
       *  
       * @param page The Page instance.
       */
      void setPage(Page page);
  
      /**
       * Return profiled page Folder used for navigation. This is the
       * folder relative to the profiled page. The returned value may
       * or may not be equivalent to getPage().getParent().
       *  
       * @return The Folder instance.
       */
      Folder getFolder();
  
      /**
       * Set profiled page Folder.
       *  
       * @param folder The Folder instance.
       */
      void setFolder(Folder folder);
  
      /**
       * Return profiled sibling Pages used for tab navigation. This is
       * the list of defined pages relative to the profiled page. The
       * returned value may or may not be equivalent to
       * getPage().getParent().getPages() or getFolder().getPages().
       *  
       * @return The sibling Page set.
       */
      NodeSet getSiblingPages();
  
      /**
       * Set profiled sibling Pages.
       *  
       * @param siblingPages The sibling Page set.
       */
      void setSiblingPages(NodeSet pages);
  
      /**
       * Return profiled parent Folder used for link navigation. This is
       * the parent folder of the folder relative to the profiled page.
       * The returned value may or may not be equivalent to
       * getPage().getFolder().getParent() or getFolder().getParent().
       *  
       * @return The parent Folder instance.
       */
      Folder getParentFolder();
  
      /**
       * Set profiled parent Folder.
       *  
       * @param folder The parent Folder instance.
       */
      void setParentFolder(Folder folder);
  
      /**
       * Return profiled sibling Folders used for link navigation. This is
       * the list of defined folders relative to the profiled page. The
       * returned value may or may not be equivalent to
       * getPage().getParent().getFolders() or getFolder().getFolders().
       *  
       * @return The sibling Folder set.
       */
      NodeSet getSiblingFolders();
  
      /**
       * Set profiled sibling Folders.
       *  
       * @param folders The sibling Folder set.
       */
      void setSiblingFolders(NodeSet folders);
  
      /**
       * Return profiled root Links used for menu navigation. This is the
       * list of defined links related to the profiled page. The returned
       * value may or may not be equivalent to the result of accessing 
       * getLinks() from getPage(), getFolder(), or getParentFolder().
       *  
       * @return The root Link set.
       */
      NodeSet getRootLinks();
  
      /**
       * Set profiled root Links.
       *  
       * @param links The root Link set.
       */
      void setRootLinks(NodeSet links);
  }
  
  
  
  1.2       +8 -1      
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/profiler/rules/RuleCriterionResolver.java
  
  Index: RuleCriterionResolver.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/profiler/rules/RuleCriterionResolver.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RuleCriterionResolver.java        28 May 2004 18:51:56 -0000      1.1
  +++ RuleCriterionResolver.java        17 Sep 2004 20:06:53 -0000      1.2
  @@ -78,4 +78,11 @@
        */        
       String resolve(RequestContext context, RuleCriterion criterion);
       
  +    /**
  +     * Gets the control classification of the resolver.
  +     * 
  +     * @return The control class flag
  +     */    
  +    boolean isControl();
  +    
   }
  
  
  
  1.7       +17 -2     
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/page/PageManager.java
  
  Index: PageManager.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/page/PageManager.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- PageManager.java  3 Sep 2004 13:24:05 -0000       1.6
  +++ PageManager.java  17 Sep 2004 20:06:53 -0000      1.7
  @@ -28,6 +28,7 @@
   import org.apache.jetspeed.page.document.DocumentNotFoundException;
   import org.apache.jetspeed.page.document.NodeException;
   import org.apache.jetspeed.page.document.UnsupportedDocumentTypeException;
  +import org.apache.jetspeed.profiler.ProfiledPageContext;
   import org.apache.jetspeed.profiler.ProfileLocator;
   
   /**
  @@ -98,11 +99,25 @@
       /**
        * 
        * <p>
  +     * getProfiledPageContext
  +     * </p>
  +     *
  +     * @param locator
  +     * @return profiled page context
  +     * @throws PageNotFoundException if the page cannot be found.
  +     * @throws DocumentException
  +     * @throws NodeException
  +     */
  +    public ProfiledPageContext getProfiledPageContext(ProfileLocator locator) 
throws PageNotFoundException, DocumentException, NodeException;
  +
  +    /**
  +     * 
  +     * <p>
        * getPage
        * </p>
        *
        * @param locator
  -     * @return
  +     * @return located Page instance
        * @throws PageNotFoundException if the page cannot be found.
        * @throws DocumentException
        * @throws NodeException
  
  
  

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

Reply via email to