You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2014/07/01 08:41:27 UTC
[4/5] CAMEL-7354: renamed camel-spark to camel-spark-rest to aovid
ppl mistaking it for Apache Spark integration.
http://git-wip-us.apache.org/repos/asf/camel/blob/3c2252aa/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkParamTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkParamTest.java b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkParamTest.java
new file mode 100644
index 0000000..09c5f43
--- /dev/null
+++ b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkParamTest.java
@@ -0,0 +1,46 @@
+/**
+ * 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.component.sparkrest;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class CamelSparkParamTest extends BaseSparkTest {
+
+ @Test
+ public void testSparkGet() throws Exception {
+ getMockEndpoint("mock:foo").expectedMessageCount(1);
+ getMockEndpoint("mock:foo").expectedHeaderReceived("name", "world");
+
+ String out = template.requestBody("http://0.0.0.0:" + getPort() + "/hello/world", null, String.class);
+ assertEquals("Bye world", out);
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("spark-rest:get:/hello/:name")
+ .to("mock:foo")
+ .transform().simple("Bye ${header.name}");
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/3c2252aa/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkRequestBeanTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkRequestBeanTest.java b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkRequestBeanTest.java
new file mode 100644
index 0000000..c0845f1
--- /dev/null
+++ b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkRequestBeanTest.java
@@ -0,0 +1,50 @@
+/**
+ * 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.component.sparkrest;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+import spark.Request;
+
+public class CamelSparkRequestBeanTest extends BaseSparkTest {
+
+ @Test
+ public void testSparkGet() throws Exception {
+ getMockEndpoint("mock:foo").expectedMessageCount(1);
+
+ String out = template.requestBody("http://0.0.0.0:" + getPort() + "/hello/camel/to/world", null, String.class);
+ assertEquals("Bye big world from camel", out);
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("spark-rest:get:/hello/*/to/*")
+ .to("mock:foo")
+ .bean(CamelSparkRequestBeanTest.class, "doSomething");
+ }
+ };
+ }
+
+ public String doSomething(Request request) {
+ return "Bye big " + request.splat()[1] + " from " + request.splat()[0];
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/3c2252aa/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkRouteBuilderPostTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkRouteBuilderPostTest.java b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkRouteBuilderPostTest.java
new file mode 100644
index 0000000..8d0ff4a
--- /dev/null
+++ b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkRouteBuilderPostTest.java
@@ -0,0 +1,45 @@
+/**
+ * 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.component.sparkrest;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class CamelSparkRouteBuilderPostTest extends BaseSparkTest {
+
+ @Test
+ public void testSparkPost() throws Exception {
+ getMockEndpoint("mock:foo").expectedMessageCount(1);
+
+ String out = template.requestBody("http://0.0.0.0:" + getPort() + "/hello", "I was here", String.class);
+ assertEquals("Bye I was here", out);
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new SparkRouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ post("hello")
+ .to("mock:foo")
+ .transform().simple("Bye ${body}");
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/3c2252aa/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkRouteBuilderTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkRouteBuilderTest.java b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkRouteBuilderTest.java
new file mode 100644
index 0000000..56c7301
--- /dev/null
+++ b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkRouteBuilderTest.java
@@ -0,0 +1,45 @@
+/**
+ * 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.component.sparkrest;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class CamelSparkRouteBuilderTest extends BaseSparkTest {
+
+ @Test
+ public void testSparkGet() throws Exception {
+ getMockEndpoint("mock:foo").expectedMessageCount(1);
+
+ String out = template.requestBody("http://0.0.0.0:" + getPort() + "/hello", null, String.class);
+ assertEquals("Bye World", out);
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new SparkRouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ get("hello")
+ .to("mock:foo")
+ .transform().constant("Bye World");
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/3c2252aa/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkSplatTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkSplatTest.java b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkSplatTest.java
new file mode 100644
index 0000000..6dd6039
--- /dev/null
+++ b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkSplatTest.java
@@ -0,0 +1,45 @@
+/**
+ * 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.component.sparkrest;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class CamelSparkSplatTest extends BaseSparkTest {
+
+ @Test
+ public void testSparkGet() throws Exception {
+ getMockEndpoint("mock:foo").expectedMessageCount(1);
+
+ String out = template.requestBody("http://0.0.0.0:" + getPort() + "/hello/camel/to/world", null, String.class);
+ assertEquals("Bye big world from camel", out);
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("spark-rest:get:/hello/*/to/*")
+ .to("mock:foo")
+ .transform().simple("Bye big ${header.splat[1]} from ${header.splat[0]}");
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/3c2252aa/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkTest.java b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkTest.java
new file mode 100644
index 0000000..41c39b7
--- /dev/null
+++ b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkTest.java
@@ -0,0 +1,45 @@
+/**
+ * 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.component.sparkrest;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class CamelSparkTest extends BaseSparkTest {
+
+ @Test
+ public void testSparkGet() throws Exception {
+ getMockEndpoint("mock:foo").expectedMessageCount(1);
+
+ String out = template.requestBody("http://0.0.0.0:" + getPort() + "/hello", null, String.class);
+ assertEquals("Bye World", out);
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("spark-rest:get:hello")
+ .to("mock:foo")
+ .transform().constant("Bye World");
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/3c2252aa/components/camel-spark-rest/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/components/camel-spark-rest/src/test/resources/log4j.properties b/components/camel-spark-rest/src/test/resources/log4j.properties
new file mode 100644
index 0000000..10c5355
--- /dev/null
+++ b/components/camel-spark-rest/src/test/resources/log4j.properties
@@ -0,0 +1,36 @@
+## ------------------------------------------------------------------------
+## 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.
+## ------------------------------------------------------------------------
+
+#
+# The logging properties used for testing.
+#
+log4j.rootLogger=INFO, file
+
+#log4j.logger.org.apache.camel.component.sparkrest=DEBUG
+
+# CONSOLE appender not used by default
+log4j.appender.out=org.apache.log4j.ConsoleAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
+#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+# File appender
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+log4j.appender.file.file=target/camel-spark-rest-test.log
+log4j.appender.file.append=true
http://git-wip-us.apache.org/repos/asf/camel/blob/3c2252aa/components/camel-spark/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-spark/pom.xml b/components/camel-spark/pom.xml
deleted file mode 100644
index a035fde..0000000
--- a/components/camel-spark/pom.xml
+++ /dev/null
@@ -1,136 +0,0 @@
-<?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.
--->
-<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>org.apache.camel</groupId>
- <artifactId>components</artifactId>
- <version>2.14-SNAPSHOT</version>
- </parent>
-
- <artifactId>camel-spark</artifactId>
- <packaging>bundle</packaging>
- <name>Camel :: Spark</name>
- <description>Camel Spark (REST DSL) support</description>
-
- <properties>
- <camel.osgi.export.pkg>org.apache.camel.component.spark.*</camel.osgi.export.pkg>
- </properties>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
- </dependency>
-
- <dependency>
- <groupId>com.sparkjava</groupId>
- <artifactId>spark-core</artifactId>
- <version>${spark-version}</version>
- </dependency>
-
- <!-- avoid mixed versions of jetty as spark requires jetty 9 -->
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-server</artifactId>
- <version>${jetty9-version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-util</artifactId>
- <version>${jetty9-version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-io</artifactId>
- <version>${jetty9-version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-servlet</artifactId>
- <version>${jetty9-version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-security</artifactId>
- <version>${jetty9-version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
- <version>${jetty9-version}</version>
- </dependency>
-
- <!-- test dependencies -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-http</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <!-- unit testing requires java 8 -->
- <profiles>
- <profile>
- <id>jdk8-test</id>
- <activation>
- <jdk>1.8</jdk>
- </activation>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skipTests>false</skipTests>
- <forkedProcessTimeoutInSeconds>300</forkedProcessTimeoutInSeconds>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skipTests>true</skipTests>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
http://git-wip-us.apache.org/repos/asf/camel/blob/3c2252aa/components/camel-spark/src/main/java/org/apache/camel/component/spark/CamelSpark.java
----------------------------------------------------------------------
diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/CamelSpark.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/CamelSpark.java
deleted file mode 100644
index 860ac5a..0000000
--- a/components/camel-spark/src/main/java/org/apache/camel/component/spark/CamelSpark.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * 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.component.spark;
-
-import spark.Route;
-import spark.Spark;
-
-public final class CamelSpark {
-
- private CamelSpark() {
- }
-
- public static void spark(String verb, String path, String accept, Route route) {
- if ("get".equals(verb)) {
- if (accept != null) {
- Spark.get(path, accept, route);
- } else {
- Spark.get(path, route);
- }
- } else if ("post".equals(verb)) {
- if (accept != null) {
- Spark.post(path, accept, route);
- } else {
- Spark.post(path, route);
- }
- } else if ("put".equals(verb)) {
- if (accept != null) {
- Spark.put(path, accept, route);
- } else {
- Spark.put(path, route);
- }
- } else if ("patch".equals(verb)) {
- if (accept != null) {
- Spark.patch(path, accept, route);
- } else {
- Spark.patch(path, route);
- }
- } else if ("delete".equals(verb)) {
- if (accept != null) {
- Spark.delete(path, accept, route);
- } else {
- Spark.delete(path, route);
- }
- } else if ("head".equals(verb)) {
- if (accept != null) {
- Spark.head(path, accept, route);
- } else {
- Spark.head(path, route);
- }
- } else if ("trace".equals(verb)) {
- if (accept != null) {
- Spark.trace(path, accept, route);
- } else {
- Spark.trace(path, route);
- }
- } else if ("connect".equals(verb)) {
- if (accept != null) {
- Spark.connect(path, accept, route);
- } else {
- Spark.connect(path, route);
- }
- } else if ("options".equals(verb)) {
- if (accept != null) {
- Spark.options(path, accept, route);
- } else {
- Spark.options(path, route);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/3c2252aa/components/camel-spark/src/main/java/org/apache/camel/component/spark/CamelSparkRoute.java
----------------------------------------------------------------------
diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/CamelSparkRoute.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/CamelSparkRoute.java
deleted file mode 100644
index 76f1fa0..0000000
--- a/components/camel-spark/src/main/java/org/apache/camel/component/spark/CamelSparkRoute.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * 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.component.spark;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.ExchangePattern;
-import org.apache.camel.Message;
-import org.apache.camel.Processor;
-import org.apache.camel.util.ObjectHelper;
-import spark.Request;
-import spark.Response;
-import spark.Route;
-
-public class CamelSparkRoute implements Route {
-
- private final SparkEndpoint endpoint;
- private final Processor processor;
-
- public CamelSparkRoute(SparkEndpoint endpoint, Processor processor) {
- this.endpoint = endpoint;
- this.processor = processor;
- }
-
- @Override
- public Object handle(Request request, Response response) {
- Exchange exchange = endpoint.createExchange(ExchangePattern.InOut);
-
- try {
- Message in = endpoint.getSparkBinding().toCamelMessage(request, exchange, endpoint.getSparkConfiguration());
- exchange.setIn(in);
-
- processor.process(exchange);
- } catch (Exception e) {
- exchange.setException(e);
- }
-
- Message msg = exchange.hasOut() ? exchange.getOut() : exchange.getIn();
-
- try {
- endpoint.getSparkBinding().toSparkResponse(msg, response, endpoint.getSparkConfiguration());
- } catch (Exception e) {
- throw ObjectHelper.wrapRuntimeCamelException(e);
- }
-
- if (exchange.hasOut()) {
- return exchange.getOut().getBody();
- } else {
- return exchange.getIn().getBody();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/3c2252aa/components/camel-spark/src/main/java/org/apache/camel/component/spark/DefaultSparkBinding.java
----------------------------------------------------------------------
diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/DefaultSparkBinding.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/DefaultSparkBinding.java
deleted file mode 100644
index 854f94b..0000000
--- a/components/camel-spark/src/main/java/org/apache/camel/component/spark/DefaultSparkBinding.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/**
- * 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.component.spark;
-
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectOutputStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-import org.apache.camel.TypeConverter;
-import org.apache.camel.spi.HeaderFilterStrategy;
-import org.apache.camel.util.ExchangeHelper;
-import org.apache.camel.util.IOHelper;
-import org.apache.camel.util.MessageHelper;
-import org.apache.camel.util.ObjectHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import spark.Request;
-import spark.Response;
-
-public class DefaultSparkBinding implements SparkBinding {
-
- private static final Logger LOG = LoggerFactory.getLogger(DefaultSparkBinding.class);
- private HeaderFilterStrategy headerFilterStrategy = new SparkHeaderFilterStrategy();
-
- @Override
- public Message toCamelMessage(Request request, Exchange exchange, SparkConfiguration configuration) throws Exception {
- LOG.trace("toCamelMessage: {}", request);
-
- SparkMessage answer = new SparkMessage(request, null);
- answer.setExchange(exchange);
- if (configuration.isMapHeaders()) {
- populateCamelHeaders(request, answer.getHeaders(), exchange, configuration);
- }
-
- if (configuration.isDisableStreamCache()) {
- // keep the body as a input stream
- answer.setBody(request.raw().getInputStream());
- } else {
- answer.setBody(request.body());
- }
- return answer;
- }
-
- @Override
- public void populateCamelHeaders(Request request, Map<String, Object> headers, Exchange exchange, SparkConfiguration configuration) throws Exception {
- // store the method and query and other info in headers as String types
- headers.put(Exchange.HTTP_METHOD, request.raw().getMethod());
- headers.put(Exchange.HTTP_QUERY, request.raw().getQueryString());
- headers.put(Exchange.HTTP_URL, request.raw().getRequestURL().toString());
- headers.put(Exchange.HTTP_URI, request.raw().getRequestURI());
- headers.put(Exchange.HTTP_PATH, request.raw().getPathInfo());
- headers.put(Exchange.CONTENT_TYPE, request.raw().getContentType());
-
- for (String key : request.attributes()) {
- Object value = request.attribute(key);
- Object decoded = shouldUrlDecodeHeader(configuration, key, value, "UTF-8");
- if (headerFilterStrategy != null
- && !headerFilterStrategy.applyFilterToExternalHeaders(key, decoded, exchange)) {
- SparkHelper.appendHeader(headers, key, decoded);
- }
- }
-
- for (String key : request.headers()) {
- Object value = request.headers(key);
- Object decoded = shouldUrlDecodeHeader(configuration, key, value, "UTF-8");
- if (headerFilterStrategy != null
- && !headerFilterStrategy.applyFilterToExternalHeaders(key, decoded, exchange)) {
- SparkHelper.appendHeader(headers, key, decoded);
- }
- }
-
- for (Map.Entry<String, String> entry : request.params().entrySet()) {
- String key = mapKey(entry.getKey());
- String value = entry.getValue();
- Object decoded = shouldUrlDecodeHeader(configuration, key, value, "UTF-8");
- if (headerFilterStrategy != null
- && !headerFilterStrategy.applyFilterToExternalHeaders(key, decoded, exchange)) {
- SparkHelper.appendHeader(headers, key, decoded);
- }
- }
-
- String[] splat = request.splat();
- String key = SparkConstants.SPLAT;
- if (headerFilterStrategy != null
- && !headerFilterStrategy.applyFilterToExternalHeaders(key, splat, exchange)) {
- SparkHelper.appendHeader(headers, key, splat);
- }
- }
-
- @Override
- public void toSparkResponse(Message message, Response response, SparkConfiguration configuration) throws Exception {
- LOG.trace("toSparkResponse: {}", message);
-
- // the response code is 200 for OK and 500 for failed
- boolean failed = message.getExchange().isFailed();
- int defaultCode = failed ? 500 : 200;
-
- int code = message.getHeader(Exchange.HTTP_RESPONSE_CODE, defaultCode, int.class);
- response.status(code);
- LOG.trace("HTTP Status Code: {}", code);
-
- TypeConverter tc = message.getExchange().getContext().getTypeConverter();
-
- // append headers
- // must use entrySet to ensure case of keys is preserved
- for (Map.Entry<String, Object> entry : message.getHeaders().entrySet()) {
- String key = entry.getKey();
- Object value = entry.getValue();
- // use an iterator as there can be multiple values. (must not use a delimiter)
- final Iterator<?> it = ObjectHelper.createIterator(value, null);
- while (it.hasNext()) {
- String headerValue = tc.convertTo(String.class, it.next());
- if (headerValue != null && headerFilterStrategy != null
- && !headerFilterStrategy.applyFilterToCamelHeaders(key, headerValue, message.getExchange())) {
- LOG.trace("HTTP-Header: {}={}", key, headerValue);
- response.header(key, headerValue);
- }
- }
- }
-
- // set the content type in the response.
- String contentType = MessageHelper.getContentType(message);
- if (contentType != null) {
- // set content-type
- response.header(Exchange.CONTENT_TYPE, contentType);
- LOG.trace("Content-Type: {}", contentType);
- }
-
- Object body = message.getBody();
- Exception cause = message.getExchange().getException();
-
- // if there was an exception then use that as body
- if (cause != null) {
- if (configuration.isTransferException()) {
- // we failed due an exception, and transfer it as java serialized object
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- ObjectOutputStream oos = new ObjectOutputStream(bos);
- oos.writeObject(cause);
- oos.flush();
- IOHelper.close(oos, bos);
-
- body = bos.toByteArray();
- // force content type to be serialized java object
- message.setHeader(Exchange.CONTENT_TYPE, SparkConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT);
- } else {
- // we failed due an exception so print it as plain text
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- cause.printStackTrace(pw);
-
- // the body should then be the stacktrace
- body = sw.toString().getBytes();
- // force content type to be text/plain as that is what the stacktrace is
- message.setHeader(Exchange.CONTENT_TYPE, "text/plain");
- }
-
- // and mark the exception as failure handled, as we handled it by returning it as the response
- ExchangeHelper.setFailureHandled(message.getExchange());
- }
-
- if (body != null) {
- String str = tc.mandatoryConvertTo(String.class, message.getExchange(), body);
- response.body(str);
- }
- }
-
- /**
- * Decodes the header if needed to, or returns the header value as is.
- *
- * @param configuration the configuration
- * @param headerName the header name
- * @param value the current header value
- * @param charset the charset to use for decoding
- * @return the decoded value (if decoded was needed) or a <tt>toString</tt> representation of the value.
- * @throws java.io.UnsupportedEncodingException is thrown if error decoding.
- */
- protected String shouldUrlDecodeHeader(SparkConfiguration configuration, String headerName, Object value, String charset) throws
- UnsupportedEncodingException {
- // do not decode Content-Type
- if (Exchange.CONTENT_TYPE.equals(headerName)) {
- return value.toString();
- } else if (configuration.isUrlDecodeHeaders()) {
- return URLDecoder.decode(value.toString(), charset);
- } else {
- return value.toString();
- }
- }
-
- protected String mapKey(String key) {
- if (key.startsWith(":")) {
- return key.substring(1);
- } else {
- return key;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/3c2252aa/components/camel-spark/src/main/java/org/apache/camel/component/spark/ServletSparkApplication.java
----------------------------------------------------------------------
diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/ServletSparkApplication.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/ServletSparkApplication.java
deleted file mode 100644
index 94675b3..0000000
--- a/components/camel-spark/src/main/java/org/apache/camel/component/spark/ServletSparkApplication.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * 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.component.spark;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import spark.Access;
-import spark.servlet.SparkApplication;
-
-/**
- * A {@link spark.servlet.SparkApplication} to run in servlet mode.
- */
-public class ServletSparkApplication implements SparkApplication {
-
- private static final Logger LOG = LoggerFactory.getLogger(ServletSparkApplication.class);
-
- @Override
- public void init() {
- LOG.info("init");
- // force spark to be in Servlet mode
- Access.runFromServlet();
- }
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/3c2252aa/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkBinding.java
----------------------------------------------------------------------
diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkBinding.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkBinding.java
deleted file mode 100644
index 21053ae..0000000
--- a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkBinding.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * 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.component.spark;
-
-import java.util.Map;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-import spark.Request;
-import spark.Response;
-
-public interface SparkBinding {
-
- /**
- * Binds from Spark {@link Request} to Camel {@link org.apache.camel.Message}.
- *
- * @param request the Spark request
- * @param exchange the exchange that should contain the returned message.
- * @param configuration configuration
- * @return the message to store on the given exchange
- * @throws Exception is thrown if error during binding
- */
- Message toCamelMessage(Request request, Exchange exchange, SparkConfiguration configuration) throws Exception;
-
- /**
- * Binds from Spark {@link Request} to Camel headers as a {@link Map}.
- *
- * @param request the Spark request
- * @param headers the Camel headers that should be populated
- * @param exchange the exchange that should contain the returned message.
- * @param configuration the endpoint configuration
- * @throws Exception is thrown if error during binding
- */
- void populateCamelHeaders(Request request, Map<String, Object> headers, Exchange exchange, SparkConfiguration configuration) throws Exception;
-
- /**
- * Binds from Camel {@link Message} to Spark {@link Response}.
- *
- * @param message the Camel message
- * @param response the Spark response to bind to
- * @param configuration the endpoint configuration
- * @throws Exception is thrown if error during binding
- */
- void toSparkResponse(Message message, Response response, SparkConfiguration configuration) throws Exception;
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/3c2252aa/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkComponent.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkComponent.java
deleted file mode 100644
index 0bc7170..0000000
--- a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkComponent.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * 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.component.spark;
-
-import java.util.Map;
-
-import org.apache.camel.Endpoint;
-import org.apache.camel.impl.UriEndpointComponent;
-import org.apache.camel.util.ObjectHelper;
-import spark.Spark;
-import spark.SparkBase;
-
-public class SparkComponent extends UriEndpointComponent {
-
- private int port = SparkBase.SPARK_DEFAULT_PORT;
- private SparkConfiguration sparkConfiguration = new SparkConfiguration();
- private SparkBinding sparkBinding = new DefaultSparkBinding();
-
- public SparkComponent() {
- super(SparkEndpoint.class);
- }
-
- public int getPort() {
- return port;
- }
-
- public void setPort(int port) {
- this.port = port;
- }
-
- public SparkConfiguration getSparkConfiguration() {
- return sparkConfiguration;
- }
-
- public void setSparkConfiguration(SparkConfiguration sparkConfiguration) {
- this.sparkConfiguration = sparkConfiguration;
- }
-
- public SparkBinding getSparkBinding() {
- return sparkBinding;
- }
-
- public void setSparkBinding(SparkBinding sparkBinding) {
- this.sparkBinding = sparkBinding;
- }
-
- @Override
- protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
- SparkEndpoint answer = new SparkEndpoint(uri, this);
- answer.setSparkConfiguration(getSparkConfiguration());
- answer.setSparkBinding(getSparkBinding());
- setProperties(answer, parameters);
-
- if (!remaining.contains(":")) {
- throw new IllegalArgumentException("Invalid syntax. Must be spark:verb:path");
- }
-
- String verb = ObjectHelper.before(remaining, ":");
- String path = ObjectHelper.after(remaining, ":");
-
- answer.setVerb(verb);
- answer.setPath(path);
-
- return answer;
- }
-
- @Override
- protected void doStart() throws Exception {
- super.doStart();
-
- if (getPort() != SparkBase.SPARK_DEFAULT_PORT) {
- Spark.setPort(getPort());
- }
- }
-
- @Override
- protected void doShutdown() throws Exception {
- super.doShutdown();
- Spark.stop();
- }
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/3c2252aa/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkConfiguration.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkConfiguration.java
deleted file mode 100644
index a24245a..0000000
--- a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkConfiguration.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * 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.component.spark;
-
-import org.apache.camel.spi.UriParam;
-import org.apache.camel.spi.UriParams;
-
-@UriParams
-public class SparkConfiguration {
-
- @UriParam
- private boolean mapHeaders = true;
- @UriParam
- private boolean disableStreamCache;
- @UriParam
- private boolean urlDecodeHeaders;
- @UriParam
- private boolean transferException;
-
- public boolean isMapHeaders() {
- return mapHeaders;
- }
-
- public void setMapHeaders(boolean mapHeaders) {
- this.mapHeaders = mapHeaders;
- }
-
- public boolean isDisableStreamCache() {
- return disableStreamCache;
- }
-
- public void setDisableStreamCache(boolean disableStreamCache) {
- this.disableStreamCache = disableStreamCache;
- }
-
- public boolean isUrlDecodeHeaders() {
- return urlDecodeHeaders;
- }
-
- public void setUrlDecodeHeaders(boolean urlDecodeHeaders) {
- this.urlDecodeHeaders = urlDecodeHeaders;
- }
-
- public boolean isTransferException() {
- return transferException;
- }
-
- public void setTransferException(boolean transferException) {
- this.transferException = transferException;
- }
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/3c2252aa/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkConstants.java
----------------------------------------------------------------------
diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkConstants.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkConstants.java
deleted file mode 100644
index 8a026fa..0000000
--- a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkConstants.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * 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.component.spark;
-
-public final class SparkConstants {
-
- public static final String CONTENT_TYPE_JAVA_SERIALIZED_OBJECT = "application/x-java-serialized-object";
- public static final String SPLAT = "splat";
-
- private SparkConstants() {
- }
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/3c2252aa/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkConsumer.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkConsumer.java
deleted file mode 100644
index 58390f0..0000000
--- a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkConsumer.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * 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.component.spark;
-
-import org.apache.camel.Endpoint;
-import org.apache.camel.Processor;
-import org.apache.camel.impl.DefaultConsumer;
-
-public class SparkConsumer extends DefaultConsumer {
-
- private final CamelSparkRoute route;
-
- public SparkConsumer(Endpoint endpoint, Processor processor, CamelSparkRoute route) {
- super(endpoint, processor);
- this.route = route;
- }
-
- @Override
- public SparkEndpoint getEndpoint() {
- return (SparkEndpoint) super.getEndpoint();
- }
-
- @Override
- protected void doStart() throws Exception {
- super.doStart();
-
- String verb = getEndpoint().getVerb();
- String path = getEndpoint().getPath();
- String accept = getEndpoint().getAccept();
-
- if (accept != null) {
- log.info("Spark: {}({}) accepting: {}", new Object[]{verb, path, accept});
- } else {
- log.info("Spark: {}({})", verb, path);
- }
- CamelSpark.spark(verb, path, accept, route);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/3c2252aa/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkConverter.java
----------------------------------------------------------------------
diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkConverter.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkConverter.java
deleted file mode 100644
index 087d5fa..0000000
--- a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkConverter.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * 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.component.spark;
-
-import org.apache.camel.Converter;
-import org.apache.camel.Exchange;
-import org.apache.camel.FallbackConverter;
-import org.apache.camel.spi.TypeConverterRegistry;
-import spark.Request;
-import spark.Response;
-
-@Converter
-public final class SparkConverter {
-
- /**
- * A fallback converter that allows us to easily call Java beans and use the raw Spark {@link Request} as parameter types.
- */
- @FallbackConverter
- public static Object convertToRequest(Class<?> type, Exchange exchange, Object value, TypeConverterRegistry registry) {
- // if we want to covert to Request
- if (value != null && Request.class.isAssignableFrom(type)) {
-
- // okay we may need to cheat a bit when we want to grab the HttpRequest as its stored on the NettyHttpMessage
- // so if the message instance is a NettyHttpMessage and its body is the value, then we can grab the
- // HttpRequest from the NettyHttpMessage
- SparkMessage msg;
- if (exchange.hasOut()) {
- msg = exchange.getOut(SparkMessage.class);
- } else {
- msg = exchange.getIn(SparkMessage.class);
- }
- if (msg != null) {
- return msg.getRequest();
- }
- }
-
- return null;
- }
-
- /**
- * A fallback converter that allows us to easily call Java beans and use the raw Spark {@link Response} as parameter types.
- */
- @FallbackConverter
- public static Object convertToResponse(Class<?> type, Exchange exchange, Object value, TypeConverterRegistry registry) {
- // if we want to covert to Response
- if (value != null && Response.class.isAssignableFrom(type)) {
-
- // okay we may need to cheat a bit when we want to grab the HttpRequest as its stored on the NettyHttpMessage
- // so if the message instance is a NettyHttpMessage and its body is the value, then we can grab the
- // HttpRequest from the NettyHttpMessage
- SparkMessage msg;
- if (exchange.hasOut()) {
- msg = exchange.getOut(SparkMessage.class);
- } else {
- msg = exchange.getIn(SparkMessage.class);
- }
- if (msg != null) {
- return msg.getResponse();
- }
- }
-
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/3c2252aa/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkEndpoint.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkEndpoint.java
deleted file mode 100644
index db88544..0000000
--- a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkEndpoint.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- * 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.component.spark;
-
-import org.apache.camel.Component;
-import org.apache.camel.Consumer;
-import org.apache.camel.Processor;
-import org.apache.camel.Producer;
-import org.apache.camel.impl.DefaultEndpoint;
-import org.apache.camel.spi.UriEndpoint;
-import org.apache.camel.spi.UriParam;
-import org.apache.camel.util.ObjectHelper;
-import spark.route.HttpMethod;
-
-@UriEndpoint(scheme = "spark", consumerClass = SparkConsumer.class)
-public class SparkEndpoint extends DefaultEndpoint {
-
- @UriParam
- SparkConfiguration sparkConfiguration;
- @UriParam
- private SparkBinding sparkBinding;
- @UriParam
- private String verb;
- @UriParam
- private String path;
- @UriParam
- private String accept;
-
- public SparkEndpoint(String endpointUri, Component component) {
- super(endpointUri, component);
- }
-
- public SparkConfiguration getSparkConfiguration() {
- return sparkConfiguration;
- }
-
- public void setSparkConfiguration(SparkConfiguration sparkConfiguration) {
- this.sparkConfiguration = sparkConfiguration;
- }
-
- public SparkBinding getSparkBinding() {
- return sparkBinding;
- }
-
- public void setSparkBinding(SparkBinding sparkBinding) {
- this.sparkBinding = sparkBinding;
- }
-
- public String getVerb() {
- return verb;
- }
-
- public void setVerb(String verb) {
- this.verb = verb;
- }
-
- public String getPath() {
- return path;
- }
-
- public void setPath(String path) {
- this.path = path;
- }
-
- public String getAccept() {
- return accept;
- }
-
- public void setAccept(String accept) {
- this.accept = accept;
- }
-
- @Override
- public Producer createProducer() throws Exception {
- throw new UnsupportedOperationException("Producer not supported");
- }
-
- @Override
- public Consumer createConsumer(Processor processor) throws Exception {
- CamelSparkRoute route = new CamelSparkRoute(this, processor);
- Consumer consumer = new SparkConsumer(this, processor, route);
- configureConsumer(consumer);
- return consumer;
- }
-
- @Override
- public boolean isSingleton() {
- return true;
- }
-
- @Override
- protected void doStart() throws Exception {
- super.doStart();
-
- ObjectHelper.notEmpty(verb, "verb", this);
- ObjectHelper.notEmpty(path, "path", this);
-
- // verb must be supported by Spark
- HttpMethod.valueOf(verb);
- }
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/3c2252aa/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkHeaderFilterStrategy.java
----------------------------------------------------------------------
diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkHeaderFilterStrategy.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkHeaderFilterStrategy.java
deleted file mode 100644
index f729bde..0000000
--- a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkHeaderFilterStrategy.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * 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.component.spark;
-
-import org.apache.camel.impl.DefaultHeaderFilterStrategy;
-
-/**
- * Default Spark {@link org.apache.camel.spi.HeaderFilterStrategy} used when binding with {@link org.apache.camel.component.spark.SparkBinding}.
- */
-public class SparkHeaderFilterStrategy extends DefaultHeaderFilterStrategy {
-
- public SparkHeaderFilterStrategy() {
- initialize();
- }
-
- protected void initialize() {
- getOutFilter().add("content-length");
- getOutFilter().add("content-type");
- getOutFilter().add("host");
- getOutFilter().add("user-agent");
- // Add the filter for the Generic Message header
- // http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.5
- getOutFilter().add("cache-control");
- getOutFilter().add("connection");
- getOutFilter().add("date");
- getOutFilter().add("pragma");
- getOutFilter().add("trailer");
- getOutFilter().add("transfer-encoding");
- getOutFilter().add("upgrade");
- getOutFilter().add("via");
- getOutFilter().add("warning");
-
- setLowerCase(true);
-
- // filter headers begin with "Camel" or "org.apache.camel"
- // must ignore case for Http based transports
- setOutFilterPattern("(?i)(Camel|org\\.apache\\.camel)[\\.|a-z|A-z|0-9]*");
-
- // filter out splat as its an internal header
- getOutFilter().add(SparkConstants.SPLAT);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/3c2252aa/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkHelper.java
----------------------------------------------------------------------
diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkHelper.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkHelper.java
deleted file mode 100644
index eda26b6..0000000
--- a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkHelper.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * 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.component.spark;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-public final class SparkHelper {
-
- private SparkHelper() {
- }
-
- /**
- * Appends the key/value to the headers.
- * <p/>
- * This implementation supports keys with multiple values. In such situations the value
- * will be a {@link java.util.List} that contains the multiple values.
- *
- * @param headers headers
- * @param key the key
- * @param value the value
- */
- @SuppressWarnings("unchecked")
- public static void appendHeader(Map<String, Object> headers, String key, Object value) {
- if (headers.containsKey(key)) {
- Object existing = headers.get(key);
- List<Object> list;
- if (existing instanceof List) {
- list = (List<Object>) existing;
- } else {
- list = new ArrayList<Object>();
- list.add(existing);
- }
- list.add(value);
- value = list;
- }
-
- headers.put(key, value);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/3c2252aa/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkMessage.java
----------------------------------------------------------------------
diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkMessage.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkMessage.java
deleted file mode 100644
index 0d02da3..0000000
--- a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkMessage.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * 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.component.spark;
-
-import org.apache.camel.impl.DefaultMessage;
-import spark.Request;
-import spark.Response;
-
-/**
- * Spark based {@link org.apache.camel.Message}.
- * <p/>
- * This implementation allows direct access to the Spark {@link Request} using
- * the {@link #getRequest()} method.
- */
-public class SparkMessage extends DefaultMessage {
-
- private final transient Request request;
- private final transient Response response;
-
- public SparkMessage(Request request, Response response) {
- this.request = request;
- this.response = response;
- }
-
- public Request getRequest() {
- return request;
- }
-
- public Response getResponse() {
- return response;
- }
-
- @Override
- public DefaultMessage newInstance() {
- return new SparkMessage(request, response);
- }
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/3c2252aa/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkRouteBuilder.java
----------------------------------------------------------------------
diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkRouteBuilder.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkRouteBuilder.java
deleted file mode 100644
index c00b276..0000000
--- a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkRouteBuilder.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * 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.component.spark;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.model.RouteDefinition;
-
-/**
- * A Spark extended {@link org.apache.camel.builder.RouteBuilder} which allows to define routes using the Spark DSL.
- */
-public abstract class SparkRouteBuilder extends RouteBuilder {
-
- public RouteDefinition get(String path) {
- return from("spark:get:" + path);
- }
-
- public RouteDefinition get(String path, String accept) {
- return from("spark:get:" + path + "?accept=" + accept);
- }
-
- public RouteDefinition post(String path) {
- return from("spark:post:" + path);
- }
-
- public RouteDefinition post(String path, String accept) {
- return from("spark:post:" + path + "?accept=" + accept);
- }
-
- public RouteDefinition put(String path) {
- return from("spark:post:" + path);
- }
-
- public RouteDefinition put(String path, String accept) {
- return from("spark:post:" + path + "?accept=" + accept);
- }
-
- public RouteDefinition delete(String path) {
- return from("spark:delete:" + path);
- }
-
- public RouteDefinition delete(String path, String accept) {
- return from("spark:delete:" + path + "?accept=" + accept);
- }
-
- public RouteDefinition head(String path) {
- return from("spark:head:" + path);
- }
-
- public RouteDefinition head(String path, String accept) {
- return from("spark:head:" + path + "?accept=" + accept);
- }
-
- public RouteDefinition trace(String path) {
- return from("spark:trace:" + path);
- }
-
- public RouteDefinition trace(String path, String accept) {
- return from("spark:trace:" + path + "?accept=" + accept);
- }
-
- public RouteDefinition connect(String path) {
- return from("spark:connect:" + path);
- }
-
- public RouteDefinition connect(String path, String accept) {
- return from("spark:connect:" + path + "?accept=" + accept);
- }
-
- public RouteDefinition options(String path) {
- return from("spark:options:" + path);
- }
-
- public RouteDefinition options(String path, String accept) {
- return from("spark:options:" + path + "?accept=" + accept);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/3c2252aa/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkServletContextListener.java
----------------------------------------------------------------------
diff --git a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkServletContextListener.java b/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkServletContextListener.java
deleted file mode 100644
index fc6c3e0..0000000
--- a/components/camel-spark/src/main/java/org/apache/camel/component/spark/SparkServletContextListener.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * 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.component.spark;
-
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import spark.Access;
-
-/**
- * A {@link javax.servlet.ServletContextListener} to ensure we initialize Spark in servlet mode.
- */
-public class SparkServletContextListener implements ServletContextListener {
-
- private static final Logger LOG = LoggerFactory.getLogger(ServletSparkApplication.class);
-
- @Override
- public void contextInitialized(ServletContextEvent event) {
- LOG.info("contextInitialized");
- // force spark to be in Servlet mode
- Access.runFromServlet();
- }
-
- @Override
- public void contextDestroyed(ServletContextEvent event) {
- LOG.info("contextDestroyed");
- // noop
- }
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/3c2252aa/components/camel-spark/src/main/resources/META-INF/LICENSE.txt
----------------------------------------------------------------------
diff --git a/components/camel-spark/src/main/resources/META-INF/LICENSE.txt b/components/camel-spark/src/main/resources/META-INF/LICENSE.txt
deleted file mode 100755
index 6b0b127..0000000
--- a/components/camel-spark/src/main/resources/META-INF/LICENSE.txt
+++ /dev/null
@@ -1,203 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
http://git-wip-us.apache.org/repos/asf/camel/blob/3c2252aa/components/camel-spark/src/main/resources/META-INF/NOTICE.txt
----------------------------------------------------------------------
diff --git a/components/camel-spark/src/main/resources/META-INF/NOTICE.txt b/components/camel-spark/src/main/resources/META-INF/NOTICE.txt
deleted file mode 100644
index 2e215bf..0000000
--- a/components/camel-spark/src/main/resources/META-INF/NOTICE.txt
+++ /dev/null
@@ -1,11 +0,0 @@
- =========================================================================
- == NOTICE file corresponding to the section 4 d of ==
- == the Apache License, Version 2.0, ==
- == in this case for the Apache Camel distribution. ==
- =========================================================================
-
- This product includes software developed by
- The Apache Software Foundation (http://www.apache.org/).
-
- Please read the different LICENSE files present in the licenses directory of
- this distribution.