cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: rev 37122 - in cocoon/branches/BRANCH_2_1_X: . src/blocks/portal/java/org/apache/cocoon/portal/layout/impl src/blocks/portal/java/org/apache/cocoon/portal/profile src/blocks/portal/java/org/apache/cocoon/portal/profile/impl
Date Fri, 27 Aug 2004 12:05:52 GMT
Author: cziegeler
Date: Fri Aug 27 05:05:51 2004
New Revision: 37122

Modified:
   cocoon/branches/BRANCH_2_1_X/gump.xml
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutFactory.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/ProfileManager.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AbstractUserProfileManager.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AuthenticationProfileManager.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/StaticProfileManager.java
Log:
Enhance Profile Manager
Fix bug in LayoutFactory
Deprecated Portal-FW
Mark portal engine as stable

Modified: cocoon/branches/BRANCH_2_1_X/gump.xml
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/gump.xml	(original)
+++ cocoon/branches/BRANCH_2_1_X/gump.xml	Fri Aug 27 05:05:51 2004
@@ -302,7 +302,7 @@
     <nag from="Gump" to="dev@cocoon.apache.org"/>
   </project>
 
-  <project name="cocoon-block-portal-fw" status="stable">
+  <project name="cocoon-block-portal-fw" status="deprecated">
     <package>org.apache.cocoon</package>
 
     <ant target="gump-block">
@@ -821,7 +821,7 @@
     <nag from="Gump" to="dev@cocoon.apache.org"/>
     </project>
 
-  <project name="cocoon-block-portal" status="unstable">
+  <project name="cocoon-block-portal" status="stable">
     <package>org.apache.cocoon</package>
 
     <ant target="gump-block">

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutFactory.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutFactory.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutFactory.java
Fri Aug 27 05:05:51 2004
@@ -123,7 +123,7 @@
  * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
  * @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
  * 
- * @version CVS $Id: DefaultLayoutFactory.java,v 1.18 2004/04/28 13:58:16 cziegeler Exp $
+ * @version CVS $Id$
  */
 public class DefaultLayoutFactory
 	extends AbstractLogEnabled
@@ -286,6 +286,9 @@
         }
     }
 
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.portal.layout.LayoutFactory#newInstance(java.lang.String)
+     */
     public Layout newInstance(String layoutName) 
     throws ProcessingException {
         this.init();
@@ -343,6 +346,7 @@
                 eventManager = (EventManager)this.manager.lookup(EventManager.ROLE);
                 eventManager.getRegister().unsubscribe( this );
             } catch (Exception ignore) {
+                // ignore
             } finally {
                 this.manager.release( eventManager ); 
             }
@@ -404,9 +408,10 @@
         if ( layout != null ) {
             this.init();
             if ( layout instanceof CompositeLayout ) {
-                Iterator itemIterator = ((CompositeLayout)layout).getItems().iterator();
-                while ( itemIterator.hasNext() ) {
-                    this.remove( ((Item)itemIterator.next()).getLayout());              

+                final CompositeLayout cl = (CompositeLayout)layout;
+                while ( cl.getItems().size() > 0 ) {
+                    final Item i = cl.getItem(0);
+                    this.remove( i.getLayout() );
                 }
             }
             Item parent = layout.getParent();

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/ProfileManager.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/ProfileManager.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/ProfileManager.java
Fri Aug 27 05:05:51 2004
@@ -15,6 +15,7 @@
  */
 package org.apache.cocoon.portal.profile;
 
+import java.util.Collection;
 import java.util.List;
 
 import org.apache.avalon.framework.component.Component;
@@ -30,7 +31,7 @@
  * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
  * @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
  * 
- * @version CVS $Id: ProfileManager.java,v 1.10 2004/03/05 13:02:16 bdelacretaz Exp $
+ * @version CVS $Id$
  */
 public interface ProfileManager extends Component {
     
@@ -89,5 +90,15 @@
      * Save the profile
      */
     void saveUserProfiles();
+    
+    /**
+     * Get all instances
+     */
+    Collection getCopletInstanceDatas();
+    
+    /**
+     * Get all coplets
+     */
+    Collection getCopletDatas();
     
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AbstractUserProfileManager.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AbstractUserProfileManager.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AbstractUserProfileManager.java
Fri Aug 27 05:05:51 2004
@@ -16,6 +16,7 @@
 package org.apache.cocoon.portal.profile.impl;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -41,7 +42,7 @@
  * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
  * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj&ouml;rn L&uuml;tkemeier</a>
  * 
- * @version CVS $Id: AbstractUserProfileManager.java,v 1.7 2004/03/05 13:02:16 bdelacretaz
Exp $
+ * @version CVS $Id$
  */
 public abstract class AbstractUserProfileManager 
     extends AbstractProfileManager { 
@@ -222,6 +223,9 @@
         }
     }
 
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.portal.profile.ProfileManager#register(org.apache.cocoon.portal.coplet.CopletInstanceData)
+     */
     public void register(CopletInstanceData coplet) {
         String layoutKey = this.getDefaultLayoutKey();
         PortalService service = null;
@@ -241,6 +245,9 @@
         }
     }
     
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.portal.profile.ProfileManager#unregister(org.apache.cocoon.portal.coplet.CopletInstanceData)
+     */
     public void unregister(CopletInstanceData coplet) {
         String layoutKey = this.getDefaultLayoutKey();
         PortalService service = null;
@@ -368,5 +375,39 @@
                                             LayoutFactory layoutFactory,
                                             ServiceSelector adapterSelector) 
     throws Exception;
+
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.portal.profile.ProfileManager#getCopletDatas()
+     */
+    public Collection getCopletDatas() {
+        final String layoutKey = this.getDefaultLayoutKey();
+        PortalService service = null;
+        try {
+            service = (PortalService) this.manager.lookup(PortalService.ROLE);
+            CopletDataManager manager = (CopletDataManager)service.getAttribute("CopletData:"
+ layoutKey);
+            return manager.getCopletData().values();
+        } catch (Exception e) {
+            throw new CascadingRuntimeException("Error in getCopletDatas.", e);
+        } finally {
+            this.manager.release(service);
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.portal.profile.ProfileManager#getCopletInstanceDatas()
+     */
+    public Collection getCopletInstanceDatas() {
+        final String layoutKey = this.getDefaultLayoutKey();
+        PortalService service = null;
+        try {
+            service = (PortalService) this.manager.lookup(PortalService.ROLE);
+            CopletInstanceDataManager manager = (CopletInstanceDataManager)service.getAttribute("CopletInstanceData:"
+ layoutKey);
+            return manager.getCopletInstanceData().values();
+        } catch (Exception e) {
+            throw new CascadingRuntimeException("Error in getCopletInstanceDatas.", e);
+        } finally {
+            this.manager.release(service);
+        }
+    }
     
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AuthenticationProfileManager.java
==============================================================================
--- 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
Fri Aug 27 05:05:51 2004
@@ -115,7 +115,7 @@
             parameters.put("profiletype", "copletdata");
             parameters.put("objectmap", copletBaseDataManager.getCopletBaseData());
             copletDataManager = (CopletDataManager)this.getDeltaProfile(layoutKey, parameters,
service, copletFactory, ((Boolean)result[1]).booleanValue());
-                    
+            service.setAttribute("CopletData:" + layoutKey, copletDataManager);        
         } finally {
             this.lock.releaseLocks();
         }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/StaticProfileManager.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/StaticProfileManager.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/StaticProfileManager.java
Fri Aug 27 05:05:51 2004
@@ -16,6 +16,7 @@
 package org.apache.cocoon.portal.profile.impl;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -44,13 +45,14 @@
  * @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
  * @author <a href="mailto:juergen.seitz@basf-it-services.com">J&uuml;rgen Seitz</a>
  * 
- * @version CVS $Id: StaticProfileManager.java,v 1.11 2004/03/05 13:02:16 bdelacretaz Exp
$
+ * @version CVS $Id$
  */
 public class StaticProfileManager extends AbstractProfileManager implements Configurable
 {
     protected String profilesPath;
 
     protected StaticBucketMap copletInstanceDataManagers = new StaticBucketMap();
+    protected StaticBucketMap copletDataManagers = new StaticBucketMap();
 
     protected static final String LAYOUTKEY_PREFIX = StaticProfileManager.class.getName()
+ "/Layout/";
 
@@ -155,6 +157,14 @@
 
     }
 
+    private CopletDataManager getCopletDataManager(PortalService service) 
+    throws Exception {
+        final String portalName = service.getPortalName();
+        // ensure that profile is loaded
+        this.getCopletInstanceDataManager(service);
+        return (CopletDataManager)this.copletDataManagers.get(portalName);
+    }
+    
     private CopletInstanceDataManager getCopletInstanceDataManager(PortalService service)

     throws Exception {
         String portalName = service.getPortalName();
@@ -215,8 +225,11 @@
                 copletFactory.prepare(cid);
             }
 
+            // store managers
             this.copletInstanceDataManagers.put(portalName, copletInstanceDataManager);
+            this.copletDataManagers.put(portalName, copletDataManager);
             return copletInstanceDataManager;
+            
         } finally {
             this.manager.release(service);
             this.manager.release(adapter);
@@ -326,5 +339,35 @@
         Configuration child = configuration.getChild("profiles-path");
         this.profilesPath = child.getValue("cocoon:/profiles");
         //this.profilesPath = "context://samples/simple-portal/profiles";
+    }
+        
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.portal.profile.ProfileManager#getCopletDatas()
+     */
+    public Collection getCopletDatas() {
+        PortalService service = null;
+        try {
+            service = (PortalService) this.manager.lookup(PortalService.ROLE);
+            return this.getCopletDataManager(service).getCopletData().values();
+        } catch (Exception e) {
+            throw new CascadingRuntimeException("Error in getCopletDatas.", e);
+        } finally {
+            this.manager.release(service);
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.portal.profile.ProfileManager#getCopletInstanceDatas()
+     */
+    public Collection getCopletInstanceDatas() {
+        PortalService service = null;
+        try {
+            service = (PortalService) this.manager.lookup(PortalService.ROLE);
+            return this.getCopletInstanceDataManager(service).getCopletInstanceData().values();
+        } catch (Exception e) {
+            throw new CascadingRuntimeException("Error in getCopletInstanceDatas.", e);
+        } finally {
+            this.manager.release(service);
+        }
     }
 }

Mime
View raw message