cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r328687 - in /cocoon: blocks/portal-sample/trunk/samples/ blocks/portal/trunk/ blocks/portal/trunk/java/org/apache/cocoon/portal/ blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/ blocks/portal/trunk/java/org/ap...
Date Wed, 26 Oct 2005 17:17:25 GMT
Author: cziegeler
Date: Wed Oct 26 10:13:41 2005
New Revision: 328687

URL: http://svn.apache.org/viewcvs?rev=328687&view=rev
Log:
Add layout source to stream complete coplets/layouts.
Revert to older Castor version (0.9.9 fails with NPEs)
Fix portlet url creation

Added:
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/source/LayoutSource.java   (with
props)
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/source/LayoutSourceFactory.java
  (with props)
    cocoon/trunk/legal/castor-0.9.6-xml.jar.license.txt
      - copied unchanged from r328374, cocoon/trunk/legal/castor-0.9.9-xml.jar.license.txt
    cocoon/trunk/lib/optional/castor-0.9.6-xml.jar   (with props)
Removed:
    cocoon/trunk/legal/castor-0.9.9-xml.jar.license.txt
    cocoon/trunk/lib/optional/castor-0.9.9-xml.jar
Modified:
    cocoon/blocks/portal-sample/trunk/samples/sitemap.xmap
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/SizingAspect.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/PortletURLProviderImpl.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/servletdefinitionmapping.xml
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/portal.roles
    cocoon/blocks/portal/trunk/pom.xml
    cocoon/blocks/portal/trunk/status.xml
    cocoon/trunk/lib/jars.xml

Modified: cocoon/blocks/portal-sample/trunk/samples/sitemap.xmap
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal-sample/trunk/samples/sitemap.xmap?rev=328687&r1=328686&r2=328687&view=diff
==============================================================================
--- cocoon/blocks/portal-sample/trunk/samples/sitemap.xmap (original)
+++ cocoon/blocks/portal-sample/trunk/samples/sitemap.xmap Wed Oct 26 10:13:41 2005
@@ -217,6 +217,19 @@
         </map:act>
       </map:match>
 
+      <map:match pattern="layoutxml-*">
+        <map:act type="cowarp-is-logged-in">
+          <map:parameter name="application" value="portal"/>
+
+          <map:generate src="layout://{../1}"/>
+          <map:transform type="cinclude"/>
+          <map:transform type="portal-coplet"/>
+          <map:transform type="portal-new-eventlink"/>
+          <map:transform type="encodeURL"/>
+          <map:serialize type="xml"/>
+        </map:act>
+      </map:match>
+
       <!-- Authenticate a user -->
       <map:match pattern="auth">
         <!-- Check if we are logged in:

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/SizingAspect.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/SizingAspect.java?rev=328687&r1=328686&r2=328687&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/SizingAspect.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/SizingAspect.java
Wed Oct 26 10:13:41 2005
@@ -49,8 +49,6 @@
  *  <li>{@link org.apache.cocoon.portal.layout.impl.CopletLayout}</li>
  * </ul>
  *
- * TODO: make the names of the aspects to test configurable
- *
  * @version $Id$
  */
 public class SizingAspect extends AbstractAspect {

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/PortletURLProviderImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/PortletURLProviderImpl.java?rev=328687&r1=328686&r2=328687&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/PortletURLProviderImpl.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/PortletURLProviderImpl.java
Wed Oct 26 10:13:41 2005
@@ -96,7 +96,7 @@
      * @param service
      * @param eventData
      */
-    PortletURLProviderImpl(PortalService service, String eventData) {
+    public PortletURLProviderImpl(PortalService service, String eventData) {
         this.linkService = service.getComponentManager().getLinkService();
         PortletURLConverter urlConverter = new PortletURLConverter(eventData);
         String copletId = urlConverter.getPortletId();

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/servletdefinitionmapping.xml
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/servletdefinitionmapping.xml?rev=328687&r1=328686&r2=328687&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/servletdefinitionmapping.xml
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/servletdefinitionmapping.xml
Wed Oct 26 10:13:41 2005
@@ -151,26 +151,29 @@
   <class name="org.apache.cocoon.portal.pluto.om.ServletDefinitionImpl">
 
     <field name="castorId" type="java.lang.String">
-
       <bind-xml name="id" node="attribute"/>
     </field>
 
     <field name="servletName" type="java.lang.String" required="true">
       <bind-xml name="servlet-name" node="element"/>
     </field>
+
     <field name="castorDisplayNames" 
          type="org.apache.cocoon.portal.pluto.om.common.DisplayNameImpl"
          collection="collection">
       <bind-xml name="display-name" node="element"/>
     </field>
+
     <field name="castorDescriptions" 
          type="org.apache.cocoon.portal.pluto.om.common.DescriptionImpl"
          collection="collection">
       <bind-xml name="description" node="element"/>
     </field>
+
     <field name="servletClass" type="java.lang.String">
       <bind-xml name="servlet-class" node="element"/>
     </field>
+
     <field name="castorInitParams"
            type="org.apache.cocoon.portal.pluto.om.common.ParameterImpl"
            collection="collection">
@@ -181,18 +184,20 @@
     <field name="icon" transient="true" direct="true">
       <bind-xml name="icon" node="element"/>
     </field>
+
     <field name="loadOnStartup" transient="true" direct="true">
       <bind-xml name="load-on-startup" node="element"/>
     </field>
+
     <field name="jspFile" type="java.lang.String">
       <bind-xml name="jsp-file" node="element"/>
     </field>
+
     <field name="castorInitSecurityRoleRefs"
            type="org.apache.cocoon.portal.pluto.om.common.SecurityRoleRefImpl"
            collection="collection">
       <bind-xml name="security-role-ref" node="element"/>
     </field>
-
   </class>
 
   <class name="org.apache.cocoon.portal.pluto.om.WebApplicationDefinitionImpl">

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/portal.roles
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/portal.roles?rev=328687&r1=328686&r2=328687&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/portal.roles (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/portal.roles Wed Oct 26 10:13:41
2005
@@ -151,11 +151,13 @@
 
 
   <!--+
-      | Coplet Source.
+      | Coplet and Layout Source.
       |
       +-->
     <role name="org.apache.excalibur.source.SourceFactory/coplet"
           default-class="org.apache.cocoon.portal.source.CopletSourceFactory"/>
+    <role name="org.apache.excalibur.source.SourceFactory/layout"
+          default-class="org.apache.cocoon.portal.source.LayoutSourceFactory"/>
 
 
   <!--+

Added: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/source/LayoutSource.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/source/LayoutSource.java?rev=328687&view=auto
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/source/LayoutSource.java (added)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/source/LayoutSource.java Wed
Oct 26 10:13:41 2005
@@ -0,0 +1,165 @@
+/*
+ * Copyright 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.
+ * 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.source;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.ContextException;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.cocoon.CascadingIOException;
+import org.apache.cocoon.components.ContextHelper;
+import org.apache.cocoon.portal.PortalService;
+import org.apache.cocoon.portal.layout.Layout;
+import org.apache.cocoon.portal.layout.renderer.Renderer;
+import org.apache.cocoon.serialization.Serializer;
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceNotFoundException;
+import org.apache.excalibur.source.SourceValidity;
+import org.apache.excalibur.xml.sax.XMLizable;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+
+/**
+ * This is the source implementation of the layout source.
+ *
+ * @version $Id$
+ */
+public class LayoutSource 
+    implements Source, XMLizable {
+
+    protected final ServiceManager manager;
+
+    protected final Context context;
+
+    protected final String uri;
+    protected final Layout layout;
+    protected final PortalService portalService;
+
+    /** The used protocol */
+    protected final String scheme;
+
+    public LayoutSource(String uri,
+                        String protocol,
+                        Layout layout,
+                        PortalService service,
+                        ServiceManager manager,
+                        Context context) {
+        this.uri = uri;
+        this.scheme = protocol;
+        this.layout = layout;
+        this.portalService = service;
+        this.manager = manager;
+        this.context = context;
+    }
+
+	/**
+	 * @see org.apache.excalibur.source.Source#getInputStream()
+	 */
+	public InputStream getInputStream() throws IOException, SourceNotFoundException {
+        try {
+            ServiceManager sitemapManager = (ServiceManager) this.context.get(ContextHelper.CONTEXT_SITEMAP_SERVICE_MANAGER);
+            Serializer serializer = null;
+            try {
+                serializer = (Serializer) sitemapManager.lookup(Serializer.ROLE+ "/xml");
+                ByteArrayOutputStream os = new ByteArrayOutputStream();
+                serializer.setOutputStream(os);
+                this.toSAX(serializer);
+                return new ByteArrayInputStream(os.toByteArray());
+            } catch (SAXException se) {
+                throw new CascadingIOException("Unable to stream content.", se);
+            } catch (ServiceException ce) {
+                throw new CascadingIOException("Unable to get components for serializing.",
ce);
+            } finally {
+                sitemapManager.release(serializer);
+            }
+        } catch (ContextException ce) {
+            throw new CascadingIOException("Unable to get sitemap service manager.", ce);
+        }
+	}
+
+	/**
+	 * @see org.apache.excalibur.source.Source#getURI()
+	 */
+	public String getURI() {
+		return this.uri;
+	}
+
+	/**
+	 * @see org.apache.excalibur.source.Source#getValidity()
+	 */
+	public SourceValidity getValidity() {
+		return null;
+	}
+
+	/**
+	 * @see org.apache.excalibur.source.Source#refresh()
+	 */
+	public void refresh() {
+        // nothing to do 
+	}
+
+	/**
+	 * @see org.apache.excalibur.source.Source#getMimeType()
+	 */
+	public String getMimeType() {
+		return null;
+	}
+
+	/**
+	 * @see org.apache.excalibur.source.Source#getContentLength()
+	 */
+	public long getContentLength() {
+		return -1;
+	}
+
+	/**
+	 * @see org.apache.excalibur.source.Source#getLastModified()
+	 */
+	public long getLastModified() {
+		return 0;
+	}
+
+	/**
+	 * @see org.apache.excalibur.xml.sax.XMLizable#toSAX(ContentHandler)
+	 */
+	public void toSAX(ContentHandler handler) 
+    throws SAXException {
+        Renderer portalLayoutRenderer = this.portalService.getComponentManager().getRenderer(
this.layout.getRendererName());
+
+        handler.startDocument();
+        portalLayoutRenderer.toSAX(this.layout, this.portalService, handler);
+        handler.endDocument();
+	}
+
+    /**
+     * @see org.apache.excalibur.source.Source#exists()
+     */
+    public boolean exists() {
+        return true;
+    }
+
+    /**
+     * @see org.apache.excalibur.source.Source#getScheme()
+     */
+    public String getScheme() {
+        return this.scheme;
+    }
+}

Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/source/LayoutSource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/source/LayoutSource.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/source/LayoutSourceFactory.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/source/LayoutSourceFactory.java?rev=328687&view=auto
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/source/LayoutSourceFactory.java
(added)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/source/LayoutSourceFactory.java
Wed Oct 26 10:13:41 2005
@@ -0,0 +1,80 @@
+/*
+ * Copyright 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.
+ * 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.source;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.Map;
+
+import org.apache.cocoon.portal.impl.AbstractComponent;
+import org.apache.cocoon.portal.layout.Layout;
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceFactory;
+
+/**
+ * The source factory for the layout sources.
+ *
+ * @version $Id$
+ */
+public class LayoutSourceFactory     
+    extends AbstractComponent
+    implements SourceFactory {
+
+	/**
+	 * @see org.apache.excalibur.source.SourceFactory#getSource(String, Map)
+	 */
+	public Source getSource(String location, Map parameters)
+    throws MalformedURLException, IOException {
+
+        String uri = location;
+        String protocol = null;
+
+        // remove the protocol
+        int position = location.indexOf(':') + 1;
+        if (position != 0) {
+            protocol = location.substring(0, position);
+            location = location.substring(position+2);
+        }
+        final int pos = location.indexOf(':');
+        final String profileKey;
+        final String layoutKey;
+        if ( pos == -1 ) {
+            profileKey = null;
+            layoutKey = location;
+        } else {
+            profileKey = location.substring(0, pos);
+            layoutKey = location.substring(pos+1);
+        }
+        final Layout layout = this.portalService.getComponentManager().getProfileManager().getPortalLayout(profileKey,
layoutKey);
+        if ( layout == null ) {
+            throw new IOException("Unable to get layout for: " + location);
+        }
+        LayoutSource source = new LayoutSource(uri,
+                                               protocol,
+                                               layout,
+                                               this.portalService,
+                                               this.manager,
+                                               this.context);
+        return source;
+	}
+
+    /**
+     * @see org.apache.excalibur.source.SourceFactory#release(Source)
+     */
+    public void release(Source source) {
+        // nothing to do 
+    }
+}

Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/source/LayoutSourceFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/source/LayoutSourceFactory.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: cocoon/blocks/portal/trunk/pom.xml
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/pom.xml?rev=328687&r1=328686&r2=328687&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/pom.xml (original)
+++ cocoon/blocks/portal/trunk/pom.xml Wed Oct 26 10:13:41 2005
@@ -90,7 +90,7 @@
     <dependency>
       <groupId>castor</groupId>
       <artifactId>castor</artifactId>
-      <version>0.9.9</version>
+      <version>0.9.6</version>
     </dependency>
     <dependency>
       <groupId>commons-collections</groupId>

Modified: cocoon/blocks/portal/trunk/status.xml
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/status.xml?rev=328687&r1=328686&r2=328687&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/status.xml (original)
+++ cocoon/blocks/portal/trunk/status.xml Wed Oct 26 10:13:41 2005
@@ -66,6 +66,9 @@
  <changes>
   <release version="@version@" date="@date@">
     <action dev="CZ" type="add">
+      Add layout source to stream complete coplets/layouts.
+    </action>
+    <action dev="CZ" type="add">
       Add temporary attributes to Layout objects.
     </action>
     <action dev="CZ" type="update">

Modified: cocoon/trunk/lib/jars.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/lib/jars.xml?rev=328687&r1=328686&r2=328687&view=diff
==============================================================================
--- cocoon/trunk/lib/jars.xml (original)
+++ cocoon/trunk/lib/jars.xml Wed Oct 26 10:13:41 2005
@@ -646,7 +646,7 @@
       binding, Java-to-SQL persistence.
     </description>
     <used-by>CastorTransformer and precept</used-by>
-    <lib>optional/castor-0.9.9-xml.jar</lib>
+    <lib>optional/castor-0.9.6-xml.jar</lib>
     <homepage>http://castor.codehaus.org/</homepage>
   </file>
 

Added: cocoon/trunk/lib/optional/castor-0.9.6-xml.jar
URL: http://svn.apache.org/viewcvs/cocoon/trunk/lib/optional/castor-0.9.6-xml.jar?rev=328687&view=auto
==============================================================================
Binary file - no diff available.

Propchange: cocoon/trunk/lib/optional/castor-0.9.6-xml.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



Mime
View raw message