cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r158790 - in cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal: PortalComponentManager.java acting/BookmarkAction.java generation/PortalGenerator.java impl/DefaultPortalComponentManager.java impl/PortalManagerImpl.java
Date Wed, 23 Mar 2005 16:02:49 GMT
Author: cziegeler
Date: Wed Mar 23 08:02:48 2005
New Revision: 158790

URL: http://svn.apache.org/viewcvs?view=rev&rev=158790
Log:
Make portal manager available through portal component manager

Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/PortalComponentManager.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/acting/BookmarkAction.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/generation/PortalGenerator.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/DefaultPortalComponentManager.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/PortalComponentManager.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/PortalComponentManager.java?view=diff&r1=158789&r2=158790
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/PortalComponentManager.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/PortalComponentManager.java
Wed Mar 23 08:02:48 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2002,2004 The Apache Software Foundation.
+ * Copyright 1999-2002,2004-2005 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.
@@ -66,4 +66,10 @@
      * Get the event manager
      */
     EventManager getEventManager();
+
+    /**
+     * Get the portal manager
+     * @since 2.1.8
+     */
+    PortalManager getPortalManager();
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/acting/BookmarkAction.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/acting/BookmarkAction.java?view=diff&r1=158789&r2=158790
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/acting/BookmarkAction.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/acting/BookmarkAction.java
Wed Mar 23 08:02:48 2005
@@ -39,7 +39,6 @@
 import org.apache.cocoon.environment.Request;
 import org.apache.cocoon.environment.Session;
 import org.apache.cocoon.environment.SourceResolver;
-import org.apache.cocoon.portal.PortalManager;
 import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.acting.helpers.CopletMapping;
 import org.apache.cocoon.portal.acting.helpers.FullScreenMapping;
@@ -193,13 +192,7 @@
         try {
             service = (PortalService)this.manager.lookup(PortalService.ROLE);
 
-            PortalManager portalManager = null;
-            try {
-                portalManager = (PortalManager) this.manager.lookup(PortalManager.ROLE);
-                portalManager.process();
-            } finally {
-                this.manager.release(portalManager);
-            }
+            service.getComponentManager().getPortalManager().process();
             
             final Request request = ObjectModelHelper.getRequest(objectModel);
             final Session session = request.getSession(false);

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/generation/PortalGenerator.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/generation/PortalGenerator.java?view=diff&r1=158789&r2=158790
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/generation/PortalGenerator.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/generation/PortalGenerator.java
Wed Mar 23 08:02:48 2005
@@ -51,15 +51,16 @@
         // start the portal rendering
         // 1. event processing
         // 2. rendering
-        PortalManager pm = null;
+        PortalService service = null;
         try {
-            pm = (PortalManager)this.manager.lookup(PortalManager.ROLE);
+            service = (PortalService)this.manager.lookup(PortalService.ROLE);
+            PortalManager pm = service.getComponentManager().getPortalManager();
             pm.process();
             pm.showPortal(this.xmlConsumer, this.parameters);
         } catch (ServiceException ce) {
-            throw new ProcessingException("Unable to lookup portal manager.", ce);
+            throw new ProcessingException("Unable to lookup portal service.", ce);
         } finally {
-            this.manager.release(pm);
+            this.manager.release(service);
         }
 	}
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/DefaultPortalComponentManager.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/DefaultPortalComponentManager.java?view=diff&r1=158789&r2=158790
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/DefaultPortalComponentManager.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/DefaultPortalComponentManager.java
Wed Mar 23 08:02:48 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2002,2004 The Apache Software Foundation.
+ * Copyright 1999-2002,2004-2005 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.
@@ -32,6 +32,7 @@
 import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.cocoon.portal.LinkService;
 import org.apache.cocoon.portal.PortalComponentManager;
+import org.apache.cocoon.portal.PortalManager;
 import org.apache.cocoon.portal.coplet.CopletFactory;
 import org.apache.cocoon.portal.event.EventManager;
 import org.apache.cocoon.portal.layout.LayoutFactory;
@@ -55,30 +56,29 @@
 
     protected ServiceManager manager;
 
-    protected LinkService linkService;
-
-    protected ProfileManager profileManager;
-
     protected String profileManagerRole;
+    protected ProfileManager profileManager;
 
     protected String linkServiceRole;
+    protected LinkService linkService;
 
     protected String rendererSelectorRole;
-
     protected ServiceSelector rendererSelector;
 
     protected Map renderers;
 
     protected String copletFactoryRole;
-
-    protected String layoutFactoryRole;
-
     protected CopletFactory copletFactory;
 
+    protected String layoutFactoryRole;
     protected LayoutFactory layoutFactory;
 
+    protected String eventManagerRole;
     protected EventManager eventManager;
 
+    protected String portalManagerRole;
+    protected PortalManager portalManager;
+
     /* (non-Javadoc)
      * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
      */
@@ -120,7 +120,7 @@
     public EventManager getEventManager() {
         if ( null == this.eventManager ) {
             try {
-                this.eventManager = (EventManager)this.manager.lookup( EventManager.ROLE
);
+                this.eventManager = (EventManager)this.manager.lookup( this.eventManagerRole
);
             } catch (ServiceException e) {
                 throw new CascadingRuntimeException("Unable to lookup event manager with
role " + EventManager.ROLE, e);
             }
@@ -152,6 +152,8 @@
             this.layoutFactory = null;
             this.manager.release(this.eventManager);
             this.eventManager = null;
+            this.manager.release(this.portalManager);
+            this.portalManager = null;
             this.manager = null;
         }
     }
@@ -165,6 +167,8 @@
         this.rendererSelectorRole = config.getChild("renderer-selector").getValue(Renderer.ROLE+"Selector");
         this.copletFactoryRole = config.getChild("coplet-factory").getValue(CopletFactory.ROLE);
         this.layoutFactoryRole = config.getChild("layout-factory").getValue(LayoutFactory.ROLE);
+        this.eventManagerRole = config.getChild("event-manager").getValue(EventManager.ROLE);
+        this.portalManagerRole = config.getChild("portal-manager").getValue(PortalManager.ROLE);
     }
 
     /* (non-Javadoc)
@@ -219,4 +223,18 @@
         return this.layoutFactory;
     }
 
+
+    /**
+     * @see org.apache.cocoon.portal.PortalComponentManager#getPortalManager()
+     */
+    public PortalManager getPortalManager() {
+        if ( null == this.portalManager ) {
+            try {
+                this.portalManager = (PortalManager)this.manager.lookup( this.portalManagerRole);
+            } catch (ServiceException e) {
+                throw new CascadingRuntimeException("Unable to lookup portal manager with
role " + this.copletFactoryRole, e);
+            }
+        }
+        return this.portalManager;
+    }
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java?view=diff&r1=158789&r2=158790
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java
Wed Mar 23 08:02:48 2005
@@ -48,14 +48,15 @@
      */
     public void process()
     throws ProcessingException {
-        EventManager eventManager = null;
+        PortalService service = null;
         try {
-            eventManager = (EventManager)this.manager.lookup(EventManager.ROLE);
+            service = (PortalService)this.manager.lookup(PortalService.ROLE);
+            EventManager eventManager = service.getComponentManager().getEventManager();
             eventManager.processEvents();
         } catch (ServiceException ce) {
             throw new ProcessingException("Unable to lookup portal service.", ce);
         } finally {
-            this.manager.release(eventManager);
+            this.manager.release(service);
         }
     }
 
@@ -80,13 +81,6 @@
             contentHandler.endDocument();
         } catch (ServiceException ce) {
             throw new SAXException("Unable to lookup portal service.", ce);
-        } catch (Exception e) {
-            getLogger().error("Caught exception", e);
-            throw new SAXException(e);
-        } catch (Error e) {
-            getLogger().error("Caught error", e);
-            e.printStackTrace();
-            throw e;
         } finally {
             this.manager.release(service);
         }



Mime
View raw message