org.apache.jetspeed.profiler
Interface Profiler


public interface Profiler

ProfilerService Jetspeed-2 Profiler service. Locates portal resources given a set of request parameters, properties, and attributes The Profiler is invoked during the request processing pipeline. It requires that the request context is already populated with the portal request and response, and capability and user information. The request context parameters, properties and attributes make up the profile criterion which the profiler uses to locate portal resources: 1. page 2. navigations 3. document lists In all cases, a fallback algorithm should be applied to fallback to default portal resources.

Version:
$Id: Profiler.java 216120 2005-07-13 06:40:27Z rwatler $
Author:
David Sean Taylor

Method Summary
 ProfileLocator createLocator(RequestContext context)
          Creates a new ProfileLocator object that can be managed by the current Profiler implementation
 void deletePrincipalRule(PrincipalRule rule)
           
 void deleteProfilingRule(ProfilingRule rule)
           
 ProfileLocator getDefaultProfile(RequestContext context, String locatorName)
           getDefaultProfile
 Map getDefaultProfileLocators(RequestContext context)
           getDefaultProfileLocators
 ProfilingRule getDefaultRule()
          Lookup the portal's default profiling rule.
 String[] getLocatorNamesForPrincipal(Principal principal)
          For a given principal, find all supported locators and return a string array of locator names.
 ProfileLocator getProfile(RequestContext context, ProfilingRule rule)
          Get the Profile object using the request parameters and the rule.
 ProfileLocator getProfile(RequestContext context, String locatorName)
          Get the Profile object using the request parameters.
 Map getProfileLocators(RequestContext context, Principal principal)
          Gets all supported locators for a principal.
 ProfilingRule getRule(String id)
          Given a rule id, get the rule
 ProfilingRule getRuleForPrincipal(Principal principal, String locatorName)
          For a given principal, lookup the associated profiling rule to that principal name.
 Collection getRules()
           
 Collection getRulesForPrincipal(Principal principal)
          For a given principal, find all supported locators and return a collection of principal rules.
 void setRuleForPrincipal(Principal principal, ProfilingRule rule, String locatorName)
          For a given principal, associate a profiling rule to that principal name.
 void storePrincipalRule(PrincipalRule rule)
           
 void storeProfilingRule(ProfilingRule rule)
           
 

Method Detail

getProfile

public ProfileLocator getProfile(RequestContext context,
                                 String locatorName)
                          throws ProfilerException
Get the Profile object using the request parameters.

Parameters:
context - The request context
locatorName - The name of the profile locator to find i.e. "page", "docset", ...
Returns:
a new Profile Locator object or null if failed to find a appropriate locator.
Throws:
ProfilerException

getDefaultProfile

public ProfileLocator getDefaultProfile(RequestContext context,
                                        String locatorName)
                                 throws ProfilerException

getDefaultProfile

Intstead of using the princpal found within the request, the DEFAULT_RULE_PRINCIPAL is used.

Parameters:
context - The request context
locatorName - The name of the profile locator to find i.e. "page", "docset", ...
Returns:
a new Profile Locator object or null if failed to find a appropriate locator.
Throws:
ProfilerException

getProfile

public ProfileLocator getProfile(RequestContext context,
                                 ProfilingRule rule)
                          throws ProfilerException
Get the Profile object using the request parameters and the rule.

Parameters:
context - The request context
Returns:
a new Profile Locator object or null if failed to find a appropriate locator.
Throws:
ProfilerException

createLocator

public ProfileLocator createLocator(RequestContext context)
Creates a new ProfileLocator object that can be managed by the current Profiler implementation

Parameters:
context - The request context
Returns:
A new ProfileLocator object

getRuleForPrincipal

public ProfilingRule getRuleForPrincipal(Principal principal,
                                         String locatorName)
For a given principal, lookup the associated profiling rule to that principal name.

Parameters:
principal - Lookup the profiling rule based on this principal.
locatorName - the unique name of a locator for this principal/rule/locator
Returns:
The rule found or null if not found

setRuleForPrincipal

public void setRuleForPrincipal(Principal principal,
                                ProfilingRule rule,
                                String locatorName)
For a given principal, associate a profiling rule to that principal name. TODO: this API should be secured and require admin role

Parameters:
principal - Lookup the profiling rule based on this principal.
locatorName - the unique name of a locator for this principal/rule/locator

getDefaultRule

public ProfilingRule getDefaultRule()
Lookup the portal's default profiling rule.

Returns:
The portal's default profiling rule.

getRules

public Collection getRules()
Returns:

getRule

public ProfilingRule getRule(String id)
Given a rule id, get the rule

Parameters:
id -
Returns:
the rule

getLocatorNamesForPrincipal

public String[] getLocatorNamesForPrincipal(Principal principal)
For a given principal, find all supported locators and return a string array of locator names.

Parameters:
principal - The given principal.
Returns:
array of String locator names

getRulesForPrincipal

public Collection getRulesForPrincipal(Principal principal)
For a given principal, find all supported locators and return a collection of principal rules.

Parameters:
principal - The given principal.
Returns:
collection of PrincipalRules

getProfileLocators

public Map getProfileLocators(RequestContext context,
                              Principal principal)
                       throws ProfilerException
Gets all supported locators for a principal.

Parameters:
context -
principal -
Returns:
Throws:
ProfilerException

getDefaultProfileLocators

public Map getDefaultProfileLocators(RequestContext context)
                              throws ProfilerException

getDefaultProfileLocators

Gets all the supported locators for the DEFAULT_RULE_PRINCIPAL

Parameters:
context -
Returns:
Throws:
ProfilerException

storeProfilingRule

public void storeProfilingRule(ProfilingRule rule)
                        throws ProfilerException
Throws:
ProfilerException

deleteProfilingRule

public void deleteProfilingRule(ProfilingRule rule)
                         throws ProfilerException
Throws:
ProfilerException

storePrincipalRule

public void storePrincipalRule(PrincipalRule rule)
                        throws ProfilerException
Throws:
ProfilerException

deletePrincipalRule

public void deletePrincipalRule(PrincipalRule rule)
                         throws ProfilerException
Throws:
ProfilerException


Copyright © 1999-2005 Apache Software Foundation. All Rights Reserved.