Hi Ralph,

I'm trying to understand it as well :) I found out today, that saving the profile resulted in an NPE in the saveUserLayout() method. This was due to some missing initialization that were removed. What I didn't realize while readding the missing code was the name of the method - saveUserLayout, I assumed it was still the old one - saveUserProfile.

I can't remember that storeProfile() was implemented in this way - the intention of storeProfile was not to persist the profile but to make an in-memory copy of it; unfortunately the implementation was too difficult so I removed the method from the interface.

So, in fact this is a little bit strange as the code couldn't run this way (NPE) and I think the method should be renamed to saveUserProfile. WDYT?

Carsten

Ralph Goers wrote:
Carsten -
I'm trying to understand what is up here.

There used to be a method called storeProfile() in AbstractProfileManager.
My recollection is that in AuthenticationProfileManager storeProfile()
called saveUserLayout() and saveUserCopletInstance().  Each of those
methods only stored the object in question.  Now storeProfile is gone and
saveUserLayout saves both the layout and the copletInstanceData.  While
more efficient, it doesn't seem right, unless saveUserLayout is renamed
saveUserProfile.

Ralph


[EMAIL PROTECTED] said:

Author: cziegeler
Date: Tue Jan 18 08:33:45 2005
New Revision: 125515

URL: http://svn.apache.org/viewcvs?view=rev&rev=125515
Log:
Readd missing code
Modified:
  
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AuthenticationProfileManager.java

Modified:
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AuthenticationProfileManager.java
Url:
http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AuthenticationProfileManager.java?view=diff&rev=125515&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AuthenticationProfileManager.java&r1=125514&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AuthenticationProfileManager.java&r2=125515
==============================================================================
---
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AuthenticationProfileManager.java
     (original)
+++
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AuthenticationProfileManager.java
     Tue
Jan 18 08:33:45 2005
@@ -185,39 +185,44 @@
        }
    }

+    /* (non-Javadoc)
+     * @see
org.apache.cocoon.portal.profile.ProfileManager#saveUserLayout(java.lang.String)
+     */
    public void saveUserLayout(String layoutKey) {
        ProfileLS adapter = null;
        PortalService service = null;
        try {
            adapter = (ProfileLS) this.manager.lookup(ProfileLS.ROLE);
            service = (PortalService)
this.manager.lookup(PortalService.ROLE);
-            if (layoutKey == null) {
+            if ( layoutKey == null ) {
                layoutKey = service.getDefaultLayoutKey();
            }
-
+
            RequestState state = this.getRequestState();
            UserHandler handler = state.getHandler();

            HashMap parameters = new HashMap();
            parameters.put("type", "user");
-            parameters.put("config",
-
state.getApplicationConfiguration().getConfiguration("portal").getChild("profiles"));
+            parameters.put("config",
state.getApplicationConfiguration().getConfiguration("portal").getChild("profiles"));
            parameters.put("handler", handler);
+            parameters.put("profiletype", "copletinstancedata");

            Map key = this.buildKey(service, parameters, layoutKey,
false);
+
+            // save coplet instance data
+            CopletInstanceDataManager profileManager =
((CopletInstanceDataManager)service.getAttribute("CopletInstanceData:"; +
layoutKey));
+            adapter.saveProfile(key, parameters, profileManager);

            // save layout data
            parameters.put("profiletype", "layout");
            key = this.buildKey(service, parameters, layoutKey, false);
-            Layout layout = (Layout) service.getAttribute("Layout:" +
layoutKey);
+            Layout layout = (Layout)service.getAttribute("Layout:" +
layoutKey);
            adapter.saveProfile(key, parameters, layout);
-
-        }
-        catch (Exception e) {
+
+        } catch (Exception e) {
            // TODO
            throw new CascadingRuntimeException("Exception during save
profile", e);
-        }
-        finally {
+        } finally {
            this.manager.release(adapter);
            this.manager.release(service);
        }








Reply via email to