Author: krasserm
Date: Thu Nov 19 13:48:14 2009
New Revision: 882143
URL: http://svn.apache.org/viewvc?rev=882143&view=rev
Log:
initial commit of camel-example-gae
Added:
camel/trunk/examples/camel-example-gae/ (with props)
camel/trunk/examples/camel-example-gae/pom.xml (with props)
camel/trunk/examples/camel-example-gae/src/
camel/trunk/examples/camel-example-gae/src/main/
camel/trunk/examples/camel-example-gae/src/main/java/
camel/trunk/examples/camel-example-gae/src/main/java/org/
camel/trunk/examples/camel-example-gae/src/main/java/org/apache/
camel/trunk/examples/camel-example-gae/src/main/java/org/apache/camel/
camel/trunk/examples/camel-example-gae/src/main/java/org/apache/camel/example/
camel/trunk/examples/camel-example-gae/src/main/java/org/apache/camel/example/gae/
camel/trunk/examples/camel-example-gae/src/main/java/org/apache/camel/example/gae/TutorialRouteBuilder.java
(with props)
camel/trunk/examples/camel-example-gae/src/main/java/org/apache/camel/example/gae/WeatherProcessor.java
(with props)
camel/trunk/examples/camel-example-gae/src/main/resources/
camel/trunk/examples/camel-example-gae/src/main/resources/context.xml
(with props)
camel/trunk/examples/camel-example-gae/src/main/webapp/
camel/trunk/examples/camel-example-gae/src/main/webapp/META-INF/
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/appengine-web.xml
(with props)
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/lib/
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/lib/datanucleus-appengine-1.0.3.jar
(with props)
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/lib/datanucleus-core-1.1.5.jar
(with props)
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/lib/datanucleus-jpa-1.1.5.jar
(with props)
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/lib/geronimo-jpa_3.0_spec-1.1.1.jar
(with props)
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/lib/geronimo-jta_1.1_spec-1.1.1.jar
(with props)
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/lib/jdo2-api-2.3-eb.jar
(with props)
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/logging.properties
(with props)
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/web.xml
(with props)
camel/trunk/examples/camel-example-gae/src/main/webapp/index.html (with
props)
camel/trunk/examples/camel-example-gae/src/test/
camel/trunk/examples/camel-example-gae/src/test/java/
camel/trunk/examples/camel-example-gae/src/test/resources/
Modified:
camel/trunk/examples/pom.xml
camel/trunk/parent/pom.xml
Propchange: camel/trunk/examples/camel-example-gae/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Nov 19 13:48:14 2009
@@ -0,0 +1,8 @@
+.checkstyle
+.pmd
+eclipse-classes
+target
+.classpath
+.project
+.settings
+*.i??
Added: camel/trunk/examples/camel-example-gae/pom.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-gae/pom.xml?rev=882143&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-gae/pom.xml (added)
+++ camel/trunk/examples/camel-example-gae/pom.xml Thu Nov 19 13:48:14 2009
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>examples</artifactId>
+ <version>2.1-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>camel-example-gae</artifactId>
+ <name>Camel :: Example :: GAE</name>
+ <description>Demonstrates how to get Camel running on Google App
Engine</description>
+ <packaging>war</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-gae</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
Propchange: camel/trunk/examples/camel-example-gae/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added:
camel/trunk/examples/camel-example-gae/src/main/java/org/apache/camel/example/gae/TutorialRouteBuilder.java
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-gae/src/main/java/org/apache/camel/example/gae/TutorialRouteBuilder.java?rev=882143&view=auto
==============================================================================
---
camel/trunk/examples/camel-example-gae/src/main/java/org/apache/camel/example/gae/TutorialRouteBuilder.java
(added)
+++
camel/trunk/examples/camel-example-gae/src/main/java/org/apache/camel/example/gae/TutorialRouteBuilder.java
Thu Nov 19 13:48:14 2009
@@ -0,0 +1,41 @@
+/**
+ * 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.camel.example.gae;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.gae.mail.GMailBinding;
+
+public class TutorialRouteBuilder extends RouteBuilder {
+
+ @Override
+ public void configure() throws Exception {
+ from("ghttp:///weather")
+ .to("gtask://default")
+ .setHeader(Exchange.CONTENT_TYPE, constant("text/plain"))
+ .transform(constant("Weather report will be sent to
").append(header("mailto")));
+
+ from("gtask://default")
+ .setHeader(Exchange.HTTP_QUERY,
constant("weather=").append(header("city")))
+ .to("ghttp://www.google.com/ig/api")
+ .process(new WeatherProcessor())
+ .setHeader(GMailBinding.GMAIL_SUBJECT, constant("Weather report"))
+ .setHeader(GMailBinding.GMAIL_TO, header("mailto"))
+ .to("gmail://[email protected]");
+ }
+
+}
Propchange:
camel/trunk/examples/camel-example-gae/src/main/java/org/apache/camel/example/gae/TutorialRouteBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
camel/trunk/examples/camel-example-gae/src/main/java/org/apache/camel/example/gae/WeatherProcessor.java
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-gae/src/main/java/org/apache/camel/example/gae/WeatherProcessor.java?rev=882143&view=auto
==============================================================================
---
camel/trunk/examples/camel-example-gae/src/main/java/org/apache/camel/example/gae/WeatherProcessor.java
(added)
+++
camel/trunk/examples/camel-example-gae/src/main/java/org/apache/camel/example/gae/WeatherProcessor.java
Thu Nov 19 13:48:14 2009
@@ -0,0 +1,55 @@
+/**
+ * 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.camel.example.gae;
+
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathFactory;
+
+import org.w3c.dom.Document;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+
+public class WeatherProcessor implements Processor {
+
+ @Override
+ public void process(Exchange exchange) throws Exception {
+ // convert XML body to DOM tree
+ Document doc = exchange.getIn().getBody(Document.class);
+
+ XPathFactory xpfactory = XPathFactory.newInstance();
+ XPath xpath = xpfactory.newXPath();
+
+ // Extract result values via XPath
+ String city = xpath.evaluate("//forecast_information/city/@data", doc);
+ String cond = xpath.evaluate("//current_conditions/condition/@data",
doc);
+ String temp = xpath.evaluate("//current_conditions/temp_c/@data", doc);
+
+ String msg = null;
+ if (city != null && city.length() > 0) {
+ msg = new StringBuffer()
+ .append("\n").append("Weather report for: ").append(city)
+ .append("\n").append("Current condition: ").append(cond)
+ .append("\n").append("Current temperature:
").append(temp).append(" (Celsius)").toString();
+ } else {
+ // create an error message
+ msg = "Error getting weather report for " +
exchange.getIn().getHeader("city", String.class);
+ }
+ exchange.getIn().setBody(msg);
+ }
+
+}
Propchange:
camel/trunk/examples/camel-example-gae/src/main/java/org/apache/camel/example/gae/WeatherProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: camel/trunk/examples/camel-example-gae/src/main/resources/context.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-gae/src/main/resources/context.xml?rev=882143&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-gae/src/main/resources/context.xml
(added)
+++ camel/trunk/examples/camel-example-gae/src/main/resources/context.xml Thu
Nov 19 13:48:14 2009
@@ -0,0 +1,16 @@
+<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 id="camelContext"
+ class="org.apache.camel.component.gae.context.GaeSpringCamelContext">
+ <property name="routeBuilder" ref="tutorialRouteBuilder" />
+ </bean>
+
+ <bean id="tutorialRouteBuilder"
+ class="org.apache.camel.example.gae.TutorialRouteBuilder">
+ </bean>
+
+</beans>
Propchange:
camel/trunk/examples/camel-example-gae/src/main/resources/context.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added:
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/appengine-web.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/appengine-web.xml?rev=882143&view=auto
==============================================================================
---
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/appengine-web.xml
(added)
+++
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/appengine-web.xml
Thu Nov 19 13:48:14 2009
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
+ <application>replaceme</application>
+ <version>1</version>
+
+ <!-- Configure java.util.logging -->
+ <system-properties>
+ <property name="java.util.logging.config.file"
value="WEB-INF/logging.properties"/>
+ </system-properties>
+
+</appengine-web-app>
\ No newline at end of file
Propchange:
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/appengine-web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added:
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/lib/datanucleus-appengine-1.0.3.jar
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/lib/datanucleus-appengine-1.0.3.jar?rev=882143&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/lib/datanucleus-appengine-1.0.3.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added:
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/lib/datanucleus-core-1.1.5.jar
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/lib/datanucleus-core-1.1.5.jar?rev=882143&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/lib/datanucleus-core-1.1.5.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added:
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/lib/datanucleus-jpa-1.1.5.jar
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/lib/datanucleus-jpa-1.1.5.jar?rev=882143&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/lib/datanucleus-jpa-1.1.5.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added:
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/lib/geronimo-jpa_3.0_spec-1.1.1.jar
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/lib/geronimo-jpa_3.0_spec-1.1.1.jar?rev=882143&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/lib/geronimo-jpa_3.0_spec-1.1.1.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added:
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/lib/geronimo-jta_1.1_spec-1.1.1.jar
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/lib/geronimo-jta_1.1_spec-1.1.1.jar?rev=882143&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/lib/geronimo-jta_1.1_spec-1.1.1.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added:
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/lib/jdo2-api-2.3-eb.jar
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/lib/jdo2-api-2.3-eb.jar?rev=882143&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/lib/jdo2-api-2.3-eb.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added:
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/logging.properties
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/logging.properties?rev=882143&view=auto
==============================================================================
---
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/logging.properties
(added)
+++
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/logging.properties
Thu Nov 19 13:48:14 2009
@@ -0,0 +1,32 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+.level = WARNING
+org.apache.camel.example.gae.level=INFO
+DataNucleus.JDO.level=WARNING
+DataNucleus.Persistence.level=WARNING
+DataNucleus.Cache.level=WARNING
+DataNucleus.MetaData.level=WARNING
+DataNucleus.General.level=WARNING
+DataNucleus.Utility.level=WARNING
+DataNucleus.Transaction.level=WARNING
+DataNucleus.Datastore.level=WARNING
+DataNucleus.ClassLoading.level=WARNING
+DataNucleus.Plugin.level=WARNING
+DataNucleus.ValueGeneration.level=WARNING
+DataNucleus.Enhancer.level=WARNING
+DataNucleus.SchemaTool.level=WARNING
Propchange:
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/logging.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added: camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/web.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/web.xml?rev=882143&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/web.xml
(added)
+++ camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/web.xml Thu
Nov 19 13:48:14 2009
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<web-app
+xmlns="http://java.sun.com/xml/ns/javaee"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+xsi:schemaLocation="
+http://java.sun.com/xml/ns/javaee
+http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
+
+ <servlet>
+ <servlet-name>CamelServlet</servlet-name>
+
<servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class>
+ <init-param>
+ <param-name>contextConfigLocation</param-name>
+ <param-value>context.xml</param-value>
+ </init-param>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>CamelServlet</servlet-name>
+ <url-pattern>/camel/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>CamelServlet</servlet-name>
+ <url-pattern>/worker/*</url-pattern>
+ </servlet-mapping>
+
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ </welcome-file-list>
+</web-app>
+
Propchange:
camel/trunk/examples/camel-example-gae/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: camel/trunk/examples/camel-example-gae/src/main/webapp/index.html
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-gae/src/main/webapp/index.html?rev=882143&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-gae/src/main/webapp/index.html (added)
+++ camel/trunk/examples/camel-example-gae/src/main/webapp/index.html Thu Nov
19 13:48:14 2009
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
+<title>Weather Report</title>
+</head>
+
+<body>
+<h1>Weather Report</h1>
+<form action="camel/weather" method="post">
+<table>
+ <tr>
+ <td>City:</td>
+ <td><input type="text" name="city"></td>
+ </tr>
+ <tr>
+ <td>Mailto:</td>
+ <td><input type="text" name="mailto"></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td align="right"><input type="submit" value="Submit" /></td>
+ </tr>
+</table>
+</form>
+</body>
+</html>
Propchange: camel/trunk/examples/camel-example-gae/src/main/webapp/index.html
------------------------------------------------------------------------------
svn:eol-style = native
Modified: camel/trunk/examples/pom.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/pom.xml?rev=882143&r1=882142&r2=882143&view=diff
==============================================================================
--- camel/trunk/examples/pom.xml (original)
+++ camel/trunk/examples/pom.xml Thu Nov 19 13:48:14 2009
@@ -54,6 +54,7 @@
<module>camel-example-cxf-async</module>
<module>camel-example-docs</module>
<module>camel-example-etl</module>
+ <module>camel-example-gae</module>
<module>camel-example-guice-jms</module>
<module>camel-example-http-async</module>
<module>camel-example-jms-file</module>
Modified: camel/trunk/parent/pom.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/parent/pom.xml?rev=882143&r1=882142&r2=882143&view=diff
==============================================================================
--- camel/trunk/parent/pom.xml (original)
+++ camel/trunk/parent/pom.xml Thu Nov 19 13:48:14 2009
@@ -245,6 +245,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-gae</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-guice</artifactId>
<version>${project.version}</version>
</dependency>