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 516881 2007-03-11 10:34:21Z ate $
Author:
David Sean Taylor

Method Summary
 ProfileLocator createLocator(RequestContext context)
          Creates a new ProfileLocator object that can be managed by the current Profiler implementation
 PrincipalRule createPrincipalRule()
          Factory for PrincipalRule, the container to connect profiling rule and (user) prinicpal
 ProfilingRule createProfilingRule(boolean standard)
          Factory for Profiling Rule.
 RuleCriterion createRuleCriterion()
          Factory for Rule Criterion
 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 setDefaultRule(String defaultRule)
          Resets the default rule for this portal
 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

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

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

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

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

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

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
The - rule used to find profiles for this user

getDefaultRule

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

Returns:
The portal's default profiling rule.

getRules

Collection getRules()
Returns:

getRule

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

Parameters:
id -
Returns:
the rule

getLocatorNamesForPrincipal

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

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

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

Parameters:
context -
principal -
Returns:
Throws:
ProfilerException

getDefaultProfileLocators

Map getDefaultProfileLocators(RequestContext context)
                              throws ProfilerException

getDefaultProfileLocators

Gets all the supported locators for the DEFAULT_RULE_PRINCIPAL

Parameters:
context -
Returns:
Throws:
ProfilerException

storeProfilingRule

void storeProfilingRule(ProfilingRule rule)
                        throws ProfilerException
Throws:
ProfilerException

deleteProfilingRule

void deleteProfilingRule(ProfilingRule rule)
                         throws ProfilerException
Throws:
ProfilerException

storePrincipalRule

void storePrincipalRule(PrincipalRule rule)
                        throws ProfilerException
Throws:
ProfilerException

deletePrincipalRule

void deletePrincipalRule(PrincipalRule rule)
                         throws ProfilerException
Throws:
ProfilerException

createProfilingRule

ProfilingRule createProfilingRule(boolean standard)
                                  throws ClassNotFoundException
Factory for Profiling Rule. The boolean argument specifies whether to obtain a new instance of a standard profiling rule or of a fallback rule.

Parameters:
standard - true if standard rule is requested, false if fallback
Returns:
New instance of a (standard or fallback) Profiling Rule
Throws:
ClassNotFoundException - if the beanfactory couldn't instantiate the bean

createPrincipalRule

PrincipalRule createPrincipalRule()
                                  throws ClassNotFoundException
Factory for PrincipalRule, the container to connect profiling rule and (user) prinicpal

Replaces the previous Class.forName and .instantiate logic with the Spring based factory.

Returns:
New instance of a principal rule
Throws:
ClassNotFoundException - if the beanfactory couldn't instantiate the bean

createRuleCriterion

RuleCriterion createRuleCriterion()
                                  throws ClassNotFoundException
Factory for Rule Criterion

Returns:
New instance of a rule criterion
Throws:
ClassNotFoundException - if the beanfactory couldn't instantiate the bean

setDefaultRule

void setDefaultRule(String defaultRule)
Resets the default rule for this portal

Parameters:
defaultRule - The default rule to set.


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