weaver      2004/11/03 08:01:50

  Modified:    portal/src/java/org/apache/jetspeed/profiler/impl
                        ProfilerValveImpl.java
               jetspeed-api/src/java/org/apache/jetspeed/profiler
                        Profiler.java
  Log:
  Added support for allowing default ("*") to be associated with principals that do 
not have any profiler rules specifically assocaited with them.
  
  Revision  Changes    Path
  1.19      +11 -4     
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/profiler/impl/ProfilerValveImpl.java
  
  Index: ProfilerValveImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/profiler/impl/ProfilerValveImpl.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- ProfilerValveImpl.java    21 Oct 2004 18:41:46 -0000      1.18
  +++ ProfilerValveImpl.java    3 Nov 2004 16:01:50 -0000       1.19
  @@ -17,7 +17,6 @@
   
   import java.io.IOException;
   import java.security.Principal;
  -import java.util.HashMap;
   import java.util.Map;
   
   import javax.security.auth.Subject;
  @@ -47,19 +46,21 @@
    */
   public class ProfilerValveImpl extends AbstractValve implements PageProfilerValve
   {
  -    protected Log log = LogFactory.getLog(ProfilerValveImpl.class);
  +    protected Log log = LogFactory.getLog(ProfilerValveImpl.class);   
   
       public static final String PROFILED_PAGE_CONTEXT_ATTR_KEY = 
"org.apache.jetspeed.profiledPageContext";
   
       private Profiler profiler;
       private PageManager pageManager;
  +   
   
       public ProfilerValveImpl( Profiler profiler, PageManager pageManager )
       {
           this.profiler = profiler;
           this.pageManager = pageManager;
       }
  -
  +    
  + 
       /*
        * (non-Javadoc)
        * 
  @@ -84,6 +85,12 @@
   
               // get all locators for the current user
               Map locators = profiler.getProfileLocators(request, principal);
  +            
  +            if (locators.size() == 0)
  +            {
  +                locators = profiler.getDefaultProfileLocators(request);             
   
  +            }
  +            
               if (locators.size() == 0)
               {
                   locators.put(ProfileLocator.PAGE_LOCATOR, 
profiler.getProfile(request, ProfileLocator.PAGE_LOCATOR));
  
  
  
  1.15      +28 -1     
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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Profiler.java     21 Oct 2004 18:40:31 -0000      1.14
  +++ Profiler.java     3 Nov 2004 16:01:50 -0000       1.15
  @@ -43,6 +43,8 @@
    */
   public interface Profiler
   {
  +    
  +    
       /**
        *  Get the Profile object using the request parameters.
        *
  @@ -51,6 +53,19 @@
        * @return a new Profile Locator object or null if failed to find a appropriate 
locator.
        */
       ProfileLocator getProfile(RequestContext context, String locatorName) throws 
ProfilerException;
  +    
  +    /**
  +     * 
  +     * <p>
  +     * getDefaultProfile
  +     * </p>
  +     * Intstead of using the princpal found within the request, the 
DEFAULT_RULE_PRINCIPAL is used.
  +     *
  +     * @param context The request context
  +     * @param locatorName The name of the profile locator to find i.e. "page", 
"docset", ...
  +     * @return a new Profile Locator object or null if failed to find a appropriate 
locator.
  +     */
  +    ProfileLocator getDefaultProfile(RequestContext context, String locatorName) 
throws ProfilerException;
   
       /**
        *  Get the Profile object using the request parameters and the rule.
  @@ -151,6 +166,18 @@
        */
       Map getProfileLocators(RequestContext context, Principal principal)
       throws ProfilerException;
  +    
  +    /**
  +     * 
  +     * <p>
  +     * getDefaultProfileLocators
  +     * </p>
  +     * Gets all the supported locators for the DEFAULT_RULE_PRINCIPAL
  +     * @param context
  +     * @return
  +     * @throws ProfilerException
  +     */
  +    Map getDefaultProfileLocators( RequestContext context) throws ProfilerException;
       
       /*
        * Persist a profiling rule to the persistent store.
  
  
  

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

Reply via email to