cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r609777 - in /cocoon/trunk/blocks/cocoon-portal: cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/ cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/ cocoon-portal-impl/src/main/resources/org/apache/coc...
Date Mon, 07 Jan 2008 21:06:08 GMT
Author: cziegeler
Date: Mon Jan  7 13:06:04 2008
New Revision: 609777

URL: http://svn.apache.org/viewvc?rev=609777&view=rev
Log:
Move configuration of profile loading and saving to profile store; use new bean ProfileKey
instead of Object for specifying the profile to load/save and directly access profiles instead
of going through the sitemap.

Added:
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/ProfileKey.java
  (with props)
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/copletdefinition/global.xml
      - copied unchanged from r609738, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/copletdefinition/portal.xml
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/copletinstance/global.xml
      - copied unchanged from r609738, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/copletinstance/portal.xml
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/copletinstance/user-anonymous.xml
      - copied unchanged from r609738, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/copletinstance/portal-user-anonymous.xml
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/copletinstance/user-cocoon.xml
      - copied unchanged from r609738, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/copletinstance/portal-user-cocoon.xml
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/copletinstance/user-test.xml
      - copied unchanged from r609738, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/copletinstance/portal-user-test.xml
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/layout/global.xml
      - copied unchanged from r609738, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/layout/portal.xml
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/layout/user-anonymous.xml
      - copied unchanged from r609738, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/layout/portal-user-anonymous.xml
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/layout/user-cocoon.xml
      - copied unchanged from r609738, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/layout/portal-user-cocoon.xml
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/layout/user-test.xml
      - copied unchanged from r609738, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/layout/portal-user-test.xml
Removed:
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/copletdefinition/portal.xml
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/copletinstance/portal-user-anonymous.xml
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/copletinstance/portal-user-cocoon.xml
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/copletinstance/portal-user-test.xml
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/copletinstance/portal.xml
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/layout/portal-user-anonymous.xml
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/layout/portal-user-cocoon.xml
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/layout/portal-user-test.xml
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/profiles/layout/portal.xml
Modified:
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/ProfileStore.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/MapBasedProfileStore.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/resources/org/apache/cocoon/portal/cocoon-portal-components.xml
    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-sample/src/main/resources/COB-INF/config/spring/cocoon-portal-sample-components.xml
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/sitemap.xmap

Added: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/ProfileKey.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/ProfileKey.java?rev=609777&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/ProfileKey.java
(added)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/ProfileKey.java
Mon Jan  7 13:06:04 2008
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.profile;
+
+import java.util.Collection;
+import java.util.Properties;
+
+/**
+*
+* @version $Id$
+*/
+public class ProfileKey extends Properties {
+
+    protected String portalName;
+
+    protected String profileName;
+
+    protected String profileCategory;
+
+    protected Collection userGroups;
+
+    protected String userName;
+
+    public String getPortalName() {
+        return portalName;
+    }
+
+    public void setPortalName(String portalName) {
+        this.portalName = portalName;
+    }
+
+    public String getProfileName() {
+        return profileName;
+    }
+
+    public void setProfileName(String profileName) {
+        this.profileName = profileName;
+    }
+
+    public String getProfileCategory() {
+        return profileCategory;
+    }
+
+    public void setProfileCategory(String profileCategory) {
+        this.profileCategory = profileCategory;
+    }
+
+    public Collection getUserGroups() {
+        return userGroups;
+    }
+
+    public void setUserGroups(Collection userGroups) {
+        this.userGroups = userGroups;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    /**
+     * @see java.util.Properties#getProperty(java.lang.String)
+     */
+    public String getProperty(String key) {
+        if ("profile-name".equals(key)) {
+            return (this.profileName == null ? "" : this.profileName);
+        }
+        if ("profile-name".equals(key)) {
+            return (this.profileCategory == null ? "" : this.profileCategory);
+        }
+        if ("portal-name".equals(key)) {
+            return (this.portalName == null ? "" : this.portalName);
+        }
+        if ("user-name".equals(key)) {
+            return (this.userName == null ? "" : this.userName);
+        }
+        return super.getProperty(key);
+    }
+
+}

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

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/ProfileKey.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/ProfileStore.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/ProfileStore.java?rev=609777&r1=609776&r2=609777&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/ProfileStore.java
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/ProfileStore.java
Mon Jan  7 13:06:04 2008
@@ -43,7 +43,7 @@
      * @param type The type of the profile (instances, types, layouts etc. )
      * @param objectMap Map with objects which might be references by the profile.
      */
-    Object loadProfile(Object key, PersistenceType type)
+    Object loadProfile(ProfileKey key, PersistenceType type)
     throws Exception;
 
     /**
@@ -53,7 +53,7 @@
      * @param type The type of the profile (instances, types, layouts etc. )
      * @param profile The profile itself.
      */
-    void saveProfile(Object key, PersistenceType type, Object profile) throws Exception;
+    void saveProfile(ProfileKey key, PersistenceType type, Object profile) throws Exception;
 
     /**
      * Get the validity of a profile.
@@ -61,5 +61,5 @@
      *            like user etc.
      * @param persistenceType The type of the profile (instances, types, layouts etc. )
      */
-    SourceValidity getValidity(Object key, String persistenceType);
+    SourceValidity getValidity(ProfileKey key, String persistenceType);
 }

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=609777&r1=609776&r2=609777&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
Mon Jan  7 13:06:04 2008
@@ -23,7 +23,6 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Properties;
 
 import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.portal.event.Receiver;
@@ -42,8 +41,8 @@
 import org.apache.cocoon.portal.om.PortalUser;
 import org.apache.cocoon.portal.profile.PersistenceType;
 import org.apache.cocoon.portal.profile.ProfileException;
+import org.apache.cocoon.portal.profile.ProfileKey;
 import org.apache.cocoon.portal.profile.ProfileStore;
-import org.apache.commons.collections.map.LinkedMap;
 import org.apache.commons.lang.exception.ExceptionUtils;
 import org.apache.excalibur.source.SourceNotFoundException;
 import org.apache.excalibur.source.SourceValidity;
@@ -92,9 +91,6 @@
     /** The profiler loader/saver. */
     protected ProfileStore loader;
 
-    /** The configuration for loading/saving the profile. */
-    protected Properties configuration;
-
     public void setProfileStore(ProfileStore loader) {
         this.loader = loader;
     }
@@ -339,10 +335,8 @@
             return this.copletDefinitions.objects;
         }
 
-        final Map key = this.buildKey(CATEGORY_GLOBAL,
-                ProfileStore.PROFILETYPE_COPLETDEFINITION,
+        final ProfileKey key = this.buildKey(CATEGORY_GLOBAL,
                 info,
-                true,
                 null);
         SourceValidity newValidity = null;
         // if we have a profile, check for reloading
@@ -405,10 +399,8 @@
                                          final String      category,
                                          final String      layoutKey)
     throws Exception {
-        Map key = this.buildKey(category,
-                                ProfileStore.PROFILETYPE_COPLETINSTANCE,
+        ProfileKey key = this.buildKey(category,
                                 info,
-                                true,
                                 layoutKey);
         try {
             final PersistenceType persType = new PersistenceType(ProfileStore.PROFILETYPE_COPLETINSTANCE);
@@ -432,10 +424,8 @@
                                 final String      category,
                                 final String      layoutKey)
     throws Exception {
-        final Map key = this.buildKey(category,
-                                      ProfileStore.PROFILETYPE_LAYOUT,
+        final ProfileKey key = this.buildKey(category,
                                       info,
-                                      true,
                                       layoutKey);
         try {
             final PersistenceType persType = new PersistenceType(ProfileStore.PROFILETYPE_LAYOUT);
@@ -455,40 +445,21 @@
         }
     }
 
-    protected Map buildKey(String   category,
-                           String   profileType,
-                           PortalUser info,
-                           boolean  load,
-                           String   profileName)
+    protected ProfileKey buildKey(String   category,
+                                  PortalUser info,
+                                  String   profileName)
     throws LayoutException {
         if ( profileName == null ) {
             profileName = this.portalService.getUserService().getDefaultProfileName();
         }
-        final StringBuffer config = new StringBuffer(profileType);
-        config.append('-');
-        config.append(category);
-        config.append('-');
-        if ( load ) {
-            config.append("load");
-        } else {
-            config.append("save");
-        }
-        final String uri = this.configuration.getProperty(config.toString());
-        if ( uri == null ) {
-            throw new LayoutException("Configuration for key '" + config.toString() + "'
is missing.");
-        }
-        final Map key = new LinkedMap();
-        key.put("baseuri", uri);
-        key.put("separator", "?");
-        key.put("portal", this.portalService.getPortalName());
-        key.put("layout", profileName);
-        key.put("type", category);
+        final ProfileKey key = new ProfileKey();
+        key.setPortalName(this.portalService.getPortalName());
+        key.setProfileName(profileName);
+        key.setProfileCategory(category);
         if ( CATEGORY_GROUP.equals(category) ) {
-            // TODO Groups is a collection!
-            key.put("group", "none");
-            //key.put("group", info.getGroups());
+            key.setUserGroups(info.getGroups());
         } else if ( CATEGORY_USER.equals(category) ) {
-            key.put("user", info.getUserName());
+            key.setUserName(info.getUserName());
         }
 
         return key;
@@ -505,10 +476,8 @@
     protected void saveCopletInstances() {
         try {
             final ProfileHolder profile = this.getUserProfile();
-            final Map key = this.buildKey(CATEGORY_USER,
-                                          ProfileStore.PROFILETYPE_COPLETINSTANCE,
+            final ProfileKey key = this.buildKey(CATEGORY_USER,
                                           this.portalService.getUserService().getUser(),
-                                          false,
                                           null);
             final PersistenceType persType = new PersistenceType(ProfileStore.PROFILETYPE_COPLETINSTANCE);
             persType.setReferences("copletDefinition", profile.getCopletDefinitionsMap());
@@ -523,10 +492,8 @@
     protected void saveLayoutInstances() {
         try {
             final ProfileHolder profile = this.getUserProfile();
-            final Map key = this.buildKey(CATEGORY_USER,
-                                          ProfileStore.PROFILETYPE_LAYOUTINSTANCE,
+            final ProfileKey key = this.buildKey(CATEGORY_USER,
                                           this.portalService.getUserService().getUser(),
-                                          false,
                                           null);
             final PersistenceType persType = new PersistenceType(ProfileStore.PROFILETYPE_LAYOUTINSTANCE);
             persType.setReferences("layout", profile.keyedLayouts);
@@ -552,9 +519,5 @@
 
     public void setCheckForChanges(boolean checkForChanges) {
         this.checkForChanges = checkForChanges;
-    }
-
-    public void setConfiguration(Properties configuration) {
-        this.configuration = configuration;
     }
 }

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/MapBasedProfileStore.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/MapBasedProfileStore.java?rev=609777&r1=609776&r2=609777&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/MapBasedProfileStore.java
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/profile/impl/MapBasedProfileStore.java
Mon Jan  7 13:06:04 2008
@@ -18,12 +18,13 @@
 
 import java.io.ByteArrayOutputStream;
 import java.io.UnsupportedEncodingException;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
+import java.util.Properties;
 
+import org.apache.cocoon.configuration.PropertyHelper;
 import org.apache.cocoon.portal.profile.Converter;
 import org.apache.cocoon.portal.profile.PersistenceType;
+import org.apache.cocoon.portal.profile.ProfileException;
+import org.apache.cocoon.portal.profile.ProfileKey;
 import org.apache.cocoon.portal.profile.ProfileStore;
 import org.apache.cocoon.portal.util.AbstractBean;
 import org.apache.cocoon.util.NetUtils;
@@ -48,6 +49,9 @@
     /** The source resolver. */
     protected SourceResolver resolver;
 
+    /** The configuration for loading/saving the profile. */
+    protected Properties configuration;
+
     public void setSourceResolver(SourceResolver sr) {
         this.resolver = sr;
     }
@@ -56,53 +60,36 @@
         this.converter = c;
     }
 
-    protected String getURI(Map keyMap)
+    public void setConfiguration(Properties configuration) {
+        this.configuration = configuration;
+    }
+
+    protected String getURI(ProfileKey key, String type, boolean load)
     throws Exception {
-        final StringBuffer buffer = new StringBuffer();
-        Iterator iter = keyMap.entrySet().iterator();
-        boolean pars = false;
-        boolean first = true;
-        while ( iter.hasNext() ) {
-            final Map.Entry entry = (Entry) iter.next();
-            final String append = entry.getValue().toString();
-            if ( pars ) {
-                if ( first ) {
-                    first = false;
-                    if ( buffer.toString().indexOf('?') == -1 ) {
-                        buffer.append('?');
-                    } else {
-                        buffer.append('&');
-                    }
-                } else {
-                    buffer.append('&');
-                }
-                buffer.append(entry.getKey().toString());
-                buffer.append('=');
-            } else {
-                if ( !first && !"?".equals(append) ) {
-                    buffer.append('/');
-                }
-                first = false;
-            }
-            if ( "?".equals(append) ) {
-                first = true;
-                pars = true;
-            } else {
-                buffer.append(append);
-            }
+        // find uri in configuration
+        final StringBuffer config = new StringBuffer(type);
+        config.append('-');
+        config.append(key.getProfileCategory());
+        config.append('-');
+        if ( load ) {
+            config.append("load");
+        } else {
+            config.append("save");
+        }
+        final String uri = this.configuration.getProperty(config.toString());
+        if ( uri == null ) {
+            throw new ProfileException("Configuration for key '" + config.toString() + "'
is missing.");
         }
 
-        return buffer.toString();
+        return PropertyHelper.getProperty(uri, key, null);
     }
 
     /**
-     * @see org.apache.cocoon.portal.profile.ProfileStore#loadProfile(java.lang.Object, org.apache.cocoon.portal.profile.PersistenceType)
+     * @see org.apache.cocoon.portal.profile.ProfileStore#loadProfile(org.apache.cocoon.portal.profile.ProfileKey,
org.apache.cocoon.portal.profile.PersistenceType)
      */
-    public Object loadProfile(Object key, PersistenceType type)
+    public Object loadProfile(ProfileKey key, PersistenceType type)
     throws Exception {
-		final Map keyMap = (Map) key;
-
-        final String uri = this.getURI( keyMap );
+        final String uri = this.getURI( key, type.getType(), true );
 
 		Source source = null;
 		try {
@@ -117,13 +104,11 @@
     }
 
     /**
-     * @see org.apache.cocoon.portal.profile.ProfileStore#saveProfile(java.lang.Object, org.apache.cocoon.portal.profile.PersistenceType,
java.lang.Object)
+     * @see org.apache.cocoon.portal.profile.ProfileStore#saveProfile(org.apache.cocoon.portal.profile.ProfileKey,
org.apache.cocoon.portal.profile.PersistenceType, java.lang.Object)
      */
-    public void saveProfile(Object key, PersistenceType type, Object profile)
+    public void saveProfile(ProfileKey key, PersistenceType type, Object profile)
     throws Exception {
-        final Map keyMap = (Map) key;
-
-        final String uri = this.getURI( keyMap );
+        final String uri = this.getURI( key, type.getType(), false );
 
         // first test: modifiable source?
         Source source = null;
@@ -159,14 +144,12 @@
     }
 
     /**
-     * @see org.apache.cocoon.portal.profile.ProfileStore#getValidity(java.lang.Object, java.lang.String)
+     * @see org.apache.cocoon.portal.profile.ProfileStore#getValidity(org.apache.cocoon.portal.profile.ProfileKey,
java.lang.String)
      */
-    public SourceValidity getValidity(Object key, String type) {
+    public SourceValidity getValidity(ProfileKey key, String type) {
 		Source source = null;
 		try {
-            final Map keyMap = (Map) key;
-
-            final String uri = this.getURI( keyMap );
+            final String uri = this.getURI( key, type, true );
 
 			source = this.resolver.resolveURI(uri);
 			return source.getValidity();

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=609777&r1=609776&r2=609777&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
Mon Jan  7 13:06:04 2008
@@ -32,8 +32,8 @@
 import org.apache.cocoon.portal.om.LayoutInstance;
 import org.apache.cocoon.portal.profile.PersistenceType;
 import org.apache.cocoon.portal.profile.ProfileException;
+import org.apache.cocoon.portal.profile.ProfileKey;
 import org.apache.cocoon.portal.profile.ProfileStore;
-import org.apache.commons.collections.map.LinkedMap;
 import org.apache.commons.collections.map.StaticBucketMap;
 import org.apache.excalibur.source.SourceValidity;
 
@@ -84,11 +84,10 @@
             }
 
             // load layout
-            final Map map = new LinkedMap();
-            map.put("base", this.profilesPath);
-            map.put("portalname", this.portalService.getPortalName());
-            map.put("profile", "layout");
-            map.put("groupKey", layoutKey);
+            final ProfileKey map = new ProfileKey();
+            map.setPortalName(this.portalService.getPortalName());
+            map.setProfileCategory("layout");
+            map.setProfileName(layoutKey);
 
             SourceValidity newValidity = this.loader.getValidity(map, ProfileStore.PROFILETYPE_LAYOUT);
             if (valid == SourceValidity.UNKNOWN) {
@@ -161,11 +160,11 @@
         }
 
         // CopletDefinition
-        final Map map = new LinkedMap();
-        map.put("base", this.profilesPath);
-        map.put("portalname", this.portalService.getPortalName());
-        map.put("profile", "coplet");
-        map.put("name", "data");
+        ProfileKey map = new ProfileKey();
+        map.setPortalName(this.portalService.getPortalName());
+        map.setProfileCategory("coplet");
+        map.setProfileName("data");
+
         final PersistenceType cdType = new PersistenceType(ProfileStore.PROFILETYPE_COPLETDEFINITION);
         cdType.setReferences("copletType", this.copletTypesMap);
 
@@ -180,11 +179,11 @@
         this.copletDefinitions.put(portalName, definitions);
 
         //CopletInstanceData
-        map.clear();
-        map.put("base", this.profilesPath);
-        map.put("portalname", this.portalService.getPortalName());
-        map.put("profile", "coplet");
-        map.put("name", "instancedata");
+        map = new ProfileKey();
+        map.setPortalName(this.portalService.getPortalName());
+        map.setProfileCategory("coplet");
+        map.setProfileName("instancedata");
+
         final PersistenceType ciType = new PersistenceType(ProfileStore.PROFILETYPE_COPLETINSTANCE);
         ciType.setReferences("copletDefinition", definitions);
 

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/cocoon-portal-components.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/cocoon-portal-components.xml?rev=609777&r1=609776&r2=609777&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/cocoon-portal-components.xml
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/resources/org/apache/cocoon/portal/cocoon-portal-components.xml
Mon Jan  7 13:06:04 2008
@@ -270,10 +270,9 @@
       | Profile Store
       |
       +-->
-    <bean name="org.apache.cocoon.portal.profile.ProfileStore"
-          class="org.apache.cocoon.portal.profile.impl.MapBasedProfileStore"
+    <bean name="org.apache.cocoon.portal.profile.ProfileStore/abstract"
           parent="org.apache.cocoon.portal.util.AbstractBean"
-          scope="singleton">
+          abstract="true">
         <property name="converter" ref="org.apache.cocoon.portal.profile.Converter"/>
         <property name="sourceResolver" ref="org.apache.excalibur.source.SourceResolver"/>
     </bean>

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=609777&r1=609776&r2=609777&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
Mon Jan  7 13:06:04 2008
@@ -16,8 +16,6 @@
  */
 package org.apache.cocoon.portal.pluto;
 
-import java.util.Map;
-
 import org.apache.avalon.framework.parameters.ParameterException;
 import org.apache.avalon.framework.parameters.Parameterizable;
 import org.apache.avalon.framework.parameters.Parameters;
@@ -26,9 +24,9 @@
 import org.apache.cocoon.portal.om.CopletInstance;
 import org.apache.cocoon.portal.pluto.om.common.PreferenceSetImpl;
 import org.apache.cocoon.portal.profile.PersistenceType;
+import org.apache.cocoon.portal.profile.ProfileKey;
 import org.apache.cocoon.portal.profile.ProfileStore;
 import org.apache.cocoon.portal.util.AbstractComponent;
-import org.apache.commons.collections.map.LinkedMap;
 import org.apache.pluto.om.common.PreferenceSet;
 
 /**
@@ -80,26 +78,13 @@
         this.loader = (ProfileStore)this.manager.lookup(ProfileStore.class.getName());
     }
 
-    protected Map buildKey(boolean load, String copletId)
+    protected ProfileKey buildKey(String copletId)
     throws ParameterException {
-        final StringBuffer config = new StringBuffer(PERSISTENCETYPE_PREFERENCES);
-        config.append('-');
-        config.append("user");
-        config.append('-');
-        if ( load ) {
-            config.append("load");
-        } else {
-            config.append("save");
-        }
-        final String uri = this.configuration.getParameter(config.toString());
-
-        final Map key = new LinkedMap();
-        key.put("baseuri", uri);
-        key.put("separator", "?");
-        key.put("portal", this.portalService.getPortalName());
-        key.put("type", "user");
-        key.put("instance", "copletId");
-        key.put("user", this.portalService.getUserService().getUser().getUserName());
+        ProfileKey key = new ProfileKey();
+        key.setPortalName(this.portalService.getPortalName());
+        key.setUserName(this.portalService.getUserService().getUser().getUserName());
+        key.setProfileCategory("user");
+        key.setProfileName(copletId);
 
         return key;
     }
@@ -111,7 +96,7 @@
         try {
             final PersistenceType persType = new PersistenceType(PERSISTENCETYPE_PREFERENCES);
 
-            return (PreferenceSet)this.loader.loadProfile(this.buildKey(true, cid.getId()),
persType);
+            return (PreferenceSet)this.loader.loadProfile(this.buildKey(cid.getId()), persType);
         } catch (Exception ignore) {
             // we ignore all exceptions for now (TODO)
         }
@@ -125,7 +110,7 @@
         try {
             final PersistenceType persType = new PersistenceType(PERSISTENCETYPE_PREFERENCES);
 
-            this.loader.saveProfile(this.buildKey(false, cid.getId()), persType, prefs);
+            this.loader.saveProfile(this.buildKey(cid.getId()), persType, prefs);
         } catch (Exception ignore) {
              // we ignore all exceptions for now (TODO)
         }

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/spring/cocoon-portal-sample-components.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/spring/cocoon-portal-sample-components.xml?rev=609777&r1=609776&r2=609777&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/spring/cocoon-portal-sample-components.xml
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/config/spring/cocoon-portal-sample-components.xml
Mon Jan  7 13:06:04 2008
@@ -109,23 +109,27 @@
         scope="singleton">
     <property name="aspectChain" ref="org.apache.cocoon.portal.profile.ProfileManager.aspects"/>
     <property name="profileStore" ref="org.apache.cocoon.portal.profile.ProfileStore"/>
+    <property name="copletTypesMap" ref="org.apache.cocoon.portal.om.CopletTypeMap"/>
+    <property name="rendererMap" ref="org.apache.cocoon.portal.layout.renderer.RendererMap"/>
+  </bean>
+
+  <!--+
+      | This is the map based profile store.
+      +-->
+  <bean name="org.apache.cocoon.portal.profile.ProfileStore"
+        class="org.apache.cocoon.portal.profile.impl.MapBasedProfileStore"
+        parent="org.apache.cocoon.portal.profile.ProfileStore/abstract"
+        scope="singleton">
     <property name="configuration">
       <value>
-        copletdefinition-global-load=cocoon:raw:/load-global-profile?profile=copletdefinition
-        copletdefinition-role-load=cocoon:raw:/load-role-profile?profile=copletdefinition
-        copletdefinition-user-load=cocoon:raw:/load-user-profile?profile=copletdefinition
-        copletinstance-global-load=cocoon:raw:/load-global-profile?profile=copletinstance
-        copletinstance-role-load=cocoon:raw:/load-role-profile?profile=copletinstance
-        copletinstance-user-load=cocoon:raw:/load-user-profile?profile=copletinstance
-        copletinstance-user-save=cocoon:raw:/save-user-profile?profile=copletinstance
-        layout-global-load=cocoon:raw:/load-global-profile?profile=layout
-        layout-role-load=cocoon:raw:/load-role-profile?profile=layout
-        layout-user-load=cocoon:raw:/load-user-profile?profile=layout
-        layout-user-save=cocoon:raw:/save-user-profile?profile=layout
+        copletdefinition-global-load=profiles/copletdefinition/global.xml
+        copletinstance-global-load=profiles/copletinstance/global.xml
+        layout-global-load=profiles/layout/global.xml
+        copletdefinition-user-load=profiles/copletdefinition/user-{user-name}.xml
+        copletinstance-user-load=profiles/copletinstance/user-{user-name}.xml
+        layout-user-load=profiles/layout/user-{user-name}.xml
       </value>
     </property>
-    <property name="copletTypesMap" ref="org.apache.cocoon.portal.om.CopletTypeMap"/>
-    <property name="rendererMap" ref="org.apache.cocoon.portal.layout.renderer.RendererMap"/>
   </bean>
 
   <!--+

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/sitemap.xmap
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/sitemap.xmap?rev=609777&r1=609776&r2=609777&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/sitemap.xmap
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/sitemap.xmap
Mon Jan  7 13:06:04 2008
@@ -77,24 +77,6 @@
   <!-- =========================== Pipelines ================================= -->
 
   <map:pipelines>
-    <!-- The internal pipelines for loading and saving -->
-    <map:pipeline internal-only="true">
-      <map:match pattern="load-global-profile">
-        <map:generate src="profiles/{request-param:profile}/{request-param:portal}.xml"/>
-        <map:serialize type="xml"/>
-      </map:match>
-
-      <map:match pattern="load-role-profile">
-        <map:generate src="profiles/{request-param:profile}/{request-param:portal}-role-{request-param:role}.xml"/>
-        <map:serialize type="xml"/>
-      </map:match>
-
-      <map:match pattern="load-user-profile">
-        <map:generate src="profiles/{request-param:profile}/{request-param:portal}-user-{request-param:user}.xml"/>
-        <map:serialize type="xml"/>
-      </map:match>
-    </map:pipeline>
-
     <map:pipeline>
       <!-- Do an auto login as anonymous -->
       <map:act type="cauth-is-logged-in">



Mime
View raw message