org.apache.jetspeed.services.profiler
Class JetspeedProfilerService

java.lang.Object
  extended byorg.apache.turbine.services.BaseInitable
      extended byorg.apache.turbine.services.BaseService
          extended byorg.apache.turbine.services.TurbineBaseService
              extended byorg.apache.jetspeed.services.profiler.JetspeedProfilerService
All Implemented Interfaces:
org.apache.turbine.services.Initable, ProfilerService, org.apache.turbine.services.Service

public class JetspeedProfilerService
extends org.apache.turbine.services.TurbineBaseService
implements ProfilerService

This is an implementation of the Profiler interface. This implementation maps requests to profiles (PSML resources) based on request parameters, requesting deviced capabilities, and the device's language.

This service expects these properties to be set for correct operation:

root
The webapp rel. path to the root profiling directory
resource.default
The default resource filename
resource.ext
The default resource filename extension
security
Use security flag
fallback.language
Use language configuration flag
fallback.country
Use country configuration flag
fallback.to.root
Continue falling back past media type flag

Version:
$Id: JetspeedProfilerService.java,v 1.60 2005/02/11 15:51:24 morciuch Exp $
Author:
David Sean Taylor, Santiago Gala, Mark Orciuch

Field Summary
protected static java.lang.String CONFIG_FALLBACK_COUNTRY
           
protected static java.lang.String CONFIG_FALLBACK_LANGUAGE
           
protected static java.lang.String CONFIG_FALLBACK_TO_ROOT
           
protected static java.lang.String CONFIG_GROUP_MERGE
           
protected static java.lang.String CONFIG_GROUP_MERGE_CONTROL
           
protected static java.lang.String CONFIG_GROUP_MERGE_CONTROLLER
           
protected static java.lang.String CONFIG_GROUP_MERGE_SECURITYREF
           
protected static java.lang.String CONFIG_NEWGROUP_TEMPLATE
           
protected static java.lang.String CONFIG_NEWUSER_MEDIA
           
protected static java.lang.String CONFIG_NEWUSER_TEMPLATE
           
protected static java.lang.String CONFIG_RESOURCE_DEFAULT
           
protected static java.lang.String CONFIG_RESOURCE_EXT
           
protected static java.lang.String CONFIG_ROLE_FALLBACK
           
protected static java.lang.String CONFIG_ROLE_MERGE
           
protected static java.lang.String CONFIG_ROLE_MERGE_CONTROL
           
protected static java.lang.String CONFIG_ROLE_MERGE_CONTROLLER
           
protected static java.lang.String CONFIG_SECURITY
           
protected static java.lang.String DEFAULT_CONFIG_GROUP_MERGE_CONTROL
           
protected static java.lang.String DEFAULT_CONFIG_GROUP_MERGE_CONTROLLER
           
protected static java.lang.String DEFAULT_CONFIG_NEWGROUP_TEMPLATE
           
protected static java.lang.String[] DEFAULT_CONFIG_NEWUSER_MEDIA
           
protected static java.lang.String DEFAULT_CONFIG_NEWUSER_TEMPLATE
           
protected static java.lang.String DEFAULT_CONFIG_RESOURCE_DEFAULT
           
protected static java.lang.String DEFAULT_CONFIG_RESOURCE_EXT
           
protected static boolean DEFAULT_CONFIG_ROLE_FALLBACK
           
protected static java.lang.String DEFAULT_CONFIG_ROLE_MERGE_CONTROL
           
protected static java.lang.String DEFAULT_CONFIG_ROLE_MERGE_CONTROLLER
           
protected static boolean DEFAULT_CONFIG_SECURITY
           
protected  java.lang.String groupmergeControl
           
protected  java.lang.String groupmergeController
           
protected  java.lang.String groupmergeSecurityref
           
protected  java.lang.Class locatorClass
           
protected static JetspeedLogger logger
          Static initialization of the logger for this class
protected  java.lang.String[] mediaTypes
           
protected static java.lang.String MSG_MISSING_PARAMETER
           
protected  java.lang.String newGroupTemplate
           
protected  java.lang.String newUserTemplate
           
protected static java.lang.String PATH_EXTENSION_DELIMITER
           
protected  java.lang.Class profileClass
           
protected  java.lang.String resourceDefault
           
protected  java.lang.String resourceExt
           
protected  java.lang.String rolemergeControl
           
protected  java.lang.String rolemergeController
           
protected  java.lang.String root
           
protected  boolean useFallbackCountry
           
protected  boolean useFallbackLanguage
           
protected  boolean useFallbackToRoot
           
protected  boolean useGroupMerge
           
protected  boolean useRoleFallback
           
protected  boolean useRoleMerge
           
protected  boolean useSecurity
           
 
Fields inherited from class org.apache.turbine.services.BaseService
configuration, name, properties, serviceBroker
 
Fields inherited from class org.apache.turbine.services.BaseInitable
initableBroker, isInitialized
 
Fields inherited from interface org.apache.jetspeed.services.profiler.ProfilerService
SERVICE_NAME
 
Constructor Summary
JetspeedProfilerService()
           
 
Method Summary
 ProfileLocator createLocator()
          Creates a new ProfileLocator object that can be successfully managed by the current Profiler implementation
 Profile createProfile()
          Creates a new Profile object that can be successfully managed by the current Profiler implementation
 Profile createProfile(ProfileLocator locator)
          Creates a new Profile object for a specific locator.
 Profile createProfile(ProfileLocator locator, Portlets portlets)
          Create a new profile given a profile locator This method assumes that you have cloned and regenerated the portlet ids if the portlets come from another profile.
 Profile createProfile(org.apache.turbine.util.RunData data, Profile profile)
          This methode creates a wml profile and a html profile for a new user -------------------------------------------------------------------------- last modified: 10/31/01 Andreas Kempf, Siemens ICM S CP PE, Munich mailto: A.Kempf@web.de
 Profile createProfile(org.apache.turbine.util.RunData data, Profile profile, MimeType mt)
          Deprecated. Should be removed when old customizer is removed.
 Profile createProfile(org.apache.turbine.util.RunData data, Profile profile, java.lang.String contentType, java.lang.String from)
          This methode creates a wml profile and a html profile for a new user
protected  PSMLDocument fallback(ProfileLocator locator)
           
protected  PSMLDocument fallbackList(ProfileLocator original, org.apache.turbine.util.RunData rundata)
           
protected  Profile fallbackProfile(org.apache.turbine.util.RunData data, CapabilityMap cm)
          get the Profile object using the Rundata state and capability map this is the mapping functionality of the profiler
protected  Profile getGroupProfile(JetspeedRunData rundata, CapabilityMap cm)
          Process group profiles
protected  void getLanguageSettings(Profile profile, org.apache.turbine.util.RunData rundata)
           
protected  java.lang.String getMediaType(org.apache.turbine.util.RunData rundata, CapabilityMap cm)
          Lookup the media type from the CapabilitMap.
 Profile getProfile(ProfileLocator locator)
          get the Profile object using a profile locator
 Profile getProfile(org.apache.turbine.util.RunData rundata)
          get the Profile object using the Rundata state and capability map this is the mapping functionality of the profiler
 Profile getProfile(org.apache.turbine.util.RunData data, CapabilityMap cm)
          get the Profile object using the Rundata state and capability map this is the mapping functionality of the profiler
 Profile getProfile(org.apache.turbine.util.RunData data, MimeType mt)
          Deprecated. Do not use a profiler method based on MimeType
protected  Profile getRoleProfile(JetspeedRunData rundata, CapabilityMap cm)
          Process role profiles
 void init(javax.servlet.ServletConfig conf)
          This is the early initialization method called by the Turbine Service framework
protected  void initConfiguration()
          Loads the configuration parameters for this service from the JetspeedResources.properties file.
 org.apache.turbine.util.DynamicURI makeDynamicURI(org.apache.turbine.util.RunData data, ProfileLocator locator)
          Builds a dynamic URI based on the current profiler group/role/page
protected  Profile mergeGroupProfiles(org.apache.turbine.util.RunData data, java.util.Vector profiles)
          Merge group profiles to create default profile.
protected  Profile mergeRoleProfiles(org.apache.turbine.util.RunData data, java.util.Vector profiles)
          Merge role profiles to create default profile.
 java.util.Iterator query(QueryLocator locator)
          Query for a collection of profiles given a profile locator criteria.
 void removeProfile(ProfileLocator locator)
          Removes a profile.
 void shutdown()
          This is the shutdown method called by the Turbine Service framework
 boolean useRoleProfileMerging()
          Returns status of role profile merging feature
 
Methods inherited from class org.apache.turbine.services.TurbineBaseService
init, init, init
 
Methods inherited from class org.apache.turbine.services.BaseService
getConfiguration, getName, getProperties, getServiceBroker, setName, setServiceBroker
 
Methods inherited from class org.apache.turbine.services.BaseInitable
getInit, getInitableBroker, setInit, setInitableBroker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.turbine.services.Service
getConfiguration, getName, getProperties, setName, setServiceBroker
 
Methods inherited from interface org.apache.turbine.services.Initable
getInit, init, init, setInitableBroker
 

Field Detail

logger

protected static final JetspeedLogger logger
Static initialization of the logger for this class


CONFIG_RESOURCE_DEFAULT

protected static final java.lang.String CONFIG_RESOURCE_DEFAULT
See Also:
Constant Field Values

CONFIG_RESOURCE_EXT

protected static final java.lang.String CONFIG_RESOURCE_EXT
See Also:
Constant Field Values

CONFIG_SECURITY

protected static final java.lang.String CONFIG_SECURITY
See Also:
Constant Field Values

CONFIG_ROLE_FALLBACK

protected static final java.lang.String CONFIG_ROLE_FALLBACK
See Also:
Constant Field Values

CONFIG_NEWUSER_TEMPLATE

protected static final java.lang.String CONFIG_NEWUSER_TEMPLATE
See Also:
Constant Field Values

CONFIG_NEWGROUP_TEMPLATE

protected static final java.lang.String CONFIG_NEWGROUP_TEMPLATE
See Also:
Constant Field Values

CONFIG_NEWUSER_MEDIA

protected static final java.lang.String CONFIG_NEWUSER_MEDIA
See Also:
Constant Field Values

CONFIG_FALLBACK_LANGUAGE

protected static final java.lang.String CONFIG_FALLBACK_LANGUAGE
See Also:
Constant Field Values

CONFIG_FALLBACK_COUNTRY

protected static final java.lang.String CONFIG_FALLBACK_COUNTRY
See Also:
Constant Field Values

CONFIG_FALLBACK_TO_ROOT

protected static final java.lang.String CONFIG_FALLBACK_TO_ROOT
See Also:
Constant Field Values

CONFIG_ROLE_MERGE

protected static final java.lang.String CONFIG_ROLE_MERGE
See Also:
Constant Field Values

CONFIG_ROLE_MERGE_CONTROL

protected static final java.lang.String CONFIG_ROLE_MERGE_CONTROL
See Also:
Constant Field Values

CONFIG_ROLE_MERGE_CONTROLLER

protected static final java.lang.String CONFIG_ROLE_MERGE_CONTROLLER
See Also:
Constant Field Values

CONFIG_GROUP_MERGE

protected static final java.lang.String CONFIG_GROUP_MERGE
See Also:
Constant Field Values

CONFIG_GROUP_MERGE_CONTROL

protected static final java.lang.String CONFIG_GROUP_MERGE_CONTROL
See Also:
Constant Field Values

CONFIG_GROUP_MERGE_CONTROLLER

protected static final java.lang.String CONFIG_GROUP_MERGE_CONTROLLER
See Also:
Constant Field Values

CONFIG_GROUP_MERGE_SECURITYREF

protected static final java.lang.String CONFIG_GROUP_MERGE_SECURITYREF
See Also:
Constant Field Values

DEFAULT_CONFIG_RESOURCE_DEFAULT

protected static final java.lang.String DEFAULT_CONFIG_RESOURCE_DEFAULT
See Also:
Constant Field Values

DEFAULT_CONFIG_RESOURCE_EXT

protected static final java.lang.String DEFAULT_CONFIG_RESOURCE_EXT
See Also:
Constant Field Values

DEFAULT_CONFIG_SECURITY

protected static final boolean DEFAULT_CONFIG_SECURITY
See Also:
Constant Field Values

DEFAULT_CONFIG_ROLE_FALLBACK

protected static final boolean DEFAULT_CONFIG_ROLE_FALLBACK
See Also:
Constant Field Values

DEFAULT_CONFIG_NEWUSER_TEMPLATE

protected static final java.lang.String DEFAULT_CONFIG_NEWUSER_TEMPLATE

DEFAULT_CONFIG_NEWGROUP_TEMPLATE

protected static final java.lang.String DEFAULT_CONFIG_NEWGROUP_TEMPLATE
See Also:
Constant Field Values

DEFAULT_CONFIG_NEWUSER_MEDIA

protected static final java.lang.String[] DEFAULT_CONFIG_NEWUSER_MEDIA

DEFAULT_CONFIG_ROLE_MERGE_CONTROL

protected static final java.lang.String DEFAULT_CONFIG_ROLE_MERGE_CONTROL
See Also:
Constant Field Values

DEFAULT_CONFIG_ROLE_MERGE_CONTROLLER

protected static final java.lang.String DEFAULT_CONFIG_ROLE_MERGE_CONTROLLER
See Also:
Constant Field Values

DEFAULT_CONFIG_GROUP_MERGE_CONTROL

protected static final java.lang.String DEFAULT_CONFIG_GROUP_MERGE_CONTROL
See Also:
Constant Field Values

DEFAULT_CONFIG_GROUP_MERGE_CONTROLLER

protected static final java.lang.String DEFAULT_CONFIG_GROUP_MERGE_CONTROLLER
See Also:
Constant Field Values

PATH_EXTENSION_DELIMITER

protected static final java.lang.String PATH_EXTENSION_DELIMITER
See Also:
Constant Field Values

MSG_MISSING_PARAMETER

protected static final java.lang.String MSG_MISSING_PARAMETER
See Also:
Constant Field Values

profileClass

protected java.lang.Class profileClass

locatorClass

protected java.lang.Class locatorClass

root

protected java.lang.String root

resourceDefault

protected java.lang.String resourceDefault

resourceExt

protected java.lang.String resourceExt

rolemergeControl

protected java.lang.String rolemergeControl

rolemergeController

protected java.lang.String rolemergeController

groupmergeControl

protected java.lang.String groupmergeControl

groupmergeController

protected java.lang.String groupmergeController

groupmergeSecurityref

protected java.lang.String groupmergeSecurityref

newUserTemplate

protected java.lang.String newUserTemplate

newGroupTemplate

protected java.lang.String newGroupTemplate

useSecurity

protected boolean useSecurity

useRoleFallback

protected boolean useRoleFallback

useFallbackLanguage

protected boolean useFallbackLanguage

useFallbackCountry

protected boolean useFallbackCountry

useFallbackToRoot

protected boolean useFallbackToRoot

useRoleMerge

protected boolean useRoleMerge

useGroupMerge

protected boolean useGroupMerge

mediaTypes

protected java.lang.String[] mediaTypes
Constructor Detail

JetspeedProfilerService

public JetspeedProfilerService()
Method Detail

createProfile

public Profile createProfile(org.apache.turbine.util.RunData data,
                             Profile profile)
                      throws ProfileException
This methode creates a wml profile and a html profile for a new user -------------------------------------------------------------------------- last modified: 10/31/01 Andreas Kempf, Siemens ICM S CP PE, Munich mailto: A.Kempf@web.de

Specified by:
createProfile in interface ProfilerService
Parameters:
profile - The description of the new profile to be created.
Returns:
The newly created profile.
Throws:
ProfileException

init

public void init(javax.servlet.ServletConfig conf)
          throws org.apache.turbine.services.InitializationException
This is the early initialization method called by the Turbine Service framework

Parameters:
conf - The ServletConfig
Throws:
throws - a InitializationException if the service fails to initialize
org.apache.turbine.services.InitializationException

shutdown

public void shutdown()
This is the shutdown method called by the Turbine Service framework

Specified by:
shutdown in interface org.apache.turbine.services.Initable

getProfile

public Profile getProfile(org.apache.turbine.util.RunData data,
                          CapabilityMap cm)
                   throws ProfileException
get the Profile object using the Rundata state and capability map this is the mapping functionality of the profiler

Specified by:
getProfile in interface ProfilerService
Parameters:
cm - the CapabilityMap of the current requesting device
data - The rundata object for the current request.
Returns:
a new Profile object
Throws:
ProfileException

getRoleProfile

protected Profile getRoleProfile(JetspeedRunData rundata,
                                 CapabilityMap cm)
                          throws java.lang.Exception
Process role profiles

Parameters:
rundata -
cm -
Returns:
Throws:
java.lang.Exception

mergeRoleProfiles

protected Profile mergeRoleProfiles(org.apache.turbine.util.RunData data,
                                    java.util.Vector profiles)
                             throws java.lang.Exception
Merge role profiles to create default profile. Resulting psml will be a set of tabs. If role's psml is a tab control, each tab is placed in the resulting psml as is. Otherwise, a new tab is created and psml is placed there. In this case, tab name will be derived from role's name. For example, if role name is "news", the resulting profile name will be "News Home".

Parameters:
data -
profiles - Vector of profiles for all roles user is part of
Returns:
Merged profile
Throws:
java.lang.Exception

getGroupProfile

protected Profile getGroupProfile(JetspeedRunData rundata,
                                  CapabilityMap cm)
                           throws java.lang.Exception
Process group profiles

Parameters:
rundata -
cm -
Returns:
Throws:
java.lang.Exception

mergeGroupProfiles

protected Profile mergeGroupProfiles(org.apache.turbine.util.RunData data,
                                     java.util.Vector profiles)
                              throws java.lang.Exception
Merge group profiles to create default profile. Resulting psml will be a set of tabs. If groups's psml is a tab control, each tab is placed in the resulting psml as is. Otherwise, a new tab is created and psml is placed there. In this case, tab name will be derived from group's name. For example, if group name is "news", the resulting profile name will be "News Home". The group profiles are pre-sorted by group name. A default security ref is set for the newly generated profile.

Parameters:
data -
profiles - Vector of profiles for all groups user is part of
Returns:
Merged profile
Throws:
java.lang.Exception

fallbackProfile

protected Profile fallbackProfile(org.apache.turbine.util.RunData data,
                                  CapabilityMap cm)
                           throws ProfileException
get the Profile object using the Rundata state and capability map this is the mapping functionality of the profiler

Parameters:
cm - the CapabilityMap of the current requesting device
Returns:
a new Profile object
Throws:
ProfileException

getProfile

public Profile getProfile(org.apache.turbine.util.RunData rundata)
                   throws ProfileException
get the Profile object using the Rundata state and capability map this is the mapping functionality of the profiler

Specified by:
getProfile in interface ProfilerService
Parameters:
rundata - the rundata object for the current request
Returns:
a new Profile object
Throws:
ProfileException

getProfile

public Profile getProfile(org.apache.turbine.util.RunData data,
                          MimeType mt)
                   throws ProfileException
Deprecated. Do not use a profiler method based on MimeType

get the Profile object using the Rundata state and specific mimetype

Specified by:
getProfile in interface ProfilerService
Parameters:
mt - the MimeType of the current requesting device
Returns:
a new Profile object
Throws:
ProfileException

getProfile

public Profile getProfile(ProfileLocator locator)
                   throws ProfileException
get the Profile object using a profile locator

Specified by:
getProfile in interface ProfilerService
Parameters:
locator - The locator containing criteria describing the profile.
Returns:
a new Profile object
Throws:
ProfileException

getLanguageSettings

protected void getLanguageSettings(Profile profile,
                                   org.apache.turbine.util.RunData rundata)

fallbackList

protected PSMLDocument fallbackList(ProfileLocator original,
                                    org.apache.turbine.util.RunData rundata)

fallback

protected PSMLDocument fallback(ProfileLocator locator)

getMediaType

protected java.lang.String getMediaType(org.apache.turbine.util.RunData rundata,
                                        CapabilityMap cm)
Lookup the media type from the CapabilitMap. First the RunData is checked for an explicit media-type request.

Parameters:
cm - The CapabilityMap of the current requesting device.
Returns:
a String, the unique name of the media type.

initConfiguration

protected void initConfiguration()
                          throws org.apache.turbine.services.InitializationException
Loads the configuration parameters for this service from the JetspeedResources.properties file.

Throws:
throws - a InitializationException if the service fails to initialize
org.apache.turbine.services.InitializationException

makeDynamicURI

public org.apache.turbine.util.DynamicURI makeDynamicURI(org.apache.turbine.util.RunData data,
                                                         ProfileLocator locator)
                                                  throws ProfileException
Builds a dynamic URI based on the current profiler group/role/page

Specified by:
makeDynamicURI in interface ProfilerService
Parameters:
data - The rundata object for the current request.
locator - The description of the profile.
Returns:
A new dynamic URI representing all profile parameters from the locator.
Throws:
ProfileException

createProfile

public Profile createProfile()
Creates a new Profile object that can be successfully managed by the current Profiler implementation

Specified by:
createProfile in interface ProfilerService
Returns:
A new Profile object

createProfile

public Profile createProfile(ProfileLocator locator)
Creates a new Profile object for a specific locator.

Specified by:
createProfile in interface ProfilerService
Parameters:
locator - The description of the profile.
Returns:
A new Profile object

createLocator

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

Specified by:
createLocator in interface ProfilerService
Returns:
A new ProfileLocator object

createProfile

public Profile createProfile(ProfileLocator locator,
                             Portlets portlets)
                      throws ProfileException
Create a new profile given a profile locator This method assumes that you have cloned and regenerated the portlet ids if the portlets come from another profile.

Specified by:
createProfile in interface ProfilerService
Parameters:
locator - The description of the new profile to be created.
portlets - The PSML tree
Throws:
ProfileException

createProfile

public Profile createProfile(org.apache.turbine.util.RunData data,
                             Profile profile,
                             java.lang.String contentType,
                             java.lang.String from)
                      throws ProfileException
This methode creates a wml profile and a html profile for a new user

Throws:
ProfileException

createProfile

public Profile createProfile(org.apache.turbine.util.RunData data,
                             Profile profile,
                             MimeType mt)
                      throws ProfileException
Deprecated. Should be removed when old customizer is removed.

Create a new profile.

Specified by:
createProfile in interface ProfilerService
Parameters:
profile - The description of the new profile to be created.
mt - The specific mime type, which is converted to a mediatype.
Returns:
The newly created profile.
Throws:
ProfileException

removeProfile

public void removeProfile(ProfileLocator locator)
Removes a profile.

Specified by:
removeProfile in interface ProfilerService
Parameters:
locator - The profile locator criteria.

query

public java.util.Iterator query(QueryLocator locator)
Query for a collection of profiles given a profile locator criteria.

Specified by:
query in interface ProfilerService
Parameters:
locator - The profile locator criteria.
Returns:
The list of profiles matching the locator criteria.

useRoleProfileMerging

public boolean useRoleProfileMerging()
Description copied from interface: ProfilerService
Returns status of role profile merging feature

Specified by:
useRoleProfileMerging in interface ProfilerService
Returns:
True if role profile merging is active
See Also:
ProfilerService.useRoleProfileMerging()


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