You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by jv...@apache.org on 2009/02/05 10:15:55 UTC
svn commit: r741053 - in /incubator/sling/whiteboard/jvazquez/pipeline:
README pom.xml
src/main/java/org/apache/sling/pipeline/prototype/PipelineServlet.java
Author: jvazquez
Date: Thu Feb 5 09:15:55 2009
New Revision: 741053
URL: http://svn.apache.org/viewvc?rev=741053&view=rev
Log:
javadoc and README
Added:
incubator/sling/whiteboard/jvazquez/pipeline/README
Modified:
incubator/sling/whiteboard/jvazquez/pipeline/pom.xml
incubator/sling/whiteboard/jvazquez/pipeline/src/main/java/org/apache/sling/pipeline/prototype/PipelineServlet.java
Added: incubator/sling/whiteboard/jvazquez/pipeline/README
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/pipeline/README?rev=741053&view=auto
==============================================================================
--- incubator/sling/whiteboard/jvazquez/pipeline/README (added)
+++ incubator/sling/whiteboard/jvazquez/pipeline/README Thu Feb 5 09:15:55 2009
@@ -0,0 +1,7 @@
+Pipeline Sample
+===============
+
+A quite naive sample of using Cocoon 3 pipelines with Sling. Deploy
+the bundle into Sling and go to:
+
+http://localhost:8888/pipeline-sample/pipelines/test_pipeline
\ No newline at end of file
Modified: incubator/sling/whiteboard/jvazquez/pipeline/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/pipeline/pom.xml?rev=741053&r1=741052&r2=741053&view=diff
==============================================================================
--- incubator/sling/whiteboard/jvazquez/pipeline/pom.xml (original)
+++ incubator/sling/whiteboard/jvazquez/pipeline/pom.xml Thu Feb 5 09:15:55 2009
@@ -19,7 +19,7 @@
-->
<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>
+ <modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
@@ -44,6 +44,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
+ <version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -94,4 +95,39 @@
</dependencies>
+ <profiles>
+
+ <profile>
+ <id>autoInstallBundle</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>maven-sling-plugin</artifactId>
+ <version>2.0.2-incubator</version>
+ <executions>
+ <execution>
+ <id>install-bundle</id>
+ <goals>
+ <goal>install</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <slingUrl>
+ http://localhost:8888/system/console/install
+ </slingUrl>
+ <user>admin</user>
+ <password>admin</password>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ </profiles>
+
</project>
Modified: 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=741053&r1=741052&r2=741053&view=diff
==============================================================================
--- incubator/sling/whiteboard/jvazquez/pipeline/src/main/java/org/apache/sling/pipeline/prototype/PipelineServlet.java (original)
+++ incubator/sling/whiteboard/jvazquez/pipeline/src/main/java/org/apache/sling/pipeline/prototype/PipelineServlet.java Thu Feb 5 09:15:55 2009
@@ -23,11 +23,10 @@
import java.net.URL;
import javax.jcr.Node;
-import javax.jcr.PathNotFoundException;
import javax.jcr.RepositoryException;
-import javax.jcr.ValueFormatException;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.apache.cocoon.pipeline.NonCachingPipeline;
import org.apache.cocoon.pipeline.Pipeline;
@@ -36,15 +35,27 @@
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;
+import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
/**
+ * Just a quite naive pipeline executor based on
+ * Cocoon Pipeline 3.
+ *
+ * This servlet resolves to resources with a
+ * "sling/pipeline" resource type. The Get method
+ * waits for two special properties in the resource:
+ *
+ * sling:generator -> the URL (without hostname and port)
+ * of the resource which will response with the pipeline´s source (XML).
+ * sling:transform -> a group of URLs (without hostname and port)
+ * of the resources which will response with the XSL templates.
+ *
* @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 {
+public class PipelineServlet extends SlingSafeMethodsServlet {
private static final long serialVersionUID = -5203204085782263204L;
@@ -68,7 +79,7 @@
xslUrls[i] = buildAbsUrl(request, transformUrls[i]);
}
- /** A simple non-caching Cocoon 3 pipeline */
+ // A simple non-caching Cocoon 3 pipeline
Pipeline pipeline = new NonCachingPipeline();
// Generator
@@ -89,20 +100,21 @@
pipeline.execute();
} catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ response.sendError(HttpServletResponse.SC_NOT_FOUND, e.getMessage());
}
}
+ //---------- internal ------------------------------------------------------------------------------
+
private URL buildAbsUrl(ServletRequest request, String relUrl) throws MalformedURLException {
return new URL(request.getScheme(), request.getServerName(), request.getServerPort(), relUrl);
}
- private String getGenUrl(Node node) throws ValueFormatException, IllegalStateException, PathNotFoundException, RepositoryException {
+ private String getGenUrl(Node node) throws RepositoryException {
return node.getProperty(PIPELINE_GENERATOR_PROP).getValue().getString();
}
- private String[] getTranUrls(Node node) throws ValueFormatException, IllegalStateException, PathNotFoundException, RepositoryException {
+ private String[] getTranUrls(Node node) throws RepositoryException {
return node.getProperty(PIPELINE_TRANSFORM_PROP).getValue().getString().split(";");
}
}