org.apache.jetspeed.profiler.impl
Class JetspeedProfilerImpl

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.ojb.support.PersistenceBrokerDaoSupport
          extended by org.apache.jetspeed.components.dao.InitablePersistenceBrokerDaoSupport
              extended by org.apache.jetspeed.profiler.impl.JetspeedProfilerImpl
All Implemented Interfaces:
Profiler, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.InitializingBean

public class JetspeedProfilerImpl
extends InitablePersistenceBrokerDaoSupport
implements Profiler, org.springframework.beans.factory.BeanFactoryAware

JetspeedTransactionalProfiler

Version:
$Id: JetspeedProfilerImpl.java 553647 2007-07-05 21:42:04Z taylor $
Author:
David Sean Taylor

Field Summary
static java.lang.String DEFAULT_RULE
          The default rule.
static java.security.Principal DEFAULT_RULE_PRINCIPAL
          This is the princapl that is used if there are no principal to rule associations for the current principal
protected static org.apache.commons.logging.Log log
          Commons logging
 
Fields inherited from class org.apache.jetspeed.components.dao.InitablePersistenceBrokerDaoSupport
repositoryPath
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
JetspeedProfilerImpl(java.lang.String repositoryPath, ProfileResolvers resolvers)
           
JetspeedProfilerImpl(java.lang.String repositoryPath, java.lang.String defaultRule, ProfileResolvers resolvers)
          Create a JetspeedProfiler with properties.
JetspeedProfilerImpl(java.lang.String repositoryPath, java.lang.String defaultRule, ProfileResolvers resolvers, java.util.Map ruleConstructors, java.lang.String ruleCriterionBean)
          support passing of rule creation classes
JetspeedProfilerImpl(java.lang.String repositoryPath, java.lang.String defaultRule, java.util.Properties properties, ProfileResolvers resolvers)
          Deprecated. As of release 2.1, property-based class references replaced by container managed bean factory
 
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, java.lang.String locatorName)
           getDefaultProfile
 java.util.Map getDefaultProfileLocators(RequestContext context)
           getDefaultProfileLocators
 ProfilingRule getDefaultRule()
          Lookup the portal's default profiling rule.
 java.lang.String[] getLocatorNamesForPrincipal(java.security.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, java.lang.String locatorName)
          Get the Profile object using the request parameters.
 java.util.Map getProfileLocators(RequestContext context, java.security.Principal principal)
          Gets all supported locators for a principal.
 ProfilingRule getRule(java.lang.String id)
          Given a rule id, get the rule
 ProfilingRule getRuleForPrincipal(java.security.Principal principal, java.lang.String locatorName)
          For a given principal, lookup the associated profiling rule to that principal name.
 java.util.Collection getRules()
           
 java.util.Collection getRulesForPrincipal(java.security.Principal principal)
          For a given principal, find all supported locators and return a collection of principal rules.
 void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
           
 void setDefaultRule(java.lang.String defaultRule)
          Resets the default rule for this portal
 void setRuleForPrincipal(java.security.Principal principal, ProfilingRule rule, java.lang.String locatorName)
          For a given principal, associate a profiling rule to that principal name.
 void storePrincipalRule(PrincipalRule rule)
           
 void storeProfilingRule(ProfilingRule rule)
           
 
Methods inherited from class org.apache.jetspeed.components.dao.InitablePersistenceBrokerDaoSupport
init
 
Methods inherited from class org.springframework.orm.ojb.support.PersistenceBrokerDaoSupport
checkDaoConfig, closePersistenceBrokerIfNecessary, convertOjbAccessException, createPersistenceBrokerTemplate, getJcdAlias, getPersistenceBroker, getPersistenceBrokerTemplate, releasePersistenceBroker, setJcdAlias, setPersistenceBrokerTemplate
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_RULE

public static final java.lang.String DEFAULT_RULE
The default rule.

See Also:
Constant Field Values

log

protected static final org.apache.commons.logging.Log log
Commons logging


DEFAULT_RULE_PRINCIPAL

public static final java.security.Principal DEFAULT_RULE_PRINCIPAL
This is the princapl that is used if there are no principal to rule associations for the current principal

Constructor Detail

JetspeedProfilerImpl

public JetspeedProfilerImpl(java.lang.String repositoryPath,
                            ProfileResolvers resolvers)

JetspeedProfilerImpl

public JetspeedProfilerImpl(java.lang.String repositoryPath,
                            java.lang.String defaultRule,
                            ProfileResolvers resolvers)
                     throws java.lang.ClassNotFoundException
Create a JetspeedProfiler with properties. Expected properties are: defaultRule = the default profiling rule anonymousUser = the name of the anonymous user storeName = The name of the persistence store component to connect to services.profiler.locator.impl = the pluggable Profile Locator impl services.profiler.principalRule.impl = the pluggable Principal Rule impl services.profiler.profilingRule.impl = the pluggable Profiling Rule impl

Parameters:
properties - Properties for this component described above
Throws:
java.lang.ClassNotFoundException - if any the implementation classes defined within the properties argument could not be found.

JetspeedProfilerImpl

public JetspeedProfilerImpl(java.lang.String repositoryPath,
                            java.lang.String defaultRule,
                            java.util.Properties properties,
                            ProfileResolvers resolvers)
                     throws java.lang.ClassNotFoundException
Deprecated. As of release 2.1, property-based class references replaced by container managed bean factory

Throws:
java.lang.ClassNotFoundException

JetspeedProfilerImpl

public JetspeedProfilerImpl(java.lang.String repositoryPath,
                            java.lang.String defaultRule,
                            ProfileResolvers resolvers,
                            java.util.Map ruleConstructors,
                            java.lang.String ruleCriterionBean)
                     throws java.lang.ClassNotFoundException
support passing of rule creation classes

Throws:
java.lang.ClassNotFoundException
Method Detail

setDefaultRule

public void setDefaultRule(java.lang.String defaultRule)
Description copied from interface: Profiler
Resets the default rule for this portal

Specified by:
setDefaultRule in interface Profiler
Parameters:
defaultRule - The default rule to set.

getProfile

public ProfileLocator getProfile(RequestContext context,
                                 java.lang.String locatorName)
                          throws ProfilerException
Description copied from interface: Profiler
Get the Profile object using the request parameters.

Specified by:
getProfile in interface Profiler
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,
                                        java.lang.String locatorName)
                                 throws ProfilerException
Description copied from interface: Profiler

getDefaultProfile

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

Specified by:
getDefaultProfile in interface Profiler
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
Description copied from interface: Profiler
Get the Profile object using the request parameters and the rule.

Specified by:
getProfile in interface Profiler
Parameters:
context - The request context
Returns:
a new Profile Locator object or null if failed to find a appropriate locator.
Throws:
ProfilerException

getRuleForPrincipal

public ProfilingRule getRuleForPrincipal(java.security.Principal principal,
                                         java.lang.String locatorName)
Description copied from interface: Profiler
For a given principal, lookup the associated profiling rule to that principal name.

Specified by:
getRuleForPrincipal in interface Profiler
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(java.security.Principal principal,
                                ProfilingRule rule,
                                java.lang.String locatorName)
Description copied from interface: Profiler
For a given principal, associate a profiling rule to that principal name. TODO: this API should be secured and require admin role

Specified by:
setRuleForPrincipal in interface Profiler
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()
Description copied from interface: Profiler
Lookup the portal's default profiling rule.

Specified by:
getDefaultRule in interface Profiler
Returns:
The portal's default profiling rule.

getRules

public java.util.Collection getRules()
Specified by:
getRules in interface Profiler
Returns:

getRule

public ProfilingRule getRule(java.lang.String id)
Description copied from interface: Profiler
Given a rule id, get the rule

Specified by:
getRule in interface Profiler
Returns:
the rule

getLocatorNamesForPrincipal

public java.lang.String[] getLocatorNamesForPrincipal(java.security.Principal principal)
Description copied from interface: Profiler
For a given principal, find all supported locators and return a string array of locator names.

Specified by:
getLocatorNamesForPrincipal in interface Profiler
Parameters:
principal - The given principal.
Returns:
array of String locator names

getRulesForPrincipal

public java.util.Collection getRulesForPrincipal(java.security.Principal principal)
Description copied from interface: Profiler
For a given principal, find all supported locators and return a collection of principal rules.

Specified by:
getRulesForPrincipal in interface Profiler
Parameters:
principal - The given principal.
Returns:
collection of PrincipalRules

getProfileLocators

public java.util.Map getProfileLocators(RequestContext context,
                                        java.security.Principal principal)
                                 throws ProfilerException
Description copied from interface: Profiler
Gets all supported locators for a principal.

Specified by:
getProfileLocators in interface Profiler
Returns:
Throws:
ProfilerException

getDefaultProfileLocators

public java.util.Map getDefaultProfileLocators(RequestContext context)
                                        throws ProfilerException
Description copied from interface: Profiler

getDefaultProfileLocators

Gets all the supported locators for the DEFAULT_RULE_PRINCIPAL

Specified by:
getDefaultProfileLocators in interface Profiler
Returns:
Throws:
ProfilerException

storeProfilingRule

public void storeProfilingRule(ProfilingRule rule)
                        throws ProfilerException
Specified by:
storeProfilingRule in interface Profiler
Throws:
ProfilerException

deleteProfilingRule

public void deleteProfilingRule(ProfilingRule rule)
                         throws ProfilerException
Specified by:
deleteProfilingRule in interface Profiler
Throws:
ProfilerException

storePrincipalRule

public void storePrincipalRule(PrincipalRule rule)
                        throws ProfilerException
Specified by:
storePrincipalRule in interface Profiler
Throws:
ProfilerException

deletePrincipalRule

public void deletePrincipalRule(PrincipalRule rule)
                         throws ProfilerException
Specified by:
deletePrincipalRule in interface Profiler
Throws:
ProfilerException

setBeanFactory

public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
                    throws org.springframework.beans.BeansException
Specified by:
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
Throws:
org.springframework.beans.BeansException

createProfilingRule

public ProfilingRule createProfilingRule(boolean standard)
                                  throws java.lang.ClassNotFoundException
Description copied from interface: Profiler
Factory for Profiling Rule. The boolean argument specifies whether to obtain a new instance of a standard profiling rule or of a fallback rule.

Specified by:
createProfilingRule in interface Profiler
Parameters:
standard - true if standard rule is requested, false if fallback
Returns:
New instance of a (standard or fallback) Profiling Rule
Throws:
java.lang.ClassNotFoundException - if the beanfactory couldn't instantiate the bean

createLocator

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

Specified by:
createLocator in interface Profiler
Parameters:
context - The request context
Returns:
A new ProfileLocator object

createPrincipalRule

public PrincipalRule createPrincipalRule()
                                  throws java.lang.ClassNotFoundException
Description copied from interface: Profiler
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.

Specified by:
createPrincipalRule in interface Profiler
Returns:
New instance of a principal rule
Throws:
java.lang.ClassNotFoundException - if the beanfactory couldn't instantiate the bean

createRuleCriterion

public RuleCriterion createRuleCriterion()
                                  throws java.lang.ClassNotFoundException
Description copied from interface: Profiler
Factory for Rule Criterion

Specified by:
createRuleCriterion in interface Profiler
Returns:
New instance of a rule criterion
Throws:
java.lang.ClassNotFoundException - if the beanfactory couldn't instantiate the bean


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