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 2017/01/19 11:06:41 UTC

[01/17] camel git commit: CAMEL-10721: camel-connector example

Repository: camel
Updated Branches:
  refs/heads/master 917b1b024 -> db8740ce9


CAMEL-10721: camel-connector example


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/db8740ce
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/db8740ce
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/db8740ce

Branch: refs/heads/master
Commit: db8740ce9787814a8176283c38de9b6f56bcff5f
Parents: 96b05ed
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Jan 19 10:57:59 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 19 11:00:00 2017 +0100

----------------------------------------------------------------------
 connectors/examples/foo-bar-wine-example/Readme.md |   4 ++++
 .../img/foo-connector-options-idea.png             | Bin 0 -> 45802 bytes
 2 files changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/db8740ce/connectors/examples/foo-bar-wine-example/Readme.md
----------------------------------------------------------------------
diff --git a/connectors/examples/foo-bar-wine-example/Readme.md b/connectors/examples/foo-bar-wine-example/Readme.md
index e65dfc2..60e717b 100644
--- a/connectors/examples/foo-bar-wine-example/Readme.md
+++ b/connectors/examples/foo-bar-wine-example/Readme.md
@@ -20,3 +20,7 @@ Notice how the tool presents only the pre-selected options of these connectors.
 which is based on the Camel `Timer` component only offers two options, where as if you are using `timer` instead
 you will have many more options.
 
+The following screenshot shows hows the `foo` connector only has two options to configure:
+
+![Foo Connector in IDEA](img/foo-connector-options-idea.png?raw=true)
+

http://git-wip-us.apache.org/repos/asf/camel/blob/db8740ce/connectors/examples/foo-bar-wine-example/img/foo-connector-options-idea.png
----------------------------------------------------------------------
diff --git a/connectors/examples/foo-bar-wine-example/img/foo-connector-options-idea.png b/connectors/examples/foo-bar-wine-example/img/foo-connector-options-idea.png
new file mode 100644
index 0000000..dc9ce4b
Binary files /dev/null and b/connectors/examples/foo-bar-wine-example/img/foo-connector-options-idea.png differ


[17/17] camel git commit: CAMEL-10721: connectors docs

Posted by da...@apache.org.
CAMEL-10721: connectors docs


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/88a76451
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/88a76451
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/88a76451

Branch: refs/heads/master
Commit: 88a7645191b77dc86f908e604763d1d1af016bfb
Parents: f79d981
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Jan 19 09:58:12 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 19 11:00:00 2017 +0100

----------------------------------------------------------------------
 connectors/examples/bar-connector/Readme.md     |  6 ++++++
 .../examples/beverage-component/Readme.md       |  5 +++++
 .../examples/foo-bar-wine-example/Readme.md     | 22 ++++++++++++++++++++
 connectors/examples/foo-connector/Readme.md     |  5 +++++
 connectors/examples/wine-connector/Readme.md    |  6 ++++++
 5 files changed, 44 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/88a76451/connectors/examples/bar-connector/Readme.md
----------------------------------------------------------------------
diff --git a/connectors/examples/bar-connector/Readme.md b/connectors/examples/bar-connector/Readme.md
new file mode 100644
index 0000000..5dae132
--- /dev/null
+++ b/connectors/examples/bar-connector/Readme.md
@@ -0,0 +1,6 @@
+## Bar Connector
+
+A Camel connector that is based on the `beverage-component`.
+
+This connector is a very basic connector with only a few options.
+

http://git-wip-us.apache.org/repos/asf/camel/blob/88a76451/connectors/examples/beverage-component/Readme.md
----------------------------------------------------------------------
diff --git a/connectors/examples/beverage-component/Readme.md b/connectors/examples/beverage-component/Readme.md
new file mode 100644
index 0000000..934a3a1
--- /dev/null
+++ b/connectors/examples/beverage-component/Readme.md
@@ -0,0 +1,5 @@
+## Beverage Component
+
+A 3rd party Camel component to be used as base for the `bar` and `wine` Camel connectors. 
+
+This is used to demonstrate that Camel connectors also work with 3rd party components.

http://git-wip-us.apache.org/repos/asf/camel/blob/88a76451/connectors/examples/foo-bar-wine-example/Readme.md
----------------------------------------------------------------------
diff --git a/connectors/examples/foo-bar-wine-example/Readme.md b/connectors/examples/foo-bar-wine-example/Readme.md
new file mode 100644
index 0000000..e65dfc2
--- /dev/null
+++ b/connectors/examples/foo-bar-wine-example/Readme.md
@@ -0,0 +1,22 @@
+## Foo Bar and Wine Example
+
+This is an example that uses the `foo`, `bar` and `wine` Camel connectors. These connectors
+are used as if they are regular Camel components in Camel routes.
+
+See the `FooBarWineRoute` class for more details.
+
+### How to run
+
+This example can be run from the command line using:
+
+    mvn camel:run
+    
+### Apache Camel IDEA Plugin
+    
+You can use tooling such as the Apache Camel IDEA Plugin to offer code assistance while create the Camel route.
+
+The tooling offers code completions such as listing the possible options you can use with the Camel connectors.
+Notice how the tool presents only the pre-selected options of these connectors. For example the `foo` connector
+which is based on the Camel `Timer` component only offers two options, where as if you are using `timer` instead
+you will have many more options.
+

http://git-wip-us.apache.org/repos/asf/camel/blob/88a76451/connectors/examples/foo-connector/Readme.md
----------------------------------------------------------------------
diff --git a/connectors/examples/foo-connector/Readme.md b/connectors/examples/foo-connector/Readme.md
new file mode 100644
index 0000000..c9c4487
--- /dev/null
+++ b/connectors/examples/foo-connector/Readme.md
@@ -0,0 +1,5 @@
+## Foo Connector
+
+This is a basic Camel connector that is based on the Timer component from Apache Camel.
+
+This connector is a very basic connector with only a few options.

http://git-wip-us.apache.org/repos/asf/camel/blob/88a76451/connectors/examples/wine-connector/Readme.md
----------------------------------------------------------------------
diff --git a/connectors/examples/wine-connector/Readme.md b/connectors/examples/wine-connector/Readme.md
new file mode 100644
index 0000000..790e4b0
--- /dev/null
+++ b/connectors/examples/wine-connector/Readme.md
@@ -0,0 +1,6 @@
+## Wine Connector
+
+A Camel connector that is based on the `beverage-component`.
+
+This connector is a very basic connector with only a few options.
+


[03/17] camel git commit: CAMEL-10721: Fixed CS

Posted by da...@apache.org.
CAMEL-10721: Fixed CS


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c4e4a7e7
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c4e4a7e7
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c4e4a7e7

Branch: refs/heads/master
Commit: c4e4a7e7aeff33f3746f966a63523afe2fb47ca6
Parents: 6333ffc
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jan 18 17:39:28 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 19 11:00:00 2017 +0100

----------------------------------------------------------------------
 .../java/org/foo/connector/BarComponent.java    |  6 ++---
 .../src/main/resources/camel-connector.json     |  2 +-
 .../src/main/java/org/foo/FooBarWineMain.java   |  8 ++++++-
 .../src/main/java/org/foo/FooBarWineRoute.java  |  3 +++
 .../src/test/java/org/foo/FooBarWineTest.java   | 25 ++++++++++----------
 .../java/org/foo/connector/FooComponent.java    |  6 ++---
 .../src/main/resources/camel-connector.json     |  2 +-
 .../java/org/foo/connector/WineComponent.java   |  6 ++---
 .../src/main/resources/camel-connector.json     |  2 +-
 9 files changed, 35 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c4e4a7e7/connectors/examples/bar-connector/src/main/java/org/foo/connector/BarComponent.java
----------------------------------------------------------------------
diff --git a/connectors/examples/bar-connector/src/main/java/org/foo/connector/BarComponent.java b/connectors/examples/bar-connector/src/main/java/org/foo/connector/BarComponent.java
index 3511227..838a644 100644
--- a/connectors/examples/bar-connector/src/main/java/org/foo/connector/BarComponent.java
+++ b/connectors/examples/bar-connector/src/main/java/org/foo/connector/BarComponent.java
@@ -20,8 +20,8 @@ import org.apache.camel.component.connector.DefaultConnectorComponent;
 
 public class BarComponent extends DefaultConnectorComponent {
 
-	public BarComponent() {
-		super("bar", "org.foo.connector.BarComponent");
-	}
+    public BarComponent() {
+        super("bar", "org.foo.connector.BarComponent");
+    }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/c4e4a7e7/connectors/examples/bar-connector/src/main/resources/camel-connector.json
----------------------------------------------------------------------
diff --git a/connectors/examples/bar-connector/src/main/resources/camel-connector.json b/connectors/examples/bar-connector/src/main/resources/camel-connector.json
index 097d0cf..db4b0ae 100644
--- a/connectors/examples/bar-connector/src/main/resources/camel-connector.json
+++ b/connectors/examples/bar-connector/src/main/resources/camel-connector.json
@@ -9,7 +9,7 @@
   "javaType" : "org.foo.connector.BarComponent",
   "groupId" : "org.apache.camel",
   "artifactId" : "wine-connector",
-  "version" : "1.0.0",
+  "version" : "2.19.0-SNAPSHOT",
   "description" : "To order two drinks from the bar",
   "labels" : [ "bar" ],
   "source" : "To",

http://git-wip-us.apache.org/repos/asf/camel/blob/c4e4a7e7/connectors/examples/foo-bar-wine-example/src/main/java/org/foo/FooBarWineMain.java
----------------------------------------------------------------------
diff --git a/connectors/examples/foo-bar-wine-example/src/main/java/org/foo/FooBarWineMain.java b/connectors/examples/foo-bar-wine-example/src/main/java/org/foo/FooBarWineMain.java
index def8b04..9e551d0 100644
--- a/connectors/examples/foo-bar-wine-example/src/main/java/org/foo/FooBarWineMain.java
+++ b/connectors/examples/foo-bar-wine-example/src/main/java/org/foo/FooBarWineMain.java
@@ -18,7 +18,13 @@ package org.foo;
 
 import org.apache.camel.main.Main;
 
-public class FooBarWineMain {
+/**
+ * Main class to run this example
+ */
+public final class FooBarWineMain {
+
+    private FooBarWineMain() {
+    }
 
     public static void main(String[] args) throws Exception {
         Main main = new Main();

http://git-wip-us.apache.org/repos/asf/camel/blob/c4e4a7e7/connectors/examples/foo-bar-wine-example/src/main/java/org/foo/FooBarWineRoute.java
----------------------------------------------------------------------
diff --git a/connectors/examples/foo-bar-wine-example/src/main/java/org/foo/FooBarWineRoute.java b/connectors/examples/foo-bar-wine-example/src/main/java/org/foo/FooBarWineRoute.java
index 7163ce2..1bd3804 100644
--- a/connectors/examples/foo-bar-wine-example/src/main/java/org/foo/FooBarWineRoute.java
+++ b/connectors/examples/foo-bar-wine-example/src/main/java/org/foo/FooBarWineRoute.java
@@ -18,6 +18,9 @@ package org.foo;
 
 import org.apache.camel.builder.RouteBuilder;
 
+/**
+ * Camel route that uses the foo, bar and wine connectors
+ */
 public class FooBarWineRoute extends RouteBuilder {
 
     @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/c4e4a7e7/connectors/examples/foo-bar-wine-example/src/test/java/org/foo/FooBarWineTest.java
----------------------------------------------------------------------
diff --git a/connectors/examples/foo-bar-wine-example/src/test/java/org/foo/FooBarWineTest.java b/connectors/examples/foo-bar-wine-example/src/test/java/org/foo/FooBarWineTest.java
index 92e1c10..80c45c5 100644
--- a/connectors/examples/foo-bar-wine-example/src/test/java/org/foo/FooBarWineTest.java
+++ b/connectors/examples/foo-bar-wine-example/src/test/java/org/foo/FooBarWineTest.java
@@ -1,17 +1,18 @@
 /**
- * Copyright 2005-2015 Red Hat, Inc.
- * <p>
- * Red Hat 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ * 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.
+ * 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.foo;
 
@@ -29,7 +30,7 @@ public class FooBarWineTest extends CamelTestSupport {
 
         mock.expectedMinimumMessageCount(2);
         mock.setAssertPeriod(500);
-    	
+
         assertMockEndpointsSatisfied();
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/c4e4a7e7/connectors/examples/foo-connector/src/main/java/org/foo/connector/FooComponent.java
----------------------------------------------------------------------
diff --git a/connectors/examples/foo-connector/src/main/java/org/foo/connector/FooComponent.java b/connectors/examples/foo-connector/src/main/java/org/foo/connector/FooComponent.java
index 754fdd0..20318f5 100644
--- a/connectors/examples/foo-connector/src/main/java/org/foo/connector/FooComponent.java
+++ b/connectors/examples/foo-connector/src/main/java/org/foo/connector/FooComponent.java
@@ -20,8 +20,8 @@ import org.apache.camel.component.connector.DefaultConnectorComponent;
 
 public class FooComponent extends DefaultConnectorComponent {
 
-	public FooComponent() {
-		super("foo", "org.foo.connector.FooComponent");
-	}
+    public FooComponent() {
+        super("foo", "org.foo.connector.FooComponent");
+    }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/c4e4a7e7/connectors/examples/foo-connector/src/main/resources/camel-connector.json
----------------------------------------------------------------------
diff --git a/connectors/examples/foo-connector/src/main/resources/camel-connector.json b/connectors/examples/foo-connector/src/main/resources/camel-connector.json
index 52cc2e2..8a3b89b 100644
--- a/connectors/examples/foo-connector/src/main/resources/camel-connector.json
+++ b/connectors/examples/foo-connector/src/main/resources/camel-connector.json
@@ -9,7 +9,7 @@
   "javaType" : "org.foo.connector.FooComponent",
   "groupId" : "org.foo",
   "artifactId" : "foo-connector",
-  "version" : "1.0.0",
+  "version" : "2.19.0-SNAPSHOT",
   "description" : "Something cool",
   "labels" : [ "foo", "timer" ],
   "source" : "From",

http://git-wip-us.apache.org/repos/asf/camel/blob/c4e4a7e7/connectors/examples/wine-connector/src/main/java/org/foo/connector/WineComponent.java
----------------------------------------------------------------------
diff --git a/connectors/examples/wine-connector/src/main/java/org/foo/connector/WineComponent.java b/connectors/examples/wine-connector/src/main/java/org/foo/connector/WineComponent.java
index 5118d25..5b5ea92 100644
--- a/connectors/examples/wine-connector/src/main/java/org/foo/connector/WineComponent.java
+++ b/connectors/examples/wine-connector/src/main/java/org/foo/connector/WineComponent.java
@@ -20,8 +20,8 @@ import org.apache.camel.component.connector.DefaultConnectorComponent;
 
 public class WineComponent extends DefaultConnectorComponent {
 
-	public WineComponent() {
-		super("wine", "org.foo.connector.WineComponent");
-	}
+    public WineComponent() {
+        super("wine", "org.foo.connector.WineComponent");
+    }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/c4e4a7e7/connectors/examples/wine-connector/src/main/resources/camel-connector.json
----------------------------------------------------------------------
diff --git a/connectors/examples/wine-connector/src/main/resources/camel-connector.json b/connectors/examples/wine-connector/src/main/resources/camel-connector.json
index a2e8ea8..17492f7 100644
--- a/connectors/examples/wine-connector/src/main/resources/camel-connector.json
+++ b/connectors/examples/wine-connector/src/main/resources/camel-connector.json
@@ -9,7 +9,7 @@
   "javaType" : "org.foo.connector.WineComponent",
   "groupId" : "org.apache.camel",
   "artifactId" : "wine-connector",
-  "version" : "1.0.0",
+  "version" : "2.19.0-SNAPSHOT",
   "description" : "To order wine from the bar",
   "labels" : [ "bar" ],
   "source" : "To",


[12/17] camel git commit: CAMEL-10721: camel-connector example

Posted by da...@apache.org.
CAMEL-10721: camel-connector example


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/219df166
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/219df166
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/219df166

Branch: refs/heads/master
Commit: 219df1664cceb21b0684f487cf469fe8d5b93c93
Parents: 1c50540
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jan 18 16:59:18 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 19 11:00:00 2017 +0100

----------------------------------------------------------------------
 connectors/camel-connector/pom.xml              |   4 +-
 .../examples/foo-bar-wine-example/pom.xml       | 105 +++++++++++++++++++
 .../src/main/java/org/foo/FooBarWineMain.java   |  28 +++++
 .../src/main/java/org/foo/FooBarWineRoute.java  |  33 ++++++
 .../src/main/resources/log4j2.properties        |  23 ++++
 .../src/test/java/io/fabric/FooBarTest.java     |  48 +++++++++
 .../src/test/resources/log4j2.properties        |  28 +++++
 connectors/examples/pom.xml                     |   1 +
 8 files changed, 268 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/219df166/connectors/camel-connector/pom.xml
----------------------------------------------------------------------
diff --git a/connectors/camel-connector/pom.xml b/connectors/camel-connector/pom.xml
index c53b02c..8706635 100644
--- a/connectors/camel-connector/pom.xml
+++ b/connectors/camel-connector/pom.xml
@@ -27,8 +27,8 @@
 
   <artifactId>camel-connector</artifactId>
   <packaging>jar</packaging>
-  <name>Camel :: Connector</name>
-  <description>Camel Connector</description>
+  <name>Camel :: Connector Component</name>
+  <description>Camel Connector Component</description>
 
   <properties>
     <camel.osgi.export.pkg>org.apache.camel.component.connector.*</camel.osgi.export.pkg>

http://git-wip-us.apache.org/repos/asf/camel/blob/219df166/connectors/examples/foo-bar-wine-example/pom.xml
----------------------------------------------------------------------
diff --git a/connectors/examples/foo-bar-wine-example/pom.xml b/connectors/examples/foo-bar-wine-example/pom.xml
new file mode 100644
index 0000000..f603032
--- /dev/null
+++ b/connectors/examples/foo-bar-wine-example/pom.xml
@@ -0,0 +1,105 @@
+<?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>connectors-examples</artifactId>
+    <version>2.19.0-SNAPSHOT</version>
+    <relativePath>..</relativePath>
+  </parent>
+
+  <artifactId>foo-bar-wine-example</artifactId>
+  <name>Camel :: Connectors :: Examples :: Foo Bar and Wine Example</name>
+  <description>Foo Bar and Wine Example</description>
+  <packaging>jar</packaging>
+
+  <dependencyManagement>
+    <dependencies>
+      <!-- Camel BOM -->
+      <dependency>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-parent</artifactId>
+        <version>${project.version}</version>
+        <scope>import</scope>
+        <type>pom</type>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+
+    <!-- connectors used in this example -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>foo-connector</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>bar-connector</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>wine-connector</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <!-- logging -->
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-slf4j-impl</artifactId>
+    </dependency>
+
+    <!-- testing -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
+
+  </dependencies>
+
+  <build>
+    <plugins>
+      <!-- Allows the example to be run via 'mvn camel:run' -->
+      <plugin>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-maven-plugin</artifactId>
+        <version>${project.version}</version>
+        <configuration>
+          <mainClass>org.foo.FooBarWineMain</mainClass>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/219df166/connectors/examples/foo-bar-wine-example/src/main/java/org/foo/FooBarWineMain.java
----------------------------------------------------------------------
diff --git a/connectors/examples/foo-bar-wine-example/src/main/java/org/foo/FooBarWineMain.java b/connectors/examples/foo-bar-wine-example/src/main/java/org/foo/FooBarWineMain.java
new file mode 100644
index 0000000..def8b04
--- /dev/null
+++ b/connectors/examples/foo-bar-wine-example/src/main/java/org/foo/FooBarWineMain.java
@@ -0,0 +1,28 @@
+/**
+ * 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.foo;
+
+import org.apache.camel.main.Main;
+
+public class FooBarWineMain {
+
+    public static void main(String[] args) throws Exception {
+        Main main = new Main();
+        main.addRouteBuilder(new FooBarWineRoute());
+        main.run();
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/219df166/connectors/examples/foo-bar-wine-example/src/main/java/org/foo/FooBarWineRoute.java
----------------------------------------------------------------------
diff --git a/connectors/examples/foo-bar-wine-example/src/main/java/org/foo/FooBarWineRoute.java b/connectors/examples/foo-bar-wine-example/src/main/java/org/foo/FooBarWineRoute.java
new file mode 100644
index 0000000..7163ce2
--- /dev/null
+++ b/connectors/examples/foo-bar-wine-example/src/main/java/org/foo/FooBarWineRoute.java
@@ -0,0 +1,33 @@
+/**
+ * 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.foo;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class FooBarWineRoute extends RouteBuilder {
+
+    @Override
+    public void configure() throws Exception {
+        from("foo:wine?period=3000")
+            .to("wine:wine?amount=2")
+            .log("Wine ordered ${body}");
+
+        from("foo:bar?period=5000")
+            .to("bar:GinTonic?amount=5")
+            .log("Bar ordered ${body}");
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/219df166/connectors/examples/foo-bar-wine-example/src/main/resources/log4j2.properties
----------------------------------------------------------------------
diff --git a/connectors/examples/foo-bar-wine-example/src/main/resources/log4j2.properties b/connectors/examples/foo-bar-wine-example/src/main/resources/log4j2.properties
new file mode 100644
index 0000000..ed759af
--- /dev/null
+++ b/connectors/examples/foo-bar-wine-example/src/main/resources/log4j2.properties
@@ -0,0 +1,23 @@
+#
+#  Copyright 2005-2015 Red Hat, Inc.
+#
+#  Red Hat 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.
+#
+
+appender.out.type = Console
+appender.out.name = out
+appender.out.layout.type = PatternLayout
+appender.out.layout.pattern = [%30.30t] %-30.30c{1} %-5p %m%n
+
+rootLogger.level = INFO
+rootLogger.appenderRef.file.ref = out

http://git-wip-us.apache.org/repos/asf/camel/blob/219df166/connectors/examples/foo-bar-wine-example/src/test/java/io/fabric/FooBarTest.java
----------------------------------------------------------------------
diff --git a/connectors/examples/foo-bar-wine-example/src/test/java/io/fabric/FooBarTest.java b/connectors/examples/foo-bar-wine-example/src/test/java/io/fabric/FooBarTest.java
new file mode 100644
index 0000000..84e47fd
--- /dev/null
+++ b/connectors/examples/foo-bar-wine-example/src/test/java/io/fabric/FooBarTest.java
@@ -0,0 +1,48 @@
+/**
+ * Copyright 2005-2015 Red Hat, Inc.
+ * <p>
+ * Red Hat 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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 io.fabric;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class FooBarTest extends CamelTestSupport {
+
+    @Test
+    public void testFooBar() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+
+        mock.expectedMinimumMessageCount(2);
+        mock.setAssertPeriod(500);
+    	
+        assertMockEndpointsSatisfied();
+    }
+
+    
+    @Override
+    protected RoutesBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("foo:hello?period=100")
+                    .to("bar:beer")
+                    .to("mock:result");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/219df166/connectors/examples/foo-bar-wine-example/src/test/resources/log4j2.properties
----------------------------------------------------------------------
diff --git a/connectors/examples/foo-bar-wine-example/src/test/resources/log4j2.properties b/connectors/examples/foo-bar-wine-example/src/test/resources/log4j2.properties
new file mode 100644
index 0000000..8910968
--- /dev/null
+++ b/connectors/examples/foo-bar-wine-example/src/test/resources/log4j2.properties
@@ -0,0 +1,28 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+appender.file.type = File
+appender.file.name = file
+appender.file.fileName = target/test.log
+appender.file.layout.type = PatternLayout
+appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+appender.out.type = Console
+appender.out.name = out
+appender.out.layout.type = PatternLayout
+appender.out.layout.pattern = [%30.30t] %-30.30c{1} %-5p %m%n
+rootLogger.level = INFO
+rootLogger.appenderRef.file.ref = file

http://git-wip-us.apache.org/repos/asf/camel/blob/219df166/connectors/examples/pom.xml
----------------------------------------------------------------------
diff --git a/connectors/examples/pom.xml b/connectors/examples/pom.xml
index 5478431..9fbdb4d 100644
--- a/connectors/examples/pom.xml
+++ b/connectors/examples/pom.xml
@@ -36,6 +36,7 @@
     <module>foo-connector</module>
     <module>bar-connector</module>
     <module>wine-connector</module>
+    <module>foo-bar-wine-example</module>
   </modules>
 
 </project>


[14/17] camel git commit: CAMEL-10721: camel-connector example

Posted by da...@apache.org.
CAMEL-10721: camel-connector example


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6333ffc2
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6333ffc2
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6333ffc2

Branch: refs/heads/master
Commit: 6333ffc26892aefe84adb8e74f29bb3e58f43057
Parents: 219df16
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jan 18 17:04:28 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 19 11:00:00 2017 +0100

----------------------------------------------------------------------
 connectors/camel-connector-maven-plugin/pom.xml |  2 +-
 connectors/camel-connector/pom.xml              |  2 +-
 .../src/test/java/io/fabric/FooBarTest.java     | 48 ---------------
 .../src/test/java/org/foo/FooBarWineTest.java   | 61 ++++++++++++++++++++
 4 files changed, 63 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/6333ffc2/connectors/camel-connector-maven-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/connectors/camel-connector-maven-plugin/pom.xml b/connectors/camel-connector-maven-plugin/pom.xml
index 6eaaf29..524b1be 100644
--- a/connectors/camel-connector-maven-plugin/pom.xml
+++ b/connectors/camel-connector-maven-plugin/pom.xml
@@ -26,7 +26,7 @@
   </parent>
 
   <artifactId>camel-connector-maven-plugin</artifactId>
-  <name>Camel :: Connector :: Camel Connector Maven Plugin</name>
+  <name>Camel :: Connectors :: Camel Connector Maven Plugin</name>
   <packaging>maven-plugin</packaging>
 
   <dependencies>

http://git-wip-us.apache.org/repos/asf/camel/blob/6333ffc2/connectors/camel-connector/pom.xml
----------------------------------------------------------------------
diff --git a/connectors/camel-connector/pom.xml b/connectors/camel-connector/pom.xml
index 8706635..d1f6a34 100644
--- a/connectors/camel-connector/pom.xml
+++ b/connectors/camel-connector/pom.xml
@@ -27,7 +27,7 @@
 
   <artifactId>camel-connector</artifactId>
   <packaging>jar</packaging>
-  <name>Camel :: Connector Component</name>
+  <name>Camel :: Connectors :: Connector Component</name>
   <description>Camel Connector Component</description>
 
   <properties>

http://git-wip-us.apache.org/repos/asf/camel/blob/6333ffc2/connectors/examples/foo-bar-wine-example/src/test/java/io/fabric/FooBarTest.java
----------------------------------------------------------------------
diff --git a/connectors/examples/foo-bar-wine-example/src/test/java/io/fabric/FooBarTest.java b/connectors/examples/foo-bar-wine-example/src/test/java/io/fabric/FooBarTest.java
deleted file mode 100644
index 84e47fd..0000000
--- a/connectors/examples/foo-bar-wine-example/src/test/java/io/fabric/FooBarTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Copyright 2005-2015 Red Hat, Inc.
- * <p>
- * Red Hat 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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 io.fabric;
-
-import org.apache.camel.RoutesBuilder;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Test;
-
-public class FooBarTest extends CamelTestSupport {
-
-    @Test
-    public void testFooBar() throws Exception {
-        MockEndpoint mock = getMockEndpoint("mock:result");
-
-        mock.expectedMinimumMessageCount(2);
-        mock.setAssertPeriod(500);
-    	
-        assertMockEndpointsSatisfied();
-    }
-
-    
-    @Override
-    protected RoutesBuilder createRouteBuilder() throws Exception {
-        return new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("foo:hello?period=100")
-                    .to("bar:beer")
-                    .to("mock:result");
-            }
-        };
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/6333ffc2/connectors/examples/foo-bar-wine-example/src/test/java/org/foo/FooBarWineTest.java
----------------------------------------------------------------------
diff --git a/connectors/examples/foo-bar-wine-example/src/test/java/org/foo/FooBarWineTest.java b/connectors/examples/foo-bar-wine-example/src/test/java/org/foo/FooBarWineTest.java
new file mode 100644
index 0000000..92e1c10
--- /dev/null
+++ b/connectors/examples/foo-bar-wine-example/src/test/java/org/foo/FooBarWineTest.java
@@ -0,0 +1,61 @@
+/**
+ * Copyright 2005-2015 Red Hat, Inc.
+ * <p>
+ * Red Hat 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.foo;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class FooBarWineTest extends CamelTestSupport {
+
+    @Test
+    public void testFooBar() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:bar");
+
+        mock.expectedMinimumMessageCount(2);
+        mock.setAssertPeriod(500);
+    	
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testFooWine() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:wine");
+
+        mock.expectedMinimumMessageCount(2);
+        mock.setAssertPeriod(500);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RoutesBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("foo:hello?period=100")
+                    .to("bar:Beer?amount=5")
+                    .to("mock:bar");
+
+                from("foo:hello2?period=50")
+                    .to("wine:wine?amount=2")
+                    .to("mock:wine");
+            }
+        };
+    }
+}


[07/17] camel git commit: CAMEL-10721: camel-connector

Posted by da...@apache.org.
CAMEL-10721: camel-connector


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c4ee179c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c4ee179c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c4ee179c

Branch: refs/heads/master
Commit: c4ee179cd81836deb1558206288154da6f7cfbc4
Parents: 18aa245
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jan 18 13:46:05 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 19 11:00:00 2017 +0100

----------------------------------------------------------------------
 apache-camel/pom.xml                                            | 4 ++++
 apache-camel/src/main/descriptors/common-bin.xml                | 1 +
 parent/pom.xml                                                  | 5 +++++
 .../camel/maven/packaging/SpringBootAutoConfigurationMojo.java  | 2 +-
 4 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c4ee179c/apache-camel/pom.xml
----------------------------------------------------------------------
diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml
index 86d1559..eb80a32 100644
--- a/apache-camel/pom.xml
+++ b/apache-camel/pom.xml
@@ -183,6 +183,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
+      <artifactId>camel-connector</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
       <artifactId>camel-consul</artifactId>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/c4ee179c/apache-camel/src/main/descriptors/common-bin.xml
----------------------------------------------------------------------
diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml
index 5e1c25d..f487e42 100644
--- a/apache-camel/src/main/descriptors/common-bin.xml
+++ b/apache-camel/src/main/descriptors/common-bin.xml
@@ -56,6 +56,7 @@
         <include>org.apache.camel:camel-core</include>
         <include>org.apache.camel:camel-core-osgi</include>
         <include>org.apache.camel:camel-cometd</include>
+        <include>org.apache.camel:camel-connector</include>
         <include>org.apache.camel:camel-consul</include>
         <include>org.apache.camel:camel-context</include>
         <include>org.apache.camel:camel-couchdb</include>

http://git-wip-us.apache.org/repos/asf/camel/blob/c4ee179c/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index b8ad3c8..180a989 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -900,6 +900,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-connector</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-consul</artifactId>
         <version>${project.version}</version>
       </dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/c4ee179c/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
index 81ff6a6..b2f0c0f 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
@@ -132,7 +132,7 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
         PRIMITIVEMAP.put("float", "java.lang.Float");
     }
 
-    private static final String[] IGNORE_MODULES = {/* Non-standard -> */ "camel-grape"};
+    private static final String[] IGNORE_MODULES = {/* Non-standard -> */ "camel-grape", "camel-connector"};
 
     /**
      * The maven project.


[05/17] camel git commit: CAMEL-10721: camel-connector

Posted by da...@apache.org.
CAMEL-10721: camel-connector


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/18aa245f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/18aa245f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/18aa245f

Branch: refs/heads/master
Commit: 18aa245f75671baf6b9764fc678311664e50168d
Parents: 917b1b0
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jan 18 13:36:56 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 19 11:00:00 2017 +0100

----------------------------------------------------------------------
 connectors/camel-connector/pom.xml              |  48 ++++
 .../connector/DefaultConnectorComponent.java    | 279 +++++++++++++++++++
 .../connector/DefaultConnectorEndpoint.java     |  76 +++++
 .../src/main/resources/META-INF/LICENSE.txt     | 203 ++++++++++++++
 .../src/main/resources/META-INF/NOTICE.txt      |  11 +
 connectors/pom.xml                              |  38 +++
 pom.xml                                         |   1 +
 7 files changed, 656 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/18aa245f/connectors/camel-connector/pom.xml
----------------------------------------------------------------------
diff --git a/connectors/camel-connector/pom.xml b/connectors/camel-connector/pom.xml
new file mode 100644
index 0000000..c53b02c
--- /dev/null
+++ b/connectors/camel-connector/pom.xml
@@ -0,0 +1,48 @@
+<?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>connectors</artifactId>
+    <version>2.19.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>camel-connector</artifactId>
+  <packaging>jar</packaging>
+  <name>Camel :: Connector</name>
+  <description>Camel Connector</description>
+
+  <properties>
+    <camel.osgi.export.pkg>org.apache.camel.component.connector.*</camel.osgi.export.pkg>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-catalog</artifactId>
+    </dependency>
+  </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/18aa245f/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/DefaultConnectorComponent.java
----------------------------------------------------------------------
diff --git a/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/DefaultConnectorComponent.java b/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/DefaultConnectorComponent.java
new file mode 100644
index 0000000..d0ef3c9
--- /dev/null
+++ b/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/DefaultConnectorComponent.java
@@ -0,0 +1,279 @@
+/**
+ * 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.connector;
+
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.LineNumberReader;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.catalog.CamelCatalog;
+import org.apache.camel.catalog.DefaultCamelCatalog;
+import org.apache.camel.impl.DefaultComponent;
+import org.apache.camel.util.IOHelper;
+import org.apache.camel.util.IntrospectionSupport;
+import org.apache.camel.util.StringHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Base class for Camel Connector components.
+ */
+public abstract class DefaultConnectorComponent extends DefaultComponent {
+
+    private static final Pattern JAVA_TYPE_PATTERN = Pattern.compile("\"javaType\"\\s?:\\s?\"([\\w|.]+)\".*");
+    private static final Pattern BASE_JAVA_TYPE_PATTERN = Pattern.compile("\"baseJavaType\"\\s?:\\s?\"([\\w|.]+)\".*");
+    private static final Pattern BASE_SCHEMA_PATTERN = Pattern.compile("\"baseScheme\"\\s?:\\s?\"([\\w|.]+)\".*");
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    private final CamelCatalog catalog = new DefaultCamelCatalog(false);
+
+    private final String componentName;
+    private final String className;
+    private List<String> lines;
+
+    public DefaultConnectorComponent(String componentName, String className) {
+        this.componentName = componentName;
+        this.className = className;
+
+        // add to catalog
+        catalog.addComponent(componentName, className);
+    }
+
+    @Override
+    protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
+        String scheme = extractBaseScheme(lines);
+
+        Map<String, String> defaultOptions = extractEndpointDefaultValues(lines);
+
+        // gather all options to use when building the delegate uri
+        Map<String, String> options = new LinkedHashMap<>();
+
+        // default options from connector json
+        if (!defaultOptions.isEmpty()) {
+            options.putAll(defaultOptions);
+        }
+        // options from query parameters
+        for (Map.Entry<String, Object> entry : parameters.entrySet()) {
+            String key = entry.getKey();
+            String value = null;
+            if (entry.getValue() != null) {
+                value = entry.getValue().toString();
+            }
+            options.put(key, value);
+        }
+        parameters.clear();
+
+        // add extra options from remaining (context-path)
+        if (remaining != null) {
+            String targetUri = scheme + ":" + remaining;
+            Map<String, String> extra = catalog.endpointProperties(targetUri);
+            if (extra != null && !extra.isEmpty()) {
+                options.putAll(extra);
+            }
+        }
+
+        String delegateUri = catalog.asEndpointUri(scheme, options, false);
+        log.debug("Connector resolved: {} -> {}", uri, delegateUri);
+
+        Endpoint delegate = getCamelContext().getEndpoint(delegateUri);
+
+        return new DefaultConnectorEndpoint(uri, this, delegate);
+    }
+
+    private List<String> findCamelConnectorJSonSchema() throws Exception {
+        Enumeration<URL> urls = getClass().getClassLoader().getResources("camel-connector.json");
+        while (urls.hasMoreElements()) {
+            URL url = urls.nextElement();
+            InputStream is = url.openStream();
+            if (is != null) {
+                List<String> lines = loadFile(is);
+                IOHelper.close(is);
+
+                String javaType = extractJavaType(lines);
+                log.trace("Found camel-connector.json in classpath with javaType: {}", javaType);
+
+                if (className.equals(javaType)) {
+                    return lines;
+                }
+            }
+        }
+        return null;
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        this.lines = findCamelConnectorJSonSchema();
+        if (lines == null) {
+            throw new IllegalArgumentException("Cannot find camel-connector.json in classpath for connector " + componentName);
+        }
+
+        // it may be a custom component so we need to register this in the camel catalog also
+        String scheme = extractBaseScheme(lines);
+        if (!catalog.findComponentNames().contains(scheme)) {
+            String javaType = extractBaseJavaType(lines);
+            catalog.addComponent(scheme, javaType);
+        }
+
+        // the connector may have default values for the component level also
+        // and if so we need to prepare these values and set on this component before we can start
+
+        Map<String, String> defaultOptions = extractComponentDefaultValues(lines);
+
+        if (!defaultOptions.isEmpty()) {
+            Map<String, Object> parameters = new LinkedHashMap<>();
+            for (Map.Entry<String, String> entry : defaultOptions.entrySet()) {
+                String key = entry.getKey();
+                String value = entry.getValue();
+                if (value != null) {
+                    // also support {{ }} placeholders so resolve those first
+                    value = getCamelContext().resolvePropertyPlaceholders(value);
+                    log.debug("Using component option: {}={}", key, value);
+                    parameters.put(key, value);
+                }
+            }
+            IntrospectionSupport.setProperties(getCamelContext(), getCamelContext().getTypeConverter(), this, parameters);
+        }
+
+        log.debug("Starting connector: {}", componentName);
+
+        super.doStart();
+    }
+
+    @Override
+    protected void doStop() throws Exception {
+        log.debug("Stopping connector: {}", componentName);
+
+        super.doStop();
+    }
+
+    // --------------------------------------------------------------
+
+    private Map<String, String> extractComponentDefaultValues(List<String> lines) {
+        Map<String, String> answer = new LinkedHashMap<>();
+
+        // extract the default options
+        boolean found = false;
+        for (String line : lines) {
+            line = line.trim();
+            if (line.startsWith("\"componentValues\":")) {
+                found = true;
+            } else if (line.startsWith("}")) {
+                found = false;
+            } else if (found) {
+                int pos = line.indexOf(':');
+                String key = line.substring(0, pos);
+                String value = line.substring(pos + 1);
+                if (value.endsWith(",")) {
+                    value = value.substring(0, value.length() - 1);
+                }
+                key = StringHelper.removeLeadingAndEndingQuotes(key);
+                value = StringHelper.removeLeadingAndEndingQuotes(value);
+                answer.put(key, value);
+            }
+        }
+
+        return answer;
+    }
+
+    private Map<String, String> extractEndpointDefaultValues(List<String> lines) {
+        Map<String, String> answer = new LinkedHashMap<>();
+
+        // extract the default options
+        boolean found = false;
+        for (String line : lines) {
+            line = line.trim();
+            if (line.startsWith("\"endpointValues\":")) {
+                found = true;
+            } else if (line.startsWith("}")) {
+                found = false;
+            } else if (found) {
+                int pos = line.indexOf(':');
+                String key = line.substring(0, pos);
+                String value = line.substring(pos + 1);
+                if (value.endsWith(",")) {
+                    value = value.substring(0, value.length() - 1);
+                }
+                key = StringHelper.removeLeadingAndEndingQuotes(key);
+                value = StringHelper.removeLeadingAndEndingQuotes(value);
+                answer.put(key, value);
+            }
+        }
+
+        return answer;
+    }
+
+    private List<String> loadFile(InputStream fis) throws Exception {
+        List<String> lines = new ArrayList<>();
+        LineNumberReader reader = new LineNumberReader(new InputStreamReader(fis));
+
+        String line;
+        do {
+            line = reader.readLine();
+            if (line != null) {
+                lines.add(line);
+            }
+        } while (line != null);
+        reader.close();
+
+        return lines;
+    }
+
+    private String extractJavaType(List<String> json) {
+        for (String line : json) {
+            line = line.trim();
+            Matcher matcher = JAVA_TYPE_PATTERN.matcher(line);
+            if (matcher.matches()) {
+                return matcher.group(1);
+            }
+        }
+        return null;
+    }
+
+    private String extractBaseJavaType(List<String> json) {
+        for (String line : json) {
+            line = line.trim();
+            Matcher matcher = BASE_JAVA_TYPE_PATTERN.matcher(line);
+            if (matcher.matches()) {
+                return matcher.group(1);
+            }
+        }
+        return null;
+    }
+
+    private String extractBaseScheme(List<String> json) {
+        for (String line : json) {
+            line = line.trim();
+            Matcher matcher = BASE_SCHEMA_PATTERN.matcher(line);
+            if (matcher.matches()) {
+                return matcher.group(1);
+            }
+        }
+        return null;
+    }
+
+}
+

http://git-wip-us.apache.org/repos/asf/camel/blob/18aa245f/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/DefaultConnectorEndpoint.java
----------------------------------------------------------------------
diff --git a/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/DefaultConnectorEndpoint.java b/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/DefaultConnectorEndpoint.java
new file mode 100644
index 0000000..f8743f2
--- /dev/null
+++ b/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/DefaultConnectorEndpoint.java
@@ -0,0 +1,76 @@
+/**
+ * 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.connector;
+
+import org.apache.camel.Component;
+import org.apache.camel.Consumer;
+import org.apache.camel.DelegateEndpoint;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.api.management.ManagedAttribute;
+import org.apache.camel.api.management.ManagedResource;
+import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.util.ServiceHelper;
+
+@ManagedResource(description = "Managed Connector Endpoint")
+public class DefaultConnectorEndpoint extends DefaultEndpoint implements DelegateEndpoint {
+
+    private final Endpoint endpoint;
+
+    public DefaultConnectorEndpoint(String endpointUri, Component component, Endpoint endpoint) {
+        super(endpointUri, component);
+        this.endpoint = endpoint;
+    }
+
+    @Override
+    public Producer createProducer() throws Exception {
+        return endpoint.createProducer();
+    }
+
+    @Override
+    public Consumer createConsumer(Processor processor) throws Exception {
+        return endpoint.createConsumer(processor);
+    }
+
+    @Override
+    public boolean isSingleton() {
+        return true;
+    }
+
+    @Override
+    public Endpoint getEndpoint() {
+        return endpoint;
+    }
+
+    @ManagedAttribute(description = "Delegate Endpoint URI", mask = true)
+    public String getDelegateEndpointUri() {
+        return endpoint.getEndpointUri();
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        super.doStart();
+        ServiceHelper.startService(endpoint);
+    }
+
+    @Override
+    protected void doStop() throws Exception {
+        ServiceHelper.stopService(endpoint);
+        super.doStop();
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/18aa245f/connectors/camel-connector/src/main/resources/META-INF/LICENSE.txt
----------------------------------------------------------------------
diff --git a/connectors/camel-connector/src/main/resources/META-INF/LICENSE.txt b/connectors/camel-connector/src/main/resources/META-INF/LICENSE.txt
new file mode 100755
index 0000000..6b0b127
--- /dev/null
+++ b/connectors/camel-connector/src/main/resources/META-INF/LICENSE.txt
@@ -0,0 +1,203 @@
+
+                                 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/18aa245f/connectors/camel-connector/src/main/resources/META-INF/NOTICE.txt
----------------------------------------------------------------------
diff --git a/connectors/camel-connector/src/main/resources/META-INF/NOTICE.txt b/connectors/camel-connector/src/main/resources/META-INF/NOTICE.txt
new file mode 100644
index 0000000..2e215bf
--- /dev/null
+++ b/connectors/camel-connector/src/main/resources/META-INF/NOTICE.txt
@@ -0,0 +1,11 @@
+   =========================================================================
+   ==  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.

http://git-wip-us.apache.org/repos/asf/camel/blob/18aa245f/connectors/pom.xml
----------------------------------------------------------------------
diff --git a/connectors/pom.xml b/connectors/pom.xml
new file mode 100644
index 0000000..43e285d
--- /dev/null
+++ b/connectors/pom.xml
@@ -0,0 +1,38 @@
+<?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>camel-parent</artifactId>
+    <version>2.19.0-SNAPSHOT</version>
+    <relativePath>../parent</relativePath>
+  </parent>
+
+  <artifactId>connectors</artifactId>
+  <name>Camel :: Connectors</name>
+  <description>Camel Connectors</description>
+  <packaging>pom</packaging>
+
+  <modules>
+    <module>camel-connector</module>
+  </modules>
+
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/18aa245f/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index b5b44c5..00734f4 100755
--- a/pom.xml
+++ b/pom.xml
@@ -140,6 +140,7 @@
     <module>components</module>
     <module>tooling</module>
     <module>platforms</module>
+    <module>connectors</module>
     <module>tests</module>
     <module>examples</module>
   </modules>


[11/17] camel git commit: CAMEL-10721: camel-connector example

Posted by da...@apache.org.
CAMEL-10721: camel-connector example


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1c505407
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1c505407
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1c505407

Branch: refs/heads/master
Commit: 1c505407b8629ba25e5c5548c14bf2f43415d683
Parents: 5d20447
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jan 18 16:42:18 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 19 11:00:00 2017 +0100

----------------------------------------------------------------------
 connectors/examples/bar-connector/pom.xml       | 175 +++++++++++++++++++
 .../java/org/foo/connector/BarComponent.java    |  27 +++
 .../services/org/apache/camel/component/bar     |  18 ++
 .../src/main/resources/camel-connector.json     |  20 +++
 connectors/examples/foo-connector/pom.xml       | 175 +++++++++++++++++++
 .../java/org/foo/connector/FooComponent.java    |  27 +++
 .../services/org/apache/camel/component/foo     |  18 ++
 .../src/main/resources/camel-connector.json     |  21 +++
 connectors/examples/pom.xml                     |   3 +
 connectors/examples/wine-connector/pom.xml      | 175 +++++++++++++++++++
 .../java/org/foo/connector/WineComponent.java   |  27 +++
 .../services/org/apache/camel/component/wine    |  18 ++
 .../src/main/resources/camel-connector.json     |  20 +++
 13 files changed, 724 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/1c505407/connectors/examples/bar-connector/pom.xml
----------------------------------------------------------------------
diff --git a/connectors/examples/bar-connector/pom.xml b/connectors/examples/bar-connector/pom.xml
new file mode 100644
index 0000000..7b74f37
--- /dev/null
+++ b/connectors/examples/bar-connector/pom.xml
@@ -0,0 +1,175 @@
+<?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>connectors-examples</artifactId>
+    <version>2.19.0-SNAPSHOT</version>
+    <relativePath>..</relativePath>
+  </parent>
+
+  <artifactId>bar-connector</artifactId>
+  <name>Camel :: Connectors :: Examples :: Bar Connector</name>
+  <description>Bar Connector</description>
+  <packaging>jar</packaging>
+
+  <dependencyManagement>
+    <dependencies>
+      <!-- Camel BOM -->
+      <dependency>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-parent</artifactId>
+        <version>${project.version}</version>
+        <scope>import</scope>
+        <type>pom</type>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+
+    <!-- base component to use for this connector -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <!-- camel-connector -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-connector</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <!-- support camel documentation -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>apt</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <!-- logging -->
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-api</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-slf4j-impl</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <!-- testing -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <defaultGoal>install</defaultGoal>
+
+    <plugins>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>${maven-compiler-plugin-version}</version>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>${maven-resources-plugin-version}</version>
+        <configuration>
+          <encoding>UTF-8</encoding>
+        </configuration>
+      </plugin>
+
+      <!-- generate components meta-data and validate component includes documentation etc -->
+      <plugin>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-package-maven-plugin</artifactId>
+        <version>${project.version}</version>
+        <executions>
+          <execution>
+            <id>prepare</id>
+            <goals>
+              <goal>prepare-components</goal>
+            </goals>
+            <phase>generate-resources</phase>
+          </execution>
+          <execution>
+            <id>validate</id>
+            <goals>
+              <goal>validate-components</goal>
+            </goals>
+            <phase>prepare-package</phase>
+          </execution>
+        </executions>
+      </plugin>
+
+      <!-- generate connector -->
+      <plugin>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-connector-maven-plugin</artifactId>
+        <version>${project.version}</version>
+        <executions>
+          <execution>
+            <id>connector</id>
+            <goals>
+              <goal>jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
+      <!-- to generate the MANIFEST-FILE of the bundle -->
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <version>${maven-bundle-plugin-version}</version>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Bundle-SymbolicName>com.foo.foo</Bundle-SymbolicName>
+            <Export-Service>org.apache.camel.spi.ComponentResolver;component=foo</Export-Service>
+          </instructions>
+        </configuration>
+      </plugin>
+
+    </plugins>
+  </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/1c505407/connectors/examples/bar-connector/src/main/java/org/foo/connector/BarComponent.java
----------------------------------------------------------------------
diff --git a/connectors/examples/bar-connector/src/main/java/org/foo/connector/BarComponent.java b/connectors/examples/bar-connector/src/main/java/org/foo/connector/BarComponent.java
new file mode 100644
index 0000000..3511227
--- /dev/null
+++ b/connectors/examples/bar-connector/src/main/java/org/foo/connector/BarComponent.java
@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.foo.connector;
+
+import org.apache.camel.component.connector.DefaultConnectorComponent;
+
+public class BarComponent extends DefaultConnectorComponent {
+
+	public BarComponent() {
+		super("bar", "org.foo.connector.BarComponent");
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/1c505407/connectors/examples/bar-connector/src/main/resources/META-INF/services/org/apache/camel/component/bar
----------------------------------------------------------------------
diff --git a/connectors/examples/bar-connector/src/main/resources/META-INF/services/org/apache/camel/component/bar b/connectors/examples/bar-connector/src/main/resources/META-INF/services/org/apache/camel/component/bar
new file mode 100644
index 0000000..60143ae
--- /dev/null
+++ b/connectors/examples/bar-connector/src/main/resources/META-INF/services/org/apache/camel/component/bar
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+class=org.foo.connector.BarComponent
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/1c505407/connectors/examples/bar-connector/src/main/resources/camel-connector.json
----------------------------------------------------------------------
diff --git a/connectors/examples/bar-connector/src/main/resources/camel-connector.json b/connectors/examples/bar-connector/src/main/resources/camel-connector.json
new file mode 100644
index 0000000..097d0cf
--- /dev/null
+++ b/connectors/examples/bar-connector/src/main/resources/camel-connector.json
@@ -0,0 +1,20 @@
+{
+  "baseScheme" : "beverage",
+  "baseGroupId" : "org.apache.camel",
+  "baseArtifactId" : "beverage-component",
+  "baseVersion" : "2.19.0-SNAPSHOT",
+  "baseJavaType" : "org.beverage.BeverageComponent",
+  "name" : "Bar",
+  "scheme" : "bar",
+  "javaType" : "org.foo.connector.BarComponent",
+  "groupId" : "org.apache.camel",
+  "artifactId" : "wine-connector",
+  "version" : "1.0.0",
+  "description" : "To order two drinks from the bar",
+  "labels" : [ "bar" ],
+  "source" : "To",
+  "endpointOptions" : [ "drink", "amount" ],
+  "endpointValues" : {
+    "amount" : "2"
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/1c505407/connectors/examples/foo-connector/pom.xml
----------------------------------------------------------------------
diff --git a/connectors/examples/foo-connector/pom.xml b/connectors/examples/foo-connector/pom.xml
new file mode 100644
index 0000000..dbc0731
--- /dev/null
+++ b/connectors/examples/foo-connector/pom.xml
@@ -0,0 +1,175 @@
+<?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>connectors-examples</artifactId>
+    <version>2.19.0-SNAPSHOT</version>
+    <relativePath>..</relativePath>
+  </parent>
+
+  <artifactId>foo-connector</artifactId>
+  <name>Camel :: Connectors :: Examples :: Foo Connector</name>
+  <description>Foo Connector</description>
+  <packaging>jar</packaging>
+
+  <dependencyManagement>
+    <dependencies>
+      <!-- Camel BOM -->
+      <dependency>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-parent</artifactId>
+        <version>${project.version}</version>
+        <scope>import</scope>
+        <type>pom</type>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+
+    <!-- base component to use for this connector -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <!-- camel-connector -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-connector</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <!-- support camel documentation -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>apt</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <!-- logging -->
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-api</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-slf4j-impl</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <!-- testing -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <defaultGoal>install</defaultGoal>
+
+    <plugins>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>${maven-compiler-plugin-version}</version>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>${maven-resources-plugin-version}</version>
+        <configuration>
+          <encoding>UTF-8</encoding>
+        </configuration>
+      </plugin>
+
+      <!-- generate components meta-data and validate component includes documentation etc -->
+      <plugin>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-package-maven-plugin</artifactId>
+        <version>${project.version}</version>
+        <executions>
+          <execution>
+            <id>prepare</id>
+            <goals>
+              <goal>prepare-components</goal>
+            </goals>
+            <phase>generate-resources</phase>
+          </execution>
+          <execution>
+            <id>validate</id>
+            <goals>
+              <goal>validate-components</goal>
+            </goals>
+            <phase>prepare-package</phase>
+          </execution>
+        </executions>
+      </plugin>
+
+      <!-- generate connector -->
+      <plugin>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-connector-maven-plugin</artifactId>
+        <version>${project.version}</version>
+        <executions>
+          <execution>
+            <id>connector</id>
+            <goals>
+              <goal>jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
+      <!-- to generate the MANIFEST-FILE of the bundle -->
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <version>${maven-bundle-plugin-version}</version>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Bundle-SymbolicName>com.foo.foo</Bundle-SymbolicName>
+            <Export-Service>org.apache.camel.spi.ComponentResolver;component=foo</Export-Service>
+          </instructions>
+        </configuration>
+      </plugin>
+
+    </plugins>
+  </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/1c505407/connectors/examples/foo-connector/src/main/java/org/foo/connector/FooComponent.java
----------------------------------------------------------------------
diff --git a/connectors/examples/foo-connector/src/main/java/org/foo/connector/FooComponent.java b/connectors/examples/foo-connector/src/main/java/org/foo/connector/FooComponent.java
new file mode 100644
index 0000000..754fdd0
--- /dev/null
+++ b/connectors/examples/foo-connector/src/main/java/org/foo/connector/FooComponent.java
@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.foo.connector;
+
+import org.apache.camel.component.connector.DefaultConnectorComponent;
+
+public class FooComponent extends DefaultConnectorComponent {
+
+	public FooComponent() {
+		super("foo", "org.foo.connector.FooComponent");
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/1c505407/connectors/examples/foo-connector/src/main/resources/META-INF/services/org/apache/camel/component/foo
----------------------------------------------------------------------
diff --git a/connectors/examples/foo-connector/src/main/resources/META-INF/services/org/apache/camel/component/foo b/connectors/examples/foo-connector/src/main/resources/META-INF/services/org/apache/camel/component/foo
new file mode 100644
index 0000000..b92962a
--- /dev/null
+++ b/connectors/examples/foo-connector/src/main/resources/META-INF/services/org/apache/camel/component/foo
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+class=org.foo.connector.FooComponent
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/1c505407/connectors/examples/foo-connector/src/main/resources/camel-connector.json
----------------------------------------------------------------------
diff --git a/connectors/examples/foo-connector/src/main/resources/camel-connector.json b/connectors/examples/foo-connector/src/main/resources/camel-connector.json
new file mode 100644
index 0000000..52cc2e2
--- /dev/null
+++ b/connectors/examples/foo-connector/src/main/resources/camel-connector.json
@@ -0,0 +1,21 @@
+{
+  "baseScheme" : "timer",
+  "baseGroupId" : "org.apache.camel",
+  "baseArtifactId" : "camel-core",
+  "baseVersion" : "2.19.0-SNAPSHOT",
+  "baseJavaType" : "org.apache.camel.component.timer.TimerComponent",
+  "name" : "Foo",
+  "scheme" : "foo",
+  "javaType" : "org.foo.connector.FooComponent",
+  "groupId" : "org.foo",
+  "artifactId" : "foo-connector",
+  "version" : "1.0.0",
+  "description" : "Something cool",
+  "labels" : [ "foo", "timer" ],
+  "source" : "From",
+  "endpointOptions" : [ "timerName", "period" ],
+  "endpointValues" : {
+    "fixedRate" : "true",
+    "period" : "5000"
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/1c505407/connectors/examples/pom.xml
----------------------------------------------------------------------
diff --git a/connectors/examples/pom.xml b/connectors/examples/pom.xml
index 07f93c7..5478431 100644
--- a/connectors/examples/pom.xml
+++ b/connectors/examples/pom.xml
@@ -33,6 +33,9 @@
 
   <modules>
     <module>beverage-component</module>
+    <module>foo-connector</module>
+    <module>bar-connector</module>
+    <module>wine-connector</module>
   </modules>
 
 </project>

http://git-wip-us.apache.org/repos/asf/camel/blob/1c505407/connectors/examples/wine-connector/pom.xml
----------------------------------------------------------------------
diff --git a/connectors/examples/wine-connector/pom.xml b/connectors/examples/wine-connector/pom.xml
new file mode 100644
index 0000000..e137acb
--- /dev/null
+++ b/connectors/examples/wine-connector/pom.xml
@@ -0,0 +1,175 @@
+<?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>connectors-examples</artifactId>
+    <version>2.19.0-SNAPSHOT</version>
+    <relativePath>..</relativePath>
+  </parent>
+
+  <artifactId>wine-connector</artifactId>
+  <name>Camel :: Connectors :: Examples :: Wine Connector</name>
+  <description>Wine Connector</description>
+  <packaging>jar</packaging>
+
+  <dependencyManagement>
+    <dependencies>
+      <!-- Camel BOM -->
+      <dependency>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-parent</artifactId>
+        <version>${project.version}</version>
+        <scope>import</scope>
+        <type>pom</type>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+
+    <!-- base component to use for this connector -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>beverage-component</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <!-- camel-connector -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-connector</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <!-- support camel documentation -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>apt</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <!-- logging -->
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-api</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-slf4j-impl</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <!-- testing -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <defaultGoal>install</defaultGoal>
+
+    <plugins>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>${maven-compiler-plugin-version}</version>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>${maven-resources-plugin-version}</version>
+        <configuration>
+          <encoding>UTF-8</encoding>
+        </configuration>
+      </plugin>
+
+      <!-- generate components meta-data and validate component includes documentation etc -->
+      <plugin>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-package-maven-plugin</artifactId>
+        <version>${project.version}</version>
+        <executions>
+          <execution>
+            <id>prepare</id>
+            <goals>
+              <goal>prepare-components</goal>
+            </goals>
+            <phase>generate-resources</phase>
+          </execution>
+          <execution>
+            <id>validate</id>
+            <goals>
+              <goal>validate-components</goal>
+            </goals>
+            <phase>prepare-package</phase>
+          </execution>
+        </executions>
+      </plugin>
+
+      <!-- generate connector -->
+      <plugin>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-connector-maven-plugin</artifactId>
+        <version>${project.version}</version>
+        <executions>
+          <execution>
+            <id>connector</id>
+            <goals>
+              <goal>jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
+      <!-- to generate the MANIFEST-FILE of the bundle -->
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <version>${maven-bundle-plugin-version}</version>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Bundle-SymbolicName>com.foo.wine</Bundle-SymbolicName>
+            <Export-Service>org.apache.camel.spi.ComponentResolver;component=wine</Export-Service>
+          </instructions>
+        </configuration>
+      </plugin>
+
+    </plugins>
+  </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/1c505407/connectors/examples/wine-connector/src/main/java/org/foo/connector/WineComponent.java
----------------------------------------------------------------------
diff --git a/connectors/examples/wine-connector/src/main/java/org/foo/connector/WineComponent.java b/connectors/examples/wine-connector/src/main/java/org/foo/connector/WineComponent.java
new file mode 100644
index 0000000..5118d25
--- /dev/null
+++ b/connectors/examples/wine-connector/src/main/java/org/foo/connector/WineComponent.java
@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.foo.connector;
+
+import org.apache.camel.component.connector.DefaultConnectorComponent;
+
+public class WineComponent extends DefaultConnectorComponent {
+
+	public WineComponent() {
+		super("wine", "org.foo.connector.WineComponent");
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/1c505407/connectors/examples/wine-connector/src/main/resources/META-INF/services/org/apache/camel/component/wine
----------------------------------------------------------------------
diff --git a/connectors/examples/wine-connector/src/main/resources/META-INF/services/org/apache/camel/component/wine b/connectors/examples/wine-connector/src/main/resources/META-INF/services/org/apache/camel/component/wine
new file mode 100644
index 0000000..0266ab6
--- /dev/null
+++ b/connectors/examples/wine-connector/src/main/resources/META-INF/services/org/apache/camel/component/wine
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+class=org.foo.connector.WineComponent
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/1c505407/connectors/examples/wine-connector/src/main/resources/camel-connector.json
----------------------------------------------------------------------
diff --git a/connectors/examples/wine-connector/src/main/resources/camel-connector.json b/connectors/examples/wine-connector/src/main/resources/camel-connector.json
new file mode 100644
index 0000000..a2e8ea8
--- /dev/null
+++ b/connectors/examples/wine-connector/src/main/resources/camel-connector.json
@@ -0,0 +1,20 @@
+{
+  "baseScheme" : "beverage",
+  "baseGroupId" : "org.apache.camel",
+  "baseArtifactId" : "beverage-component",
+  "baseVersion" : "2.19.0-SNAPSHOT",
+  "baseJavaType" : "org.beverage.BeverageComponent",
+  "name" : "Wine",
+  "scheme" : "wine",
+  "javaType" : "org.foo.connector.WineComponent",
+  "groupId" : "org.apache.camel",
+  "artifactId" : "wine-connector",
+  "version" : "1.0.0",
+  "description" : "To order wine from the bar",
+  "labels" : [ "bar" ],
+  "source" : "To",
+  "endpointOptions" : [ "amount" ],
+  "endpointValues" : {
+    "drink" : "Wine"
+  }
+}
\ No newline at end of file


[08/17] camel git commit: CAMEL-10721: camel-connector archetype

Posted by da...@apache.org.
CAMEL-10721: camel-connector archetype


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4e8d50fd
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4e8d50fd
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4e8d50fd

Branch: refs/heads/master
Commit: 4e8d50fdb265412ea522c34d7f4f66fa2f9d262f
Parents: 369bff6
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jan 18 14:54:17 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 19 11:00:00 2017 +0100

----------------------------------------------------------------------
 .../camel-archetype-connector/pom.xml           |  61 ++++++
 .../META-INF/maven/archetype-metadata.xml       |  78 +++++++
 .../src/main/resources/META-INF/LICENSE.txt     | 203 +++++++++++++++++++
 .../src/main/resources/META-INF/NOTICE.txt      |  11 +
 .../main/resources/archetype-resources/pom.xml  | 176 ++++++++++++++++
 .../src/main/java/__name__Component.java        |  30 +++
 .../org/apache/camel/component/__scheme__       |  17 ++
 .../src/main/resources/camel-connector.json     |  13 ++
 tooling/archetypes/pom.xml                      |   1 +
 9 files changed, 590 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/4e8d50fd/tooling/archetypes/camel-archetype-connector/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/archetypes/camel-archetype-connector/pom.xml b/tooling/archetypes/camel-archetype-connector/pom.xml
new file mode 100644
index 0000000..925c751
--- /dev/null
+++ b/tooling/archetypes/camel-archetype-connector/pom.xml
@@ -0,0 +1,61 @@
+<?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>archetypes</artifactId>
+    <version>2.19.0-SNAPSHOT</version>
+  </parent>
+
+  <groupId>org.apache.camel.archetypes</groupId>
+  <artifactId>camel-archetype-connector</artifactId>
+  <name>Camel :: Archetypes :: Connector</name>
+  <description>Creates a new Camel connector.</description>
+  <packaging>maven-archetype</packaging>
+
+  <build>
+    <extensions>
+      <extension>
+        <groupId>org.apache.maven.archetype</groupId>
+        <artifactId>archetype-packaging</artifactId>
+        <version>${maven-archetype-packaging-version}</version>
+      </extension>
+    </extensions>
+
+    <!-- include all resources but only filter archetype-metadata.xml -->
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>false</filtering>
+      </resource>
+      <resource>
+        <directory>src/main/resources-filtered</directory>
+        <filtering>true</filtering>
+        <includes>
+          <include>**/archetype-metadata.xml</include>
+        </includes>
+      </resource>
+    </resources>
+  </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/4e8d50fd/tooling/archetypes/camel-archetype-connector/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
----------------------------------------------------------------------
diff --git a/tooling/archetypes/camel-archetype-connector/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml b/tooling/archetypes/camel-archetype-connector/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
new file mode 100644
index 0000000..81140d2
--- /dev/null
+++ b/tooling/archetypes/camel-archetype-connector/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
@@ -0,0 +1,78 @@
+<?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.
+
+-->
+<archetype-descriptor xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" name="camel-archetype-java"
+    xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <requiredProperties>
+    <requiredProperty key="baseScheme"/>
+    <requiredProperty key="baseGroupId"/>
+    <requiredProperty key="baseArtifactId"/>
+    <requiredProperty key="baseVersion">
+      <defaultValue>${project.version}</defaultValue>
+    </requiredProperty>
+    <requiredProperty key="name"/>
+    <requiredProperty key="scheme"/>
+    <requiredProperty key="description"/>
+    <requiredProperty key="camel-version">
+      <defaultValue>${project.version}</defaultValue>
+    </requiredProperty>
+    <requiredProperty key="log4j-version">
+      <defaultValue>${log4j-version}</defaultValue>
+    </requiredProperty>
+    <requiredProperty key="maven-compiler-plugin-version">
+      <defaultValue>${maven-compiler-plugin-version}</defaultValue>
+    </requiredProperty>
+    <requiredProperty key="maven-resources-plugin-version">
+      <defaultValue>${maven-resources-plugin-version}</defaultValue>
+    </requiredProperty>
+    <requiredProperty key="maven-bundle-plugin-version">
+      <defaultValue>${maven-bundle-plugin-version}</defaultValue>
+    </requiredProperty>
+    <requiredProperty key="slf4j-version">
+      <defaultValue>${slf4j-version}</defaultValue>
+    </requiredProperty>
+  </requiredProperties>
+  <fileSets>
+    <fileSet filtered="true" packaged="true" encoding="UTF-8">
+      <directory>src/main/java</directory>
+      <includes>
+        <include>**/*.java</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory>src/main/resources</directory>
+      <includes>
+        <include>**/*</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" packaged="true" encoding="UTF-8">
+      <directory>src/test/java</directory>
+      <includes>
+        <include>**/*.java</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory>src/test/resources</directory>
+      <includes>
+        <include>**/*</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+</archetype-descriptor>

http://git-wip-us.apache.org/repos/asf/camel/blob/4e8d50fd/tooling/archetypes/camel-archetype-connector/src/main/resources/META-INF/LICENSE.txt
----------------------------------------------------------------------
diff --git a/tooling/archetypes/camel-archetype-connector/src/main/resources/META-INF/LICENSE.txt b/tooling/archetypes/camel-archetype-connector/src/main/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ b/tooling/archetypes/camel-archetype-connector/src/main/resources/META-INF/LICENSE.txt
@@ -0,0 +1,203 @@
+
+                                 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/4e8d50fd/tooling/archetypes/camel-archetype-connector/src/main/resources/META-INF/NOTICE.txt
----------------------------------------------------------------------
diff --git a/tooling/archetypes/camel-archetype-connector/src/main/resources/META-INF/NOTICE.txt b/tooling/archetypes/camel-archetype-connector/src/main/resources/META-INF/NOTICE.txt
new file mode 100644
index 0000000..2e215bf
--- /dev/null
+++ b/tooling/archetypes/camel-archetype-connector/src/main/resources/META-INF/NOTICE.txt
@@ -0,0 +1,11 @@
+   =========================================================================
+   ==  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.

http://git-wip-us.apache.org/repos/asf/camel/blob/4e8d50fd/tooling/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/pom.xml b/tooling/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/pom.xml
new file mode 100644
index 0000000..39245a1
--- /dev/null
+++ b/tooling/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/pom.xml
@@ -0,0 +1,176 @@
+<?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>
+
+  <groupId>${groupId}</groupId>
+  <artifactId>${artifactId}</artifactId>
+  <packaging>jar</packaging>
+  <version>${version}</version>
+
+  <name>Camel ${name} Connector</name>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+  </properties>
+
+  <dependencyManagement>
+    <dependencies>
+      <!-- Camel BOM -->
+      <dependency>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-parent</artifactId>
+        <version>${camel-version}</version>
+        <scope>import</scope>
+        <type>pom</type>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+
+    <!-- base component to use for this connector -->
+    <dependency>
+      <groupId>${baseGroupId}</groupId>
+      <artifactId>${baseArtifactId}</artifactId>
+      <version>${baseVersion}</version>
+    </dependency>
+
+    <!-- camel-connector -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-connector</artifactId>
+      <version>${camel-version}</version>
+    </dependency>
+
+
+    <!-- support camel documentation -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>apt</artifactId>
+      <version>${camel-version}</version>
+    </dependency>
+    
+    <!-- logging -->
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-api</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-slf4j-impl</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <!-- testing -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <defaultGoal>install</defaultGoal>
+
+    <plugins>
+      
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>${maven-compiler-plugin-version}</version>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
+      
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>${maven-resources-plugin-version}</version>
+        <configuration>
+          <encoding>UTF-8</encoding>
+        </configuration>
+      </plugin>
+
+      <!-- generate components meta-data and validate component includes documentation etc -->
+      <plugin>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-package-maven-plugin</artifactId>
+        <version>${camel-version}</version>
+        <executions>
+          <execution>
+            <id>prepare</id>
+            <goals>
+              <goal>prepare-components</goal>
+            </goals>
+            <phase>generate-resources</phase>
+          </execution>
+          <execution>
+            <id>validate</id>
+            <goals>
+              <goal>validate-components</goal>
+            </goals>
+            <phase>prepare-package</phase>
+          </execution>
+        </executions>
+      </plugin>
+
+      <!-- generate connector -->
+      <plugin>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-connector-maven-plugin</artifactId>
+        <version>${camel-version}</version>
+        <executions>
+          <execution>
+            <id>connector</id>
+            <goals>
+              <goal>jar</goal>
+            </goals>
+            <phase>generate-resources</phase>
+          </execution>
+        </executions>
+      </plugin>
+
+      <!-- to generate the MANIFEST-FILE of the bundle -->
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <version>${maven-bundle-plugin-version}</version>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Bundle-SymbolicName>${groupId}.${artifactId}</Bundle-SymbolicName>
+            <Export-Service>org.apache.camel.spi.ComponentResolver;component=${scheme}</Export-Service>
+          </instructions>
+        </configuration>
+      </plugin>
+
+    </plugins>
+  </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/4e8d50fd/tooling/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/src/main/java/__name__Component.java
----------------------------------------------------------------------
diff --git a/tooling/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/src/main/java/__name__Component.java b/tooling/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/src/main/java/__name__Component.java
new file mode 100644
index 0000000..7ef274b
--- /dev/null
+++ b/tooling/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/src/main/java/__name__Component.java
@@ -0,0 +1,30 @@
+## ------------------------------------------------------------------------
+## 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 ${package};
+
+import org.apache.camel.component.connector.DefaultConnectorComponent;
+
+/**
+ * Camel ${name} connector
+ */
+public class ${name}Component extends DefaultConnectorComponent {
+    
+    public ${name}Component() {
+        super("${name}", "${package}.${name}Component");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/4e8d50fd/tooling/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/src/main/resources/META-INF/services/org/apache/camel/component/__scheme__
----------------------------------------------------------------------
diff --git a/tooling/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/src/main/resources/META-INF/services/org/apache/camel/component/__scheme__ b/tooling/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/src/main/resources/META-INF/services/org/apache/camel/component/__scheme__
new file mode 100644
index 0000000..ff171b5
--- /dev/null
+++ b/tooling/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/src/main/resources/META-INF/services/org/apache/camel/component/__scheme__
@@ -0,0 +1,17 @@
+## ------------------------------------------------------------------------
+## 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.
+## ------------------------------------------------------------------------
+class=${package}.${name}Component

http://git-wip-us.apache.org/repos/asf/camel/blob/4e8d50fd/tooling/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/src/main/resources/camel-connector.json
----------------------------------------------------------------------
diff --git a/tooling/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/src/main/resources/camel-connector.json b/tooling/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/src/main/resources/camel-connector.json
new file mode 100644
index 0000000..1e588a3
--- /dev/null
+++ b/tooling/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/src/main/resources/camel-connector.json
@@ -0,0 +1,13 @@
+{
+  "baseScheme" : "${baseScheme}",
+  "baseGroupId" : "${baseGroupId}",
+  "baseArtifactId" : "${baseArtifactId}",
+  "baseVersion" : "${baseVersion}",
+  "name" : "${name}",
+  "scheme" : "${scheme}",
+  "javaType" : "${package}.${name}Component",
+  "groupId" : "${groupId}",
+  "artifactId" : "${artifactId}",
+  "version" : "${version}",
+  "description" : "${description}"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/4e8d50fd/tooling/archetypes/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/archetypes/pom.xml b/tooling/archetypes/pom.xml
index d934056..17201e4 100644
--- a/tooling/archetypes/pom.xml
+++ b/tooling/archetypes/pom.xml
@@ -36,6 +36,7 @@
     <module>camel-archetype-blueprint</module>
     <module>camel-archetype-cdi</module>
     <module>camel-archetype-component</module>
+    <module>camel-archetype-connector</module>
     <module>camel-archetype-dataformat</module>
     <module>camel-archetype-groovy</module>
     <module>camel-archetype-java</module>


[02/17] camel git commit: CAMEL-10721: camel-connector example

Posted by da...@apache.org.
CAMEL-10721: camel-connector example


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/94017c0b
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/94017c0b
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/94017c0b

Branch: refs/heads/master
Commit: 94017c0ba9add6204fa852ad0e4b3c7224023ec3
Parents: 88a7645
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Jan 19 10:08:16 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 19 11:00:00 2017 +0100

----------------------------------------------------------------------
 .../src/main/java/org/foo/FooBarWineRoute.java                   | 4 ++--
 .../foo-connector/src/main/resources/camel-connector.json        | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/94017c0b/connectors/examples/foo-bar-wine-example/src/main/java/org/foo/FooBarWineRoute.java
----------------------------------------------------------------------
diff --git a/connectors/examples/foo-bar-wine-example/src/main/java/org/foo/FooBarWineRoute.java b/connectors/examples/foo-bar-wine-example/src/main/java/org/foo/FooBarWineRoute.java
index e1a4808..f2b8f15 100644
--- a/connectors/examples/foo-bar-wine-example/src/main/java/org/foo/FooBarWineRoute.java
+++ b/connectors/examples/foo-bar-wine-example/src/main/java/org/foo/FooBarWineRoute.java
@@ -25,8 +25,8 @@ public class FooBarWineRoute extends RouteBuilder {
 
     @Override
     public void configure() throws Exception {
-        from("foo:wine?period=3000")
-            .to("wine:Wine?amount=3")
+        from("foo:wine?period=2000")
+            .to("wine:Wine?amount=2")
             .log("Wine ordered ${body}");
 
         from("foo:bar?period=5000")

http://git-wip-us.apache.org/repos/asf/camel/blob/94017c0b/connectors/examples/foo-connector/src/main/resources/camel-connector.json
----------------------------------------------------------------------
diff --git a/connectors/examples/foo-connector/src/main/resources/camel-connector.json b/connectors/examples/foo-connector/src/main/resources/camel-connector.json
index 8a3b89b..6b683b3 100644
--- a/connectors/examples/foo-connector/src/main/resources/camel-connector.json
+++ b/connectors/examples/foo-connector/src/main/resources/camel-connector.json
@@ -13,7 +13,7 @@
   "description" : "Something cool",
   "labels" : [ "foo", "timer" ],
   "source" : "From",
-  "endpointOptions" : [ "timerName", "period" ],
+  "endpointOptions" : [ "timerName", "period", "repeatCount" ],
   "endpointValues" : {
     "fixedRate" : "true",
     "period" : "5000"


[06/17] camel git commit: CAMEL-10721: Fixed CS

Posted by da...@apache.org.
CAMEL-10721: Fixed CS


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/369bff6e
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/369bff6e
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/369bff6e

Branch: refs/heads/master
Commit: 369bff6e23dfbb768c05ba0134dceffdbdcd98ee
Parents: c473d0b
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jan 18 14:29:02 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 19 11:00:00 2017 +0100

----------------------------------------------------------------------
 .../java/org/apache/camel/maven/connector/ConnectorMojo.java    | 2 +-
 .../main/java/org/apache/camel/maven/connector/FileHelper.java  | 5 ++++-
 .../main/java/org/apache/camel/maven/connector/GitHelper.java   | 5 ++++-
 3 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/369bff6e/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/ConnectorMojo.java
----------------------------------------------------------------------
diff --git a/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/ConnectorMojo.java b/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/ConnectorMojo.java
index 4683db7..bc2a35d 100644
--- a/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/ConnectorMojo.java
+++ b/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/ConnectorMojo.java
@@ -34,11 +34,11 @@ import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.jar.AbstractJarMojo;
 import org.apache.maven.plugins.annotations.LifecyclePhase;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.plugins.annotations.ResolutionScope;
-import org.apache.maven.plugin.jar.AbstractJarMojo;
 
 @Mojo(name = "jar", defaultPhase = LifecyclePhase.PREPARE_PACKAGE, requiresProject = true, threadSafe = true,
         requiresDependencyResolution = ResolutionScope.RUNTIME)

http://git-wip-us.apache.org/repos/asf/camel/blob/369bff6e/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/FileHelper.java
----------------------------------------------------------------------
diff --git a/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/FileHelper.java b/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/FileHelper.java
index caecd16..30f187a 100644
--- a/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/FileHelper.java
+++ b/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/FileHelper.java
@@ -22,7 +22,10 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.LineNumberReader;
 
-public class FileHelper {
+public final class FileHelper {
+
+    private FileHelper() {
+    }
 
     /**
      * Loads the entire stream into memory as a String and returns it.

http://git-wip-us.apache.org/repos/asf/camel/blob/369bff6e/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/GitHelper.java
----------------------------------------------------------------------
diff --git a/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/GitHelper.java b/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/GitHelper.java
index 92c50ee..023a948 100644
--- a/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/GitHelper.java
+++ b/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/GitHelper.java
@@ -24,7 +24,10 @@ import java.io.StringReader;
 import java.util.HashMap;
 import java.util.Map;
 
-public class GitHelper {
+public final class GitHelper {
+
+    private GitHelper() {
+    }
 
     public static File findGitFolder() {
         File baseDir = new File("").getAbsoluteFile();


[16/17] camel git commit: CAMEL-10721: Regen

Posted by da...@apache.org.
CAMEL-10721: Regen


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/96b05ed8
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/96b05ed8
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/96b05ed8

Branch: refs/heads/master
Commit: 96b05ed8a3cf1ada179d55daa805f73f77cf36b1
Parents: 94017c0
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Jan 19 10:53:26 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 19 11:00:00 2017 +0100

----------------------------------------------------------------------
 .../spring-boot-dm/camel-spring-boot-dependencies/pom.xml       | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/96b05ed8/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
index 608eb96..3ffa306 100644
--- a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
+++ b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
@@ -572,6 +572,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-connector</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-consul</artifactId>
         <version>${project.version}</version>
       </dependency>


[15/17] camel git commit: CAMEL-10721: connector docs

Posted by da...@apache.org.
CAMEL-10721: connector docs


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f79d981f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f79d981f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f79d981f

Branch: refs/heads/master
Commit: f79d981f7c425fb4c504eaeda3e9814539aa5b1e
Parents: 9bf705d
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Jan 19 09:22:57 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 19 11:00:00 2017 +0100

----------------------------------------------------------------------
 .../src/main/docs/connector-component.adoc      | 59 ++++++++++++++++++++
 1 file changed, 59 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/f79d981f/connectors/camel-connector/src/main/docs/connector-component.adoc
----------------------------------------------------------------------
diff --git a/connectors/camel-connector/src/main/docs/connector-component.adoc b/connectors/camel-connector/src/main/docs/connector-component.adoc
new file mode 100644
index 0000000..be13741
--- /dev/null
+++ b/connectors/camel-connector/src/main/docs/connector-component.adoc
@@ -0,0 +1,59 @@
+## Connector Component
+
+The connector component is an abstract component that is used as a building block to build a Camel connector.
+
+
+### What is a Camel connector?
+
+A Camel connector is a simplified setup of any existing Camel component. The idea is to be able to pre-configure
+  a connector to a specific use-case, such as _add contact to salesforce_, or _add calender entry_,
+  or _new leads from twitter_.
+
+The existing Camel components are generic and have many options. Therefore to use any of these components you
+   need to understand how to use and setup all these options.
+
+
+### How it works
+
+The connector is based on one of the existing Camel components (or 3rd party component) by which you can specify
+in a `camel-connector.json` file which options to pre-select and as well specify other default values etc.
+
+Then the `camel-connector-maven-plugin` Maven plugin will build this as a Camel component,
+so at runtime its just a regular Camel component.
+
+Because connectors are just regular Camel component there is no problem running them in Camel applications.
+
+In addition all existing JMX, tooling et all just sees this as Camel components and can use that.
+Also at design time, for example the Apache Camel IDEA plugin will see the connector as a 3rd party Camel component
+and offer code assistance to it etc.
+
+You can have as many connectors you want, and a Camel component can have many connectors.
+For example you can have multiple connectors to the `camel-salesforce` component, where each connectors
+is specialized to do a different use-case with Salesforce.
+
+
+### How to create a Connector
+
+You can use the Maven archetype `camel-archetype-connector` to create a new connector. You would need to specify
+some values as input to select the existing Camel component to use as base, and then in addition the name and title
+of the connector, and a few other values as well.
+
+You can also copy the existing examples from the `connectors` directory where the following connectors examples is provided:
+
+- `foo-connector` - A connector that is based on the Timer component from `camel-core`.
+- `bar-connector` - A connector that is based on the 3rd party `beverage-component`.
+- `wine-connector` - Another connector that is based on the 3rd party `beverage-component`.
+
+You can find an example using these connectors in the `foo-bar-wine-example` in the `connectors` directory.
+
+
+### The connectors schema file
+
+A connector has a schema file `camel-connector.json` located in `src/main/resources` directory.
+
+This schema holds the information where you can pre-configure and specify which options a connector should offer.
+
+The options the connector can provide is a limited set of all the existing options that comes from the Camel component
+its based upon. Each option can then also be pre-configured with a default-value.
+
+To understand this schema file, its easier to study those existing connectors from the `connectors` directory.
\ No newline at end of file


[09/17] camel git commit: CAMEL-10721: camel-connector

Posted by da...@apache.org.
CAMEL-10721: camel-connector


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/38b0ff86
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/38b0ff86
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/38b0ff86

Branch: refs/heads/master
Commit: 38b0ff869c5b4056ac02be7dc0db0aded3b1d600
Parents: 4e8d50f
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jan 18 16:08:59 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 19 11:00:00 2017 +0100

----------------------------------------------------------------------
 .../camel/maven/connector/ConnectorMojo.java    | 93 ++++++++------------
 .../main/resources/archetype-resources/pom.xml  |  1 -
 .../src/main/resources/camel-connector.json     | 22 ++---
 3 files changed, 48 insertions(+), 68 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/38b0ff86/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/ConnectorMojo.java
----------------------------------------------------------------------
diff --git a/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/ConnectorMojo.java b/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/ConnectorMojo.java
index bc2a35d..0a4637a 100644
--- a/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/ConnectorMojo.java
+++ b/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/ConnectorMojo.java
@@ -50,6 +50,12 @@ public class ConnectorMojo extends AbstractJarMojo {
     @Parameter(defaultValue = "${project.build.outputDirectory}", required = true)
     private File classesDirectory;
 
+    /**
+     * Whether to include the git url for the git repository of the source code for the Camel connector
+     */
+    @Parameter(defaultValue = "false")
+    private boolean includeGitUrl;
+
     @Override
     protected File getClassesDirectory() {
         return classesDirectory;
@@ -68,26 +74,26 @@ public class ConnectorMojo extends AbstractJarMojo {
     @Override
     public File createArchive() throws MojoExecutionException {
 
-        String gitUrl;
+        String gitUrl = null;
 
         // find the component dependency and get its .json file
-
         File file = new File(classesDirectory, "camel-connector.json");
         if (file.exists()) {
 
-            // we want to include the git url of the project
-            File gitFolder = GitHelper.findGitFolder();
-            try {
-                gitUrl = GitHelper.extractGitUrl(gitFolder);
-            } catch (IOException e) {
-                throw new MojoExecutionException("Cannot extract gitUrl due " + e.getMessage(), e);
-            }
-            if (gitUrl == null) {
-                getLog().warn("No .git directory found for connector");
+            if (includeGitUrl) {
+                // we want to include the git url of the project
+                File gitFolder = GitHelper.findGitFolder();
+                try {
+                    gitUrl = GitHelper.extractGitUrl(gitFolder);
+                } catch (IOException e) {
+                    throw new MojoExecutionException("Cannot extract gitUrl due " + e.getMessage(), e);
+                }
+                if (gitUrl == null) {
+                    getLog().warn("No .git directory found for connector");
+                }
             }
 
             try {
-
                 ObjectMapper mapper = new ObjectMapper();
                 Map dto = mapper.readValue(file, Map.class);
 
@@ -155,7 +161,7 @@ public class ConnectorMojo extends AbstractJarMojo {
 
                 // build json schema for component that only has the selectable options
             } catch (Exception e) {
-                throw new MojoExecutionException("Error in connector-maven-plugin", e);
+                throw new MojoExecutionException("Error in camel-connector-maven-plugin", e);
             }
         }
 
@@ -285,7 +291,9 @@ public class ConnectorMojo extends AbstractJarMojo {
 
         StringBuilder sb = new StringBuilder();
         sb.append("  \"component\": {\n");
-        sb.append("    \"girUrl\": \"" + nullSafe(gitUrl) + "\",\n");
+        if (gitUrl != null) {
+            sb.append("    \"girUrl\": \"" + nullSafe(gitUrl) + "\",\n");
+        }
         sb.append("    \"kind\": \"component\",\n");
         sb.append("    \"baseScheme\": \"" + nullSafe(baseScheme) + "\",\n");
         sb.append("    \"scheme\": \"" + scheme + "\",\n");
@@ -327,12 +335,13 @@ public class ConnectorMojo extends AbstractJarMojo {
      */
     private File embedCamelComponentSchema(File file) throws MojoExecutionException {
         try {
-            List<String> json = loadFile(file);
+            ObjectMapper mapper = new ObjectMapper();
+            Map dto = mapper.readValue(file, Map.class);
 
-            String scheme = extractScheme(json);
-            String groupId = extractGroupId(json);
-            String artifactId = extractArtifactId(json);
-            String version = extractVersion(json); // version not in use
+            String scheme = extractScheme(dto);
+            String groupId = extractGroupId(dto);
+            String artifactId = extractArtifactId(dto);
+            String version = extractVersion(dto);
 
             // find the artifact on the classpath that has the Camel component this connector is using
             // then we want to grab its json schema file to embed in this JAR so we have all files together
@@ -341,7 +350,7 @@ public class ConnectorMojo extends AbstractJarMojo {
                 for (Object obj : getProject().getDependencyArtifacts()) {
                     Artifact artifact = (Artifact) obj;
                     if ("jar".equals(artifact.getType())) {
-                        if (groupId.equals(artifact.getGroupId()) && artifactId.equals(artifact.getArtifactId())) {
+                        if (groupId.equals(artifact.getGroupId()) && artifactId.equals(artifact.getArtifactId()) && version.equals(artifact.getVersion())) {
                             // load the component file inside the file
                             URL url = new URL("file:" + artifact.getFile());
                             URLClassLoader child = new URLClassLoader(new URL[]{url}, this.getClass().getClassLoader());
@@ -397,48 +406,20 @@ public class ConnectorMojo extends AbstractJarMojo {
         return null;
     }
 
-    private String extractScheme(List<String> json) {
-        for (String line : json) {
-            line = line.trim();
-            if (line.startsWith("\"baseScheme\":")) {
-                String answer = line.substring(14);
-                return answer.substring(0, answer.length() - 2);
-            }
-        }
-        return null;
+    private String extractScheme(Map map) {
+        return (String) map.get("baseScheme");
     }
 
-    private String extractGroupId(List<String> json) {
-        for (String line : json) {
-            line = line.trim();
-            if (line.startsWith("\"baseGroupId\":")) {
-                String answer = line.substring(15);
-                return answer.substring(0, answer.length() - 2);
-            }
-        }
-        return null;
+    private String extractGroupId(Map map) {
+        return (String) map.get("baseGroupId");
     }
 
-    private String extractArtifactId(List<String> json) {
-        for (String line : json) {
-            line = line.trim();
-            if (line.startsWith("\"baseArtifactId\":")) {
-                String answer = line.substring(18);
-                return answer.substring(0, answer.length() - 2);
-            }
-        }
-        return null;
+    private String extractArtifactId(Map map) {
+        return (String) map.get("baseArtifactId");
     }
 
-    private String extractVersion(List<String> json) {
-        for (String line : json) {
-            line = line.trim();
-            if (line.startsWith("\"baseVersion\":")) {
-                String answer = line.substring(15);
-                return answer.substring(0, answer.length() - 2);
-            }
-        }
-        return null;
+    private String extractVersion(Map map) {
+        return (String) map.get("baseVersion");
     }
 
     private List<String> loadFile(File file) throws Exception {

http://git-wip-us.apache.org/repos/asf/camel/blob/38b0ff86/tooling/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/pom.xml b/tooling/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/pom.xml
index 39245a1..cff525d 100644
--- a/tooling/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/pom.xml
+++ b/tooling/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/pom.xml
@@ -151,7 +151,6 @@
             <goals>
               <goal>jar</goal>
             </goals>
-            <phase>generate-resources</phase>
           </execution>
         </executions>
       </plugin>

http://git-wip-us.apache.org/repos/asf/camel/blob/38b0ff86/tooling/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/src/main/resources/camel-connector.json
----------------------------------------------------------------------
diff --git a/tooling/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/src/main/resources/camel-connector.json b/tooling/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/src/main/resources/camel-connector.json
index 1e588a3..df1e313 100644
--- a/tooling/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/src/main/resources/camel-connector.json
+++ b/tooling/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/src/main/resources/camel-connector.json
@@ -1,13 +1,13 @@
 {
-  "baseScheme" : "${baseScheme}",
-  "baseGroupId" : "${baseGroupId}",
-  "baseArtifactId" : "${baseArtifactId}",
-  "baseVersion" : "${baseVersion}",
-  "name" : "${name}",
-  "scheme" : "${scheme}",
-  "javaType" : "${package}.${name}Component",
-  "groupId" : "${groupId}",
-  "artifactId" : "${artifactId}",
-  "version" : "${version}",
-  "description" : "${description}"
+  "baseScheme": "${baseScheme}",
+  "baseGroupId": "${baseGroupId}",
+  "baseArtifactId": "${baseArtifactId}",
+  "baseVersion": "${baseVersion}",
+  "name": "${name}",
+  "scheme": "${scheme}",
+  "javaType": "${package}.${name}Component",
+  "groupId": "${groupId}",
+  "artifactId": "${artifactId}",
+  "version": "${version}",
+  "description": "${description}"
 }
\ No newline at end of file


[13/17] camel git commit: CAMEL-10721: camel-connector example

Posted by da...@apache.org.
CAMEL-10721: camel-connector example


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9bf705dc
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9bf705dc
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9bf705dc

Branch: refs/heads/master
Commit: 9bf705dc394b5dea64a2275f99959c6ddd39cf8a
Parents: c4e4a7e
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jan 18 17:53:28 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 19 11:00:00 2017 +0100

----------------------------------------------------------------------
 connectors/examples/bar-connector/pom.xml                   | 9 +++++----
 .../bar-connector/src/main/resources/camel-connector.json   | 4 ++--
 connectors/examples/beverage-component/pom.xml              | 1 +
 connectors/examples/foo-bar-wine-example/pom.xml            | 7 ++++---
 .../src/main/java/org/foo/FooBarWineRoute.java              | 2 +-
 connectors/examples/foo-connector/pom.xml                   | 1 +
 connectors/examples/wine-connector/pom.xml                  | 3 ++-
 .../wine-connector/src/main/resources/camel-connector.json  | 6 +++---
 8 files changed, 19 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/9bf705dc/connectors/examples/bar-connector/pom.xml
----------------------------------------------------------------------
diff --git a/connectors/examples/bar-connector/pom.xml b/connectors/examples/bar-connector/pom.xml
index 7b74f37..8c1fa74 100644
--- a/connectors/examples/bar-connector/pom.xml
+++ b/connectors/examples/bar-connector/pom.xml
@@ -27,6 +27,7 @@
     <relativePath>..</relativePath>
   </parent>
 
+  <groupId>org.foo</groupId>
   <artifactId>bar-connector</artifactId>
   <name>Camel :: Connectors :: Examples :: Bar Connector</name>
   <description>Bar Connector</description>
@@ -49,8 +50,8 @@
 
     <!-- base component to use for this connector -->
     <dependency>
-      <groupId>org.apache.camel</groupId>
-      <artifactId>camel-core</artifactId>
+      <groupId>org.foo</groupId>
+      <artifactId>beverage-component</artifactId>
       <version>${project.version}</version>
     </dependency>
 
@@ -163,8 +164,8 @@
         <extensions>true</extensions>
         <configuration>
           <instructions>
-            <Bundle-SymbolicName>com.foo.foo</Bundle-SymbolicName>
-            <Export-Service>org.apache.camel.spi.ComponentResolver;component=foo</Export-Service>
+            <Bundle-SymbolicName>com.foo.bar</Bundle-SymbolicName>
+            <Export-Service>org.apache.camel.spi.ComponentResolver;component=bar</Export-Service>
           </instructions>
         </configuration>
       </plugin>

http://git-wip-us.apache.org/repos/asf/camel/blob/9bf705dc/connectors/examples/bar-connector/src/main/resources/camel-connector.json
----------------------------------------------------------------------
diff --git a/connectors/examples/bar-connector/src/main/resources/camel-connector.json b/connectors/examples/bar-connector/src/main/resources/camel-connector.json
index db4b0ae..a85257c 100644
--- a/connectors/examples/bar-connector/src/main/resources/camel-connector.json
+++ b/connectors/examples/bar-connector/src/main/resources/camel-connector.json
@@ -1,13 +1,13 @@
 {
   "baseScheme" : "beverage",
-  "baseGroupId" : "org.apache.camel",
+  "baseGroupId" : "org.foo",
   "baseArtifactId" : "beverage-component",
   "baseVersion" : "2.19.0-SNAPSHOT",
   "baseJavaType" : "org.beverage.BeverageComponent",
   "name" : "Bar",
   "scheme" : "bar",
   "javaType" : "org.foo.connector.BarComponent",
-  "groupId" : "org.apache.camel",
+  "groupId" : "org.foo",
   "artifactId" : "wine-connector",
   "version" : "2.19.0-SNAPSHOT",
   "description" : "To order two drinks from the bar",

http://git-wip-us.apache.org/repos/asf/camel/blob/9bf705dc/connectors/examples/beverage-component/pom.xml
----------------------------------------------------------------------
diff --git a/connectors/examples/beverage-component/pom.xml b/connectors/examples/beverage-component/pom.xml
index 369b777..d349490 100644
--- a/connectors/examples/beverage-component/pom.xml
+++ b/connectors/examples/beverage-component/pom.xml
@@ -26,6 +26,7 @@
     <relativePath>..</relativePath>
   </parent>
 
+  <groupId>org.foo</groupId>
   <artifactId>beverage-component</artifactId>
   <name>Camel :: Connectors :: Examples :: Beverage Component</name>
   <description>Camel Beverage Component</description>

http://git-wip-us.apache.org/repos/asf/camel/blob/9bf705dc/connectors/examples/foo-bar-wine-example/pom.xml
----------------------------------------------------------------------
diff --git a/connectors/examples/foo-bar-wine-example/pom.xml b/connectors/examples/foo-bar-wine-example/pom.xml
index f603032..358d1cc 100644
--- a/connectors/examples/foo-bar-wine-example/pom.xml
+++ b/connectors/examples/foo-bar-wine-example/pom.xml
@@ -27,6 +27,7 @@
     <relativePath>..</relativePath>
   </parent>
 
+  <groupId>org.foo</groupId>
   <artifactId>foo-bar-wine-example</artifactId>
   <name>Camel :: Connectors :: Examples :: Foo Bar and Wine Example</name>
   <description>Foo Bar and Wine Example</description>
@@ -49,17 +50,17 @@
 
     <!-- connectors used in this example -->
     <dependency>
-      <groupId>org.apache.camel</groupId>
+      <groupId>org.foo</groupId>
       <artifactId>foo-connector</artifactId>
       <version>${project.version}</version>
     </dependency>
     <dependency>
-      <groupId>org.apache.camel</groupId>
+      <groupId>org.foo</groupId>
       <artifactId>bar-connector</artifactId>
       <version>${project.version}</version>
     </dependency>
     <dependency>
-      <groupId>org.apache.camel</groupId>
+      <groupId>org.foo</groupId>
       <artifactId>wine-connector</artifactId>
       <version>${project.version}</version>
     </dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/9bf705dc/connectors/examples/foo-bar-wine-example/src/main/java/org/foo/FooBarWineRoute.java
----------------------------------------------------------------------
diff --git a/connectors/examples/foo-bar-wine-example/src/main/java/org/foo/FooBarWineRoute.java b/connectors/examples/foo-bar-wine-example/src/main/java/org/foo/FooBarWineRoute.java
index 1bd3804..e1a4808 100644
--- a/connectors/examples/foo-bar-wine-example/src/main/java/org/foo/FooBarWineRoute.java
+++ b/connectors/examples/foo-bar-wine-example/src/main/java/org/foo/FooBarWineRoute.java
@@ -26,7 +26,7 @@ public class FooBarWineRoute extends RouteBuilder {
     @Override
     public void configure() throws Exception {
         from("foo:wine?period=3000")
-            .to("wine:wine?amount=2")
+            .to("wine:Wine?amount=3")
             .log("Wine ordered ${body}");
 
         from("foo:bar?period=5000")

http://git-wip-us.apache.org/repos/asf/camel/blob/9bf705dc/connectors/examples/foo-connector/pom.xml
----------------------------------------------------------------------
diff --git a/connectors/examples/foo-connector/pom.xml b/connectors/examples/foo-connector/pom.xml
index dbc0731..d9285d8 100644
--- a/connectors/examples/foo-connector/pom.xml
+++ b/connectors/examples/foo-connector/pom.xml
@@ -27,6 +27,7 @@
     <relativePath>..</relativePath>
   </parent>
 
+  <groupId>org.foo</groupId>
   <artifactId>foo-connector</artifactId>
   <name>Camel :: Connectors :: Examples :: Foo Connector</name>
   <description>Foo Connector</description>

http://git-wip-us.apache.org/repos/asf/camel/blob/9bf705dc/connectors/examples/wine-connector/pom.xml
----------------------------------------------------------------------
diff --git a/connectors/examples/wine-connector/pom.xml b/connectors/examples/wine-connector/pom.xml
index e137acb..f23cc88 100644
--- a/connectors/examples/wine-connector/pom.xml
+++ b/connectors/examples/wine-connector/pom.xml
@@ -27,6 +27,7 @@
     <relativePath>..</relativePath>
   </parent>
 
+  <groupId>org.foo</groupId>
   <artifactId>wine-connector</artifactId>
   <name>Camel :: Connectors :: Examples :: Wine Connector</name>
   <description>Wine Connector</description>
@@ -49,7 +50,7 @@
 
     <!-- base component to use for this connector -->
     <dependency>
-      <groupId>org.apache.camel</groupId>
+      <groupId>org.foo</groupId>
       <artifactId>beverage-component</artifactId>
       <version>${project.version}</version>
     </dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/9bf705dc/connectors/examples/wine-connector/src/main/resources/camel-connector.json
----------------------------------------------------------------------
diff --git a/connectors/examples/wine-connector/src/main/resources/camel-connector.json b/connectors/examples/wine-connector/src/main/resources/camel-connector.json
index 17492f7..f49cb4d 100644
--- a/connectors/examples/wine-connector/src/main/resources/camel-connector.json
+++ b/connectors/examples/wine-connector/src/main/resources/camel-connector.json
@@ -1,19 +1,19 @@
 {
   "baseScheme" : "beverage",
-  "baseGroupId" : "org.apache.camel",
+  "baseGroupId" : "org.foo",
   "baseArtifactId" : "beverage-component",
   "baseVersion" : "2.19.0-SNAPSHOT",
   "baseJavaType" : "org.beverage.BeverageComponent",
   "name" : "Wine",
   "scheme" : "wine",
   "javaType" : "org.foo.connector.WineComponent",
-  "groupId" : "org.apache.camel",
+  "groupId" : "org.foo",
   "artifactId" : "wine-connector",
   "version" : "2.19.0-SNAPSHOT",
   "description" : "To order wine from the bar",
   "labels" : [ "bar" ],
   "source" : "To",
-  "endpointOptions" : [ "amount" ],
+  "endpointOptions" : [ "drink", "amount" ],
   "endpointValues" : {
     "drink" : "Wine"
   }


[04/17] camel git commit: CAMEL-10721: camel-connector

Posted by da...@apache.org.
CAMEL-10721: camel-connector


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c473d0b9
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c473d0b9
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c473d0b9

Branch: refs/heads/master
Commit: c473d0b9627ff8b6a817c31092c55f86904a5137
Parents: c4ee179
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jan 18 14:27:14 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 19 11:00:00 2017 +0100

----------------------------------------------------------------------
 connectors/camel-connector-maven-plugin/pom.xml |  90 ++++
 .../maven/connector/CollectionStringBuffer.java |  57 +++
 .../camel/maven/connector/ConnectorMojo.java    | 501 +++++++++++++++++++
 .../camel/maven/connector/FileHelper.java       |  56 +++
 .../apache/camel/maven/connector/GitHelper.java | 123 +++++
 .../camel/maven/connector/JSonSchemaHelper.java | 356 +++++++++++++
 .../src/main/resources/META-INF/MANIFEST.MF     |   4 +
 connectors/pom.xml                              |   1 +
 parent/pom.xml                                  |   2 +
 9 files changed, 1190 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c473d0b9/connectors/camel-connector-maven-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/connectors/camel-connector-maven-plugin/pom.xml b/connectors/camel-connector-maven-plugin/pom.xml
new file mode 100644
index 0000000..6eaaf29
--- /dev/null
+++ b/connectors/camel-connector-maven-plugin/pom.xml
@@ -0,0 +1,90 @@
+<?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>connectors</artifactId>
+    <version>2.19.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>camel-connector-maven-plugin</artifactId>
+  <name>Camel :: Connector :: Camel Connector Maven Plugin</name>
+  <packaging>maven-plugin</packaging>
+
+  <dependencies>
+
+    <!-- we extend this existing maven plugin -->
+    <dependency>
+      <groupId>org.apache.maven.plugins</groupId>
+      <artifactId>maven-jar-plugin</artifactId>
+      <version>${maven-jar-plugin-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.plugin-tools</groupId>
+      <artifactId>maven-plugin-annotations</artifactId>
+      <version>3.2</version>
+      <scope>provided</scope>
+    </dependency>
+
+    <!-- use jackson json parser -->
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-core</artifactId>
+      <version>${jackson2-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-annotations</artifactId>
+      <version>${jackson2-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+      <version>${jackson2-version}</version>
+    </dependency>
+
+    <!-- logging -->
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <version>${slf4j-version}</version>
+      <scope>runtime</scope>
+    </dependency>
+
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <version>${maven-jar-plugin-version}</version>
+        <configuration>
+          <!-- must include our own dummy manifest -->
+          <archive>
+            <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
+          </archive>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/c473d0b9/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/CollectionStringBuffer.java
----------------------------------------------------------------------
diff --git a/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/CollectionStringBuffer.java b/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/CollectionStringBuffer.java
new file mode 100644
index 0000000..bd11654
--- /dev/null
+++ b/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/CollectionStringBuffer.java
@@ -0,0 +1,57 @@
+/**
+ * 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.maven.connector;
+
+public class CollectionStringBuffer {
+    private final StringBuilder buffer = new StringBuilder();
+    private String separator;
+    private boolean first = true;
+
+    public CollectionStringBuffer() {
+        this(", ");
+    }
+
+    public CollectionStringBuffer(String separator) {
+        this.separator = separator;
+    }
+
+    @Override
+    public String toString() {
+        return buffer.toString();
+    }
+
+    public void append(Object value) {
+        if (first) {
+            first = false;
+        } else {
+            buffer.append(separator);
+        }
+        buffer.append(value);
+    }
+
+    public String getSeparator() {
+        return separator;
+    }
+
+    public void setSeparator(String separator) {
+        this.separator = separator;
+    }
+
+    public boolean isEmpty() {
+        return first;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c473d0b9/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/ConnectorMojo.java
----------------------------------------------------------------------
diff --git a/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/ConnectorMojo.java b/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/ConnectorMojo.java
new file mode 100644
index 0000000..4683db7
--- /dev/null
+++ b/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/ConnectorMojo.java
@@ -0,0 +1,501 @@
+/**
+ * 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.maven.connector;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.LineNumberReader;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+import org.apache.maven.plugin.jar.AbstractJarMojo;
+
+@Mojo(name = "jar", defaultPhase = LifecyclePhase.PREPARE_PACKAGE, requiresProject = true, threadSafe = true,
+        requiresDependencyResolution = ResolutionScope.RUNTIME)
+public class ConnectorMojo extends AbstractJarMojo {
+
+    /**
+     * Directory containing the classes and resource files that should be packaged into the JAR.
+     */
+    @Parameter(defaultValue = "${project.build.outputDirectory}", required = true)
+    private File classesDirectory;
+
+    @Override
+    protected File getClassesDirectory() {
+        return classesDirectory;
+    }
+
+    @Override
+    protected String getClassifier() {
+        return "camel-connector";
+    }
+
+    @Override
+    protected String getType() {
+        return "jar";
+    }
+
+    @Override
+    public File createArchive() throws MojoExecutionException {
+
+        String gitUrl;
+
+        // find the component dependency and get its .json file
+
+        File file = new File(classesDirectory, "camel-connector.json");
+        if (file.exists()) {
+
+            // we want to include the git url of the project
+            File gitFolder = GitHelper.findGitFolder();
+            try {
+                gitUrl = GitHelper.extractGitUrl(gitFolder);
+            } catch (IOException e) {
+                throw new MojoExecutionException("Cannot extract gitUrl due " + e.getMessage(), e);
+            }
+            if (gitUrl == null) {
+                getLog().warn("No .git directory found for connector");
+            }
+
+            try {
+
+                ObjectMapper mapper = new ObjectMapper();
+                Map dto = mapper.readValue(file, Map.class);
+
+                // embed girUrl in camel-connector.json file
+                if (gitUrl != null) {
+                    String existingGitUrl = (String) dto.get("gitUrl");
+                    if (existingGitUrl == null || !existingGitUrl.equals(gitUrl)) {
+                        dto.put("gitUrl", gitUrl);
+                        // update file
+                        mapper.writerWithDefaultPrettyPrinter().writeValue(file, dto);
+                        // update source file also
+                        File root = classesDirectory.getParentFile().getParentFile();
+                        file = new File(root, "src/main/resources/camel-connector.json");
+                        if (file.exists()) {
+                            getLog().info("Updating gitUrl to " + file);
+                            mapper.writerWithDefaultPrettyPrinter().writeValue(file, dto);
+                        }
+                    }
+                }
+
+                File schema = embedCamelComponentSchema(file);
+                if (schema != null) {
+                    String json = FileHelper.loadText(new FileInputStream(schema));
+
+                    List<Map<String, String>> rows = JSonSchemaHelper.parseJsonSchema("component", json, false);
+                    String header = buildComponentHeaderSchema(rows, dto, gitUrl);
+                    getLog().debug(header);
+
+                    rows = JSonSchemaHelper.parseJsonSchema("componentProperties", json, true);
+                    // we do not offer editing component properties (yet) so clear the rows
+                    rows.clear();
+                    String componentOptions = buildComponentOptionsSchema(rows, dto);
+                    getLog().debug(componentOptions);
+
+                    rows = JSonSchemaHelper.parseJsonSchema("properties", json, true);
+                    String endpointOptions = buildEndpointOptionsSchema(rows, dto);
+                    getLog().debug(endpointOptions);
+
+                    // generate the json file
+                    StringBuilder jsonSchema = new StringBuilder();
+                    jsonSchema.append("{\n");
+                    jsonSchema.append(header);
+                    jsonSchema.append(componentOptions);
+                    jsonSchema.append(endpointOptions);
+                    jsonSchema.append("}\n");
+
+                    String newJson = jsonSchema.toString();
+
+                    // parse ourselves
+                    rows = JSonSchemaHelper.parseJsonSchema("component", newJson, false);
+                    String newScheme = getOption(rows, "scheme");
+
+                    // write the json file to the target directory as if camel apt would do it
+                    String javaType = (String) dto.get("javaType");
+                    String dir = javaType.substring(0, javaType.lastIndexOf("."));
+                    dir = dir.replace('.', '/');
+                    File subDir = new File(classesDirectory, dir);
+                    String name = newScheme + ".json";
+                    File out = new File(subDir, name);
+
+                    FileOutputStream fos = new FileOutputStream(out, false);
+                    fos.write(newJson.getBytes());
+                    fos.close();
+                }
+
+                // build json schema for component that only has the selectable options
+            } catch (Exception e) {
+                throw new MojoExecutionException("Error in connector-maven-plugin", e);
+            }
+        }
+
+        return super.createArchive();
+    }
+
+    private String extractJavaType(String scheme) throws Exception {
+        File file = new File(classesDirectory, "META-INF/services/org/apache/camel/component/" + scheme);
+        if (file.exists()) {
+            List<String> lines = loadFile(file);
+            String fqn = extractClass(lines);
+            return fqn;
+        }
+        return null;
+    }
+
+    private String getOption(List<Map<String, String>> rows, String key) {
+        for (Map<String, String> row : rows) {
+            if (row.containsKey(key)) {
+                return row.get(key);
+            }
+        }
+        return null;
+    }
+
+    private String buildComponentOptionsSchema(List<Map<String, String>> rows, Map dto) throws JsonProcessingException {
+        ObjectMapper mapper = new ObjectMapper();
+
+        StringBuilder sb = new StringBuilder();
+        sb.append("  \"componentProperties\": {\n");
+
+        for (int i = 0; i < rows.size(); i++) {
+            Map<String, String> row = rows.get(i);
+            String key = row.get("name");
+            row.remove("name");
+            String line = mapper.writeValueAsString(row);
+
+            sb.append("    \"" + key + "\": ");
+            sb.append(line);
+            if (i < rows.size() - 1) {
+                sb.append(",\n");
+            } else {
+                sb.append("\n");
+            }
+        }
+
+        sb.append("  },\n");
+        return sb.toString();
+    }
+
+    private String buildEndpointOptionsSchema(List<Map<String, String>> rows, Map dto) throws JsonProcessingException {
+        // find the endpoint options
+        List options = (List) dto.get("endpointOptions");
+        Map values = (Map) dto.get("endpointValues");
+
+        ObjectMapper mapper = new ObjectMapper();
+
+        StringBuilder sb = new StringBuilder();
+        sb.append("  \"properties\": {\n");
+
+        boolean first = true;
+        for (int i = 0; i < rows.size(); i++) {
+            Map<String, String> row = rows.get(i);
+            String key = row.get("name");
+            row.remove("name");
+
+            // TODO: if no options should we include all by default instead?
+            if (options == null || !options.contains(key)) {
+                continue;
+            }
+
+            // do we have a new default value for this row?
+            if (values != null && values.containsKey(key)) {
+                String newDefaultValue = (String) values.get(key);
+                if (newDefaultValue != null) {
+                    row.put("defaultValue", newDefaultValue);
+                }
+            }
+
+            // we should build the json as one-line which is how Camel does it today
+            // which makes its internal json parser support loading our generated schema file
+            String line = mapper.writeValueAsString(row);
+
+            if (!first) {
+                sb.append(",\n");
+            }
+            sb.append("    \"" + key + "\": ");
+            sb.append(line);
+
+            first = false;
+        }
+        if (!first) {
+            sb.append("\n");
+        }
+
+        sb.append("  }\n");
+        return sb.toString();
+    }
+
+    private String buildComponentHeaderSchema(List<Map<String, String>> rows, Map dto, String gitUrl) throws Exception {
+        String baseScheme = (String) dto.get("baseScheme");
+        String source = (String) dto.get("source");
+        String title = (String) dto.get("name");
+        String scheme = camelCaseToDash(title);
+        String baseSyntax = getOption(rows, "syntax");
+        String syntax = baseSyntax.replaceFirst(baseScheme, scheme);
+
+        String description = (String) dto.get("description");
+        // dto has labels
+        String label = null;
+        List<String> labels = (List<String>) dto.get("labels");
+        if (labels != null) {
+            CollectionStringBuffer csb = new CollectionStringBuffer(",");
+            for (String s : labels) {
+                csb.append(s);
+            }
+            label = csb.toString();
+        }
+        String async = getOption(rows, "async");
+        String producerOnly = "To".equals(source) ? "true" : null;
+        String consumerOnly = "From".equals(source) ? "true" : null;
+        String lenientProperties = getOption(rows, "lenientProperties");
+        String javaType = extractJavaType(scheme);
+        String groupId = getProject().getGroupId();
+        String artifactId = getProject().getArtifactId();
+        String version = getProject().getVersion();
+
+        StringBuilder sb = new StringBuilder();
+        sb.append("  \"component\": {\n");
+        sb.append("    \"girUrl\": \"" + nullSafe(gitUrl) + "\",\n");
+        sb.append("    \"kind\": \"component\",\n");
+        sb.append("    \"baseScheme\": \"" + nullSafe(baseScheme) + "\",\n");
+        sb.append("    \"scheme\": \"" + scheme + "\",\n");
+        sb.append("    \"syntax\": \"" + syntax + "\",\n");
+        sb.append("    \"title\": \"" + title + "\",\n");
+        if (description != null) {
+            sb.append("    \"description\": \"" + description + "\",\n");
+        }
+        if (label != null) {
+            sb.append("    \"label\": \"" + label + "\",\n");
+        }
+        sb.append("    \"deprecated\": \"false\",\n");
+        if (async != null) {
+            sb.append("    \"async\": \"" + async + "\",\n");
+        }
+        if (producerOnly != null) {
+            sb.append("    \"producerOnly\": \"" + producerOnly + "\",\n");
+        } else if (consumerOnly != null) {
+            sb.append("    \"consumerOnly\": \"" + consumerOnly + "\",\n");
+        }
+        if (lenientProperties != null) {
+            sb.append("    \"lenientProperties\": \"" + lenientProperties + "\",\n");
+        }
+        sb.append("    \"javaType\": \"" + javaType + "\",\n");
+        sb.append("    \"groupId\": \"" + groupId + "\",\n");
+        sb.append("    \"artifactId\": \"" + artifactId + "\",\n");
+        sb.append("    \"version\": \"" + version + "\"\n");
+        sb.append("  },\n");
+
+        return sb.toString();
+    }
+
+    private static String nullSafe(String text) {
+        return text != null ? text : "";
+    }
+
+    /**
+     * Finds and embeds the Camel component JSon schema file
+     */
+    private File embedCamelComponentSchema(File file) throws MojoExecutionException {
+        try {
+            List<String> json = loadFile(file);
+
+            String scheme = extractScheme(json);
+            String groupId = extractGroupId(json);
+            String artifactId = extractArtifactId(json);
+            String version = extractVersion(json); // version not in use
+
+            // find the artifact on the classpath that has the Camel component this connector is using
+            // then we want to grab its json schema file to embed in this JAR so we have all files together
+
+            if (scheme != null && groupId != null && artifactId != null) {
+                for (Object obj : getProject().getDependencyArtifacts()) {
+                    Artifact artifact = (Artifact) obj;
+                    if ("jar".equals(artifact.getType())) {
+                        if (groupId.equals(artifact.getGroupId()) && artifactId.equals(artifact.getArtifactId())) {
+                            // load the component file inside the file
+                            URL url = new URL("file:" + artifact.getFile());
+                            URLClassLoader child = new URLClassLoader(new URL[]{url}, this.getClass().getClassLoader());
+
+                            InputStream is = child.getResourceAsStream("META-INF/services/org/apache/camel/component/" + scheme);
+                            if (is != null) {
+                                List<String> lines = loadFile(is);
+                                String fqn = extractClass(lines);
+                                is.close();
+
+                                // only keep package
+                                String pck = fqn.substring(0, fqn.lastIndexOf("."));
+                                String name = pck.replace(".", "/") + "/" + scheme + ".json";
+
+                                is = child.getResourceAsStream(name);
+                                if (is != null) {
+                                    List<String> schema = loadFile(is);
+                                    is.close();
+
+                                    // write schema to file
+                                    File out = new File(classesDirectory, "camel-component-schema.json");
+                                    FileOutputStream fos = new FileOutputStream(out, false);
+                                    for (String line : schema) {
+                                        fos.write(line.getBytes());
+                                        fos.write("\n".getBytes());
+                                    }
+                                    fos.close();
+
+                                    getLog().info("Embedded camel-component-schema.json file for Camel component " + scheme);
+
+                                    return out;
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+
+        } catch (Exception e) {
+            throw new MojoExecutionException("Cannot read file camel-connector.json", e);
+        }
+
+        return null;
+    }
+
+    private String extractClass(List<String> lines) {
+        for (String line : lines) {
+            line = line.trim();
+            if (line.startsWith("class=")) {
+                return line.substring(6);
+            }
+        }
+        return null;
+    }
+
+    private String extractScheme(List<String> json) {
+        for (String line : json) {
+            line = line.trim();
+            if (line.startsWith("\"baseScheme\":")) {
+                String answer = line.substring(14);
+                return answer.substring(0, answer.length() - 2);
+            }
+        }
+        return null;
+    }
+
+    private String extractGroupId(List<String> json) {
+        for (String line : json) {
+            line = line.trim();
+            if (line.startsWith("\"baseGroupId\":")) {
+                String answer = line.substring(15);
+                return answer.substring(0, answer.length() - 2);
+            }
+        }
+        return null;
+    }
+
+    private String extractArtifactId(List<String> json) {
+        for (String line : json) {
+            line = line.trim();
+            if (line.startsWith("\"baseArtifactId\":")) {
+                String answer = line.substring(18);
+                return answer.substring(0, answer.length() - 2);
+            }
+        }
+        return null;
+    }
+
+    private String extractVersion(List<String> json) {
+        for (String line : json) {
+            line = line.trim();
+            if (line.startsWith("\"baseVersion\":")) {
+                String answer = line.substring(15);
+                return answer.substring(0, answer.length() - 2);
+            }
+        }
+        return null;
+    }
+
+    private List<String> loadFile(File file) throws Exception {
+        List<String> lines = new ArrayList<>();
+        LineNumberReader reader = new LineNumberReader(new FileReader(file));
+
+        String line;
+        do {
+            line = reader.readLine();
+            if (line != null) {
+                lines.add(line);
+            }
+        } while (line != null);
+        reader.close();
+
+        return lines;
+    }
+
+    private List<String> loadFile(InputStream fis) throws Exception {
+        List<String> lines = new ArrayList<>();
+        LineNumberReader reader = new LineNumberReader(new InputStreamReader(fis));
+
+        String line;
+        do {
+            line = reader.readLine();
+            if (line != null) {
+                lines.add(line);
+            }
+        } while (line != null);
+        reader.close();
+
+        return lines;
+    }
+
+    public static String camelCaseToDash(String value) {
+        StringBuilder sb = new StringBuilder(value.length());
+        boolean dash = false;
+
+        for (char c : value.toCharArray()) {
+            // skip dash in start
+            if (sb.length() > 0 & Character.isUpperCase(c)) {
+                dash = true;
+            }
+            if (dash) {
+                sb.append('-');
+                sb.append(Character.toLowerCase(c));
+            } else {
+                // lower case first
+                if (sb.length() == 0) {
+                    sb.append(Character.toLowerCase(c));
+                } else {
+                    sb.append(c);
+                }
+            }
+            dash = false;
+        }
+        return sb.toString();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c473d0b9/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/FileHelper.java
----------------------------------------------------------------------
diff --git a/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/FileHelper.java b/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/FileHelper.java
new file mode 100644
index 0000000..caecd16
--- /dev/null
+++ b/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/FileHelper.java
@@ -0,0 +1,56 @@
+/**
+ * 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.maven.connector;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.LineNumberReader;
+
+public class FileHelper {
+
+    /**
+     * Loads the entire stream into memory as a String and returns it.
+     * <p/>
+     * <b>Notice:</b> This implementation appends a <tt>\n</tt> as line
+     * terminator at the of the text.
+     * <p/>
+     * Warning, don't use for crazy big streams :)
+     */
+    public static String loadText(InputStream in) throws IOException {
+        StringBuilder builder = new StringBuilder();
+        InputStreamReader isr = new InputStreamReader(in);
+        try {
+            BufferedReader reader = new LineNumberReader(isr);
+            while (true) {
+                String line = reader.readLine();
+                if (line != null) {
+                    builder.append(line);
+                    builder.append("\n");
+                } else {
+                    break;
+                }
+            }
+            return builder.toString();
+        } finally {
+            isr.close();
+            in.close();
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c473d0b9/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/GitHelper.java
----------------------------------------------------------------------
diff --git a/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/GitHelper.java b/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/GitHelper.java
new file mode 100644
index 0000000..92c50ee
--- /dev/null
+++ b/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/GitHelper.java
@@ -0,0 +1,123 @@
+/**
+ * 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.maven.connector;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.HashMap;
+import java.util.Map;
+
+public class GitHelper {
+
+    public static File findGitFolder() {
+        File baseDir = new File("").getAbsoluteFile();
+        return findGitFolder(baseDir);
+    }
+
+    private static File findGitFolder(File basedir) {
+        File gitDir = new File(basedir, ".git");
+        if (gitDir.exists() && gitDir.isDirectory()) {
+            return gitDir;
+        }
+
+        File parent = basedir.getParentFile();
+        if (parent != null) {
+            return findGitFolder(parent);
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * Returns the remote git URL for the given folder; looking for the .git/config file in the current directory or a parent directory
+     */
+    public static String extractGitUrl(File basedir) throws IOException {
+        if (basedir == null) {
+            return null;
+        }
+        if (basedir.exists() && basedir.isDirectory()) {
+            File gitConfig = new File(basedir, ".git/config");
+            if (gitConfig.isFile() && gitConfig.exists()) {
+                String text = FileHelper.loadText(new FileInputStream(gitConfig));
+                return extractGitUrl(text);
+            }
+        }
+        File parentFile = basedir.getParentFile();
+        if (parentFile != null) {
+            return extractGitUrl(parentFile);
+        }
+        return null;
+    }
+
+    /**
+     * Returns the remote git URL for the given git config file text lets extract the
+     */
+    private static String extractGitUrl(String configText) {
+        String remote = null;
+        String lastUrl = null;
+        String firstUrl = null;
+        BufferedReader reader = new BufferedReader(new StringReader(configText));
+        Map<String, String> remoteUrls = new HashMap<>();
+        while (true) {
+            String line = null;
+            try {
+                line = reader.readLine();
+            } catch (IOException e) {
+                // ignore should never happen!
+            }
+            if (line == null) {
+                break;
+            }
+            if (line.startsWith("[remote ")) {
+                String[] parts = line.split("\"");
+                if (parts.length > 1) {
+                    remote = parts[1];
+                }
+            } else if (line.startsWith("[")) {
+                remote = null;
+            } else if (remote != null && line.length() > 0 && Character.isWhitespace(line.charAt(0))) {
+                String trimmed = line.trim();
+                if (trimmed.startsWith("url ")) {
+                    String[] parts = trimmed.split("=", 2);
+                    if (parts.length > 1) {
+                        lastUrl = parts[1].trim();
+                        if (firstUrl == null) {
+                            firstUrl = lastUrl;
+                        }
+                        remoteUrls.put(remote, lastUrl);
+                    }
+                }
+
+            }
+        }
+        String answer = null;
+        if (remoteUrls.size() == 1) {
+            return lastUrl;
+        } else if (remoteUrls.size() > 1) {
+            answer = remoteUrls.get("origin");
+            if (answer == null) {
+                answer = firstUrl;
+            }
+        }
+        return answer;
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c473d0b9/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/JSonSchemaHelper.java
----------------------------------------------------------------------
diff --git a/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/JSonSchemaHelper.java b/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/JSonSchemaHelper.java
new file mode 100644
index 0000000..d42e5e3
--- /dev/null
+++ b/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/JSonSchemaHelper.java
@@ -0,0 +1,356 @@
+/**
+ * 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.maven.connector;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public final class JSonSchemaHelper {
+
+    private static final Pattern PATTERN = Pattern.compile("\"(.+?)\"|\\[(.+)\\]");
+    private static final String QUOT = "&quot;";
+
+    private JSonSchemaHelper() {
+    }
+
+    /**
+     * Parses the json schema to split it into a list or rows, where each row contains key value pairs with the metadata
+     *
+     * @param group the group to parse from such as <tt>component</tt>, <tt>componentProperties</tt>, or <tt>properties</tt>.
+     * @param json the json
+     * @return a list of all the rows, where each row is a set of key value pairs with metadata
+     */
+    public static List<Map<String, String>> parseJsonSchema(String group, String json, boolean parseProperties) {
+        List<Map<String, String>> answer = new ArrayList<Map<String, String>>();
+        if (json == null) {
+            return answer;
+        }
+
+        boolean found = false;
+
+        // parse line by line
+        String[] lines = json.split("\n");
+        for (String line : lines) {
+            // we need to find the group first
+            if (!found) {
+                String s = line.trim();
+                found = s.startsWith("\"" + group + "\":") && s.endsWith("{");
+                continue;
+            }
+
+            // we should stop when we end the group
+            if (line.equals("  },") || line.equals("  }")) {
+                break;
+            }
+
+            // need to safe encode \" so we can parse the line
+            line = line.replaceAll("\"\\\\\"\"", '"' + QUOT + '"');
+
+            Map<String, String> row = new LinkedHashMap<String, String>();
+            Matcher matcher = PATTERN.matcher(line);
+
+            String key;
+            if (parseProperties) {
+                // when parsing properties the first key is given as name, so the first parsed token is the value of the name
+                key = "name";
+            } else {
+                key = null;
+            }
+            while (matcher.find()) {
+                if (key == null) {
+                    key = matcher.group(1);
+                } else {
+                    String value = matcher.group(1);
+                    if (value == null) {
+                        value = matcher.group(2);
+                        // its an enum so strip out " and trim spaces after comma
+                        value = value.replaceAll("\"", "");
+                        value = value.replaceAll(", ", ",");
+                    }
+                    if (value != null) {
+                        value = value.trim();
+                        // decode
+                        value = value.replaceAll(QUOT, "\"");
+                        value = decodeJson(value);
+                    }
+                    row.put(key, value);
+                    // reset
+                    key = null;
+                }
+            }
+            if (!row.isEmpty()) {
+                answer.add(row);
+            }
+        }
+
+        return answer;
+    }
+
+    private static String decodeJson(String value) {
+        // json encodes a \ as \\ so we need to decode from \\ back to \
+        if ("\\\\".equals(value)) {
+            value = "\\";
+        }
+        return value;
+    }
+
+    public static boolean isComponentLenientProperties(List<Map<String, String>> rows) {
+        for (Map<String, String> row : rows) {
+            if (row.containsKey("lenientProperties")) {
+                return "true".equals(row.get("lenientProperties"));
+            }
+        }
+        return false;
+    }
+
+    public static boolean isPropertyRequired(List<Map<String, String>> rows, String name) {
+        for (Map<String, String> row : rows) {
+            boolean required = false;
+            boolean found = false;
+            if (row.containsKey("name")) {
+                found = name.equals(row.get("name"));
+            }
+            if (row.containsKey("required")) {
+                required = "true".equals(row.get("required"));
+            }
+            if (found) {
+                return required;
+            }
+        }
+        return false;
+    }
+
+    public static String getPropertyKind(List<Map<String, String>> rows, String name) {
+        for (Map<String, String> row : rows) {
+            String kind = null;
+            boolean found = false;
+            if (row.containsKey("name")) {
+                found = name.equals(row.get("name"));
+            }
+            if (row.containsKey("kind")) {
+                kind = row.get("kind");
+            }
+            if (found) {
+                return kind;
+            }
+        }
+        return null;
+    }
+
+    public static boolean isPropertyBoolean(List<Map<String, String>> rows, String name) {
+        for (Map<String, String> row : rows) {
+            String type = null;
+            boolean found = false;
+            if (row.containsKey("name")) {
+                found = name.equals(row.get("name"));
+            }
+            if (row.containsKey("type")) {
+                type = row.get("type");
+            }
+            if (found) {
+                return "boolean".equals(type);
+            }
+        }
+        return false;
+    }
+
+    public static boolean isPropertyInteger(List<Map<String, String>> rows, String name) {
+        for (Map<String, String> row : rows) {
+            String type = null;
+            boolean found = false;
+            if (row.containsKey("name")) {
+                found = name.equals(row.get("name"));
+            }
+            if (row.containsKey("type")) {
+                type = row.get("type");
+            }
+            if (found) {
+                return "integer".equals(type);
+            }
+        }
+        return false;
+    }
+
+    public static boolean isPropertyNumber(List<Map<String, String>> rows, String name) {
+        for (Map<String, String> row : rows) {
+            String type = null;
+            boolean found = false;
+            if (row.containsKey("name")) {
+                found = name.equals(row.get("name"));
+            }
+            if (row.containsKey("type")) {
+                type = row.get("type");
+            }
+            if (found) {
+                return "number".equals(type);
+            }
+        }
+        return false;
+    }
+
+    public static boolean isPropertyObject(List<Map<String, String>> rows, String name) {
+        for (Map<String, String> row : rows) {
+            String type = null;
+            boolean found = false;
+            if (row.containsKey("name")) {
+                found = name.equals(row.get("name"));
+            }
+            if (row.containsKey("type")) {
+                type = row.get("type");
+            }
+            if (found) {
+                return "object".equals(type);
+            }
+        }
+        return false;
+    }
+
+    public static String getPropertyDefaultValue(List<Map<String, String>> rows, String name) {
+        for (Map<String, String> row : rows) {
+            String defaultValue = null;
+            boolean found = false;
+            if (row.containsKey("name")) {
+                found = name.equals(row.get("name"));
+            }
+            if (row.containsKey("defaultValue")) {
+                defaultValue = row.get("defaultValue");
+            }
+            if (found) {
+                return defaultValue;
+            }
+        }
+        return null;
+    }
+
+    public static String stripOptionalPrefixFromName(List<Map<String, String>> rows, String name) {
+        for (Map<String, String> row : rows) {
+            String optionalPrefix = null;
+            boolean found = false;
+            if (row.containsKey("optionalPrefix")) {
+                optionalPrefix = row.get("optionalPrefix");
+            }
+            if (row.containsKey("name")) {
+                if (optionalPrefix != null && name.startsWith(optionalPrefix)) {
+                    name = name.substring(optionalPrefix.length());
+                    // try again
+                    return stripOptionalPrefixFromName(rows, name);
+                } else {
+                    found = name.equals(row.get("name"));
+                }
+            }
+            if (found) {
+                return name;
+            }
+        }
+        return name;
+    }
+
+    public static String getPropertyEnum(List<Map<String, String>> rows, String name) {
+        for (Map<String, String> row : rows) {
+            String enums = null;
+            boolean found = false;
+            if (row.containsKey("name")) {
+                found = name.equals(row.get("name"));
+            }
+            if (row.containsKey("enum")) {
+                enums = row.get("enum");
+            }
+            if (found) {
+                return enums;
+            }
+        }
+        return null;
+    }
+
+    public static String getPropertyPrefix(List<Map<String, String>> rows, String name) {
+        for (Map<String, String> row : rows) {
+            String prefix = null;
+            boolean found = false;
+            if (row.containsKey("name")) {
+                found = name.equals(row.get("name"));
+            }
+            if (row.containsKey("prefix")) {
+                prefix = row.get("prefix");
+            }
+            if (found) {
+                return prefix;
+            }
+        }
+        return null;
+    }
+
+    public static boolean isPropertyMultiValue(List<Map<String, String>> rows, String name) {
+        for (Map<String, String> row : rows) {
+            boolean multiValue = false;
+            boolean found = false;
+            if (row.containsKey("name")) {
+                found = name.equals(row.get("name"));
+            }
+            if (row.containsKey("multiValue")) {
+                multiValue = "true".equals(row.get("multiValue"));
+            }
+            if (found) {
+                return multiValue;
+            }
+        }
+        return false;
+    }
+
+    public static String getPropertyNameFromNameWithPrefix(List<Map<String, String>> rows, String name) {
+        for (Map<String, String> row : rows) {
+            String propertyName = null;
+            boolean found = false;
+            if (row.containsKey("name")) {
+                propertyName = row.get("name");
+            }
+            if (row.containsKey("prefix")) {
+                String preifx = row.get("prefix");
+                found = name.startsWith(preifx);
+            }
+            if (found) {
+                return propertyName;
+            }
+        }
+        return null;
+    }
+
+    public static Map<String, String> getRow(List<Map<String, String>> rows, String key) {
+        for (Map<String, String> row : rows) {
+            if (key.equals(row.get("name"))) {
+                return row;
+            }
+        }
+        return null;
+    }
+
+    public static Set<String> getNames(List<Map<String, String>> rows) {
+        Set<String> answer = new LinkedHashSet<String>();
+        for (Map<String, String> row : rows) {
+            if (row.containsKey("name")) {
+                answer.add(row.get("name"));
+            }
+        }
+        return answer;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c473d0b9/connectors/camel-connector-maven-plugin/src/main/resources/META-INF/MANIFEST.MF
----------------------------------------------------------------------
diff --git a/connectors/camel-connector-maven-plugin/src/main/resources/META-INF/MANIFEST.MF b/connectors/camel-connector-maven-plugin/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..8428f49
--- /dev/null
+++ b/connectors/camel-connector-maven-plugin/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,4 @@
+Manifest-Version: 1.0
+Implementation-Title: Camel :: Connector :: Camel Connector Maven Plugin
+Implementation-Vendor: The Apache Software Foundation
+Implementation-Vendor-Id: org.apache.camel

http://git-wip-us.apache.org/repos/asf/camel/blob/c473d0b9/connectors/pom.xml
----------------------------------------------------------------------
diff --git a/connectors/pom.xml b/connectors/pom.xml
index 43e285d..acb3aef 100644
--- a/connectors/pom.xml
+++ b/connectors/pom.xml
@@ -33,6 +33,7 @@
 
   <modules>
     <module>camel-connector</module>
+    <module>camel-connector-maven-plugin</module>
   </modules>
 
 </project>

http://git-wip-us.apache.org/repos/asf/camel/blob/c473d0b9/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 180a989..15c3330 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -425,6 +425,8 @@
     <maven-jar-plugin-version>2.6</maven-jar-plugin-version>
     <maven-javadoc-plugin-version>2.9.1</maven-javadoc-plugin-version>
     <maven-jboss-as-maven-plugin-version>7.7.Final</maven-jboss-as-maven-plugin-version>
+    <!-- plugin-plugin 3.5 does not work -->
+    <maven-plugin-plugin-version>3.4</maven-plugin-plugin-version>
     <maven-remote-resources-plugin-version>1.5</maven-remote-resources-plugin-version>
     <!-- resources plugin needed by Camel maven archetypes -->
     <maven-resources-plugin-version>3.0.1</maven-resources-plugin-version>


[10/17] camel git commit: CAMEL-10721: camel-connector example

Posted by da...@apache.org.
CAMEL-10721: camel-connector example


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5d20447c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5d20447c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5d20447c

Branch: refs/heads/master
Commit: 5d20447ca4c095bc196eae39082134afb6e8be15
Parents: 38b0ff8
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jan 18 16:26:51 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 19 11:00:00 2017 +0100

----------------------------------------------------------------------
 connectors/examples/beverage-component/pom.xml  |  93 +++++++++
 .../java/org/beverage/BeverageComponent.java    |  40 ++++
 .../java/org/beverage/BeverageEndpoint.java     |  78 +++++++
 .../java/org/beverage/BeverageProducer.java     |  42 ++++
 .../src/main/java/org/beverage/Beverages.java   |  22 ++
 .../src/main/resources/META-INF/LICENSE.txt     | 203 +++++++++++++++++++
 .../src/main/resources/META-INF/NOTICE.txt      |  11 +
 .../org/apache/camel/component/beverage         |  18 ++
 .../test/java/org/beverage/BeverageTest.java    |  46 +++++
 .../src/test/resources/log4j2.properties        |  30 +++
 connectors/examples/pom.xml                     |  38 ++++
 connectors/pom.xml                              |   1 +
 12 files changed, 622 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/5d20447c/connectors/examples/beverage-component/pom.xml
----------------------------------------------------------------------
diff --git a/connectors/examples/beverage-component/pom.xml b/connectors/examples/beverage-component/pom.xml
new file mode 100644
index 0000000..369b777
--- /dev/null
+++ b/connectors/examples/beverage-component/pom.xml
@@ -0,0 +1,93 @@
+<?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>connectors-examples</artifactId>
+    <version>2.19.0-SNAPSHOT</version>
+    <relativePath>..</relativePath>
+  </parent>
+
+  <artifactId>beverage-component</artifactId>
+  <name>Camel :: Connectors :: Examples :: Beverage Component</name>
+  <description>Camel Beverage Component</description>
+  <packaging>jar</packaging>
+
+  <dependencies>
+
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-api</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-slf4j-impl</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <!-- use the Camel apt compiler plugin -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>apt</artifactId>
+      <version>${project.version}</version>
+      <scope>provided</scope>
+    </dependency>
+
+  </dependencies>
+
+  <build>
+    <plugins>
+      <!-- use Camel plugins to generate component details -->
+      <plugin>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-package-maven-plugin</artifactId>
+        <version>${project.version}</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>generate-components-list</goal>
+            </goals>
+            <phase>generate-resources</phase>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/5d20447c/connectors/examples/beverage-component/src/main/java/org/beverage/BeverageComponent.java
----------------------------------------------------------------------
diff --git a/connectors/examples/beverage-component/src/main/java/org/beverage/BeverageComponent.java b/connectors/examples/beverage-component/src/main/java/org/beverage/BeverageComponent.java
new file mode 100644
index 0000000..c42b926
--- /dev/null
+++ b/connectors/examples/beverage-component/src/main/java/org/beverage/BeverageComponent.java
@@ -0,0 +1,40 @@
+/**
+ * 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.beverage;
+
+import java.util.Map;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.impl.UriEndpointComponent;
+
+public class BeverageComponent extends UriEndpointComponent {
+
+    public BeverageComponent() {
+        super(BeverageEndpoint.class);
+    }
+
+    @Override
+    protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
+        BeverageEndpoint answer = new BeverageEndpoint(uri, this);
+
+        Beverages drink = getCamelContext().getTypeConverter().mandatoryConvertTo(Beverages.class, remaining);
+        answer.setDrink(drink);
+
+        setProperties(answer, parameters);
+        return answer;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/5d20447c/connectors/examples/beverage-component/src/main/java/org/beverage/BeverageEndpoint.java
----------------------------------------------------------------------
diff --git a/connectors/examples/beverage-component/src/main/java/org/beverage/BeverageEndpoint.java b/connectors/examples/beverage-component/src/main/java/org/beverage/BeverageEndpoint.java
new file mode 100644
index 0000000..d333b59
--- /dev/null
+++ b/connectors/examples/beverage-component/src/main/java/org/beverage/BeverageEndpoint.java
@@ -0,0 +1,78 @@
+/**
+ * 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.beverage;
+
+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.Metadata;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
+
+@UriEndpoint(scheme = "beverage", syntax = "beverage:drink", title = "Beverage", label = "bar", producerOnly = true)
+public class BeverageEndpoint extends DefaultEndpoint {
+
+    @UriPath @Metadata(required = "true")
+    private Beverages drink;
+
+    @UriParam(defaultValue = "1")
+    private int amount = 1;
+
+    public BeverageEndpoint(String endpointUri, Component component) {
+        super(endpointUri, component);
+    }
+
+    @Override
+    public Producer createProducer() throws Exception {
+        return new BeverageProducer(this, drink, amount);
+    }
+
+    @Override
+    public Consumer createConsumer(Processor processor) throws Exception {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean isSingleton() {
+        return true;
+    }
+
+    public Beverages getDrink() {
+        return drink;
+    }
+
+    /**
+     * What drink to order
+     */
+    public void setDrink(Beverages drink) {
+        this.drink = drink;
+    }
+
+    public int getAmount() {
+        return amount;
+    }
+
+    /**
+     * Number of drinks in the order
+     */
+    public void setAmount(int amount) {
+        this.amount = amount;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/5d20447c/connectors/examples/beverage-component/src/main/java/org/beverage/BeverageProducer.java
----------------------------------------------------------------------
diff --git a/connectors/examples/beverage-component/src/main/java/org/beverage/BeverageProducer.java b/connectors/examples/beverage-component/src/main/java/org/beverage/BeverageProducer.java
new file mode 100644
index 0000000..c93e87c
--- /dev/null
+++ b/connectors/examples/beverage-component/src/main/java/org/beverage/BeverageProducer.java
@@ -0,0 +1,42 @@
+/**
+ * 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.beverage;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.impl.DefaultProducer;
+
+public class BeverageProducer extends DefaultProducer {
+
+    private final Beverages drink;
+    private final int amount;
+
+    private transient int total;
+
+    public BeverageProducer(Endpoint endpoint, Beverages drink, int amount) {
+        super(endpoint);
+        this.drink = drink;
+        this.amount = amount;
+    }
+
+    @Override
+    public void process(Exchange exchange) throws Exception {
+        total += amount;
+
+        exchange.getIn().setBody("Total " + total + " of " + drink.name().toLowerCase() + " ordered");
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/5d20447c/connectors/examples/beverage-component/src/main/java/org/beverage/Beverages.java
----------------------------------------------------------------------
diff --git a/connectors/examples/beverage-component/src/main/java/org/beverage/Beverages.java b/connectors/examples/beverage-component/src/main/java/org/beverage/Beverages.java
new file mode 100644
index 0000000..bf8435b
--- /dev/null
+++ b/connectors/examples/beverage-component/src/main/java/org/beverage/Beverages.java
@@ -0,0 +1,22 @@
+/**
+ * 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.beverage;
+
+public enum Beverages {
+
+    Beer, GinTonic, Wine
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/5d20447c/connectors/examples/beverage-component/src/main/resources/META-INF/LICENSE.txt
----------------------------------------------------------------------
diff --git a/connectors/examples/beverage-component/src/main/resources/META-INF/LICENSE.txt b/connectors/examples/beverage-component/src/main/resources/META-INF/LICENSE.txt
new file mode 100755
index 0000000..6b0b127
--- /dev/null
+++ b/connectors/examples/beverage-component/src/main/resources/META-INF/LICENSE.txt
@@ -0,0 +1,203 @@
+
+                                 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/5d20447c/connectors/examples/beverage-component/src/main/resources/META-INF/NOTICE.txt
----------------------------------------------------------------------
diff --git a/connectors/examples/beverage-component/src/main/resources/META-INF/NOTICE.txt b/connectors/examples/beverage-component/src/main/resources/META-INF/NOTICE.txt
new file mode 100755
index 0000000..2e215bf
--- /dev/null
+++ b/connectors/examples/beverage-component/src/main/resources/META-INF/NOTICE.txt
@@ -0,0 +1,11 @@
+   =========================================================================
+   ==  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.

http://git-wip-us.apache.org/repos/asf/camel/blob/5d20447c/connectors/examples/beverage-component/src/main/resources/META-INF/services/org/apache/camel/component/beverage
----------------------------------------------------------------------
diff --git a/connectors/examples/beverage-component/src/main/resources/META-INF/services/org/apache/camel/component/beverage b/connectors/examples/beverage-component/src/main/resources/META-INF/services/org/apache/camel/component/beverage
new file mode 100644
index 0000000..068b108
--- /dev/null
+++ b/connectors/examples/beverage-component/src/main/resources/META-INF/services/org/apache/camel/component/beverage
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+class=org.beverage.BeverageComponent
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/5d20447c/connectors/examples/beverage-component/src/test/java/org/beverage/BeverageTest.java
----------------------------------------------------------------------
diff --git a/connectors/examples/beverage-component/src/test/java/org/beverage/BeverageTest.java b/connectors/examples/beverage-component/src/test/java/org/beverage/BeverageTest.java
new file mode 100644
index 0000000..3d6f5c0
--- /dev/null
+++ b/connectors/examples/beverage-component/src/test/java/org/beverage/BeverageTest.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.beverage;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class BeverageTest extends CamelTestSupport {
+
+    @Test
+    public void testBeverage() throws Exception {
+        getMockEndpoint("mock:result").expectedBodiesReceived("Total 2 of wine ordered");
+
+        template.sendBody("direct:bar", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RoutesBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:bar")
+                    .to("beverage:wine?amount=2")
+                    .to("mock:result");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/5d20447c/connectors/examples/beverage-component/src/test/resources/log4j2.properties
----------------------------------------------------------------------
diff --git a/connectors/examples/beverage-component/src/test/resources/log4j2.properties b/connectors/examples/beverage-component/src/test/resources/log4j2.properties
new file mode 100644
index 0000000..108152a
--- /dev/null
+++ b/connectors/examples/beverage-component/src/test/resources/log4j2.properties
@@ -0,0 +1,30 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+appender.file.type = File
+appender.file.name = file
+appender.file.fileName = target/camel-beverage-test.log
+appender.file.layout.type = PatternLayout
+appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+appender.out.type = Console
+appender.out.name = out
+appender.out.layout.type = PatternLayout
+appender.out.layout.pattern = [%30.30t] %-30.30c{1} %-5p %m%n
+logger.converter.name = org.apache.camel.impl.converter
+logger.converter.level = INFO
+rootLogger.level = INFO
+rootLogger.appenderRef.file.ref = file

http://git-wip-us.apache.org/repos/asf/camel/blob/5d20447c/connectors/examples/pom.xml
----------------------------------------------------------------------
diff --git a/connectors/examples/pom.xml b/connectors/examples/pom.xml
new file mode 100644
index 0000000..07f93c7
--- /dev/null
+++ b/connectors/examples/pom.xml
@@ -0,0 +1,38 @@
+<?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>connectors</artifactId>
+    <version>2.19.0-SNAPSHOT</version>
+    <relativePath>..</relativePath>
+  </parent>
+
+  <artifactId>connectors-examples</artifactId>
+  <name>Camel :: Connectors :: Examples</name>
+  <description>Camel Connectors Examples</description>
+  <packaging>pom</packaging>
+
+  <modules>
+    <module>beverage-component</module>
+  </modules>
+
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/5d20447c/connectors/pom.xml
----------------------------------------------------------------------
diff --git a/connectors/pom.xml b/connectors/pom.xml
index acb3aef..de66bc8 100644
--- a/connectors/pom.xml
+++ b/connectors/pom.xml
@@ -34,6 +34,7 @@
   <modules>
     <module>camel-connector</module>
     <module>camel-connector-maven-plugin</module>
+    <module>examples</module>
   </modules>
 
 </project>