org.apache.cocoon.portal.profile.impl
Class GroupBasedProfileManager

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.portal.profile.impl.AbstractProfileManager
          extended by org.apache.cocoon.portal.profile.impl.GroupBasedProfileManager
All Implemented Interfaces:
Disposable, Initializable, Component, Contextualizable, LogEnabled, Parameterizable, Serviceable, ThreadSafe, ProfileManager

public class GroupBasedProfileManager
extends AbstractProfileManager
implements Parameterizable, Contextualizable, Initializable, Disposable

This profile manager uses a group based approach: The coplet-base-data and the coplet-data are global, these are shared between all users. If the user has is own set of coplet-instance-datas/layouts these are loaded. If the user has not an own set, the group set is loaded - therefore each user has belong to exactly one group. In the case that the user does not belong to a group, a global profile is loaded. This profile manager does not check for changes of the profile, which means for example once a global profile is loaded, it is used until Cocoon is restarted. (This will be changed later on) THIS IS A WORK IN PROGRESS - IT'S NOT FINISHED/WORKING YET

Version:
CVS $Id: GroupBasedProfileManager.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Carsten Ziegeler

Nested Class Summary
protected static class GroupBasedProfileManager.ProfileInfo
           
 
Field Summary
static String CATEGORY_GLOBAL
           
static String CATEGORY_GROUP
           
static String CATEGORY_USER
           
protected  Context context
          The component context
protected  GroupBasedProfileManager.ProfileInfo copletBaseDatas
           
protected  GroupBasedProfileManager.ProfileInfo copletDatas
           
protected static String KEY_PREFIX
           
protected  UserInfoProvider provider
          The userinfo provider - the connection to the authentication mechanism
protected  String userInfoProviderClassName
          The class name of the userinfo provider
 
Fields inherited from class org.apache.cocoon.portal.profile.impl.AbstractProfileManager
manager
 
Fields inherited from interface org.apache.cocoon.portal.profile.ProfileManager
ROLE
 
Constructor Summary
GroupBasedProfileManager()
           
 
Method Summary
protected  Map buildKey(String category, String profileType, UserInfo info, boolean load)
           
 void contextualize(Context context)
           
 void dispose()
           
 CopletData getCopletData(String copletDataId)
          Return the coplet data object
 Collection getCopletDatas()
          Get all coplets
 List getCopletInstanceData(CopletData data)
           
 CopletInstanceData getCopletInstanceData(String copletID)
           
 Collection getCopletInstanceDatas()
          Get all instances
protected  boolean getCopletInstanceDatas(ProfileLS loader, UserProfile profile, UserInfo info, PortalService service, String category)
           
protected  Map getGlobalBaseDatas(ProfileLS loader, UserInfo info, PortalService service)
           
protected  Map getGlobalDatas(ProfileLS loader, UserInfo info, PortalService service, UserProfile profile)
           
protected  boolean getLayout(ProfileLS loader, UserProfile profile, UserInfo info, PortalService service, String category)
           
 Layout getPortalLayout(String layoutKey, String layoutId)
          Get the portal layout defined by the layout key.
 PortalUser getUser()
          Get current user information
protected  UserProfile getUserProfile(String layoutKey)
           
 void initialize()
           
protected  UserProfile loadProfile(String layoutKey, PortalService service)
          Load the profile
 void login()
          This method is invoked when the user logs into the portal.
 void logout()
          This method is invoked when the user logs out of the portal
 void parameterize(Parameters params)
           
protected  void prepareObject(Object object, PortalService service)
          Prepares the object by using the specified factory.
 void register(CopletInstanceData coplet)
          New coplet instance datas have to be registered using this method.
 void register(Layout layout)
          New layouts have to be registered using this method.
protected  void removeUserProfiles()
           
 void saveUserCopletInstanceDatas(String layoutKey)
          Save the coplet instance data
 void saveUserLayout(String layoutKey)
          Save the layout
 void storeProfile(Layout rootLayout, String layoutKey)
          Store the provided profile under the layoutKey.
protected  void storeUserProfile(String layoutKey, PortalService service, UserProfile profile)
           
 void unregister(CopletInstanceData coplet)
          Removed coplet instance datas have to be unregistered using this method.
 void unregister(Layout layout)
          New layouts have to be unregistered using this method.
 
Methods inherited from class org.apache.cocoon.portal.profile.impl.AbstractProfileManager
saveUserProfiles, service
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CATEGORY_GLOBAL

public static final String CATEGORY_GLOBAL
See Also:
Constant Field Values

CATEGORY_GROUP

public static final String CATEGORY_GROUP
See Also:
Constant Field Values

CATEGORY_USER

public static final String CATEGORY_USER
See Also:
Constant Field Values

KEY_PREFIX

protected static final String KEY_PREFIX

copletBaseDatas

protected GroupBasedProfileManager.ProfileInfo copletBaseDatas

copletDatas

protected GroupBasedProfileManager.ProfileInfo copletDatas

provider

protected UserInfoProvider provider
The userinfo provider - the connection to the authentication mechanism


userInfoProviderClassName

protected String userInfoProviderClassName
The class name of the userinfo provider


context

protected Context context
The component context

Constructor Detail

GroupBasedProfileManager

public GroupBasedProfileManager()
Method Detail

contextualize

public void contextualize(Context context)
                   throws ContextException
Specified by:
contextualize in interface Contextualizable
Throws:
ContextException

parameterize

public void parameterize(Parameters params)
                  throws ParameterException
Specified by:
parameterize in interface Parameterizable
Throws:
ParameterException

initialize

public void initialize()
                throws Exception
Specified by:
initialize in interface Initializable
Throws:
Exception

dispose

public void dispose()
Specified by:
dispose in interface Disposable

getUserProfile

protected UserProfile getUserProfile(String layoutKey)

removeUserProfiles

protected void removeUserProfiles()

storeUserProfile

protected void storeUserProfile(String layoutKey,
                                PortalService service,
                                UserProfile profile)

prepareObject

protected void prepareObject(Object object,
                             PortalService service)
                      throws ProcessingException
Prepares the object by using the specified factory.

Throws:
ProcessingException

login

public void login()
Description copied from interface: ProfileManager
This method is invoked when the user logs into the portal.

Specified by:
login in interface ProfileManager
Overrides:
login in class AbstractProfileManager

logout

public void logout()
Description copied from interface: ProfileManager
This method is invoked when the user logs out of the portal

Specified by:
logout in interface ProfileManager
Overrides:
logout in class AbstractProfileManager

getCopletInstanceData

public CopletInstanceData getCopletInstanceData(String copletID)
Specified by:
getCopletInstanceData in interface ProfileManager

getCopletData

public CopletData getCopletData(String copletDataId)
Description copied from interface: ProfileManager
Return the coplet data object

Specified by:
getCopletData in interface ProfileManager

getCopletInstanceData

public List getCopletInstanceData(CopletData data)
Specified by:
getCopletInstanceData in interface ProfileManager

register

public void register(CopletInstanceData coplet)
Description copied from interface: ProfileManager
New coplet instance datas have to be registered using this method.

Specified by:
register in interface ProfileManager
Overrides:
register in class AbstractProfileManager

unregister

public void unregister(CopletInstanceData coplet)
Description copied from interface: ProfileManager
Removed coplet instance datas have to be unregistered using this method.

Specified by:
unregister in interface ProfileManager
Overrides:
unregister in class AbstractProfileManager

register

public void register(Layout layout)
Description copied from interface: ProfileManager
New layouts have to be registered using this method.

Specified by:
register in interface ProfileManager
Overrides:
register in class AbstractProfileManager

unregister

public void unregister(Layout layout)
Description copied from interface: ProfileManager
New layouts have to be unregistered using this method.

Specified by:
unregister in interface ProfileManager
Overrides:
unregister in class AbstractProfileManager

getPortalLayout

public Layout getPortalLayout(String layoutKey,
                              String layoutId)
Description copied from interface: ProfileManager
Get the portal layout defined by the layout key. This usually addresses the layout profile. With the optional subKey it's possible to retrieve a specific layout object in the profile defined by the layout key.

Specified by:
getPortalLayout in interface ProfileManager
Parameters:
layoutKey - A key describing the layout or null for the default
layoutId - The id of a layout object or null for the root object
Returns:
The layout

getCopletDatas

public Collection getCopletDatas()
Description copied from interface: ProfileManager
Get all coplets

Specified by:
getCopletDatas in interface ProfileManager

getCopletInstanceDatas

public Collection getCopletInstanceDatas()
Description copied from interface: ProfileManager
Get all instances

Specified by:
getCopletInstanceDatas in interface ProfileManager

loadProfile

protected UserProfile loadProfile(String layoutKey,
                                  PortalService service)
                           throws Exception
Load the profile

Throws:
Exception

getGlobalBaseDatas

protected Map getGlobalBaseDatas(ProfileLS loader,
                                 UserInfo info,
                                 PortalService service)
                          throws Exception
Throws:
Exception

getGlobalDatas

protected Map getGlobalDatas(ProfileLS loader,
                             UserInfo info,
                             PortalService service,
                             UserProfile profile)
                      throws Exception
Throws:
Exception

getCopletInstanceDatas

protected boolean getCopletInstanceDatas(ProfileLS loader,
                                         UserProfile profile,
                                         UserInfo info,
                                         PortalService service,
                                         String category)
                                  throws Exception
Throws:
Exception

getLayout

protected boolean getLayout(ProfileLS loader,
                            UserProfile profile,
                            UserInfo info,
                            PortalService service,
                            String category)
                     throws Exception
Throws:
Exception

buildKey

protected Map buildKey(String category,
                       String profileType,
                       UserInfo info,
                       boolean load)

storeProfile

public void storeProfile(Layout rootLayout,
                         String layoutKey)
Description copied from interface: ProfileManager
Store the provided profile under the layoutKey. This method can be used to overwrite a profile with another one.

Specified by:
storeProfile in interface ProfileManager

getUser

public PortalUser getUser()
Description copied from interface: ProfileManager
Get current user information

Specified by:
getUser in interface ProfileManager

saveUserCopletInstanceDatas

public void saveUserCopletInstanceDatas(String layoutKey)
Description copied from interface: ProfileManager
Save the coplet instance data

Specified by:
saveUserCopletInstanceDatas in interface ProfileManager
Overrides:
saveUserCopletInstanceDatas in class AbstractProfileManager
See Also:
ProfileManager.saveUserCopletInstanceDatas(java.lang.String)

saveUserLayout

public void saveUserLayout(String layoutKey)
Description copied from interface: ProfileManager
Save the layout

Specified by:
saveUserLayout in interface ProfileManager
Overrides:
saveUserLayout in class AbstractProfileManager
See Also:
ProfileManager.saveUserLayout(java.lang.String)


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.