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

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

public class GroupBasedProfileManager
extends AbstractProfileManager
implements Parameterizable, Contextualizable, 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 his 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 YET

Version:
$Id: AbstractUserProfileManager.java 37123 2004-08-27 12:11:53Z cziegeler $

Nested Class Summary
protected static class GroupBasedProfileManager.ProfileInfo
           
 
Field Summary
static String CATEGORY_GLOBAL
           
static String CATEGORY_GROUP
           
static String CATEGORY_USER
           
protected  boolean checkForChanges
          Check for changes?
protected  Context context
          The component context
protected  GroupBasedProfileManager.ProfileInfo copletBaseDatas
           
protected  GroupBasedProfileManager.ProfileInfo copletDatas
           
protected static String KEY_PREFIX
           
protected static Map MAP_FOR_BASE_DATA
           
protected  Parameters parameters
          The parameters for the profile configuration.
 
Fields inherited from class org.apache.cocoon.portal.profile.impl.AbstractProfileManager
USER_ATTRIBUTE
 
Fields inherited from class org.apache.cocoon.portal.impl.AbstractComponent
manager, portalService
 
Fields inherited from interface org.apache.cocoon.portal.profile.ProfileManager
ROLE
 
Constructor Summary
GroupBasedProfileManager()
           
 
Method Summary
protected  Map buildKey(String category, String profileType, PortalUser info, boolean load, String layoutKey)
           
 void contextualize(Context context)
           
 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, ProfileImpl profile, PortalUser info, String category, String layoutKey)
           
protected  Map getGlobalBaseDatas(ProfileLS loader, PortalUser info, String layoutKey)
           
protected  Map getGlobalDatas(ProfileLS loader, PortalUser info, ProfileImpl profile, String layoutKey)
           
protected  boolean getLayout(ProfileLS loader, ProfileImpl profile, PortalUser info, String category, String layoutKey)
           
 Layout getPortalLayout(String layoutKey, String layoutId)
          Get the portal layout defined by the layout key.
 PortalUser getUser()
          Get current user information
protected  ProfileImpl getUserProfile(String layoutKey)
           
 void inform(CopletInstanceDataAddedEvent event, PortalService service)
          Receives a coplet instance data added event.
 void inform(CopletInstanceDataRemovedEvent event, PortalService service)
          Receives a coplet instance data added event.
protected  Profile loadProfile(String layoutKey)
          Load the profile
protected  void login(PortalUser user)
          This method is invoked when a user logs in.
protected  void logout(PortalUser user)
          This method is invoked when a user logs out.
 void parameterize(Parameters params)
           
protected  void prepareObject(Object object)
          Prepares the object by using the specified factory.
 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
protected  void storeUserProfile(String layoutKey, Profile profile)
           
 void unregister(Layout layout)
          New layouts have to be unregistered using this method.
 
Methods inherited from class org.apache.cocoon.portal.profile.impl.AbstractProfileManager
getProfile, inform, saveUserProfiles
 
Methods inherited from class org.apache.cocoon.portal.impl.AbstractComponent
dispose, initialize, 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
 
Methods inherited from interface org.apache.avalon.framework.activity.Disposable
dispose
 

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

MAP_FOR_BASE_DATA

protected static final Map MAP_FOR_BASE_DATA

KEY_PREFIX

protected static final String KEY_PREFIX

copletBaseDatas

protected final GroupBasedProfileManager.ProfileInfo copletBaseDatas

copletDatas

protected final GroupBasedProfileManager.ProfileInfo copletDatas

context

protected Context context
The component context


checkForChanges

protected boolean checkForChanges
Check for changes?


parameters

protected Parameters parameters
The parameters for the profile configuration.

Constructor Detail

GroupBasedProfileManager

public GroupBasedProfileManager()
Method Detail

contextualize

public void contextualize(Context context)
                   throws ContextException
Specified by:
contextualize in interface Contextualizable
Overrides:
contextualize in class AbstractComponent
Throws:
ContextException
See Also:
Contextualizable.contextualize(org.apache.avalon.framework.context.Context)

parameterize

public void parameterize(Parameters params)
                  throws ParameterException
Specified by:
parameterize in interface Parameterizable
Throws:
ParameterException
See Also:
Parameterizable.parameterize(org.apache.avalon.framework.parameters.Parameters)

getUserProfile

protected ProfileImpl getUserProfile(String layoutKey)

removeUserProfiles

protected void removeUserProfiles()

storeUserProfile

protected void storeUserProfile(String layoutKey,
                                Profile profile)

prepareObject

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

Throws:
ProcessingException

login

protected void login(PortalUser user)
Description copied from class: AbstractProfileManager
This method is invoked when a user logs in.

Overrides:
login in class AbstractProfileManager
See Also:
AbstractProfileManager.login(org.apache.cocoon.portal.profile.PortalUser)

logout

protected void logout(PortalUser user)
Description copied from class: AbstractProfileManager
This method is invoked when a user logs out.

Overrides:
logout in class AbstractProfileManager
See Also:
AbstractProfileManager.logout(org.apache.cocoon.portal.profile.PortalUser)

getCopletInstanceData

public CopletInstanceData getCopletInstanceData(String copletID)
Specified by:
getCopletInstanceData in interface ProfileManager
See Also:
ProfileManager.getCopletInstanceData(java.lang.String)

getCopletData

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

Specified by:
getCopletData in interface ProfileManager
See Also:
ProfileManager.getCopletData(java.lang.String)

getCopletInstanceData

public List getCopletInstanceData(CopletData data)
Specified by:
getCopletInstanceData in interface ProfileManager
See Also:
ProfileManager.getCopletInstanceData(org.apache.cocoon.portal.coplet.CopletData)

inform

public void inform(CopletInstanceDataAddedEvent event,
                   PortalService service)
Receives a coplet instance data added event.

See Also:
Receiver

inform

public void inform(CopletInstanceDataRemovedEvent event,
                   PortalService service)
Receives a coplet instance data added event.

See Also:
Receiver

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
See Also:
ProfileManager.register(org.apache.cocoon.portal.layout.Layout)

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
See Also:
ProfileManager.unregister(org.apache.cocoon.portal.layout.Layout)

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
See Also:
ProfileManager.getPortalLayout(java.lang.String, java.lang.String)

getCopletDatas

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

Specified by:
getCopletDatas in interface ProfileManager
See Also:
ProfileManager.getCopletDatas()

getCopletInstanceDatas

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

Specified by:
getCopletInstanceDatas in interface ProfileManager
See Also:
ProfileManager.getCopletInstanceDatas()

loadProfile

protected Profile loadProfile(String layoutKey)
                       throws Exception
Load the profile

Throws:
Exception

getGlobalBaseDatas

protected Map getGlobalBaseDatas(ProfileLS loader,
                                 PortalUser info,
                                 String layoutKey)
                          throws Exception
Throws:
Exception

getGlobalDatas

protected Map getGlobalDatas(ProfileLS loader,
                             PortalUser info,
                             ProfileImpl profile,
                             String layoutKey)
                      throws Exception
Throws:
Exception

getCopletInstanceDatas

protected boolean getCopletInstanceDatas(ProfileLS loader,
                                         ProfileImpl profile,
                                         PortalUser info,
                                         String category,
                                         String layoutKey)
                                  throws Exception
Throws:
Exception

getLayout

protected boolean getLayout(ProfileLS loader,
                            ProfileImpl profile,
                            PortalUser info,
                            String category,
                            String layoutKey)
                     throws Exception
Throws:
Exception

buildKey

protected Map buildKey(String category,
                       String profileType,
                       PortalUser info,
                       boolean load,
                       String layoutKey)
                throws ParameterException
Throws:
ParameterException

getUser

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

Specified by:
getUser in interface ProfileManager
See Also:
ProfileManager.getUser()

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-2005 The Apache Software Foundation. All Rights Reserved.