You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by re...@apache.org on 2008/04/03 11:32:46 UTC
svn commit: r644238 - in /cocoon/whiteboard/corona/trunk:
corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/
corona-core/src/main/resources/
corona-core/src/test/java/org/apache/cocoon/corona/pipeline/
corona-core/src/test/resources...
Author: reinhard
Date: Thu Apr 3 02:32:37 2008
New Revision: 644238
URL: http://svn.apache.org/viewvc?rev=644238&view=rev
Log:
. make components more friendly for usage via API (constructors, pass URLs, explicit setters/getters)
. schema for sitemap language (-> servlet environment independant)
. schema for additional elements in sitemap language (-> servlet environment)
. move redirectComponent and redirectNode to corona-servlet (because it's serlvet API specific)
. exception generator
. fix handle-errors
Added:
cocoon/whiteboard/corona/trunk/corona-core/src/test/resources/test.xml
- copied unchanged from r643483, cocoon/whiteboard/corona/trunk/corona-core/src/main/resources/test.xml
cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/node/RedirectNode.java (with props)
cocoon/whiteboard/corona/trunk/corona-servlet/src/main/resources/META-INF/cocoon/spring/corona-servlet-component.xml (with props)
cocoon/whiteboard/corona/trunk/corona-servlet/src/main/resources/corona-servlet-1.0.xsd (with props)
cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/component/
cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/component/ExceptionGenerator.java (with props)
cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/util/ParameterHelper.java (with props)
cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/xml/
cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/xml/AttributeTypes.java (with props)
cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/xml/AttributesImpl.java (with props)
cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/resources/corona-sitemap-1.0.xsd (with props)
Removed:
cocoon/whiteboard/corona/trunk/corona-core/src/main/resources/test.xml
cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/RedirectNode.java
Modified:
cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/FileGenerator.java
cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/FileReaderComponent.java
cocoon/whiteboard/corona/trunk/corona-core/src/test/java/org/apache/cocoon/corona/pipeline/PipelineTest.java
cocoon/whiteboard/corona/trunk/corona-servlet/rcl.properties
cocoon/whiteboard/corona/trunk/corona-servlet/src/main/resources/COB-INF/sitemap.xmap
cocoon/whiteboard/corona/trunk/corona-servlet/src/test/java/org/apache/cocoon/corona/sitemap/SitemapBuilderTest.java
cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/Invocation.java
cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/InvocationImpl.java
cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/SitemapBuilder.java
cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ErrorNode.java
cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/GenerateNode.java
cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelineNode.java
cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelinesNode.java
cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ReadNode.java
cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/spring/SitemapNodeNameGenerator.java
cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/resources/META-INF/cocoon/spring/corona-pipeline-component.xml
cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/resources/META-INF/cocoon/spring/corona-sitemap-node.xml
Modified: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/FileGenerator.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/FileGenerator.java?rev=644238&r1=644237&r2=644238&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/FileGenerator.java (original)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/FileGenerator.java Thu Apr 3 02:32:37 2008
@@ -26,24 +26,31 @@
import org.apache.cocoon.corona.pipeline.caching.CacheKey;
import org.apache.cocoon.corona.pipeline.caching.TimestampCacheKey;
-import org.apache.cocoon.corona.pipeline.resource.ClassPathResourceResolver;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
public class FileGenerator extends AbstractXMLProducer implements Starter, CachingPipelineComponent {
- private String src;
+ private URL source;
+
+ public FileGenerator() {
+ super();
+ }
+
+ public FileGenerator(URL source) {
+ super();
+ this.source = source;
+ }
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.corona.pipeline.component.CachingPipelineComponent#constructCacheKey(Map)
*/
public CacheKey constructCacheKey(Map<String, ? extends Object> parameters) {
- URL url = ClassPathResourceResolver.getInstance().resolve(this.src);
try {
- return new TimestampCacheKey(url, url.openConnection().getLastModified());
+ return new TimestampCacheKey(this.source, this.source.openConnection().getLastModified());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -54,15 +61,13 @@
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.corona.pipeline.component.Starter#execute(Map)
*/
public void execute(Map<String, ? extends Object> parameters) {
- // resolve the "src" parameter before using it
- URL url = ClassPathResourceResolver.getInstance().resolve(this.src);
- if (url == null) {
+ if (this.source == null) {
// failed to resolve
- throw new IllegalArgumentException("FileGenerator cannot resolve source '" + this.src + "'");
+ throw new IllegalArgumentException("FileGenerator cannot resolve source '" + this.source + "'");
}
try {
@@ -71,7 +76,7 @@
xmlReader.setContentHandler(this.getXMLConsumer());
xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", this.getXMLConsumer());
- InputStream inputStream = new BufferedInputStream(url.openStream());
+ InputStream inputStream = new BufferedInputStream(this.source.openStream());
xmlReader.parse(new InputSource(inputStream));
inputStream.close();
} catch (Exception e) {
@@ -81,11 +86,15 @@
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.corona.pipeline.component.AbstractXMLProducer#setParameters(java.util.Map)
*/
@Override
public void setParameters(Map<String, ? extends Object> parameters) {
- this.src = (String) parameters.get("src");
+ this.setSource((URL) parameters.get("source"));
+ }
+
+ public void setSource(URL source) {
+ this.source = source;
}
}
Modified: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/FileReaderComponent.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/FileReaderComponent.java?rev=644238&r1=644237&r2=644238&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/FileReaderComponent.java (original)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/FileReaderComponent.java Thu Apr 3 02:32:37 2008
@@ -22,21 +22,35 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
+import java.net.URLConnection;
import java.util.Map;
import org.apache.cocoon.corona.pipeline.caching.CacheKey;
import org.apache.cocoon.corona.pipeline.caching.TimestampCacheKey;
-import org.apache.cocoon.corona.pipeline.resource.ClassPathResourceResolver;
public class FileReaderComponent implements Starter, Finisher, CachingPipelineComponent {
private OutputStream outputStream;
- private String src;
+ private URL source;
+ public FileReaderComponent() {
+ super();
+ }
+
+ public FileReaderComponent(URL source) {
+ super();
+ this.source = source;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.apache.cocoon.corona.pipeline.component.CachingPipelineComponent#constructCacheKey(java.util.Map)
+ */
public CacheKey constructCacheKey(Map<String, ? extends Object> parameters) {
- URL url = ClassPathResourceResolver.getInstance().resolve(this.src);
try {
- return new TimestampCacheKey(url, url.openConnection().getLastModified());
+ URLConnection connection = this.source.openConnection();
+ return new TimestampCacheKey(this.source, connection.getLastModified());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -47,17 +61,16 @@
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.corona.pipeline.component.Starter#execute(Map)
*/
public void execute(Map<String, ? extends Object> parameters) {
try {
- URL url = ClassPathResourceResolver.getInstance().resolve(this.src);
- if (url == null) {
- throw new IllegalArgumentException("FileReaderComponent could not resolve '" + this.src + "'");
+ if (this.source == null) {
+ throw new IllegalArgumentException("FileReaderComponent has no source configured to read from.");
}
- InputStream inputStream = url.openStream();
+ InputStream inputStream = this.source.openStream();
byte[] data = new byte[1024];
while (true) {
@@ -69,15 +82,17 @@
this.outputStream.write(data, 0, bytesRead);
}
+
+ inputStream.close();
} catch (IOException e) {
// TODO: a specific exception is in order
- throw new RuntimeException("FileReader cannot read from '" + this.src + "'", e);
+ throw new RuntimeException("FileReader cannot read from '" + this.source + "'", e);
}
}
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.corona.pipeline.component.Finisher#setOutputStream(java.io.OutputStream)
*/
public void setOutputStream(OutputStream outputStream) {
@@ -86,20 +101,24 @@
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.corona.pipeline.component.PipelineComponent#setParameters(java.util.Map)
*/
public void setParameters(Map<String, ? extends Object> parameters) {
- this.src = (String) parameters.get("src");
+ this.setSource((URL) parameters.get("source"));
+ }
+
+ public void setSource(URL source) {
+ this.source = source;
}
/**
* {@inheritDoc}
- *
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "ReaderComponent(" + this.src + ")";
+ return "ReaderComponent(" + this.source + ")";
}
}
Modified: cocoon/whiteboard/corona/trunk/corona-core/src/test/java/org/apache/cocoon/corona/pipeline/PipelineTest.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/test/java/org/apache/cocoon/corona/pipeline/PipelineTest.java?rev=644238&r1=644237&r2=644238&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/test/java/org/apache/cocoon/corona/pipeline/PipelineTest.java (original)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/test/java/org/apache/cocoon/corona/pipeline/PipelineTest.java Thu Apr 3 02:32:37 2008
@@ -18,9 +18,6 @@
*/
package org.apache.cocoon.corona.pipeline;
-import java.util.HashMap;
-import java.util.Map;
-
import junit.framework.TestCase;
import org.apache.cocoon.corona.pipeline.component.FileReaderComponent;
@@ -28,18 +25,12 @@
public class PipelineTest extends TestCase {
/**
- * Demonstration of how to use the pipeline API. Currently it hasn't been
- * optimized for this purpose though!
+ * Demonstration of how to use the pipeline API. Currently it hasn't been optimized for this purpose though!
*/
public void testPipeline() throws Exception {
Pipeline pipeline = new NonCachingPipeline();
- FileReaderComponent fileReaderComponent = new FileReaderComponent();
- Map<String, Object> parameters = new HashMap<String, Object>();
- parameters.put("src", "/test.xml");
- fileReaderComponent.setParameters(parameters);
- pipeline.addComponent(fileReaderComponent);
-
+ pipeline.addComponent(new FileReaderComponent(PipelineTest.class.getResource("/test.xml")));
pipeline.execute(null, System.out);
}
}
Modified: cocoon/whiteboard/corona/trunk/corona-servlet/rcl.properties
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-servlet/rcl.properties?rev=644238&r1=644237&r2=644238&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-servlet/rcl.properties (original)
+++ cocoon/whiteboard/corona/trunk/corona-servlet/rcl.properties Thu Apr 3 02:32:37 2008
@@ -18,4 +18,8 @@
# Cocoon Corona Core
#%classes-dir=../corona-core/target/classes
-#%exclude-lib=org.apache.cocoon:corona-core
\ No newline at end of file
+#%exclude-lib=org.apache.cocoon:corona-core
+
+# Cocoon Corona Sitemap
+#%classes-dir=../corona-sitemap/target/classes
+#%exclude-lib=org.apache.cocoon:corona-sitemap
\ No newline at end of file
Added: cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/node/RedirectNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/node/RedirectNode.java?rev=644238&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/node/RedirectNode.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/node/RedirectNode.java Thu Apr 3 02:32:37 2008
@@ -0,0 +1,52 @@
+/*
+ * 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.corona.servlet.node;
+
+import org.apache.cocoon.corona.sitemap.Invocation;
+import org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode;
+import org.apache.cocoon.corona.sitemap.node.InvocationResult;
+import org.apache.cocoon.corona.sitemap.node.Node;
+
+@Node(name="redirect-to")
+public class RedirectNode extends AbstractSitemapNode {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#invoke(org.apache.cocoon.corona.sitemap.Invocation)
+ */
+ @Override
+ public InvocationResult invoke(Invocation invocation) {
+ // install the component
+ invocation.installComponent("redirector", this.getParameters());
+
+ // signal that we did some processing
+ return InvocationResult.PROCESSED;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#toString()
+ */
+ @Override
+ public String toString() {
+ return "RedirectNode(" + this.getParameters().get("uri") + ")";
+ }
+}
Propchange: cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/node/RedirectNode.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/node/RedirectNode.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/node/RedirectNode.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: cocoon/whiteboard/corona/trunk/corona-servlet/src/main/resources/COB-INF/sitemap.xmap
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-servlet/src/main/resources/COB-INF/sitemap.xmap?rev=644238&r1=644237&r2=644238&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-servlet/src/main/resources/COB-INF/sitemap.xmap (original)
+++ cocoon/whiteboard/corona/trunk/corona-servlet/src/main/resources/COB-INF/sitemap.xmap Thu Apr 3 02:32:37 2008
@@ -1,11 +1,30 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<map:sitemap xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://apache.org/cocoon/sitemap/1.0 http://cocoon.apache.org/schema/sitemap/cocoon-sitemap-1.0.xsd"
- xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+<?xml version="1.0" encoding="UTF-8" ?>
+<map:sitemap xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:map="http://apache.org/cocoon/corona/sitemap"
+ xmlns:servlet="http://apache.org/cocoon/corona/servlet">
<map:flow language="it-controller" />
<map:pipelines>
+ <!-- ~~~~~~~~~~~~~~~~ exemplary image pipelines ~~~~~~~~~~~~~~~ -->
+ <map:pipeline id="image">
+ <map:match pattern="images/simple">
+ <map:generate src="images/simple.jpg" type="image" />
+ <map:serialize type="image">
+ <map:parameter name="format" value="png" />
+ </map:serialize>
+ </map:match>
+ <map:match pattern="images/simple-gray">
+ <map:generate src="images/simple.jpg" type="image" />
+ <map:transform type="image-gray">
+ <map:parameter name="brighten" value="true" />
+ <map:parameter name="gray" value="10" />
+ </map:transform>
+ <map:serialize type="image">
+ <map:parameter name="format" value="PNG" />
+ </map:serialize>
+ </map:match>
+ </map:pipeline>
+
<!-- ~~~~~~~~~~~~~~~~ map:read ~~~~~~~~~~~~~~~ -->
<map:pipeline id="read">
<map:match pattern="">
@@ -168,7 +187,7 @@
<!-- ~~~~~~~~~~~~~~~~ redirect ~~~~~~~~~~~~~~~ -->
<map:pipeline id="redirect">
<map:match pattern="redirect/www.orf.at">
- <map:redirect-to uri="http://www.orf.at" />
+ <servlet:redirect-to uri="http://www.orf.at" />
</map:match>
<!-- Redirecting to a servlet service doesn't work -->
<!--map:match pattern="redirect/sax-pipeline/simple-xml">
@@ -184,6 +203,7 @@
<map:serialize type="xml" />
</map:match>
</map:pipeline>
+
<!-- doesn't work: when this per pipeline error handler is active, it catches ALL error and
the per-sitemap error handler will never be reached. -->
<map:pipeline id="error-handling-2">
@@ -197,21 +217,26 @@
<map:serialize type="xhtml" status-code="501" />
</map:handle-errors>
</map:pipeline>
+
<map:handle-errors>
- <map:select type="custom-exception">
+ <map:generate type="exception" src="error-handling/503.xml" />
+ <map:serialize type="xhtml" status-code="503" />
+ <!--
+ <map:select type="custom-exception">
<map:when test="not-found">
- <map:generate src="error-handling/404.xml" />
- <map:serialize type="xhtml" status-code="404" />
+ <map:generate src="error-handling/404.xml" />
+ <map:serialize type="xhtml" status-code="404" />
</map:when>
<map:when test="custom-exception">
- <map:generate src="error-handling/500.xml" />
- <map:serialize type="xhtml" status-code="500" />
+ <map:generate src="error-handling/500.xml" />
+ <map:serialize type="xhtml" status-code="500" />
</map:when>
<map:otherwise>
- <map:generate type="exception" src="error-handling/503.xml" />
- <map:serialize type="xhtml" status-code="503" />
+ <map:generate type="exception" src="error-handling/503.xml" />
+ <map:serialize type="xhtml" status-code="503" />
</map:otherwise>
- </map:select>
+ </map:select>
+ -->
</map:handle-errors>
</map:pipelines>
Added: cocoon/whiteboard/corona/trunk/corona-servlet/src/main/resources/META-INF/cocoon/spring/corona-servlet-component.xml
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-servlet/src/main/resources/META-INF/cocoon/spring/corona-servlet-component.xml?rev=644238&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-servlet/src/main/resources/META-INF/cocoon/spring/corona-servlet-component.xml (added)
+++ cocoon/whiteboard/corona/trunk/corona-servlet/src/main/resources/META-INF/cocoon/spring/corona-servlet-component.xml Thu Apr 3 02:32:37 2008
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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
+ und
+-->
+<!-- $Id$ -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+
+ <bean name="redirector" class="org.apache.cocoon.corona.servlet.component.RedirectorComponent" scope="prototype" />
+
+ <bean name="generator:request-parameters" class="org.apache.cocoon.corona.servlet.component.RequestParametersGenerator" scope="prototype" />
+
+</beans>
Propchange: cocoon/whiteboard/corona/trunk/corona-servlet/src/main/resources/META-INF/cocoon/spring/corona-servlet-component.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/whiteboard/corona/trunk/corona-servlet/src/main/resources/META-INF/cocoon/spring/corona-servlet-component.xml
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/whiteboard/corona/trunk/corona-servlet/src/main/resources/META-INF/cocoon/spring/corona-servlet-component.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: cocoon/whiteboard/corona/trunk/corona-servlet/src/main/resources/corona-servlet-1.0.xsd
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-servlet/src/main/resources/corona-servlet-1.0.xsd?rev=644238&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-servlet/src/main/resources/corona-servlet-1.0.xsd (added)
+++ cocoon/whiteboard/corona/trunk/corona-servlet/src/main/resources/corona-servlet-1.0.xsd Thu Apr 3 02:32:37 2008
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://apache.org/cocoon/corona/servlet"
+ xmlns="http://apache.org/cocoon/corona/servlet" elementFormDefault="qualified">
+
+ <xsd:element name="redirect-to">
+ <xsd:complexType>
+ <xsd:attribute name="uri" type="xsd:string" use="optional" />
+ <xsd:attribute name="resource" type="xsd:string" use="optional" />
+ </xsd:complexType>
+ </xsd:element>
+
+</xsd:schema>
Propchange: cocoon/whiteboard/corona/trunk/corona-servlet/src/main/resources/corona-servlet-1.0.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/whiteboard/corona/trunk/corona-servlet/src/main/resources/corona-servlet-1.0.xsd
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/whiteboard/corona/trunk/corona-servlet/src/main/resources/corona-servlet-1.0.xsd
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: cocoon/whiteboard/corona/trunk/corona-servlet/src/test/java/org/apache/cocoon/corona/sitemap/SitemapBuilderTest.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-servlet/src/test/java/org/apache/cocoon/corona/sitemap/SitemapBuilderTest.java?rev=644238&r1=644237&r2=644238&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-servlet/src/test/java/org/apache/cocoon/corona/sitemap/SitemapBuilderTest.java (original)
+++ cocoon/whiteboard/corona/trunk/corona-servlet/src/test/java/org/apache/cocoon/corona/sitemap/SitemapBuilderTest.java Thu Apr 3 02:32:37 2008
@@ -37,11 +37,8 @@
public class SitemapBuilderTest extends TestCase {
private Sitemap sitemap;
-
private SitemapBuilder sitemapBuilder;
-
private ComponentProvider componentProvider;
-
private StatusCodeCollector statusCodeCollector;
public void testErrorHandlingGlobal() {
@@ -90,12 +87,13 @@
}
public void testNoMatchingPipeline() {
- try {
- this.sitemap.invoke(this.buildInvocation("unknown"));
- fail("NoMatchingPipelineException was expected");
- } catch (NoMatchingPipelineException nmpex) {
- // expected result
- }
+ Invocation invocation = this.buildInvocation("unknown");
+ InvocationResult invocationResult = this.sitemap.invoke(invocation);
+
+ assertNotNull(invocationResult);
+ assertTrue(invocation.isErrorInvocation());
+ assertTrue("Expected NoMatchingPipelineException but received " + invocation.getThrowable(),
+ invocation.getThrowable() instanceof NoMatchingPipelineException);
}
public void testObjectModelPipeline() {
@@ -176,18 +174,15 @@
ApplicationContext applicationContext = new ClassPathXmlApplicationContext(new String[] {
"META-INF/cocoon/spring/applicationContext.xml", "META-INF/cocoon/spring/corona-pipeline-action.xml",
"META-INF/cocoon/spring/corona-pipeline-component.xml", "META-INF/cocoon/spring/corona-pipeline.xml",
- "META-INF/cocoon/spring/corona-sitemap-node.xml",
- "META-INF/cocoon/spring/corona-expression-language.xml",
- "META-INF/cocoon/spring/corona-servlet-node.xml"});
+ "META-INF/cocoon/spring/corona-sitemap-node.xml", "META-INF/cocoon/spring/corona-expression-language.xml",
+ "META-INF/cocoon/spring/corona-servlet-node.xml", "META-INF/cocoon/spring/corona-servlet-component.xml"});
this.statusCodeCollector = (StatusCodeCollector) applicationContext.getBean(StatusCodeCollector.class.getName());
- this.componentProvider = (ComponentProvider) applicationContext
- .getBean("org.apache.cocoon.corona.sitemap.ComponentProvider");
+ this.componentProvider = (ComponentProvider) applicationContext.getBean("org.apache.cocoon.corona.sitemap.ComponentProvider");
URL sitemapURL = this.getClass().getResource("/COB-INF/sitemap.xmap");
- this.sitemapBuilder = (SitemapBuilder) applicationContext
- .getBean("org.apache.cocoon.corona.sitemap.SitemapBuilder");
+ this.sitemapBuilder = (SitemapBuilder) applicationContext.getBean("org.apache.cocoon.corona.sitemap.SitemapBuilder");
this.sitemap = this.sitemapBuilder.build(sitemapURL);
}
Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/Invocation.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/Invocation.java?rev=644238&r1=644237&r2=644238&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/Invocation.java (original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/Invocation.java Thu Apr 3 02:32:37 2008
@@ -58,4 +58,6 @@
String getSitemapParameter(String parameterName);
+ public String resolveParameter(final String parameter);
+
}
Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/InvocationImpl.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/InvocationImpl.java?rev=644238&r1=644237&r2=644238&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/InvocationImpl.java (original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/InvocationImpl.java Thu Apr 3 02:32:37 2008
@@ -29,32 +29,26 @@
import org.apache.cocoon.corona.pipeline.action.Action;
import org.apache.cocoon.corona.pipeline.component.PipelineComponent;
import org.apache.cocoon.corona.sitemap.expression.LanguageInterpreter;
+import org.apache.cocoon.corona.sitemap.util.ParameterHelper;
public class InvocationImpl implements Invocation {
private static final Pattern PARAMETER_PATTERN = Pattern.compile("\\{([a-zA-Z\\-]+):([^\\{]*)\\}");
private ComponentProvider componentProvider;
-
private OutputStream outputStream;
-
private Map<String, Object> parameters = new HashMap<String, Object>();
-
private Pipeline pipeline;
-
private String requestURI;
-
private SitemapParameters sitemapParameters = new SitemapParameters();
- private Throwable throwable;
-
public InvocationImpl() {
}
/**
* Create a {@link InvocationImpl} object using the given output stream.
- *
- * @param outputStream The {@link OutputStream} where the result is writen to.
+ *
+ * @param outputStream The {@link OutputStream} where the result is writen to.
*/
public InvocationImpl(OutputStream outputStream) {
super();
@@ -63,9 +57,9 @@
/**
* Create a {@link InvocationImpl} object using the given output stream and requestURI.
- *
- * @param outputStream The {@link OutputStream} where the result is writen to.
- * @param requestURI The requested path.
+ *
+ * @param outputStream The {@link OutputStream} where the result is writen to.
+ * @param requestURI The requested path.
*/
public InvocationImpl(OutputStream outputStream, String requestURI) {
super();
@@ -75,10 +69,10 @@
/**
* Create a {@link InvocationImpl} object using the given output stream, requestURI and parameters.
- *
- * @param outputStream The {@link OutputStream} where the result is writen to.
- * @param requestURI The requested path.
- * @param parameters A {@link Map} of parameters that are used when the pipeline is being executed.
+ *
+ * @param outputStream The {@link OutputStream} where the result is written to.
+ * @param requestURI The requested path.
+ * @param parameters A {@link Map} of parameters that are used when the pipeline is being executed.
*/
public InvocationImpl(OutputStream outputStream, String requestURI, Map<String, Object> parameters) {
super();
@@ -89,7 +83,7 @@
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.corona.sitemap.Invocation#execute()
*/
public void execute() throws Exception {
@@ -102,7 +96,7 @@
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.corona.sitemap.Invocation#getOutputStream()
*/
public OutputStream getOutputStream() {
@@ -111,7 +105,7 @@
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.corona.sitemap.Invocation#getParameter(java.lang.String)
*/
public Object getParameter(String name) {
@@ -123,7 +117,7 @@
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.corona.sitemap.Invocation#getParameters()
*/
public Map<String, Object> getParameters() {
@@ -132,7 +126,7 @@
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.corona.sitemap.Invocation#getRequestURI()
*/
public String getRequestURI() {
@@ -145,16 +139,16 @@
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.corona.sitemap.Invocation#getThrowable()
*/
public Throwable getThrowable() {
- return this.throwable;
+ return ParameterHelper.getThrowable(this.parameters);
}
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.corona.sitemap.Invocation#installAction(java.lang.String)
*/
public void installAction(String type) {
@@ -168,9 +162,8 @@
/**
* {@inheritDoc}
- *
- * @see org.apache.cocoon.corona.sitemap.Invocation#installComponent(java.lang.String,
- * java.util.Map)
+ *
+ * @see org.apache.cocoon.corona.sitemap.Invocation#installComponent(java.lang.String, java.util.Map)
*/
public void installComponent(String type, Map<String, ? extends Object> componentParameters) {
if (this.pipeline == null) {
@@ -185,7 +178,7 @@
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.corona.sitemap.Invocation#installPipeline(java.lang.String)
*/
public void installPipeline(String type) {
@@ -194,16 +187,16 @@
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.corona.sitemap.Invocation#isErrorInvocation()
*/
public boolean isErrorInvocation() {
- return this.throwable != null;
+ return this.getThrowable() != null;
}
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.corona.sitemap.Invocation#popSitemapParameters()
*/
public void popSitemapParameters() {
@@ -212,9 +205,8 @@
/**
* {@inheritDoc}
- *
- * @see org.apache.cocoon.corona.sitemap.Invocation#pushSitemapParameters(java.lang.String,
- * java.util.Map)
+ *
+ * @see org.apache.cocoon.corona.sitemap.Invocation#pushSitemapParameters(java.lang.String, java.util.Map)
*/
public void pushSitemapParameters(String nodeName, Map<String, ? extends Object> sitemapParameters) {
this.sitemapParameters.pushParameters(nodeName, sitemapParameters);
@@ -222,7 +214,7 @@
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.corona.sitemap.Invocation#resolve(java.lang.String)
*/
public URL resolve(String resource) {
@@ -235,7 +227,7 @@
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.corona.sitemap.Invocation#setOutputStream(java.io.OutputStream)
*/
public void setOutputStream(OutputStream outputStream) {
@@ -244,7 +236,7 @@
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.corona.sitemap.Invocation#setParameters(java.util.Map)
*/
public void setParameters(Map<String, Object> parameters) {
@@ -257,18 +249,18 @@
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.corona.sitemap.Invocation#setThrowable(java.lang.Throwable)
*/
public void setThrowable(Throwable throwable) {
- this.throwable = throwable;
+ ParameterHelper.setThrowable(this.parameters, throwable);
}
private LanguageInterpreter getLanguageInterpreter(final String language) {
return this.componentProvider.getLanguageInterpreter(language);
}
- private String resolveParameter(final String parameter) {
+ public String resolveParameter(final String parameter) {
final StringBuilder result = new StringBuilder(parameter);
final Matcher matcher = PARAMETER_PATTERN.matcher(result);
@@ -276,8 +268,8 @@
final String language = matcher.group(1);
final LanguageInterpreter languageInterpreter = this.getLanguageInterpreter(language);
if (languageInterpreter == null) {
- throw new IllegalArgumentException("Could not resolve parameter '" + parameter + "'. The language '"
- + language + "' is not supported.");
+ throw new IllegalArgumentException("Could not resolve parameter '" + parameter + "'. The language '" + language
+ + "' is not supported.");
}
final String variable = matcher.group(2);
Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/SitemapBuilder.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/SitemapBuilder.java?rev=644238&r1=644237&r2=644238&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/SitemapBuilder.java (original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/SitemapBuilder.java Thu Apr 3 02:32:37 2008
@@ -25,11 +25,14 @@
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
+import javax.xml.validation.SchemaFactory;
import org.apache.cocoon.corona.sitemap.node.Sitemap;
import org.apache.cocoon.corona.sitemap.node.SitemapNode;
import org.apache.cocoon.corona.sitemap.node.SitemapNodeFactory;
import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
public class SitemapBuilder {
@@ -39,6 +42,8 @@
public Sitemap build(URL sitemap) throws Exception {
SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
saxParserFactory.setNamespaceAware(true);
+// saxParserFactory.setSchema(SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema").newSchema());
+
SAXParser saxParser = saxParserFactory.newSAXParser();
InputStream inputStream = sitemap.openStream();
@@ -60,7 +65,6 @@
class SitemapHandler extends DefaultHandler {
private SitemapNode currentNode;
-
private Sitemap sitemap;
@Override
@@ -70,6 +74,11 @@
}
this.currentNode = this.currentNode.getParent();
+ }
+
+ @Override
+ public void error(SAXParseException e) throws SAXException {
+ throw e;
}
public Sitemap getSitemap() {
Added: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/component/ExceptionGenerator.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/component/ExceptionGenerator.java?rev=644238&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/component/ExceptionGenerator.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/component/ExceptionGenerator.java Thu Apr 3 02:32:37 2008
@@ -0,0 +1,81 @@
+/*
+ * 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.corona.sitemap.component;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Map;
+
+import org.apache.cocoon.corona.pipeline.component.AbstractXMLProducer;
+import org.apache.cocoon.corona.pipeline.component.Starter;
+import org.apache.cocoon.corona.sitemap.util.ParameterHelper;
+import org.apache.cocoon.corona.sitemap.xml.AttributesImpl;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+
+public class ExceptionGenerator extends AbstractXMLProducer implements Starter {
+
+ public static final String EXCEPTION_NS = "";
+
+ // public static final String EXCEPTION_NS = "http://apache.org/cocoon/exception/1.0";
+
+ private static void simpleElement(String name, Attributes attr, String value, ContentHandler handler) throws SAXException {
+ handler.startElement(EXCEPTION_NS, name, name, attr);
+ // handler.startElement(EXCEPTION_NS, name, "ex:" + name, attr);
+ if (value != null && value.length() > 0) {
+ handler.characters(value.toCharArray(), 0, value.length());
+ }
+ handler.endElement(EXCEPTION_NS, name, name);
+ // handler.endElement(EXCEPTION_NS, name, "ex:" + name);
+ }
+
+ public void execute(Map<String, ? extends Object> parameters) {
+ Throwable throwable = ParameterHelper.getThrowable(parameters);
+
+ try {
+ this.getXMLConsumer().startDocument();
+ this.toSAX(throwable, this.getXMLConsumer());
+ this.getXMLConsumer().endDocument();
+ } catch (SAXException e) {
+ throw new RuntimeException("Failed to generate exception document.", e);
+ }
+ }
+
+ private void toSAX(Throwable throwable, ContentHandler handler) throws SAXException {
+ AttributesImpl attr = new AttributesImpl();
+ // handler.startPrefixMapping("ex", EXCEPTION_NS);
+ attr.addCDATAAttribute("class", throwable.getClass().getName());
+ handler.startElement(EXCEPTION_NS, "exception-report", "exception-report", attr);
+ // handler.startElement(EXCEPTION_NS, "exception-report", "ex:exception-report", attr);
+
+ // exception message
+ attr.clear();
+ simpleElement("message", attr, throwable.getMessage(), handler);
+
+ // exception stacktrace
+ attr.clear();
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw, true);
+ throwable.printStackTrace(pw);
+ simpleElement("stacktrace", attr, sw.getBuffer().toString(), handler);
+
+ handler.endElement(EXCEPTION_NS, "exception-report", "exception-report");
+ // handler.endElement(EXCEPTION_NS, "exception-report", "ex:exception-report");
+ // handler.endPrefixMapping("ex");
+ }
+}
Propchange: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/component/ExceptionGenerator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/component/ExceptionGenerator.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/component/ExceptionGenerator.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ErrorNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ErrorNode.java?rev=644238&r1=644237&r2=644238&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ErrorNode.java (original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ErrorNode.java Thu Apr 3 02:32:37 2008
@@ -20,8 +20,8 @@
import org.apache.cocoon.corona.sitemap.Invocation;
-@Node(name="handle-errors")
-public class ErrorNode extends AbstractSitemapNode {
+@Node(name = "handle-errors")
+public class ErrorNode extends PipelineNode {
@Override
public InvocationResult invoke(Invocation invocation) {
Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/GenerateNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/GenerateNode.java?rev=644238&r1=644237&r2=644238&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/GenerateNode.java (original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/GenerateNode.java Thu Apr 3 02:32:37 2008
@@ -18,10 +18,14 @@
*/
package org.apache.cocoon.corona.sitemap.node;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.cocoon.corona.pipeline.resource.ClassPathResourceResolver;
import org.apache.cocoon.corona.sitemap.Invocation;
import org.apache.cocoon.corona.sitemap.node.annotations.Parameter;
-@Node(name="generate")
+@Node(name = "generate")
public class GenerateNode extends AbstractSitemapNode {
private static final String GENERATOR_CATEGORY = "generator:";
@@ -29,15 +33,24 @@
@Parameter
private String type = "file"; // "file" is the default type
+ @Parameter
+ private String src;
+
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#invoke(org.apache.cocoon.corona.sitemap.Invocation)
*/
@Override
public InvocationResult invoke(Invocation invocation) {
+ Map<String, Object> parameters = new HashMap<String, Object>(this.getParameters());
+ if (this.src != null) {
+ String resolvedSource = invocation.resolveParameter(this.src);
+ parameters.put("source", ClassPathResourceResolver.getInstance().resolve(resolvedSource));
+ }
+
// install the component
- invocation.installComponent(GENERATOR_CATEGORY + this.type, this.getParameters());
+ invocation.installComponent(GENERATOR_CATEGORY + this.type, parameters);
// signal that we did some processing
return InvocationResult.PROCESSED;
@@ -45,11 +58,11 @@
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#toString()
*/
@Override
public String toString() {
- return "GenerateNode(src=" + this.getParameters().get("src") + ", type=" + this.type + ")";
+ return "GenerateNode(src=" + this.src + ", type=" + this.type + ")";
}
}
Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelineNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelineNode.java?rev=644238&r1=644237&r2=644238&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelineNode.java (original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelineNode.java Thu Apr 3 02:32:37 2008
@@ -24,7 +24,7 @@
import org.apache.cocoon.corona.sitemap.node.annotations.Parameter;
import org.apache.cocoon.corona.sitemap.util.ExceptionHandler;
-@Node(name="pipeline")
+@Node(name = "pipeline")
public class PipelineNode extends AbstractSitemapNode {
private static final String PIPELINE_CATEGORY = "pipeline:";
@@ -40,7 +40,7 @@
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#invoke(org.apache.cocoon.corona.sitemap.Invocation)
*/
@Override
@@ -67,7 +67,7 @@
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#toString()
*/
@Override
@@ -76,34 +76,21 @@
}
private InvocationResult handleException(Invocation invocation, Exception ex) {
- if (this.errorNode == null) {
- // don't have an error node -> let the parent handle this
- throw ExceptionHandler.getInvocationException(ex);
- }
-
- // re-install pipeline
- this.installPipeline(invocation);
-
- // try to recover from the exception, using our error node
- invocation.setThrowable(ExceptionHandler.getCause(ex, InvocationException.class));
- if (this.errorNode.invoke(invocation).isCompleted()) {
- // one of our children was responsible for handling this invocation:
- // assume the invocation is properly prepared and execute it
- try {
- invocation.execute();
+ if (this.errorNode != null) {
+ // try to recover from the exception, using our error node
+ invocation.setThrowable(ExceptionHandler.getCause(ex, InvocationException.class));
+ if (this.errorNode.invoke(invocation).isCompleted()) {
// indicate that we handled this successfully
return InvocationResult.COMPLETED;
- } catch (Exception e) {
- // error node failed to process -> let the parent handle this
- throw ExceptionHandler.getInvocationException(e);
}
}
- // error node was not responsible -> let the parent handle this
+ // no error-handling configured or error-handling itself failed
+ // -> let the parent handle this
throw ExceptionHandler.getInvocationException(ex);
}
- private void installPipeline(Invocation invocation) {
+ protected void installPipeline(Invocation invocation) {
invocation.installPipeline(PIPELINE_CATEGORY + this.type);
}
}
Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelinesNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelinesNode.java?rev=644238&r1=644237&r2=644238&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelinesNode.java (original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelinesNode.java Thu Apr 3 02:32:37 2008
@@ -24,7 +24,7 @@
import org.apache.cocoon.corona.sitemap.node.annotations.NodeChild;
import org.apache.cocoon.corona.sitemap.util.ExceptionHandler;
-@Node(name="pipelines")
+@Node(name = "pipelines")
public class PipelinesNode extends AbstractSitemapNode {
@NodeChild
@@ -32,7 +32,7 @@
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#invoke(org.apache.cocoon.corona.sitemap.Invocation)
*/
@Override
@@ -45,9 +45,6 @@
// none of our children was responsible
throw new NoMatchingPipelineException("No pipeline matched the request '" + invocation.getRequestURI() + "'");
- } catch (NoMatchingPipelineException nmpex) {
- // no error handling when no pipeline matched
- throw nmpex;
} catch (Exception ex) {
return this.handleException(invocation, ex);
}
Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ReadNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ReadNode.java?rev=644238&r1=644237&r2=644238&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ReadNode.java (original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/ReadNode.java Thu Apr 3 02:32:37 2008
@@ -18,10 +18,14 @@
*/
package org.apache.cocoon.corona.sitemap.node;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.cocoon.corona.pipeline.resource.ClassPathResourceResolver;
import org.apache.cocoon.corona.sitemap.Invocation;
import org.apache.cocoon.corona.sitemap.node.annotations.Parameter;
-@Node(name="read")
+@Node(name = "read")
public class ReadNode extends AbstractSitemapNode {
private static final String READER_CATEGORY = "reader:";
@@ -29,15 +33,20 @@
@Parameter
private String type = "file"; // "file" is default
+ @Parameter
+ private String src;
+
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#invoke(org.apache.cocoon.corona.sitemap.Invocation)
*/
@Override
public InvocationResult invoke(Invocation invocation) {
// install the component
- invocation.installComponent(READER_CATEGORY + this.type, this.getParameters());
+ Map<String, Object> parameters = new HashMap<String, Object>(this.getParameters());
+ parameters.put("source", ClassPathResourceResolver.getInstance().resolve(this.src));
+ invocation.installComponent(READER_CATEGORY + this.type, parameters);
// signal that we did some processing
return InvocationResult.PROCESSED;
@@ -45,11 +54,11 @@
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#toString()
*/
@Override
public String toString() {
- return "ReadNode(" + this.getParameters().get("src") + ")";
+ return "ReadNode(" + this.src + ")";
}
}
Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/spring/SitemapNodeNameGenerator.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/spring/SitemapNodeNameGenerator.java?rev=644238&r1=644237&r2=644238&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/spring/SitemapNodeNameGenerator.java (original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/spring/SitemapNodeNameGenerator.java Thu Apr 3 02:32:37 2008
@@ -27,12 +27,17 @@
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanNameGenerator;
-public class SitemapNodeNameGenerator implements BeanNameGenerator{
+public class SitemapNodeNameGenerator implements BeanNameGenerator {
public String generateBeanName(BeanDefinition definition, BeanDefinitionRegistry registry) {
if (definition instanceof AnnotatedBeanDefinition) {
AnnotatedBeanDefinition annotatedBeanDefinition = (AnnotatedBeanDefinition) definition;
- Map<String, Object> annotationAttributes = annotatedBeanDefinition.getMetadata().getAnnotationAttributes(Node.class.getName());
+ Map<String, Object> annotationAttributes = annotatedBeanDefinition.getMetadata().getAnnotationAttributes(
+ Node.class.getName());
+
+ if (annotationAttributes == null || annotationAttributes.get("name") == null) {
+ return null;
+ }
return SitemapNode.class.getName() + "/" + annotationAttributes.get("name");
}
Added: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/util/ParameterHelper.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/util/ParameterHelper.java?rev=644238&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/util/ParameterHelper.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/util/ParameterHelper.java Thu Apr 3 02:32:37 2008
@@ -0,0 +1,16 @@
+package org.apache.cocoon.corona.sitemap.util;
+
+import java.util.Map;
+
+public class ParameterHelper {
+
+ private static final String THROWABLE_KEY = java.lang.Throwable.class.getName();
+
+ public static Throwable getThrowable(Map<String, ? extends Object> parameters) {
+ return (Throwable) parameters.get(THROWABLE_KEY);
+ }
+
+ public static void setThrowable(Map<String, Object> parameters, Throwable throwable) {
+ parameters.put(THROWABLE_KEY, throwable);
+ }
+}
Propchange: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/util/ParameterHelper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/util/ParameterHelper.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/util/ParameterHelper.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/xml/AttributeTypes.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/xml/AttributeTypes.java?rev=644238&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/xml/AttributeTypes.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/xml/AttributeTypes.java Thu Apr 3 02:32:37 2008
@@ -0,0 +1,27 @@
+/*
+ * 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.corona.sitemap.xml;
+
+/**
+ * Insert the type's description here.
+ *
+ * @version $Id$
+ */
+public enum AttributeTypes {
+
+ CDATA, ENTITY, ENTITIES, ID, IDREF, IDREFS, NAME, NAMES, NMTOKEN, NMTOKENS, NOTATION, NUMBER, NUMBERS, NUTOKEN, NUTOKENS;
+}
Propchange: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/xml/AttributeTypes.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/xml/AttributeTypes.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/xml/AttributeTypes.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/xml/AttributesImpl.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/xml/AttributesImpl.java?rev=644238&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/xml/AttributesImpl.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/xml/AttributesImpl.java Thu Apr 3 02:32:37 2008
@@ -0,0 +1,109 @@
+/*
+ * 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.corona.sitemap.xml;
+
+import org.xml.sax.Attributes;
+
+/**
+ * A helper Class creating SAX Attributes
+ *
+ * @version $Id$
+ */
+public class AttributesImpl extends org.xml.sax.helpers.AttributesImpl {
+
+ /**
+ * Constructor
+ */
+ public AttributesImpl() {
+ super();
+ }
+
+ /**
+ * Constructor
+ */
+ public AttributesImpl(Attributes attr) {
+ super(attr);
+ }
+
+ /**
+ * Add an attribute of type CDATA with empty Namespace to the end of the list.
+ *
+ * <p>
+ * For the sake of speed, this method does no checking to see if the attribute is already in the list: that is the responsibility
+ * of the application.
+ * </p>
+ *
+ * @param localName The local name.
+ * @param value The attribute value.
+ */
+ public void addCDATAAttribute(String localName, String value) {
+ this.addAttribute("", localName, localName, AttributeTypes.CDATA.name(), value);
+ }
+
+ /**
+ * Add an attribute of type CDATA with the namespace to the end of the list.
+ *
+ * <p>
+ * For the sake of speed, this method does no checking to see if the attribute is already in the list: that is the responsibility
+ * of the application.
+ * </p>
+ *
+ * @param namespace The namespace.
+ * @param localName The local name.
+ * @param value The attribute value.
+ */
+ public void addCDATAAttribute(String namespace, String localName, String value) {
+ this.addAttribute(namespace, localName, localName, AttributeTypes.CDATA.name(), value);
+ }
+
+ /**
+ * Add an attribute of type CDATA to the end of the list.
+ *
+ * <p>
+ * For the sake of speed, this method does no checking to see if the attribute is already in the list: that is the responsibility
+ * of the application.
+ * </p>
+ *
+ * @param uri The Namespace URI, or the empty string if none is available or Namespace processing is not being performed.
+ * @param localName The local name, or the empty string if Namespace processing is not being performed.
+ * @param qName The qualified (prefixed) name, or the empty string if qualified names are not available.
+ * @param value The attribute value.
+ */
+ public void addCDATAAttribute(String uri, String localName, String qName, String value) {
+ this.addAttribute(uri, localName, qName, AttributeTypes.CDATA.name(), value);
+ }
+
+ /**
+ * Remove an attribute
+ */
+ public void removeAttribute(String localName) {
+ final int index = this.getIndex(localName);
+ if (index != -1) {
+ this.removeAttribute(index);
+ }
+ }
+
+ /**
+ * Remove an attribute
+ */
+ public void removeAttribute(String uri, String localName) {
+ final int index = this.getIndex(uri, localName);
+ if (index != -1) {
+ this.removeAttribute(index);
+ }
+ }
+}
Propchange: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/xml/AttributesImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/xml/AttributesImpl.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/xml/AttributesImpl.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/resources/META-INF/cocoon/spring/corona-pipeline-component.xml
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/resources/META-INF/cocoon/spring/corona-pipeline-component.xml?rev=644238&r1=644237&r2=644238&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/resources/META-INF/cocoon/spring/corona-pipeline-component.xml (original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/resources/META-INF/cocoon/spring/corona-pipeline-component.xml Thu Apr 3 02:32:37 2008
@@ -21,20 +21,6 @@
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
- <!--
- <bean name="org.apache.cocoon.corona.sitemap.spring.PipelineComponentFactory"
- class="org.apache.cocoon.corona.sitemap.spring.ReflectionPipelineComponentFactory">
- <property name="types">
- <map>
- <entry key="redirector" value="org.apache.cocoon.corona.servlet.component.RedirectorComponent" />
- <entry key="generator:file" value="org.apache.cocoon.corona.pipeline.component.FileGenerator" />
- <entry key="serializer:xml" value="org.apache.cocoon.corona.pipeline.component.XMLSerializer" />
- <entry key="reader:file" value="org.apache.cocoon.corona.pipeline.component.FileReaderComponent" />
- </map>
- </property>
- </bean>
- -->
-
<bean name="org.apache.cocoon.corona.sitemap.spring.PipelineComponentFactory"
class="org.apache.cocoon.corona.sitemap.spring.PrototypePipelineComponentFactory">
</bean>
@@ -53,10 +39,8 @@
<bean name="generator:file" class="org.apache.cocoon.corona.pipeline.component.FileGenerator" scope="prototype" />
- <bean name="generator:request-parameters" class="org.apache.cocoon.corona.servlet.component.RequestParametersGenerator" scope="prototype" />
+ <bean name="generator:exception" class="org.apache.cocoon.corona.sitemap.component.ExceptionGenerator" scope="prototype" />
<bean name="reader:file" class="org.apache.cocoon.corona.pipeline.component.FileReaderComponent" scope="prototype" />
-
- <bean name="redirector" class="org.apache.cocoon.corona.servlet.component.RedirectorComponent" scope="prototype" />
</beans>
Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/resources/META-INF/cocoon/spring/corona-sitemap-node.xml
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/resources/META-INF/cocoon/spring/corona-sitemap-node.xml?rev=644238&r1=644237&r2=644238&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/resources/META-INF/cocoon/spring/corona-sitemap-node.xml (original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/resources/META-INF/cocoon/spring/corona-sitemap-node.xml Thu Apr 3 02:32:37 2008
@@ -32,7 +32,7 @@
<bean name="org.apache.cocoon.corona.sitemap.node.SitemapNodeFactory" class="org.apache.cocoon.corona.sitemap.node.SitemapNodeFactory"/>
- <context:component-scan base-package="org.apache.cocoon.corona.sitemap.node" use-default-filters="false"
+ <context:component-scan base-package="org.apache.cocoon.corona" use-default-filters="false"
scope-resolver="org.apache.cocoon.corona.sitemap.spring.SitemapNodeScopeResolver"
name-generator="org.apache.cocoon.corona.sitemap.spring.SitemapNodeNameGenerator">
<context:include-filter type="annotation" expression="org.apache.cocoon.corona.sitemap.node.Node" />
Added: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/resources/corona-sitemap-1.0.xsd
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/resources/corona-sitemap-1.0.xsd?rev=644238&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/resources/corona-sitemap-1.0.xsd (added)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/resources/corona-sitemap-1.0.xsd Thu Apr 3 02:32:37 2008
@@ -0,0 +1,238 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://apache.org/cocoon/corona/sitemap"
+ xmlns:tns="http://apache.org/cocoon/corona/sitemap" xmlns="http://apache.org/cocoon/corona/sitemap" elementFormDefault="qualified">
+
+ <xsd:element name="sitemap">
+ <xsd:annotation>
+ <xsd:documentation>This is the root element of a sitemap.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:all>
+ <xsd:element ref="flow" minOccurs="0" maxOccurs="1" />
+ <xsd:element ref="pipelines" minOccurs="1" maxOccurs="1" />
+ </xsd:all>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="flow">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="script" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="language" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="script">
+ <xsd:complexType>
+ <xsd:attribute name="src" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="pipelines">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="pipeline" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="handle-errors" minOccurs="0" maxOccurs="1" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="pipeline">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:group ref="pipeline-content" />
+ <xsd:element ref="handle-errors" minOccurs="0" maxOccurs="1" />
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID" use="optional" />
+ <xsd:attribute name="type" type="xsd:string" use="optional" />
+ <xsd:attribute name="internal-only" type="xsd:string" use="optional" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="parameter">
+ <xsd:complexType>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ <xsd:attribute name="value" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:group name="pipeline-content">
+ <xsd:sequence>
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element ref="match" />
+ <xsd:element ref="mount" />
+ <xsd:element ref="call" />
+ <xsd:element ref="aggregate" />
+ <xsd:element ref="generate" />
+ <xsd:element ref="transform" />
+ <xsd:element ref="serialize" />
+ <xsd:element ref="read" />
+ <xsd:element ref="select" />
+ <xsd:element ref="act" />
+ <xsd:any namespace="##other" processContents="strict" />
+ </xsd:choice>
+ </xsd:sequence>
+ </xsd:group>
+
+ <xsd:element name="match">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:group ref="pipeline-content" />
+ </xsd:sequence>
+ <xsd:attribute name="type" type="xsd:string" use="optional" />
+ <xsd:attribute name="pattern" type="xsd:string" use="optional" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="mount">
+ <xsd:complexType>
+ <xsd:attribute name="src" type="xsd:string" use="required" />
+ <xsd:attribute name="check-reload" type="xsd:string" use="optional" />
+ <xsd:attribute name="uri-prefix" type="xsd:string" use="optional" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="call">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="resource" type="xsd:string" use="optional" />
+ <xsd:attribute name="function" type="xsd:string" use="optional" />
+ <xsd:attribute name="continuation" type="xsd:string" use="optional" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="aggregate">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="part" minOccurs="1" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="element" type="xsd:string" use="required" />
+ <xsd:attribute name="ns" type="xsd:string" use="optional" />
+ <xsd:attribute name="prefix" type="xsd:string" use="optional" />
+ <xsd:attribute name="label" type="xsd:string" use="optional" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="part">
+ <xsd:complexType>
+ <xsd:attribute name="src" type="xsd:string" use="required" />
+ <xsd:attribute name="element" type="xsd:string" use="optional" />
+ <xsd:attribute name="ns" type="xsd:string" use="optional" />
+ <xsd:attribute name="prefix" type="xsd:string" use="optional" />
+ <xsd:attribute name="strip-root" type="xsd:string" use="optional" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="generate">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="src" type="xsd:string" use="optional" />
+ <xsd:attribute name="type" type="xsd:string" use="optional" />
+ <xsd:attribute name="label" type="xsd:string" use="optional" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="transform">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="src" type="xsd:string" use="optional" />
+ <xsd:attribute name="type" type="xsd:string" use="optional" />
+ <xsd:attribute name="label" type="xsd:string" use="optional" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="serialize">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="src" type="xsd:string" use="optional" />
+ <xsd:attribute name="type" type="xsd:string" use="optional" />
+ <xsd:attribute name="status-code" type="xsd:string" use="optional" />
+ <xsd:attribute name="label" type="xsd:string" use="optional" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="read">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="src" type="xsd:string" use="optional" />
+ <xsd:attribute name="type" type="xsd:string" use="optional" />
+ <xsd:attribute name="mime-type" type="xsd:string" use="optional" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="select">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="when" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="otherwise" minOccurs="0" maxOccurs="1" />
+ </xsd:sequence>
+ <xsd:attribute name="type" type="xsd:string" use="optional" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="when">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:group ref="pipeline-content" />
+ </xsd:sequence>
+ <xsd:attribute name="test" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="otherwise">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:group ref="pipeline-content" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="act">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:group ref="pipeline-content" />
+ </xsd:sequence>
+ <xsd:attribute name="type" type="xsd:string" use="optional" />
+ <xsd:attribute name="set" type="xsd:string" use="optional" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="handle-errors">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:group ref="pipeline-content" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+</xsd:schema>
Propchange: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/resources/corona-sitemap-1.0.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/resources/corona-sitemap-1.0.xsd
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/resources/corona-sitemap-1.0.xsd
------------------------------------------------------------------------------
svn:mime-type = text/xml