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:
org.apache.jetspeed.profiler.Profiler, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.InitializingBean

public class JetspeedProfilerImpl
extends org.apache.jetspeed.components.dao.InitablePersistenceBrokerDaoSupport
implements org.apache.jetspeed.profiler.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
private  org.springframework.beans.factory.BeanFactory beanFactory
          added support for bean factory to create profile rules
static String DEFAULT_RULE
          The default rule.
static Principal DEFAULT_RULE_PRINCIPAL
          This is the princapl that is used if there are no principal to rule associations for the current principal
private  String defaultRule
          The configured default rule for this portal
private  String locatorBean
          The default locator class implementation
protected static org.apache.commons.logging.Log log
          Commons logging
private  String principalRuleBean
           
private  Map principalRules
           
private  Class profilingRuleClass
          The base (abstract) profilingRule class implementation
private  String profilingRuleFallbackBean
          The base (abstract) profilingRule class implementation
private  String profilingRuleStandardBean
          The base (abstract) profilingRule class implementation
private  Class prRuleClass
          The default principalRule association class implementation
private  org.apache.jetspeed.profiler.rules.ProfileResolvers resolvers
           
private  String ruleCriterionBean
          the default criterion bean name
private  Map rulesPerPrincipal
           
 
Fields inherited from class org.apache.jetspeed.components.dao.InitablePersistenceBrokerDaoSupport
repositoryPath
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
JetspeedProfilerImpl(String repositoryPath, org.apache.jetspeed.profiler.rules.ProfileResolvers resolvers)
           
JetspeedProfilerImpl(String repositoryPath, String defaultRule, org.apache.jetspeed.profiler.rules.ProfileResolvers resolvers)
          Create a JetspeedProfiler with properties.
JetspeedProfilerImpl(String repositoryPath, String defaultRule, org.apache.jetspeed.profiler.rules.ProfileResolvers resolvers, Map ruleConstructors, String ruleCriterionBean)
          support passing of rule creation classes
JetspeedProfilerImpl(String repositoryPath, String defaultRule, Properties properties, org.apache.jetspeed.profiler.rules.ProfileResolvers resolvers)
          Deprecated. As of release 2.1, property-based class references replaced by container managed bean factory
 
Method Summary
 org.apache.jetspeed.profiler.ProfileLocator createLocator(org.apache.jetspeed.request.RequestContext context)
           
 org.apache.jetspeed.profiler.rules.PrincipalRule createPrincipalRule()
           
 org.apache.jetspeed.profiler.rules.ProfilingRule createProfilingRule(boolean standard)
           
 org.apache.jetspeed.profiler.rules.RuleCriterion createRuleCriterion()
           
 void deletePrincipalRule(org.apache.jetspeed.profiler.rules.PrincipalRule rule)
           
 void deleteProfilingRule(org.apache.jetspeed.profiler.rules.ProfilingRule rule)
           
 org.apache.jetspeed.profiler.ProfileLocator getDefaultProfile(org.apache.jetspeed.request.RequestContext context, String locatorName)
           
 Map getDefaultProfileLocators(org.apache.jetspeed.request.RequestContext context)
           
 org.apache.jetspeed.profiler.rules.ProfilingRule getDefaultRule()
           
 String[] getLocatorNamesForPrincipal(Principal principal)
           
private  Class getPrincipalRuleClass()
          Internal method to ensure we have a valid principalRule class for queries
 org.apache.jetspeed.profiler.ProfileLocator getProfile(org.apache.jetspeed.request.RequestContext context, org.apache.jetspeed.profiler.rules.ProfilingRule rule)
           
 org.apache.jetspeed.profiler.ProfileLocator getProfile(org.apache.jetspeed.request.RequestContext context, String locatorName)
           
 Map getProfileLocators(org.apache.jetspeed.request.RequestContext context, Principal principal)
           
 org.apache.jetspeed.profiler.rules.ProfilingRule getRule(String id)
           
 org.apache.jetspeed.profiler.rules.ProfilingRule getRuleForPrincipal(Principal principal, String locatorName)
           
 Collection getRules()
           
 Collection getRulesForPrincipal(Principal principal)
           
private  void initModelClasses(Properties properties)
          Deprecated. As of release 2.1, property-based class references replaced by container managed bean factory
private  void initRuleClasses(Map beans)
          added logic to get the settings for creating the various rule related instances
private  org.apache.jetspeed.profiler.rules.PrincipalRule lookupPrincipalRule(String principal, String locatorName)
          Helper function to lookup principal rule associations by principal
private  String makePrincipalRuleKey(String principal, String locator)
           
 void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
           
 void setDefaultRule(String defaultRule)
           
 void setRuleForPrincipal(Principal principal, org.apache.jetspeed.profiler.rules.ProfilingRule rule, String locatorName)
           
 void storePrincipalRule(org.apache.jetspeed.profiler.rules.PrincipalRule rule)
           
 void storeProfilingRule(org.apache.jetspeed.profiler.rules.ProfilingRule rule)
           
 
Methods inherited from class org.apache.jetspeed.components.dao.InitablePersistenceBrokerDaoSupport
init
 
Methods inherited from class org.springframework.orm.ojb.support.PersistenceBrokerDaoSupport
checkDaoConfig, 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 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 Principal DEFAULT_RULE_PRINCIPAL
This is the princapl that is used if there are no principal to rule associations for the current principal


locatorBean

private String locatorBean
The default locator class implementation


prRuleClass

private Class prRuleClass
The default principalRule association class implementation


principalRuleBean

private String principalRuleBean

profilingRuleStandardBean

private String profilingRuleStandardBean
The base (abstract) profilingRule class implementation


profilingRuleFallbackBean

private String profilingRuleFallbackBean
The base (abstract) profilingRule class implementation


profilingRuleClass

private Class profilingRuleClass
The base (abstract) profilingRule class implementation


defaultRule

private String defaultRule
The configured default rule for this portal


principalRules

private Map principalRules

rulesPerPrincipal

private Map rulesPerPrincipal

resolvers

private org.apache.jetspeed.profiler.rules.ProfileResolvers resolvers

ruleCriterionBean

private String ruleCriterionBean
the default criterion bean name


beanFactory

private org.springframework.beans.factory.BeanFactory beanFactory
added support for bean factory to create profile rules

Constructor Detail

JetspeedProfilerImpl

public JetspeedProfilerImpl(String repositoryPath,
                            org.apache.jetspeed.profiler.rules.ProfileResolvers resolvers)

JetspeedProfilerImpl

public JetspeedProfilerImpl(String repositoryPath,
                            String defaultRule,
                            org.apache.jetspeed.profiler.rules.ProfileResolvers resolvers)
                     throws 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:
ClassNotFoundException - if any the implementation classes defined within the properties argument could not be found.

JetspeedProfilerImpl

public JetspeedProfilerImpl(String repositoryPath,
                            String defaultRule,
                            Properties properties,
                            org.apache.jetspeed.profiler.rules.ProfileResolvers resolvers)
                     throws ClassNotFoundException
Deprecated. As of release 2.1, property-based class references replaced by container managed bean factory

Throws:
ClassNotFoundException

JetspeedProfilerImpl

public JetspeedProfilerImpl(String repositoryPath,
                            String defaultRule,
                            org.apache.jetspeed.profiler.rules.ProfileResolvers resolvers,
                            Map ruleConstructors,
                            String ruleCriterionBean)
                     throws ClassNotFoundException
support passing of rule creation classes

Throws:
ClassNotFoundException
Method Detail

setDefaultRule

public void setDefaultRule(String defaultRule)
Specified by:
setDefaultRule in interface org.apache.jetspeed.profiler.Profiler
Parameters:
defaultRule - The default rule to set.

initModelClasses

private void initModelClasses(Properties properties)
                       throws ClassNotFoundException
Deprecated. As of release 2.1, property-based class references replaced by container managed bean factory

Throws:
ClassNotFoundException

getProfile

public org.apache.jetspeed.profiler.ProfileLocator getProfile(org.apache.jetspeed.request.RequestContext context,
                                                              String locatorName)
                                                       throws org.apache.jetspeed.profiler.ProfilerException
Specified by:
getProfile in interface org.apache.jetspeed.profiler.Profiler
Throws:
org.apache.jetspeed.profiler.ProfilerException

getDefaultProfile

public org.apache.jetspeed.profiler.ProfileLocator getDefaultProfile(org.apache.jetspeed.request.RequestContext context,
                                                                     String locatorName)
                                                              throws org.apache.jetspeed.profiler.ProfilerException
Specified by:
getDefaultProfile in interface org.apache.jetspeed.profiler.Profiler
Throws:
org.apache.jetspeed.profiler.ProfilerException

getProfile

public org.apache.jetspeed.profiler.ProfileLocator getProfile(org.apache.jetspeed.request.RequestContext context,
                                                              org.apache.jetspeed.profiler.rules.ProfilingRule rule)
                                                       throws org.apache.jetspeed.profiler.ProfilerException
Specified by:
getProfile in interface org.apache.jetspeed.profiler.Profiler
Throws:
org.apache.jetspeed.profiler.ProfilerException

getRuleForPrincipal

public org.apache.jetspeed.profiler.rules.ProfilingRule getRuleForPrincipal(Principal principal,
                                                                            String locatorName)
Specified by:
getRuleForPrincipal in interface org.apache.jetspeed.profiler.Profiler

getPrincipalRuleClass

private Class getPrincipalRuleClass()
Internal method to ensure we have a valid principalRule class for queries

Returns:
the class object for the principalRule

setRuleForPrincipal

public void setRuleForPrincipal(Principal principal,
                                org.apache.jetspeed.profiler.rules.ProfilingRule rule,
                                String locatorName)
Specified by:
setRuleForPrincipal in interface org.apache.jetspeed.profiler.Profiler

makePrincipalRuleKey

private String makePrincipalRuleKey(String principal,
                                    String locator)

lookupPrincipalRule

private org.apache.jetspeed.profiler.rules.PrincipalRule lookupPrincipalRule(String principal,
                                                                             String locatorName)
Helper function to lookup principal rule associations by principal

Parameters:
principal - The string representation of the principal name.
Returns:
The found PrincipalRule associated with the principal key or null if not found.

getDefaultRule

public org.apache.jetspeed.profiler.rules.ProfilingRule getDefaultRule()
Specified by:
getDefaultRule in interface org.apache.jetspeed.profiler.Profiler

getRules

public Collection getRules()
Specified by:
getRules in interface org.apache.jetspeed.profiler.Profiler

getRule

public org.apache.jetspeed.profiler.rules.ProfilingRule getRule(String id)
Specified by:
getRule in interface org.apache.jetspeed.profiler.Profiler

getLocatorNamesForPrincipal

public String[] getLocatorNamesForPrincipal(Principal principal)
Specified by:
getLocatorNamesForPrincipal in interface org.apache.jetspeed.profiler.Profiler

getRulesForPrincipal

public Collection getRulesForPrincipal(Principal principal)
Specified by:
getRulesForPrincipal in interface org.apache.jetspeed.profiler.Profiler

getProfileLocators

public Map getProfileLocators(org.apache.jetspeed.request.RequestContext context,
                              Principal principal)
                       throws org.apache.jetspeed.profiler.ProfilerException
Specified by:
getProfileLocators in interface org.apache.jetspeed.profiler.Profiler
Throws:
org.apache.jetspeed.profiler.ProfilerException

getDefaultProfileLocators

public Map getDefaultProfileLocators(org.apache.jetspeed.request.RequestContext context)
                              throws org.apache.jetspeed.profiler.ProfilerException
Specified by:
getDefaultProfileLocators in interface org.apache.jetspeed.profiler.Profiler
Throws:
org.apache.jetspeed.profiler.ProfilerException

storeProfilingRule

public void storeProfilingRule(org.apache.jetspeed.profiler.rules.ProfilingRule rule)
                        throws org.apache.jetspeed.profiler.ProfilerException
Specified by:
storeProfilingRule in interface org.apache.jetspeed.profiler.Profiler
Throws:
org.apache.jetspeed.profiler.ProfilerException

deleteProfilingRule

public void deleteProfilingRule(org.apache.jetspeed.profiler.rules.ProfilingRule rule)
                         throws org.apache.jetspeed.profiler.ProfilerException
Specified by:
deleteProfilingRule in interface org.apache.jetspeed.profiler.Profiler
Throws:
org.apache.jetspeed.profiler.ProfilerException

storePrincipalRule

public void storePrincipalRule(org.apache.jetspeed.profiler.rules.PrincipalRule rule)
                        throws org.apache.jetspeed.profiler.ProfilerException
Specified by:
storePrincipalRule in interface org.apache.jetspeed.profiler.Profiler
Throws:
org.apache.jetspeed.profiler.ProfilerException

deletePrincipalRule

public void deletePrincipalRule(org.apache.jetspeed.profiler.rules.PrincipalRule rule)
                         throws org.apache.jetspeed.profiler.ProfilerException
Specified by:
deletePrincipalRule in interface org.apache.jetspeed.profiler.Profiler
Throws:
org.apache.jetspeed.profiler.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

initRuleClasses

private void initRuleClasses(Map beans)
                      throws ClassNotFoundException
added logic to get the settings for creating the various rule related instances

Parameters:
classes -
Throws:
ClassNotFoundException

createProfilingRule

public org.apache.jetspeed.profiler.rules.ProfilingRule createProfilingRule(boolean standard)
                                                                     throws ClassNotFoundException
Specified by:
createProfilingRule in interface org.apache.jetspeed.profiler.Profiler
Throws:
ClassNotFoundException

createLocator

public org.apache.jetspeed.profiler.ProfileLocator createLocator(org.apache.jetspeed.request.RequestContext context)
Specified by:
createLocator in interface org.apache.jetspeed.profiler.Profiler

createPrincipalRule

public org.apache.jetspeed.profiler.rules.PrincipalRule createPrincipalRule()
                                                                     throws ClassNotFoundException
Specified by:
createPrincipalRule in interface org.apache.jetspeed.profiler.Profiler
Throws:
ClassNotFoundException

createRuleCriterion

public org.apache.jetspeed.profiler.rules.RuleCriterion createRuleCriterion()
                                                                     throws ClassNotFoundException
Specified by:
createRuleCriterion in interface org.apache.jetspeed.profiler.Profiler
Throws:
ClassNotFoundException


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