cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r432969 [1/2] - in /cocoon/trunk/blocks/cocoon-portal: cocoon-portal-auth-impl/src/main/java/org/apache/cocoon/auth/portal/ cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/ cocoon-portal-impl/src/main/java/org/apache/cocoon/portal...
Date Sun, 20 Aug 2006 14:03:31 GMT
Author: cziegeler
Date: Sun Aug 20 07:03:27 2006
New Revision: 432969

URL: http://svn.apache.org/viewvc?rev=432969&view=rev
Log:
Add new user service and clean up portal service

Added:
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/om/PortalUser.java
      - copied, changed from r432835, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/PortalUser.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/UserService.java   (with props)
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/impl/DefaultUserService.java   (with props)
Removed:
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalComponentManager.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/DefaultPortalComponentManager.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/PortalUser.java
Modified:
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-auth-impl/src/main/java/org/apache/cocoon/auth/portal/StandardPortalApplication.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManager.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManagerAspect.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalService.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/ActionCounterEventAspect.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/impl/DefaultEventConverter.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/user/UserDidLoginEvent.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/user/UserEvent.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/user/UserEventUtil.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/user/UserIsAccessingEvent.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/user/UserWillLogoutEvent.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PageLabelManager.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalManagerAspectChain.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/om/CopletInstanceFeatures.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/ProfileManager.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/AbstractPortalUser.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/AbstractProfileManager.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/StaticProfileManager.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/CopletFactory.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/LayoutFactory.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/LinkService.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/portal.roles
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/PortletPreferencesProviderImpl.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/TestProfileManager.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/adapter/PortletAdapter.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/factory/ActionRequestFactoryImpl.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/factory/ActionRequestImpl.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/factory/RenderRequestFactoryImpl.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/factory/RenderRequestImpl.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/om/PortletDefinitionRegistryImpl.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/java/org/apache/cocoon/portal/coplets/basket/BasketManagerImpl.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-tools-impl/src/main/java/org/apache/cocoon/portal/tools/PortalToolManager.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-tools-impl/src/main/java/org/apache/cocoon/portal/tools/acting/CheckAccessAction.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-tools-impl/src/main/java/org/apache/cocoon/portal/tools/helper/MultipleRoleMatcher.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-tools-impl/src/main/java/org/apache/cocoon/portal/tools/helper/PortalObjects.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-tools-impl/src/main/java/org/apache/cocoon/portal/tools/helper/RoleMatcher.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-tools-impl/src/main/java/org/apache/cocoon/portal/tools/helper/SingleRoleMatcher.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-tools-impl/src/main/java/org/apache/cocoon/portal/tools/service/UserRightsService.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-tools-impl/src/main/java/org/apache/cocoon/portal/tools/transformation/CheckAccessTransformer.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-tools-impl/src/main/java/org/apache/cocoon/portal/tools/userManagement/ContextGrabber.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-auth-impl/src/main/java/org/apache/cocoon/auth/portal/StandardPortalApplication.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-auth-impl/src/main/java/org/apache/cocoon/auth/portal/StandardPortalApplication.java?rev=432969&r1=432968&r2=432969&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-auth-impl/src/main/java/org/apache/cocoon/auth/portal/StandardPortalApplication.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-auth-impl/src/main/java/org/apache/cocoon/auth/portal/StandardPortalApplication.java Sun Aug 20 07:03:27 2006
@@ -17,6 +17,8 @@
 package org.apache.cocoon.auth.portal;
 
 import java.security.Principal;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
@@ -27,7 +29,7 @@
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.event.user.UserEventUtil;
-import org.apache.cocoon.portal.profile.PortalUser;
+import org.apache.cocoon.portal.om.PortalUser;
 import org.apache.cocoon.portal.profile.impl.AbstractPortalUser;
 import org.apache.cocoon.auth.StandardApplication;
 import org.apache.cocoon.auth.User;
@@ -146,21 +148,25 @@
         }
 
         /**
-         * @see org.apache.cocoon.portal.profile.PortalUser#isUserInRole(java.lang.String)
+         * @see org.apache.cocoon.portal.om.PortalUser#isUserInRole(java.lang.String)
          */
         public boolean isUserInRole(final String role) {
             return user.isUserInRole(role);
         }
 
         /**
-         * @see org.apache.cocoon.portal.profile.PortalUser#getGroup()
+         * @see org.apache.cocoon.portal.om.PortalUser#getGroups()
          */
-        public String getGroup() {
-            return (String)this.user.getAttribute("group");
+        public Collection getGroups() {
+            final Collection c = (Collection) this.user.getAttribute("groups");
+            if ( c == null ) {
+                return Collections.EMPTY_LIST;
+            }
+            return c;
         }
 
         /**
-         * @see org.apache.cocoon.portal.profile.PortalUser#getUserName()
+         * @see org.apache.cocoon.portal.om.PortalUser#getUserName()
          */
         public String getUserName() {
             return this.user.getId();

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManager.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManager.java?rev=432969&r1=432968&r2=432969&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManager.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManager.java Sun Aug 20 07:03:27 2006
@@ -26,7 +26,7 @@
  * Invoke the request processing using the {@link #process()} method,
  * this starts the event handling for the current request (evaluating
  * request parameters etc.)
- * The section method {@link #showPortal(ContentHandler, Parameters)}
+ * The section method {@link #showPortal(ContentHandler, Properties)}
  * starts rendering the portal.
  *
  * @version $Id$
@@ -44,9 +44,6 @@
      * case only the coplet with the surrounding layout is rendered.
      */
     String PROPERTY_RENDER_COPLET = "render-coplet";
-
-    /** The bean name of this component. */
-    String ROLE = PortalManager.class.getName();
 
     /**
      * Start the first phase of the request handling.

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManagerAspect.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManagerAspect.java?rev=432969&r1=432968&r2=432969&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManagerAspect.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalManagerAspect.java Sun Aug 20 07:03:27 2006
@@ -28,9 +28,6 @@
  */
 public interface PortalManagerAspect {
 
-    /** The role to lookup an aspect. */
-    String ROLE = PortalManagerAspect.class.getName();
-
     void prepare(PortalManagerAspectPrepareContext context,
                  PortalService service)
     throws ProcessingException;

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalService.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalService.java?rev=432969&r1=432968&r2=432969&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalService.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/PortalService.java Sun Aug 20 07:03:27 2006
@@ -15,19 +15,31 @@
  */
 package org.apache.cocoon.portal;
 
-import java.util.Iterator;
 import java.util.List;
 
+import org.apache.cocoon.portal.coplet.adapter.CopletAdapter;
+import org.apache.cocoon.portal.event.EventManager;
+import org.apache.cocoon.portal.layout.renderer.Renderer;
+import org.apache.cocoon.portal.profile.ProfileManager;
+import org.apache.cocoon.portal.services.CopletFactory;
+import org.apache.cocoon.portal.services.LayoutFactory;
+import org.apache.cocoon.portal.services.LinkService;
+import org.apache.cocoon.portal.services.UserService;
+import org.apache.cocoon.processing.ProcessInfoProvider;
+
 /**
- * This is the central component in the portal. It holds the configuration
- * of the portal, the current name etc.
- * The main use of this component is to get other components of the portal,
- * like the link service or the event manager.
- * This component is a singleton.
+ * This is the central component of the portal. It holds the global configuration,
+ * the current name of the portal and other important information.
+ * Apart from configuration, the main purpose if this component is to provide a unique
+ * and simple access to other portal components and services like the link
+ * service or the event manager. A portal component should never lookup these services by
+ * itself. It must only lookup the portal service and get the components/services
+ * from there.
+ * The portal service is a singleton.
  *
  * @version $Id$
  */
-public interface PortalService extends PortalComponentManager {
+public interface PortalService {
 
     /** The role to lookup this component. */
     String ROLE = PortalService.class.getName();
@@ -38,93 +50,92 @@
     String getPortalName();
 
     /**
-     * Return the value of an attribute.
-     * @param key The key of the attribute
-     * @return The value of the attribute or null.
+     * Return all skins
+     */
+    List getSkinDescriptions();
+
+    /**
+     * Get a configuration value.
+     * @param key The key for the configuration.
+     * @return The value of the configuration or null.
+     * @since 2.2
      */
-    Object getAttribute(String key);
+    String getConfiguration(String key);
 
     /**
-     * Set an attribute.
-     * @param key    The key of the attribute
-     * @param value  The new value
+     * Get a configuration value.
+     * @param key The key for the configuration.
+     * @param defaultValue The default value if no configuration for the key is available.
+     * @return The value of the configuration or the default value.
+     * @since 2.2
      */
-    void setAttribute(String key, Object value);
+    String getConfiguration(String key, String defaultValue);
 
     /**
-     * Remove an attribute.
-     * @param key The key of the attribute
+     * Get a configuration value as a boolean.
+     * @param key The key for the configuration.
+     * @param defaultValue The default value if no configuration for the key is available.
+     * @return The value of the configuration or the default value.
+     * @since 2.2
      */
-    Object removeAttribute(String key);
+    boolean getConfigurationAsBoolean(String key, boolean defaultValue);
 
     /**
-     * Return the names of all attributes.
+     * Get the link service.
      */
-    Iterator getAttributeNames();
+    LinkService getLinkService();
 
     /**
-     * Return the value of a temporary attribute.
-     * @param key The key of the attribute
-     * @return The value of the attribute or null.
+     * Get the current profile manager.
      */
-    Object getTemporaryAttribute(String key);
+    ProfileManager getProfileManager();
 
     /**
-     * Set a temporary attribute.
-     * @param key    The key of the attribute
-     * @param value  The new value
+     * Get the renderer.
      */
-    void setTemporaryAttribute(String key, Object value);
+    Renderer getRenderer(String name);
 
     /**
-     * Remove a temporary attribute.
-     * @param key The key of the attribute
+     * Get the coplet adapter.
      */
-    Object removeTemporaryAttribute(String key);
+    CopletAdapter getCopletAdapter(String name);
 
     /**
-     * Return the names of all temporary attributes.
+     * Get the coplet factory.
      */
-    Iterator getTemporaryAttributeNames();
+    CopletFactory getCopletFactory();
 
     /**
-     * Change the default layout key for most functions
+     * Get the layout factory
      */
-    void setDefaultLayoutKey(String layoutKey);
+    LayoutFactory getLayoutFactory();
 
     /**
-     * Get the default layout key
+     * Get the event manager
      */
-    String getDefaultLayoutKey();
+    EventManager getEventManager();
 
     /**
-     * Return all skins
+     * Get the portal manager
+     * @since 2.1.8
      */
-    List getSkinDescriptions();
+    PortalManager getPortalManager();
 
     /**
-     * Get a configuration value.
-     * @param key The key for the configuration.
-     * @return The value of the configuration or null.
+     * Register a renderer.
      * @since 2.2
      */
-    String getConfiguration(String key);
+    void register(String name, Renderer renderer);
 
     /**
-     * Get a configuration value.
-     * @param key The key for the configuration.
-     * @param defaultValue The default value if no configuration for the key is available.
-     * @return The value of the configuration or the default value.
+     * Get the process info provider for accessing request
+     * information.
      * @since 2.2
      */
-    String getConfiguration(String key, String defaultValue);
+    ProcessInfoProvider getProcessInfoProvider();
 
     /**
-     * Get a configuration value as a boolean.
-     * @param key The key for the configuration.
-     * @param defaultValue The default value if no configuration for the key is available.
-     * @return The value of the configuration or the default value.
-     * @since 2.2
+     * Get the user service.
      */
-    boolean getConfigurationAsBoolean(String key, boolean defaultValue);
+    UserService getUserService();
 }

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/ActionCounterEventAspect.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/ActionCounterEventAspect.java?rev=432969&r1=432968&r2=432969&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/ActionCounterEventAspect.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/ActionCounterEventAspect.java Sun Aug 20 07:03:27 2006
@@ -57,14 +57,14 @@
 
         int actionCount;
 
-        Integer actionValue = (Integer) service.getAttribute(ATTRIBUTE_NAME);
+        Integer actionValue = (Integer) service.getUserService().getAttribute(ATTRIBUTE_NAME);
         if (null == actionValue) {
             actionValue = new Integer(0);
-            service.setAttribute(ATTRIBUTE_NAME, actionValue);
+            service.getUserService().setAttribute(ATTRIBUTE_NAME, actionValue);
             actionCount = 0;
         } else {
             actionCount = actionValue.intValue() + 1;
-            service.setAttribute(ATTRIBUTE_NAME, new Integer(actionCount));
+            service.getUserService().setAttribute(ATTRIBUTE_NAME, new Integer(actionCount));
         }
 
         final Request request = ObjectModelHelper.getRequest( service.getProcessInfoProvider().getObjectModel() );

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/impl/DefaultEventConverter.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/impl/DefaultEventConverter.java?rev=432969&r1=432968&r2=432969&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/impl/DefaultEventConverter.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/impl/DefaultEventConverter.java Sun Aug 20 07:03:27 2006
@@ -164,7 +164,7 @@
             }
             return o.toString() + ':' + data;
         }
-        List list = (List)this.portalService.getAttribute(EVENT_LIST);
+        List list = (List)this.portalService.getUserService().getAttribute(EVENT_LIST);
         if ( null == list ) {
             list = new ArrayList();
         }
@@ -172,7 +172,7 @@
         if ( index == -1 ) {
             list.add(event);
             index = list.size() - 1;
-            this.portalService.setAttribute(EVENT_LIST, list);
+            this.portalService.getUserService().setAttribute(EVENT_LIST, list);
         }
         return String.valueOf(index);
     }
@@ -213,7 +213,7 @@
                     return converter.decode(data);
                 }
             }
-            List list = (List)this.portalService.getAttribute(EVENT_LIST);
+            List list = (List)this.portalService.getUserService().getAttribute(EVENT_LIST);
             if ( null != list ) {
                 int index = new Integer(value).intValue();
                 if (index < list.size()) {

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/user/UserDidLoginEvent.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/user/UserDidLoginEvent.java?rev=432969&r1=432968&r2=432969&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/user/UserDidLoginEvent.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/user/UserDidLoginEvent.java Sun Aug 20 07:03:27 2006
@@ -15,7 +15,7 @@
  */
 package org.apache.cocoon.portal.event.user;
 
-import org.apache.cocoon.portal.profile.PortalUser;
+import org.apache.cocoon.portal.om.PortalUser;
 
 /**
  * This event is send when a new user logs into the portal.

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/user/UserEvent.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/user/UserEvent.java?rev=432969&r1=432968&r2=432969&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/user/UserEvent.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/user/UserEvent.java Sun Aug 20 07:03:27 2006
@@ -16,7 +16,7 @@
 package org.apache.cocoon.portal.event.user;
 
 import org.apache.cocoon.portal.event.Event;
-import org.apache.cocoon.portal.profile.PortalUser;
+import org.apache.cocoon.portal.om.PortalUser;
 
 /**
  * This interface marks an event as a user related event.

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/user/UserEventUtil.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/user/UserEventUtil.java?rev=432969&r1=432968&r2=432969&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/user/UserEventUtil.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/user/UserEventUtil.java Sun Aug 20 07:03:27 2006
@@ -17,7 +17,7 @@
 
 import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.event.Event;
-import org.apache.cocoon.portal.profile.PortalUser;
+import org.apache.cocoon.portal.om.PortalUser;
 
 /**
  * Utility class for user events.

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/user/UserIsAccessingEvent.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/user/UserIsAccessingEvent.java?rev=432969&r1=432968&r2=432969&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/user/UserIsAccessingEvent.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/user/UserIsAccessingEvent.java Sun Aug 20 07:03:27 2006
@@ -15,7 +15,7 @@
  */
 package org.apache.cocoon.portal.event.user;
 
-import org.apache.cocoon.portal.profile.PortalUser;
+import org.apache.cocoon.portal.om.PortalUser;
 
 /**
  * This event is send when a user is accessing(using) the portal.

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/user/UserWillLogoutEvent.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/user/UserWillLogoutEvent.java?rev=432969&r1=432968&r2=432969&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/user/UserWillLogoutEvent.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/user/UserWillLogoutEvent.java Sun Aug 20 07:03:27 2006
@@ -15,7 +15,7 @@
  */
 package org.apache.cocoon.portal.event.user;
 
-import org.apache.cocoon.portal.profile.PortalUser;
+import org.apache.cocoon.portal.om.PortalUser;
 
 /**
  * This event is send when a user logs out from the portal.

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PageLabelManager.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PageLabelManager.java?rev=432969&r1=432968&r2=432969&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PageLabelManager.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PageLabelManager.java Sun Aug 20 07:03:27 2006
@@ -151,10 +151,10 @@
         PortalService service = null;
         try {
             service = (PortalService) this.manager.lookup(PortalService.ROLE);
-            Map map = (Map) service.getAttribute(EVENT_MAP);
+            Map map = (Map) service.getUserService().getAttribute(EVENT_MAP);
             if (null == map) {
                 map = new HashMap();
-                service.setAttribute(EVENT_MAP, map);
+                service.getUserService().setAttribute(EVENT_MAP, map);
             }
 
             return map;
@@ -176,10 +176,10 @@
         PortalService service = null;
         try {
             service = (PortalService) this.manager.lookup(PortalService.ROLE);
-            Map map = (Map) service.getAttribute(LABEL_MAP);
+            Map map = (Map) service.getUserService().getAttribute(LABEL_MAP);
             if (null == map) {
                 map = initializeLabels(service);
-                service.setAttribute(LABEL_MAP, map);
+                service.getUserService().setAttribute(LABEL_MAP, map);
             }
 
             List list = (List) map.get(pageLabel);
@@ -204,10 +204,10 @@
         PortalService service = null;
         try {
             service = (PortalService) this.manager.lookup(PortalService.ROLE);
-            String[] labels = (String[]) service.getAttribute(LABEL_ARRAY);
+            String[] labels = (String[]) service.getUserService().getAttribute(LABEL_ARRAY);
             if (null == labels) {
                 labels = new String[2];
-                service.setAttribute(LABEL_ARRAY, labels);
+                service.getUserService().setAttribute(LABEL_ARRAY, labels);
             }
             return labels;
         }

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalManagerAspectChain.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalManagerAspectChain.java?rev=432969&r1=432968&r2=432969&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalManagerAspectChain.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalManagerAspectChain.java Sun Aug 20 07:03:27 2006
@@ -52,7 +52,7 @@
                 PortalManagerAspect pAspect;
                 if ( role != null ) {
                     try {
-                        pAspect = (PortalManagerAspect) manager.lookup(PortalManagerAspect.ROLE + '/' + role);                        
+                        pAspect = (PortalManagerAspect) manager.lookup(PortalManagerAspect.class.getName() + '/' + role);                        
                     } catch (ServiceException se) {
                         throw new ConfigurationException("Unable to lookup aspect " + role, current, se);
                     }

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java?rev=432969&r1=432968&r2=432969&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java Sun Aug 20 07:03:27 2006
@@ -18,7 +18,7 @@
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Enumeration;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -38,10 +38,8 @@
 import org.apache.avalon.framework.service.Serviceable;
 import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.cocoon.Constants;
-import org.apache.cocoon.components.ContextHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.Session;
 import org.apache.cocoon.portal.PortalManager;
+import org.apache.cocoon.portal.PortalRuntimeException;
 import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.coplet.adapter.CopletAdapter;
 import org.apache.cocoon.portal.event.EventManager;
@@ -51,6 +49,7 @@
 import org.apache.cocoon.portal.services.CopletFactory;
 import org.apache.cocoon.portal.services.LayoutFactory;
 import org.apache.cocoon.portal.services.LinkService;
+import org.apache.cocoon.portal.services.UserService;
 import org.apache.cocoon.processing.ProcessInfoProvider;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceResolver;
@@ -80,142 +79,59 @@
     /** The service locator. */
     protected ServiceManager manager;
 
-    /** The manager for some core portal components. */
-    protected DefaultPortalComponentManager portalComponentManager;
-
     /** The list of skins. */
     protected List skinList = new ArrayList();
 
     /** The name of the portal. */
     protected String portalName;
 
-    /** The default layout key. */
-    protected String defaultLayoutKey;
-
-    /** The attribute prefix used to prefix attributes in the session and request. */
-    protected String attributePrefix;
-
-    final protected static String KEY = PortalServiceImpl.class.getName();
-
     /** The portal configuration. */
     protected Configuration configuration;
 
-    /**
-     * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
-     */
-    public void service(ServiceManager serviceManager) throws ServiceException {
-        this.manager = serviceManager;
-        this.portalComponentManager = new DefaultPortalComponentManager(this.manager);
-    }
+    /** The profile manager. */
+    protected ProfileManager profileManager;
 
-    /**
-     * @see org.apache.cocoon.portal.PortalService#getPortalName()
-     */
-    public String getPortalName() {
-        return this.portalName;
-    }
+    /** The link service. */
+    protected LinkService linkService;
 
-    /**
-     * @see org.apache.cocoon.portal.PortalService#getAttribute(java.lang.String)
-     */
-    public Object getAttribute(String key) {
-        final Session session = ContextHelper.getRequest(this.context).getSession(false);
-        if (session == null) {
-            return null;
-        }
-        return session.getAttribute( this.attributePrefix + key);
-    }
+    /** The used renderers. */
+    protected Map renderers = new HashMap();
 
-    /**
-     * @see org.apache.cocoon.portal.PortalService#setAttribute(java.lang.String, java.lang.Object)
-     */
-    public void setAttribute(String key, Object value) {
-        final Session session = ContextHelper.getRequest(this.context).getSession();
-        session.setAttribute( this.attributePrefix + key, value);
-    }
+    /** The used coplet adapters. */
+    protected Map copletAdapters = new HashMap();
 
-    /**
-     * @see org.apache.cocoon.portal.PortalService#removeAttribute(java.lang.String)
-     */
-    public Object removeAttribute(String key) {
-        final Session session = ContextHelper.getRequest(this.context).getSession(false);
-        if ( session != null ) {
-            Object value = session.getAttribute(this.attributePrefix + key);
-            if ( value != null ) {
-                session.removeAttribute( this.attributePrefix + key );
-            }
-            return value;
-        }
-        return null;
-    }
+    /** The coplet factory. */
+    protected CopletFactory copletFactory;
 
-    /**
-     * @see org.apache.cocoon.portal.PortalService#getAttributeNames()
-     */
-    public Iterator getAttributeNames() {
-        final Session session = ContextHelper.getRequest(this.context).getSession(false);
-        if ( session != null ) {
-            List names = new ArrayList();
-            Enumeration e = session.getAttributeNames();
-            final int pos = this.attributePrefix.length() + 1;
-            if ( e != null ) {
-                while ( e.hasMoreElements() ) {
-                    final String name = (String)e.nextElement();
-                    if ( name.startsWith( this.attributePrefix )) {
-                        names.add( name.substring( pos ) );
-                    }
-                }
-            }
-            return names.iterator();
-        }
-        return Collections.EMPTY_MAP.keySet().iterator();
-    }
+    /** The layout factory. */
+    protected LayoutFactory layoutFactory;
 
-    /**
-     * @see org.apache.cocoon.portal.PortalService#getTemporaryAttribute(java.lang.String)
-     */
-    public Object getTemporaryAttribute(String key) {
-        final Request request = ContextHelper.getRequest(this.context);
-        return request.getAttribute(this.attributePrefix + key);
-    }
+    /** The event manager. */
+    protected EventManager eventManager;
 
-    /**
-     * @see org.apache.cocoon.portal.PortalService#setTemporaryAttribute(java.lang.String, java.lang.Object)
-     */
-    public void setTemporaryAttribute(String key, Object value) {
-        final Request request = ContextHelper.getRequest(this.context);
-        request.setAttribute( this.attributePrefix + key, value );
-    }
+    /** The portal manager. */
+    protected PortalManager portalManager;
+
+    /** The process info provider. */
+    protected ProcessInfoProvider processInfoProvider;
+
+    /** The user service. */
+    protected UserService userService;
 
     /**
-     * @see org.apache.cocoon.portal.PortalService#removeTemporaryAttribute(java.lang.String)
+     * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
      */
-    public Object removeTemporaryAttribute(String key) {
-        final Request request = ContextHelper.getRequest(this.context);
-        final Object oldValue = request.getAttribute(this.attributePrefix + key);
-        if ( oldValue != null ) {
-            request.removeAttribute( this.attributePrefix + key );
-        }
-        return oldValue;
+    public void service(ServiceManager serviceManager) throws ServiceException {
+        this.manager = serviceManager;
+        this.processInfoProvider = (ProcessInfoProvider)this.manager.lookup(ProcessInfoProvider.ROLE);
+        this.userService = (UserService)this.manager.lookup(UserService.class.getName());
     }
 
     /**
-     * @see org.apache.cocoon.portal.PortalService#getTemporaryAttributeNames()
+     * @see org.apache.cocoon.portal.PortalService#getPortalName()
      */
-    public Iterator getTemporaryAttributeNames() {
-        final Request request = ContextHelper.getRequest(this.context);
-        List names = new ArrayList();
-        Enumeration e = request.getAttributeNames();
-        final int pos = this.attributePrefix.length() + 1;
-        if ( e != null ) {
-            while ( e.hasMoreElements() ) {
-                final String name = (String)e.nextElement();
-                if ( name.startsWith( this.attributePrefix )) {
-                    names.add( name.substring( pos ) );
-                }
-            }
-        }
-        return names.iterator();
+    public String getPortalName() {
+        return this.portalName;
     }
 
     /**
@@ -239,9 +155,6 @@
      * @see org.apache.avalon.framework.activity.Disposable#dispose()
      */
     public void dispose() {
-        if ( this.portalComponentManager != null ) {
-            this.portalComponentManager.dispose();
-        }
         // remove the portal service from the servlet context - if available
         if ( this.context != null ) {
             try {
@@ -251,6 +164,31 @@
                 // we ignore the context exception
             }
         }
+        if ( this.manager != null ) {
+            this.renderers.clear();
+            Iterator i = this.copletAdapters.values().iterator();
+            while (i.hasNext()) {
+                this.manager.release(i.next());
+            }
+            this.copletAdapters.clear();
+            this.manager.release(this.profileManager);
+            this.profileManager = null;
+            this.manager.release(this.linkService);
+            this.linkService = null;
+            this.manager.release(this.copletFactory);
+            this.copletFactory = null;
+            this.manager.release(this.layoutFactory);
+            this.layoutFactory = null;
+            this.manager.release(this.eventManager);
+            this.eventManager = null;
+            this.manager.release(this.portalManager);
+            this.portalManager = null;
+            this.manager.release(this.processInfoProvider);
+            this.processInfoProvider = null;
+            this.manager.release(this.userService);
+            this.userService = null;
+            this.manager = null;
+        }
     }
 
     /**
@@ -262,8 +200,6 @@
             throw new ConfigurationException("No portal configured.", config);
         }
         this.portalName = portal.getAttribute("name");
-        this.defaultLayoutKey = portal.getAttribute("default-layout-key", "portal");
-        this.attributePrefix = this.getClass().getName() + '/' + this.portalName + '/';
         this.configuration = portal.getChild("configuration");
         this.configureSkins(this.getConfiguration(org.apache.cocoon.portal.Constants.CONFIGURATION_SKINS_PATH,
                                                   org.apache.cocoon.portal.Constants.DEFAULT_CONFIGURATION_SKINS_PATH));
@@ -316,29 +252,6 @@
     }
 
     /**
-     * @see org.apache.cocoon.portal.PortalService#setDefaultLayoutKey(java.lang.String)
-     */
-    public void setDefaultLayoutKey(String layoutKey) {
-        if ( layoutKey == null ) {
-            this.removeAttribute("default-layout-key");
-        } else {
-            this.setAttribute("default-layout-key", layoutKey);
-        }
-    }
-
-    /**
-     * @see org.apache.cocoon.portal.PortalService#getDefaultLayoutKey()
-     */
-    public String getDefaultLayoutKey() {
-        String key = (String)this.getAttribute("default-layout-key");
-        if ( key == null ) {
-            key = this.defaultLayoutKey;
-            this.setDefaultLayoutKey(key);
-        }
-        return key;
-    }
-
-    /**
      * @see org.apache.cocoon.portal.PortalService#getSkinDescriptions()
      */
     public List getSkinDescriptions() {
@@ -367,72 +280,134 @@
     }
 
     /**
-     * @see org.apache.cocoon.portal.PortalComponentManager#getCopletAdapter(java.lang.String)
+     * @see org.apache.cocoon.portal.PortalService#getLinkService()
      */
-    public CopletAdapter getCopletAdapter(String name) {
-        return this.portalComponentManager.getCopletAdapter(name);
+    public LinkService getLinkService() {
+        if ( null == this.linkService ) {
+            try {
+                this.linkService = (LinkService)this.manager.lookup( LinkService.class.getName() );
+            } catch (ServiceException e) {
+                throw new PortalRuntimeException("Unable to lookup link service.", e);
+            }
+        }
+        return this.linkService;
     }
 
     /**
-     * @see org.apache.cocoon.portal.PortalComponentManager#getCopletFactory()
+     * @see org.apache.cocoon.portal.PortalService#getProfileManager()
      */
-    public CopletFactory getCopletFactory() {
-        return this.portalComponentManager.getCopletFactory();
+    public ProfileManager getProfileManager() {
+        if ( null == this.profileManager ) {
+            try {
+                this.profileManager = (ProfileManager)this.manager.lookup( ProfileManager.class.getName() );
+            } catch (ServiceException e) {
+                throw new PortalRuntimeException("Unable to lookup profile manager.", e);
+            }
+        }
+        return this.profileManager;
     }
 
     /**
-     * @see org.apache.cocoon.portal.PortalComponentManager#getEventManager()
+     * @see org.apache.cocoon.portal.PortalService#getEventManager()
      */
     public EventManager getEventManager() {
-        return this.portalComponentManager.getEventManager();
+        if ( null == this.eventManager ) {
+            try {
+                this.eventManager = (EventManager)this.manager.lookup( EventManager.ROLE );
+            } catch (ServiceException e) {
+                throw new PortalRuntimeException("Unable to lookup event manager.", e);
+            }
+        }
+        return this.eventManager;
     }
 
     /**
-     * @see org.apache.cocoon.portal.PortalComponentManager#getLayoutFactory()
+     * @see org.apache.cocoon.portal.PortalService#getRenderer(java.lang.String)
      */
-    public LayoutFactory getLayoutFactory() {
-        return this.portalComponentManager.getLayoutFactory();
+    public Renderer getRenderer(String name) {
+        final Renderer o = (Renderer) this.renderers.get( name );
+        if ( o == null ) {
+            throw new PortalRuntimeException("Unable to lookup renderer with name " + name);
+        }
+        return o;
     }
 
     /**
-     * @see org.apache.cocoon.portal.PortalComponentManager#getLinkService()
+     * @see org.apache.cocoon.portal.PortalService#getCopletAdapter(java.lang.String)
      */
-    public LinkService getLinkService() {
-        return this.portalComponentManager.getLinkService();
+    public CopletAdapter getCopletAdapter(String name) {
+        CopletAdapter o = (CopletAdapter) this.copletAdapters.get( name );
+        if ( o == null ) {
+            try {
+                o = (CopletAdapter) this.manager.lookup( CopletAdapter.ROLE + '/' + name );
+                this.copletAdapters.put( name, o );
+            } catch (ServiceException e) {
+                throw new PortalRuntimeException("Unable to lookup coplet adapter with name " + name, e);
+            }
+        }
+        return o;
     }
 
     /**
-     * @see org.apache.cocoon.portal.PortalComponentManager#getPortalManager()
+     * @see org.apache.cocoon.portal.PortalService#getCopletFactory()
      */
-    public PortalManager getPortalManager() {
-        return this.portalComponentManager.getPortalManager();
+    public CopletFactory getCopletFactory() {
+        if ( null == this.copletFactory ) {
+            try {
+                this.copletFactory = (CopletFactory)this.manager.lookup( CopletFactory.class.getName() );
+            } catch (ServiceException e) {
+                throw new PortalRuntimeException("Unable to lookup coplet factory.", e);
+            }
+        }
+        return this.copletFactory;
     }
 
     /**
-     * @see org.apache.cocoon.portal.PortalComponentManager#getProfileManager()
+     * @see org.apache.cocoon.portal.PortalService#getLayoutFactory()
      */
-    public ProfileManager getProfileManager() {
-        return this.portalComponentManager.getProfileManager();
+    public LayoutFactory getLayoutFactory() {
+        if ( null == this.layoutFactory ) {
+            try {
+                this.layoutFactory = (LayoutFactory)this.manager.lookup( LayoutFactory.class.getName() );
+            } catch (ServiceException e) {
+                throw new PortalRuntimeException("Unable to lookup layout factory.", e);
+            }
+        }
+        return this.layoutFactory;
     }
 
     /**
-     * @see org.apache.cocoon.portal.PortalComponentManager#getRenderer(java.lang.String)
+     * @see org.apache.cocoon.portal.PortalService#getPortalManager()
      */
-    public Renderer getRenderer(String name) {
-        return this.portalComponentManager.getRenderer(name);
+    public PortalManager getPortalManager() {
+        if ( null == this.portalManager ) {
+            try {
+                this.portalManager = (PortalManager)this.manager.lookup( PortalManager.class.getName() );
+            } catch (ServiceException e) {
+                throw new PortalRuntimeException("Unable to lookup portal manager.", e);
+            }
+        }
+        return this.portalManager;
     }
 
     /**
-     * @see org.apache.cocoon.portal.PortalComponentManager#register(java.lang.String, org.apache.cocoon.portal.layout.renderer.Renderer)
+     * @see org.apache.cocoon.portal.PortalService#register(String, org.apache.cocoon.portal.layout.renderer.Renderer)
      */
     public void register(String name, Renderer renderer) {
-        this.portalComponentManager.register(name, renderer);
+        this.renderers.put(name, renderer);
     }
 
     /**
-     * @see org.apache.cocoon.portal.PortalComponentManager#getProcessInfoProvider()
+     * @see org.apache.cocoon.portal.PortalService#getProcessInfoProvider()
      */
     public ProcessInfoProvider getProcessInfoProvider() {
-        return this.portalComponentManager.getProcessInfoProvider();
+        return this.processInfoProvider;
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.PortalService#getUserService()
+     */
+    public UserService getUserService() {
+        return this.userService;
     }
 }

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/om/CopletInstanceFeatures.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/om/CopletInstanceFeatures.java?rev=432969&r1=432968&r2=432969&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/om/CopletInstanceFeatures.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/om/CopletInstanceFeatures.java Sun Aug 20 07:03:27 2006
@@ -66,7 +66,7 @@
     }
 
     public static List getChangedCopletInstanceDataObjects(PortalService service) {
-        List list = (List)service.getTemporaryAttribute(CHANGED_COPLETS_ATTRIBUTE_NAME);
+        List list = (List)service.getUserService().getTemporaryAttribute(CHANGED_COPLETS_ATTRIBUTE_NAME);
         if ( list == null ) {
             return Collections.EMPTY_LIST;
         }
@@ -75,14 +75,14 @@
 
     public static void addChangedCopletInstanceData(PortalService service,
                                                     CopletInstance cid) {
-        List list = (List)service.getTemporaryAttribute(CHANGED_COPLETS_ATTRIBUTE_NAME);
+        List list = (List)service.getUserService().getTemporaryAttribute(CHANGED_COPLETS_ATTRIBUTE_NAME);
         if ( list == null ) {
             list = new ArrayList();
         }
         if ( !list.contains(cid) ) {
             list.add(cid);
         }
-        service.setTemporaryAttribute(CHANGED_COPLETS_ATTRIBUTE_NAME, list);
+        service.getUserService().setTemporaryAttribute(CHANGED_COPLETS_ATTRIBUTE_NAME, list);
     }
 
     public static String sizeToString(int value) {

Copied: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/om/PortalUser.java (from r432835, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/PortalUser.java)
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/om/PortalUser.java?p2=cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/om/PortalUser.java&p1=cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/PortalUser.java&r1=432835&r2=432969&rev=432969&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/PortalUser.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/om/PortalUser.java Sun Aug 20 07:03:27 2006
@@ -13,9 +13,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.cocoon.portal.profile;
+package org.apache.cocoon.portal.om;
 
 import java.security.Principal;
+import java.util.Collection;
 import java.util.Map;
 
 /**
@@ -32,9 +33,9 @@
     boolean isAnonymous();
 
     /**
-     * @return Returns the group.
+     * @return Return all groups.
      */
-    String getGroup();
+    Collection getGroups();
 
     /**
      * @return Returns the userName.
@@ -75,4 +76,10 @@
      * @return A string specifying the mechanism or null.
      */
     String getAuthType();
+
+    /**
+     * Return the default layout key for this user.
+     * @return The default layout key or null if the portal wide default should be used.
+     */
+    String getDefaultLayoutKey();
 }

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/ProfileManager.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/ProfileManager.java?rev=432969&r1=432968&r2=432969&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/ProfileManager.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/ProfileManager.java Sun Aug 20 07:03:27 2006
@@ -33,8 +33,6 @@
  */
 public interface ProfileManager {
 
-    String ROLE = ProfileManager.class.getName();
-
     /**
      * Get the portal layout defined by the layout id.
      * @param layoutID    The id of a layout object or null for the root object
@@ -92,9 +90,4 @@
      * Get a specific coplet type for the current user.
      */
     CopletType getCopletType(String id);
-
-    /**
-     * Get current user information.
-     */
-    PortalUser getUser();
 }

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/AbstractPortalUser.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/AbstractPortalUser.java?rev=432969&r1=432968&r2=432969&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/AbstractPortalUser.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/AbstractPortalUser.java Sun Aug 20 07:03:27 2006
@@ -17,10 +17,11 @@
 
 import java.io.Serializable;
 import java.security.Principal;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Map;
 
-import org.apache.cocoon.portal.profile.PortalUser;
+import org.apache.cocoon.portal.om.PortalUser;
 
 /**
  * Information about the current user.
@@ -35,7 +36,7 @@
     /** The unique name of the user. */
     protected String userName;
 
-    protected String group;
+    protected Collection groups = Collections.EMPTY_LIST;
 
     protected Map userInfo = Collections.EMPTY_MAP;
 
@@ -47,7 +48,7 @@
     }
 
     /**
-     * @see org.apache.cocoon.portal.profile.PortalUser#isAnonymous()
+     * @see org.apache.cocoon.portal.om.PortalUser#isAnonymous()
      */
     public boolean isAnonymous() {
         return this.anonymous;
@@ -58,17 +59,17 @@
     }
 
     /**
-     * @return Returns the group.
+     * @see org.apache.cocoon.portal.om.PortalUser#getGroups()
      */
-    public String getGroup() {
-        return group;
+    public Collection getGroups() {
+        return groups;
     }
 
     /**
      * @param group The group to set.
      */
-    public void setGroup(String group) {
-        this.group = group;
+    public void setGroups(Collection groups) {
+        this.groups = groups;
     }
 
     /**
@@ -86,21 +87,21 @@
     }
 
     /**
-     * @see org.apache.cocoon.portal.profile.PortalUser#getUserInfo(java.lang.String)
+     * @see org.apache.cocoon.portal.om.PortalUser#getUserInfo(java.lang.String)
      */
     public Object getUserInfo(String key) {
         return this.userInfo.get(key);
     }
 
     /**
-     * @see org.apache.cocoon.portal.profile.PortalUser#getUserInfos()
+     * @see org.apache.cocoon.portal.om.PortalUser#getUserInfos()
      */
     public Map getUserInfos() {
         return this.userInfo;
     }
 
     public void setUserInfos(Map infos) {
-        if ( infos == null ) {
+        if ( infos == null || infos.size() == 0) {
             this.userInfo = Collections.EMPTY_MAP;
         } else {
             this.userInfo = Collections.unmodifiableMap(infos);
@@ -108,16 +109,23 @@
     }
 
     /**
-     * @see org.apache.cocoon.portal.profile.PortalUser#getUserPrincipal()
+     * @see org.apache.cocoon.portal.om.PortalUser#getUserPrincipal()
      */
     public Principal getUserPrincipal() {
         return null;
     }
 
     /**
-     * @see org.apache.cocoon.portal.profile.PortalUser#getAuthType()
+     * @see org.apache.cocoon.portal.om.PortalUser#getAuthType()
      */
     public String getAuthType() {
+        return null;
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.om.PortalUser#getDefaultLayoutKey()
+     */
+    public String getDefaultLayoutKey() {
         return null;
     }
 }

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/AbstractProfileManager.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/AbstractProfileManager.java?rev=432969&r1=432968&r2=432969&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/AbstractProfileManager.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/AbstractProfileManager.java Sun Aug 20 07:03:27 2006
@@ -38,7 +38,7 @@
 import org.apache.cocoon.portal.om.CopletLayout;
 import org.apache.cocoon.portal.om.Item;
 import org.apache.cocoon.portal.om.Layout;
-import org.apache.cocoon.portal.profile.PortalUser;
+import org.apache.cocoon.portal.om.PortalUser;
 import org.apache.cocoon.portal.profile.ProfileManager;
 import org.apache.cocoon.portal.profile.ProfileManagerAspect;
 import org.apache.cocoon.portal.scratchpad.Profile;
@@ -52,9 +52,6 @@
     extends AbstractComponent 
     implements ProfileManager, Receiver, Configurable {
 
-    /** Attribute to store the current user. */
-    public static final String USER_ATTRIBUTE = AbstractProfileManager.class.getName() + "/User";
-
     /** The configuration. */
     protected Configuration configuration;
 
@@ -100,7 +97,6 @@
      * @see Receiver
      */
     public void inform(UserEvent event, PortalService service) {
-        this.portalService.setTemporaryAttribute(USER_ATTRIBUTE, event.getPortalUser());
         if ( event instanceof UserDidLoginEvent ) {
             this.login(event.getPortalUser());
         } else if ( event instanceof UserWillLogoutEvent ) {

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java?rev=432969&r1=432968&r2=432969&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java Sun Aug 20 07:03:27 2006
@@ -44,7 +44,7 @@
 import org.apache.cocoon.portal.om.CopletType;
 import org.apache.cocoon.portal.om.Layout;
 import org.apache.cocoon.portal.om.LayoutInstance;
-import org.apache.cocoon.portal.profile.PortalUser;
+import org.apache.cocoon.portal.om.PortalUser;
 import org.apache.cocoon.portal.profile.ProfileException;
 import org.apache.cocoon.portal.profile.ProfileLS;
 import org.apache.cocoon.portal.scratchpad.Profile;
@@ -132,28 +132,28 @@
 
     protected ProfileImpl getUserProfile(String layoutKey) {
         if ( layoutKey == null ) {
-            layoutKey = this.portalService.getDefaultLayoutKey();
+            layoutKey = this.portalService.getUserService().getDefaultLayoutKey();
         }
 
-        return (ProfileImpl)this.portalService.getAttribute(KEY_PREFIX + layoutKey);
+        return (ProfileImpl)this.portalService.getUserService().getAttribute(KEY_PREFIX + layoutKey);
     }
 
     protected void removeUserProfiles() {
         // TODO: remove all profiles - we have to rememember all used layout keys
-        final String layoutKey = this.portalService.getDefaultLayoutKey();
+        final String layoutKey = this.portalService.getUserService().getDefaultLayoutKey();
 
-        this.portalService.removeAttribute(KEY_PREFIX + layoutKey);
+        this.portalService.getUserService().removeAttribute(KEY_PREFIX + layoutKey);
     }
 
     protected void storeUserProfile(String layoutKey, Profile profile) {
         if ( layoutKey == null ) {
-            layoutKey = this.portalService.getDefaultLayoutKey();
+            layoutKey = this.portalService.getUserService().getDefaultLayoutKey();
         }
-        this.portalService.setAttribute(KEY_PREFIX + layoutKey, profile);
+        this.portalService.getUserService().setAttribute(KEY_PREFIX + layoutKey, profile);
     }
 
     /**
-     * @see org.apache.cocoon.portal.profile.impl.AbstractProfileManager#login(org.apache.cocoon.portal.profile.PortalUser)
+     * @see org.apache.cocoon.portal.profile.impl.AbstractProfileManager#login(org.apache.cocoon.portal.om.PortalUser)
      */
     protected void login(PortalUser user) {
         super.login(user);
@@ -163,7 +163,7 @@
     }
 
     /**
-     * @see org.apache.cocoon.portal.profile.impl.AbstractProfileManager#logout(org.apache.cocoon.portal.profile.PortalUser)
+     * @see org.apache.cocoon.portal.profile.impl.AbstractProfileManager#logout(org.apache.cocoon.portal.om.PortalUser)
      */
     protected void logout(PortalUser user) {
         final Profile profile = this.getUserProfile(null);
@@ -279,7 +279,7 @@
     }
 
     public Layout getLayout(String layoutId) {
-        final String layoutKey = this.portalService.getDefaultLayoutKey();
+        final String layoutKey = this.portalService.getUserService().getDefaultLayoutKey();
 
         Profile profile = this.getUserProfile(layoutKey);
         if ( profile == null ) {
@@ -325,7 +325,7 @@
      */
     protected Profile loadProfile(final String layoutKey) 
     throws Exception {
-        final PortalUser info = (PortalUser)this.portalService.getTemporaryAttribute(USER_ATTRIBUTE);
+        final PortalUser info = this.portalService.getUserService().getUser();
         ProfileImpl profile = new ProfileImpl(layoutKey);
 
         // first "load" the global data
@@ -334,7 +334,7 @@
 
         // now load the user/group specific data
         if ( !this.getCopletInstanceDatas(profile, info, CATEGORY_USER, layoutKey) ) {
-            if ( info.getGroup() == null || !this.getCopletInstanceDatas(profile, info, CATEGORY_GROUP, layoutKey)) {
+            if ( info.getGroups().size() == 0 || !this.getCopletInstanceDatas(profile, info, CATEGORY_GROUP, layoutKey)) {
                 if ( !this.getCopletInstanceDatas(profile, info, CATEGORY_GLOBAL, layoutKey) ) {
                     throw new ProcessingException("No profile for copletinstancedatas found.");
                 }
@@ -342,7 +342,7 @@
         }
 
         if ( !this.getLayout(profile, info, CATEGORY_USER, layoutKey) ) {
-            if ( info.getGroup() == null || !this.getLayout(profile, info, CATEGORY_GROUP, layoutKey)) {
+            if ( info.getGroups().size() == 0 || !this.getLayout(profile, info, CATEGORY_GROUP, layoutKey)) {
                 if ( !this.getLayout(profile, info, CATEGORY_GLOBAL, layoutKey) ) {
                     throw new ProcessingException("No profile for layout found.");
                 }
@@ -541,7 +541,9 @@
         key.put("layout", layoutKey);
         key.put("type", category);
         if ( CATEGORY_GROUP.equals(category) ) {
-            key.put("group", info.getGroup());
+            // TODO Groups is a collection!
+            key.put("group", "none");
+            //key.put("group", info.getGroups());
         } else if ( CATEGORY_USER.equals(category) ) {
             key.put("user", info.getUserName());
         }
@@ -550,24 +552,17 @@
     }
 
     /**
-     * @see org.apache.cocoon.portal.profile.ProfileManager#getUser()
-     */
-    public PortalUser getUser() {
-        return (PortalUser)this.portalService.getTemporaryAttribute(USER_ATTRIBUTE);
-    }
-
-    /**
      * @see org.apache.cocoon.portal.profile.impl.AbstractProfileManager#saveUserCopletInstanceDatas(java.lang.String)
      */
     public void saveUserCopletInstanceDatas(String layoutKey) {
         try {
             if (layoutKey == null) {
-                layoutKey = this.portalService.getDefaultLayoutKey();
+                layoutKey = this.portalService.getUserService().getDefaultLayoutKey();
             }
             final ProfileImpl profile = this.getUserProfile(layoutKey);
             final Map key = this.buildKey(CATEGORY_USER,
                                           ProfileLS.PROFILETYPE_COPLETINSTANCE,
-                                          this.getUser(),
+                                          this.portalService.getUserService().getUser(),
                                           false,
                                           layoutKey);
             this.loader.saveProfile(key, ProfileLS.PROFILETYPE_COPLETINSTANCE, profile.getCopletInstances());
@@ -583,12 +578,12 @@
     public void saveUserLayout(String layoutKey) {
         try {
             if (layoutKey == null) {
-                layoutKey = this.portalService.getDefaultLayoutKey();
+                layoutKey = this.portalService.getUserService().getDefaultLayoutKey();
             }
             final Profile profile = this.getUserProfile(layoutKey);
             final Map key = this.buildKey(CATEGORY_USER,
                                           ProfileLS.PROFILETYPE_LAYOUT, 
-                                          this.getUser(), 
+                                          this.portalService.getUserService().getUser(),
                                           false,
                                           layoutKey);
             this.loader.saveProfile(key, ProfileLS.PROFILETYPE_LAYOUT, profile.getRootLayout());
@@ -615,7 +610,7 @@
         if ( this.copletTypes.objects == null ) {
             try {
                 // first "load" the global data
-                this.getGlobalBaseDatas(this.portalService.getDefaultLayoutKey());
+                this.getGlobalBaseDatas(this.portalService.getUserService().getDefaultLayoutKey());
             } catch (Exception e) {
                 throw new ProfileException("Unable to load global base datas.", e);
             }            

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/StaticProfileManager.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/StaticProfileManager.java?rev=432969&r1=432968&r2=432969&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/StaticProfileManager.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/StaticProfileManager.java Sun Aug 20 07:03:27 2006
@@ -31,7 +31,6 @@
 import org.apache.cocoon.portal.om.Item;
 import org.apache.cocoon.portal.om.Layout;
 import org.apache.cocoon.portal.om.LayoutInstance;
-import org.apache.cocoon.portal.profile.PortalUser;
 import org.apache.cocoon.portal.profile.ProfileLS;
 import org.apache.cocoon.portal.profile.ProfileException;
 import org.apache.cocoon.portal.PortalRuntimeException;
@@ -56,18 +55,16 @@
 
     protected static final String LAYOUTKEY_PREFIX = StaticProfileManager.class.getName() + "/Layout/";
 
-    protected final PortalUser portalUser = new StaticPortalUser();
-
     /**
      * @see org.apache.cocoon.portal.profile.ProfileManager#getLayout(java.lang.String)
      */
     public Layout getLayout(String layoutID) {
         ProfileLS adapter = null;
         try {
-            final String layoutKey = this.portalService.getDefaultLayoutKey();
+            final String layoutKey = this.portalService.getUserService().getDefaultLayoutKey();
 
             String serviceKey = LAYOUTKEY_PREFIX + layoutKey;
-            Object[] objects = (Object[]) this.portalService.getAttribute(serviceKey);
+            Object[] objects = (Object[]) this.portalService.getUserService().getAttribute(serviceKey);
 
             // check if the layout is already cached and still valid
             int valid = SourceValidity.INVALID;
@@ -113,7 +110,7 @@
             // store the new values in the service
             if (newValidity != null) {
                 objects = new Object[] { layouts, newValidity };
-                this.portalService.setAttribute(serviceKey, objects);
+                this.portalService.getUserService().setAttribute(serviceKey, objects);
             }
 
             return (Layout) layouts.get(layoutID);
@@ -303,28 +300,6 @@
             return this.getCopletInstanceDataManager();
         } catch (Exception e) {
             throw new ProfileException("Error in getCopletInstanceDatas.", e);
-        }
-    }
-
-    /**
-     * @see org.apache.cocoon.portal.profile.ProfileManager#getUser()
-     */
-    public PortalUser getUser() {
-        return this.portalUser;
-    }
-
-    protected static final class StaticPortalUser extends AbstractPortalUser {
-
-        public StaticPortalUser() {
-            this.setUserName("static");
-            this.setAnonymous(true);
-        }
-
-        /**
-         * @see org.apache.cocoon.portal.profile.PortalUser#isUserInRole(java.lang.String)
-         */
-        public boolean isUserInRole(String role) {
-            return false;
         }
     }
 

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/CopletFactory.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/CopletFactory.java?rev=432969&r1=432968&r2=432969&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/CopletFactory.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/CopletFactory.java Sun Aug 20 07:03:27 2006
@@ -27,8 +27,6 @@
  */
 public interface CopletFactory  {
 
-    String ROLE = CopletFactory.class.getName();
-
     /** 
      * Create a new coplet instance.
      * This is also registered at the profile manager.

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/LayoutFactory.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/LayoutFactory.java?rev=432969&r1=432968&r2=432969&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/LayoutFactory.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/LayoutFactory.java Sun Aug 20 07:03:27 2006
@@ -29,8 +29,6 @@
  */
 public interface LayoutFactory  {
 
-    String ROLE = LayoutFactory.class.getName();
-
     /**
      * Return all available types.
      */

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/LinkService.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/LinkService.java?rev=432969&r1=432968&r2=432969&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/LinkService.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/LinkService.java Sun Aug 20 07:03:27 2006
@@ -27,8 +27,6 @@
  */
 public interface LinkService {
 
-    String ROLE = LinkService.class.getName();
-
     String DEFAULT_REQUEST_EVENT_PARAMETER_NAME = "cocoon-portal-event";
 
     static class ParameterDescription {

Added: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/UserService.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/UserService.java?rev=432969&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/UserService.java (added)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/UserService.java Sun Aug 20 07:03:27 2006
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.portal.services;
+
+import java.util.Collection;
+
+import org.apache.cocoon.portal.om.PortalUser;
+
+
+/**
+ * The user service provides access to the portal user object (which is a wrapper around the
+ * portal application specific user object).
+ * The user service can store user specific attributes which have the lifetime of the user
+ * session or the current request (temporary attributes).
+ *
+ * @version $Id$
+ */
+public interface UserService {
+
+    /**
+     * Get current user object.
+     */
+    PortalUser getUser();
+
+    /**
+     * Return the value of an attribute.
+     * @param key The key of the attribute
+     * @return The value of the attribute or null.
+     */
+    Object getAttribute(String key);
+
+    /**
+     * Set an attribute.
+     * @param key    The key of the attribute
+     * @param value  The new value
+     */
+    void setAttribute(String key, Object value);
+
+    /**
+     * Remove an attribute.
+     * @param key The key of the attribute
+     */
+    Object removeAttribute(String key);
+
+    /**
+     * Return the names of all attributes.
+     */
+    Collection getAttributeNames();
+
+    /**
+     * Return the value of a temporary attribute.
+     * @param key The key of the attribute
+     * @return The value of the attribute or null.
+     */
+    Object getTemporaryAttribute(String key);
+
+    /**
+     * Set a temporary attribute.
+     * @param key    The key of the attribute
+     * @param value  The new value
+     */
+    void setTemporaryAttribute(String key, Object value);
+
+    /**
+     * Remove a temporary attribute.
+     * @param key The key of the attribute
+     */
+    Object removeTemporaryAttribute(String key);
+
+    /**
+     * Return the names of all temporary attributes.
+     */
+    Collection getTemporaryAttributeNames();
+
+    /**
+     * Return the default layout key for the specific user.
+     */
+    String getDefaultLayoutKey();
+}
\ No newline at end of file

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/UserService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/UserService.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/impl/DefaultUserService.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/impl/DefaultUserService.java?rev=432969&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/impl/DefaultUserService.java (added)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/impl/DefaultUserService.java Sun Aug 20 07:03:27 2006
@@ -0,0 +1,215 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.portal.services.impl;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.cocoon.components.ContextHelper;
+import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.environment.Session;
+import org.apache.cocoon.portal.PortalService;
+import org.apache.cocoon.portal.event.Receiver;
+import org.apache.cocoon.portal.event.user.UserEvent;
+import org.apache.cocoon.portal.impl.AbstractComponent;
+import org.apache.cocoon.portal.om.PortalUser;
+import org.apache.cocoon.portal.services.UserService;
+
+
+/**
+ * @version $Id$
+ */
+public class DefaultUserService
+    extends AbstractComponent
+    implements UserService, Receiver {
+
+    /** Attribute to store the current user. */
+    protected static final String USER_ATTRIBUTE = DefaultUserService.class.getName() + "/User";
+
+    /** The attribute prefix used to prefix attributes in the session and request. */
+    protected String attributeName;
+
+    /** The default layout key. */
+    protected String defaultLayoutKey;
+
+    /**
+     * @see org.apache.cocoon.portal.impl.AbstractComponent#initialize()
+     */
+    public void initialize() throws Exception {
+        super.initialize();
+        this.attributeName = DefaultUserService.class.getName() + '/' + this.portalService.getPortalName();
+        this.defaultLayoutKey = this.portalService.getConfiguration("default-layout-key", "portal");
+    }
+
+    /**
+     * Receives any user related event and invokes login, logout etc.
+     * @see Receiver
+     */
+    public void inform(UserEvent event, PortalService service) {
+        this.setTemporaryAttribute(USER_ATTRIBUTE, event.getPortalUser());
+    }
+
+    protected Map getSessionMap() {
+        final Session session = ContextHelper.getRequest(this.context).getSession(false);
+        if ( session == null ) {
+            return null;
+        }
+        final Map map = (Map) session.getAttribute(this.attributeName);
+        return map;
+    }
+
+    protected Map getRequestMap() {
+        final Request request = ContextHelper.getRequest(this.context);
+        final Map map = (Map) request.getAttribute(this.attributeName);
+        return map;
+    }
+
+    protected void setSessionMap(Map map) {
+        final Session session = ContextHelper.getRequest(this.context).getSession(true);
+        session.setAttribute(this.attributeName, map);
+    }
+
+    protected void setRequestMap(Map map) {
+        final Request request = ContextHelper.getRequest(this.context);
+        request.setAttribute(this.attributeName, map);
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.services.UserService#getAttribute(java.lang.String)
+     */
+    public Object getAttribute(String key) {
+        Map map = this.getSessionMap();
+        if ( map != null ) {
+            return map.get(key);
+        }
+        return null;
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.services.UserService#getAttributeNames()
+     */
+    public Collection getAttributeNames() {
+        Map map = this.getSessionMap();
+        if ( map != null ) {
+            return map.keySet();
+        }
+        return Collections.EMPTY_LIST;
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.services.UserService#getTemporaryAttribute(java.lang.String)
+     */
+    public Object getTemporaryAttribute(String key) {
+        Map map = this.getRequestMap();
+        if ( map != null ) {
+            return map.get(key);
+        }
+        return null;
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.services.UserService#getTemporaryAttributeNames()
+     */
+    public Collection getTemporaryAttributeNames() {
+        Map map = this.getRequestMap();
+        if ( map != null ) {
+            return map.keySet();
+        }
+        return Collections.EMPTY_LIST;
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.services.UserService#getUser()
+     */
+    public PortalUser getUser() {
+        return (PortalUser)this.getTemporaryAttribute(USER_ATTRIBUTE);
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.services.UserService#removeAttribute(java.lang.String)
+     */
+    public Object removeAttribute(String key) {
+        Map map = this.getSessionMap();
+        if ( map != null ) {
+            final Object result = map.remove(key);
+            this.setSessionMap(map);
+            return result;
+        }
+        return null;
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.services.UserService#removeTemporaryAttribute(java.lang.String)
+     */
+    public Object removeTemporaryAttribute(String key) {
+        Map map = this.getRequestMap();
+        if ( map != null ) {
+            final Object result = map.remove(key);
+            this.setRequestMap(map);
+            return result;
+        }
+        return null;
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.services.UserService#setAttribute(java.lang.String, java.lang.Object)
+     */
+    public void setAttribute(String key, Object value) {
+        Map map = this.getSessionMap();
+        if ( map == null ) {
+            synchronized ( this ) {
+                map = this.getSessionMap();
+                if ( map == null ) {
+                    map = new HashMap();
+                    this.setSessionMap(map);
+                }
+            }
+        }
+        map.put(key, value);
+        this.setSessionMap(map);
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.services.UserService#setTemporaryAttribute(java.lang.String, java.lang.Object)
+     */
+    public void setTemporaryAttribute(String key, Object value) {
+        Map map = this.getRequestMap();
+        if ( map == null ) {
+            synchronized ( this ) {
+                map = this.getRequestMap();
+                if ( map == null ) {
+                    map = new HashMap();
+                    this.setRequestMap(map);
+                }
+            }
+        }
+        map.put(key, value);
+        this.setRequestMap(map);
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.services.UserService#getDefaultLayoutKey()
+     */
+    public String getDefaultLayoutKey() {
+        String key = this.getUser().getDefaultLayoutKey();
+        if ( key == null ) {
+            return this.defaultLayoutKey;
+        }
+        return key;
+    }
+}
\ No newline at end of file

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/impl/DefaultUserService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/impl/DefaultUserService.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/portal.roles
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/portal.roles?rev=432969&r1=432968&r2=432969&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/portal.roles (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/portal.roles Sun Aug 20 07:03:27 2006
@@ -183,6 +183,14 @@
           shorthand="portal-manager"/>
 
   <!--+
+      | User Service.
+      |
+      +-->
+    <role name="org.apache.cocoon.portal.services.UserService"
+          default-class="org.apache.cocoon.portal.services.impl.DefaultUserService"
+          shorthand="user-service"/>
+
+  <!--+
       | Event Manager.
       |
       +-->

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/PortletPreferencesProviderImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/PortletPreferencesProviderImpl.java?rev=432969&r1=432968&r2=432969&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/PortletPreferencesProviderImpl.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/PortletPreferencesProviderImpl.java Sun Aug 20 07:03:27 2006
@@ -97,7 +97,7 @@
         key.put("portal", this.portalService.getPortalName());
         key.put("type", "user");
         key.put("instance", "copletId");
-        key.put("user", this.portalService.getProfileManager().getUser().getUserName());
+        key.put("user", this.portalService.getUserService().getUser().getUserName());
 
         return key;
     }

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/TestProfileManager.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/TestProfileManager.java?rev=432969&r1=432968&r2=432969&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/TestProfileManager.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/TestProfileManager.java Sun Aug 20 07:03:27 2006
@@ -31,7 +31,7 @@
 import org.apache.cocoon.portal.om.CopletInstance;
 import org.apache.cocoon.portal.om.CopletLayout;
 import org.apache.cocoon.portal.om.Item;
-import org.apache.cocoon.portal.profile.PortalUser;
+import org.apache.cocoon.portal.om.PortalUser;
 import org.apache.cocoon.portal.profile.impl.GroupBasedProfileManager;
 import org.apache.cocoon.portal.scratchpad.Profile;
 import org.apache.cocoon.portal.scratchpad.ProfileImpl;
@@ -58,7 +58,7 @@
 
     protected Profile loadProfile(final String layoutKey) 
     throws Exception {
-        final PortalUser info = (PortalUser)this.portalService.getTemporaryAttribute(USER_ATTRIBUTE);
+        final PortalUser info = this.portalService.getUserService().getUser();
         if ( info.getUserName().equals("test") ) {
             // if the request parameter 'portletName' is available we only
             // display the portlets specified with the parameter. Otherwise



Mime
View raw message