Author: jvazquez
Date: Fri Jan 30 17:39:17 2009
New Revision: 739346
URL: http://svn.apache.org/viewvc?rev=739346&view=rev
Log:
First steps towards a pipeline prototype.
Added:
incubator/sling/whiteboard/jvazquez/pipeline/pom.xml
incubator/sling/whiteboard/jvazquez/pipeline/src/
incubator/sling/whiteboard/jvazquez/pipeline/src/main/
incubator/sling/whiteboard/jvazquez/pipeline/src/main/java/
incubator/sling/whiteboard/jvazquez/pipeline/src/main/java/org/
incubator/sling/whiteboard/jvazquez/pipeline/src/main/java/org/apache/
incubator/sling/whiteboard/jvazquez/pipeline/src/main/java/org/apache/sling/
incubator/sling/whiteboard/jvazquez/pipeline/src/main/java/org/apache/sling/pipeline/
incubator/sling/whiteboard/jvazquez/pipeline/src/main/java/org/apache/sling/pipeline/prototype/
incubator/sling/whiteboard/jvazquez/pipeline/src/main/java/org/apache/sling/pipeline/prototype/PipelineServlet.java
incubator/sling/whiteboard/jvazquez/pipeline/src/main/resources/
incubator/sling/whiteboard/jvazquez/pipeline/src/main/resources/SLING-INF/
incubator/sling/whiteboard/jvazquez/pipeline/src/main/resources/SLING-INF/content/
incubator/sling/whiteboard/jvazquez/pipeline/src/main/resources/SLING-INF/content/pipeline-sample/
incubator/sling/whiteboard/jvazquez/pipeline/src/main/resources/SLING-INF/content/pipeline-sample/generator/
incubator/sling/whiteboard/jvazquez/pipeline/src/main/resources/SLING-INF/content/pipeline-sample/generator/test.xml
incubator/sling/whiteboard/jvazquez/pipeline/src/main/resources/SLING-INF/content/pipeline-sample/pipelines/
incubator/sling/whiteboard/jvazquez/pipeline/src/main/resources/SLING-INF/content/pipeline-sample/pipelines.json
incubator/sling/whiteboard/jvazquez/pipeline/src/main/resources/SLING-INF/content/pipeline-sample/transform/
incubator/sling/whiteboard/jvazquez/pipeline/src/main/resources/SLING-INF/content/pipeline-sample/transform/test.xslt
Modified:
incubator/sling/whiteboard/jvazquez/pipeline/ (props changed)
Propchange: incubator/sling/whiteboard/jvazquez/pipeline/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Jan 30 17:39:17 2009
@@ -0,0 +1 @@
+.*
Added: incubator/sling/whiteboard/jvazquez/pipeline/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/pipeline/pom.xml?rev=739346&view=auto
==============================================================================
--- incubator/sling/whiteboard/jvazquez/pipeline/pom.xml (added)
+++ incubator/sling/whiteboard/jvazquez/pipeline/pom.xml Fri Jan 30 17:39:17
2009
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>es.eufer.simed</groupId>
+ <artifactId>eufer-simed-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+ <!--
+ <parent>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>sling</artifactId>
+ <version>5-incubator-SNAPSHOT</version>
+ </parent>
+ -->
+
+ <artifactId>org.apache.sling.pipeline.prototype</artifactId>
+ <packaging>bundle</packaging>
+ <version>1.0.0-incubator-SNAPSHOT</version>
+
+ <name>Sling - Pipeline Support Prototype</name>
+ <description>
+ Bundle implementing pipeline support in Sling. Uses Cocoon 3
underlying.
+ </description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-scr-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Export-Package>
+ org.apache.sling.pipeline.prototype.*
+ </Export-Package>
+ <Embed-Dependency>cocoon-pipeline</Embed-Dependency>
+
<Embed-Transitive>false</Embed-Transitive>
+
<Sling-Initial-Content>SLING-INF/content;uninstall:=true</Sling-Initial-Content>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+
+ <!-- SERVLET API -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- APACHE SLING 2 -->
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.api</artifactId>
+ <version>2.0.2-incubator</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- APACHE COCOON 3 -->
+ <dependency>
+ <groupId>org.apache.cocoon.pipeline</groupId>
+ <artifactId>cocoon-pipeline</artifactId>
+ <version>3.0.0-alpha-1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- JCR -->
+ <dependency>
+ <groupId>javax.jcr</groupId>
+ <artifactId>jcr</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
Added:
incubator/sling/whiteboard/jvazquez/pipeline/src/main/java/org/apache/sling/pipeline/prototype/PipelineServlet.java
URL:
http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/pipeline/src/main/java/org/apache/sling/pipeline/prototype/PipelineServlet.java?rev=739346&view=auto
==============================================================================
---
incubator/sling/whiteboard/jvazquez/pipeline/src/main/java/org/apache/sling/pipeline/prototype/PipelineServlet.java
(added)
+++
incubator/sling/whiteboard/jvazquez/pipeline/src/main/java/org/apache/sling/pipeline/prototype/PipelineServlet.java
Fri Jan 30 17:39:17 2009
@@ -0,0 +1,67 @@
+/*
+ * 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.sling.pipeline.prototype;
+
+import java.io.IOException;
+import java.net.URL;
+
+import javax.jcr.Node;
+import javax.servlet.ServletException;
+
+import org.apache.cocoon.pipeline.NonCachingPipeline;
+import org.apache.cocoon.pipeline.Pipeline;
+import org.apache.cocoon.pipeline.component.sax.FileGenerator;
+import org.apache.cocoon.pipeline.component.sax.XMLSerializer;
+import org.apache.cocoon.pipeline.component.sax.XSLTTransformer;
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.SlingHttpServletResponse;
+import org.apache.sling.api.servlets.SlingAllMethodsServlet;
+
+/**
+ * @scr.component immediate="true" metatype="no"
+ * @scr.service interface="javax.servlet.Servlet"
+ * @scr.property name="service.description" value="Pipeline Servlet"
+ * @scr.property name="sling.servlet.resourceTypes" value="sling/pipeline"
+ */
+public class PipelineServlet extends SlingAllMethodsServlet {
+
+ private static final long serialVersionUID = -5203204085782263204L;
+
+ @Override
+ protected void doGet(SlingHttpServletRequest request,
SlingHttpServletResponse response) throws ServletException, IOException {
+ try {
+ Node currentNode =
request.getResource().adaptTo(Node.class);
+ String generatoUrl =
currentNode.getProperty("sling:generator").getValue().getString();
+ String transformUrl =
currentNode.getProperty("sling:transform").getValue().getString();
+ final String baseUrl = request.getScheme() + "://" +
request.getServerName() + ":" + request.getServerPort();
+ URL srcUrl = new URL(baseUrl + generatoUrl);
+ URL xslUrl = new URL(baseUrl + transformUrl);
+ Pipeline pipeline = new NonCachingPipeline();
+ pipeline.addComponent(new FileGenerator(srcUrl));
+ pipeline.addComponent(new XSLTTransformer(xslUrl));
+ pipeline.addComponent(new XMLSerializer());
+ pipeline.setup(response.getOutputStream());
+ pipeline.execute();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+}
Added:
incubator/sling/whiteboard/jvazquez/pipeline/src/main/resources/SLING-INF/content/pipeline-sample/generator/test.xml
URL:
http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/pipeline/src/main/resources/SLING-INF/content/pipeline-sample/generator/test.xml?rev=739346&view=auto
==============================================================================
---
incubator/sling/whiteboard/jvazquez/pipeline/src/main/resources/SLING-INF/content/pipeline-sample/generator/test.xml
(added)
+++
incubator/sling/whiteboard/jvazquez/pipeline/src/main/resources/SLING-INF/content/pipeline-sample/generator/test.xml
Fri Jan 30 17:39:17 2009
@@ -0,0 +1,18 @@
+<?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.
+-->
+<test/>
\ No newline at end of file
Added:
incubator/sling/whiteboard/jvazquez/pipeline/src/main/resources/SLING-INF/content/pipeline-sample/pipelines.json
URL:
http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/pipeline/src/main/resources/SLING-INF/content/pipeline-sample/pipelines.json?rev=739346&view=auto
==============================================================================
---
incubator/sling/whiteboard/jvazquez/pipeline/src/main/resources/SLING-INF/content/pipeline-sample/pipelines.json
(added)
+++
incubator/sling/whiteboard/jvazquez/pipeline/src/main/resources/SLING-INF/content/pipeline-sample/pipelines.json
Fri Jan 30 17:39:17 2009
@@ -0,0 +1,10 @@
+{
+ "title": "pipelines",
+ "jcr:primaryType":"nt:unstructured",
+ "test_pipeline": {
+ "title": "test_pipeline",
+ "sling:resourceType": "sling/pipeline",
+ "sling:generator": "/pipeline-sample/generator/test.xml",
+ "sling:transform": "/pipeline-sample/transform/test.xslt"
+ }
+}
\ No newline at end of file
Added:
incubator/sling/whiteboard/jvazquez/pipeline/src/main/resources/SLING-INF/content/pipeline-sample/transform/test.xslt
URL:
http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/pipeline/src/main/resources/SLING-INF/content/pipeline-sample/transform/test.xslt?rev=739346&view=auto
==============================================================================
---
incubator/sling/whiteboard/jvazquez/pipeline/src/main/resources/SLING-INF/content/pipeline-sample/transform/test.xslt
(added)
+++
incubator/sling/whiteboard/jvazquez/pipeline/src/main/resources/SLING-INF/content/pipeline-sample/transform/test.xslt
Fri Jan 30 17:39:17 2009
@@ -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.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+ <xsl:param name="myParam" />
+
+ <xsl:template match="/">
+ <p>
+ <xsl:value-of select="$myParam" />
+ </p>
+ </xsl:template>
+
+</xsl:stylesheet>