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/04/11 08:46:41 UTC

[1/3] camel git commit: CAMEL-11126: add petstore connector for example

Repository: camel
Updated Branches:
  refs/heads/master 5be6f68fe -> c912cd8ae


CAMEL-11126: add petstore connector for example


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

Branch: refs/heads/master
Commit: b04d6a83f7feb3ffbfcc35ce841f110d131e16c7
Parents: 5be6f68
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Apr 10 13:14:53 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Apr 11 10:39:57 2017 +0200

----------------------------------------------------------------------
 .../examples/petstore-connector/Readme.md       |   6 +
 connectors/examples/petstore-connector/pom.xml  | 192 +++++++++++++++++++
 .../org/foo/connector/PetStoreComponent.java    |  27 +++
 .../PetStoreConnectorAutoConfiguration.java     |  59 ++++++
 .../PetStoreConnectorConfiguration.java         |  28 +++
 .../org/apache/camel/component/petstore         |  18 ++
 .../main/resources/META-INF/spring.factories    |  19 ++
 .../main/resources/camel-connector-schema.json  |  25 +++
 .../src/main/resources/camel-connector.json     |  22 +++
 connectors/examples/pom.xml                     |   4 +-
 10 files changed, 399 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/b04d6a83/connectors/examples/petstore-connector/Readme.md
----------------------------------------------------------------------
diff --git a/connectors/examples/petstore-connector/Readme.md b/connectors/examples/petstore-connector/Readme.md
new file mode 100644
index 0000000..68891d0
--- /dev/null
+++ b/connectors/examples/petstore-connector/Readme.md
@@ -0,0 +1,6 @@
+## PetStore Connector
+
+This is a basic Camel connector that is based on the Rest Swagger component from Apache Camel.
+
+The connector is configured to call the Swagger PetStore API online service every 5th second
+and return a list of pets in json format.

http://git-wip-us.apache.org/repos/asf/camel/blob/b04d6a83/connectors/examples/petstore-connector/pom.xml
----------------------------------------------------------------------
diff --git a/connectors/examples/petstore-connector/pom.xml b/connectors/examples/petstore-connector/pom.xml
new file mode 100644
index 0000000..f129d55
--- /dev/null
+++ b/connectors/examples/petstore-connector/pom.xml
@@ -0,0 +1,192 @@
+<?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>
+
+  <groupId>org.foo</groupId>
+  <artifactId>petstore-connector</artifactId>
+  <name>Camel :: Connectors :: Examples :: PetStore Connector</name>
+  <description>PetStore 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>
+
+    <!-- component -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-rest-swagger</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <!-- camel and spring boot compiler plugins -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>apt</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-configuration-processor</artifactId>
+      <version>${spring-boot-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>
+
+      <!-- turn off jar plugin as we use connector plugin to jar instead -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <version>${maven-jar-plugin-version}</version>
+        <executions>
+          <execution>
+            <id>default-jar</id>
+            <phase/>
+          </execution>
+        </executions>
+      </plugin>
+
+      <!-- connector plugin will build the jar -->
+      <plugin>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-connector-maven-plugin</artifactId>
+        <version>${project.version}</version>
+        <executions>
+          <execution>
+            <id>boot</id>
+            <goals>
+              <goal>prepare-spring-boot-auto-configuration</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>connector</id>
+            <goals>
+              <goal>jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
+    </plugins>
+  </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/b04d6a83/connectors/examples/petstore-connector/src/main/java/org/foo/connector/PetStoreComponent.java
----------------------------------------------------------------------
diff --git a/connectors/examples/petstore-connector/src/main/java/org/foo/connector/PetStoreComponent.java b/connectors/examples/petstore-connector/src/main/java/org/foo/connector/PetStoreComponent.java
new file mode 100644
index 0000000..11c2bb9
--- /dev/null
+++ b/connectors/examples/petstore-connector/src/main/java/org/foo/connector/PetStoreComponent.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 PetStoreComponent extends DefaultConnectorComponent {
+
+    public PetStoreComponent() {
+        super("petstore", "org.foo.connector.PetStoreComponent");
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/b04d6a83/connectors/examples/petstore-connector/src/main/java/org/foo/connector/springboot/PetStoreConnectorAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/connectors/examples/petstore-connector/src/main/java/org/foo/connector/springboot/PetStoreConnectorAutoConfiguration.java b/connectors/examples/petstore-connector/src/main/java/org/foo/connector/springboot/PetStoreConnectorAutoConfiguration.java
new file mode 100644
index 0000000..b2739c5
--- /dev/null
+++ b/connectors/examples/petstore-connector/src/main/java/org/foo/connector/springboot/PetStoreConnectorAutoConfiguration.java
@@ -0,0 +1,59 @@
+/**
+ * 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.springboot;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.camel.CamelContext;
+import org.apache.camel.util.IntrospectionSupport;
+import org.foo.connector.PetStoreComponent;
+import org.springframework.boot.autoconfigure.AutoConfigureAfter;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Lazy;
+
+/**
+ * Generated by camel-connector-maven-plugin - do not edit this file!
+ */
+@Configuration
+@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@EnableConfigurationProperties(PetStoreConnectorConfiguration.class)
+public class PetStoreConnectorAutoConfiguration {
+
+    @Lazy
+    @Bean(name = "petstore-component")
+    @ConditionalOnClass(CamelContext.class)
+    @ConditionalOnMissingBean(org.foo.connector.PetStoreComponent.class)
+    public PetStoreComponent configurePetStoreComponent(
+            CamelContext camelContext,
+            PetStoreConnectorConfiguration configuration) throws Exception {
+        PetStoreComponent connector = new PetStoreComponent();
+        connector.setCamelContext(camelContext);
+        Map<String, Object> parameters = new HashMap<>();
+        IntrospectionSupport.getProperties(configuration, parameters, null,
+                false);
+        IntrospectionSupport.setProperties(camelContext,
+                camelContext.getTypeConverter(), connector, parameters);
+        connector.setComponentOptions(parameters);
+        return connector;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/b04d6a83/connectors/examples/petstore-connector/src/main/java/org/foo/connector/springboot/PetStoreConnectorConfiguration.java
----------------------------------------------------------------------
diff --git a/connectors/examples/petstore-connector/src/main/java/org/foo/connector/springboot/PetStoreConnectorConfiguration.java b/connectors/examples/petstore-connector/src/main/java/org/foo/connector/springboot/PetStoreConnectorConfiguration.java
new file mode 100644
index 0000000..88409ab
--- /dev/null
+++ b/connectors/examples/petstore-connector/src/main/java/org/foo/connector/springboot/PetStoreConnectorConfiguration.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.connector.springboot;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * An awesome REST endpoint backed by Swagger specifications.
+ * 
+ * Generated by camel-connector-maven-plugin - do not edit this file!
+ */
+@ConfigurationProperties(prefix = "camel.connector.petstore")
+public class PetStoreConnectorConfiguration {
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/b04d6a83/connectors/examples/petstore-connector/src/main/resources/META-INF/services/org/apache/camel/component/petstore
----------------------------------------------------------------------
diff --git a/connectors/examples/petstore-connector/src/main/resources/META-INF/services/org/apache/camel/component/petstore b/connectors/examples/petstore-connector/src/main/resources/META-INF/services/org/apache/camel/component/petstore
new file mode 100644
index 0000000..3344d63
--- /dev/null
+++ b/connectors/examples/petstore-connector/src/main/resources/META-INF/services/org/apache/camel/component/petstore
@@ -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.PetStoreComponent
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/b04d6a83/connectors/examples/petstore-connector/src/main/resources/META-INF/spring.factories
----------------------------------------------------------------------
diff --git a/connectors/examples/petstore-connector/src/main/resources/META-INF/spring.factories b/connectors/examples/petstore-connector/src/main/resources/META-INF/spring.factories
new file mode 100644
index 0000000..1a5d3bd
--- /dev/null
+++ b/connectors/examples/petstore-connector/src/main/resources/META-INF/spring.factories
@@ -0,0 +1,19 @@
+#
+# 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.
+#
+
+org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
+org.foo.connector.springboot.PetStoreConnectorAutoConfiguration

http://git-wip-us.apache.org/repos/asf/camel/blob/b04d6a83/connectors/examples/petstore-connector/src/main/resources/camel-connector-schema.json
----------------------------------------------------------------------
diff --git a/connectors/examples/petstore-connector/src/main/resources/camel-connector-schema.json b/connectors/examples/petstore-connector/src/main/resources/camel-connector-schema.json
new file mode 100644
index 0000000..d2e33ed
--- /dev/null
+++ b/connectors/examples/petstore-connector/src/main/resources/camel-connector-schema.json
@@ -0,0 +1,25 @@
+{
+  "component": {
+    "kind": "component",
+    "baseScheme": "rest-swagger",
+    "scheme": "petstore",
+    "syntax": "petstore:specificationUri#operationId",
+    "title": "PetStore",
+    "description": "Pets in the store",
+    "label": "api,rest",
+    "deprecated": false,
+    "async": false,
+    "producerOnly": true,
+    "lenientProperties": false,
+    "javaType": "org.foo.connector.PetStoreComponent",
+    "groupId": "org.foo",
+    "artifactId": "petstore-connector",
+    "version": "2.19.0-SNAPSHOT"
+  },
+  "componentProperties": {
+  },
+  "properties": {
+    "specificationUri": { "kind": "path", "displayName": "Specification Uri", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.net.URI", "deprecated": false, "secret": false, "defaultValue": "http://petstore.swagger.io/v2/swagger.json", "description": "Path to the Swagger specification file. The scheme host base path are taken from this specification but these can be overriden with properties on the component or endpoint level. If not given the component tries to load swagger.json resource. Note that the host defined on the component and endpoint of this Component should contain the scheme hostname and optionally the port in the URI syntax (i.e. https://api.example.com:8080). Overrides component configuration." },
+    "operationId": { "kind": "path", "displayName": "Operation Id", "group": "producer", "label": "producer", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "ID of the operation from the Swagger specification." }
+  }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b04d6a83/connectors/examples/petstore-connector/src/main/resources/camel-connector.json
----------------------------------------------------------------------
diff --git a/connectors/examples/petstore-connector/src/main/resources/camel-connector.json b/connectors/examples/petstore-connector/src/main/resources/camel-connector.json
new file mode 100644
index 0000000..fdc9d26
--- /dev/null
+++ b/connectors/examples/petstore-connector/src/main/resources/camel-connector.json
@@ -0,0 +1,22 @@
+{
+  "baseScheme": "rest-swagger",
+  "baseGroupId": "org.apache.camel",
+  "baseArtifactId": "camel-rest-swagger",
+  "baseVersion": "2.19.0-SNAPSHOT",
+  "baseJavaType": "org.apache.camel.component.rest.swagger.RestSwaggerComponent",
+  "name": "PetStore",
+  "scheme": "petstore",
+  "javaType": "org.foo.connector.PetStoreComponent",
+  "groupId": "org.foo",
+  "artifactId": "petstore-connector",
+  "version": "2.19.0-SNAPSHOT",
+  "description": "Pets in the store",
+  "labels": [ "api", "rest" ],
+  "pattern": "To",
+  "inputDataType": "none",
+  "outputDataType": "json",
+  "endpointOptions": [ "specificationUri", "operationId" ],
+  "endpointValues": {
+    "specificationUri": "http://petstore.swagger.io/v2/swagger.json"
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/b04d6a83/connectors/examples/pom.xml
----------------------------------------------------------------------
diff --git a/connectors/examples/pom.xml b/connectors/examples/pom.xml
index 2148263..15eeb81 100644
--- a/connectors/examples/pom.xml
+++ b/connectors/examples/pom.xml
@@ -14,7 +14,8 @@
   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">
+-->
+<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>
 
@@ -39,6 +40,7 @@
     <module>twitter-mention-connector</module>
     <module>twitter-salesforce-example</module>
     <module>salesforce-upsert-contact-connector</module>
+    <module>petstore-connector</module>
   </modules>
 
 </project>
\ No newline at end of file


[2/3] camel git commit: CAMEL-11126: add petstore connector for example

Posted by da...@apache.org.
CAMEL-11126: add petstore connector for example


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

Branch: refs/heads/master
Commit: 46ee93e0219d52f4791d6a2c075afcb2c4ba4fa2
Parents: b04d6a8
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Apr 10 13:35:24 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Apr 11 10:40:05 2017 +0200

----------------------------------------------------------------------
 connectors/examples/petstore-connector/pom.xml  |   5 +
 .../PetStoreConnectorConfiguration.java         |  21 +++
 .../main/resources/camel-connector-schema.json  |   2 +-
 .../src/main/resources/camel-connector.json     |   6 +-
 connectors/examples/petstore-example/Readme.md  |  26 ++++
 connectors/examples/petstore-example/pom.xml    | 127 +++++++++++++++++++
 .../main/java/org/foo/PetStoreApplication.java  |  34 +++++
 .../src/main/java/org/foo/PetStoreRoute.java    |  34 +++++
 .../src/main/resources/application.properties   |   3 +
 connectors/examples/pom.xml                     |   1 +
 10 files changed, 256 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/46ee93e0/connectors/examples/petstore-connector/pom.xml
----------------------------------------------------------------------
diff --git a/connectors/examples/petstore-connector/pom.xml b/connectors/examples/petstore-connector/pom.xml
index f129d55..369e796 100644
--- a/connectors/examples/petstore-connector/pom.xml
+++ b/connectors/examples/petstore-connector/pom.xml
@@ -68,6 +68,11 @@
       <artifactId>camel-rest-swagger</artifactId>
       <version>${project.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-undertow</artifactId>
+      <version>${project.version}</version>
+    </dependency>
 
     <!-- camel and spring boot compiler plugins -->
     <dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/46ee93e0/connectors/examples/petstore-connector/src/main/java/org/foo/connector/springboot/PetStoreConnectorConfiguration.java
----------------------------------------------------------------------
diff --git a/connectors/examples/petstore-connector/src/main/java/org/foo/connector/springboot/PetStoreConnectorConfiguration.java b/connectors/examples/petstore-connector/src/main/java/org/foo/connector/springboot/PetStoreConnectorConfiguration.java
index 88409ab..0ae5ef3 100644
--- a/connectors/examples/petstore-connector/src/main/java/org/foo/connector/springboot/PetStoreConnectorConfiguration.java
+++ b/connectors/examples/petstore-connector/src/main/java/org/foo/connector/springboot/PetStoreConnectorConfiguration.java
@@ -16,6 +16,7 @@
  */
 package org.foo.connector.springboot;
 
+import java.net.URI;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 
 /**
@@ -25,4 +26,24 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
  */
 @ConfigurationProperties(prefix = "camel.connector.petstore")
 public class PetStoreConnectorConfiguration {
+
+    /**
+     * Path to the Swagger specification file. The scheme host base path are
+     * taken from this specification but these can be overriden with properties
+     * on the component or endpoint level. If not given the component tries to
+     * load swagger.json resource. Note that the host defined on the component
+     * and endpoint of this Component should contain the scheme hostname and
+     * optionally the port in the URI syntax (i.e.
+     * https://api.example.com:8080). Can be overriden in endpoint
+     * configuration.
+     */
+    private URI specificationUri;
+
+    public URI getSpecificationUri() {
+        return specificationUri;
+    }
+
+    public void setSpecificationUri(URI specificationUri) {
+        this.specificationUri = specificationUri;
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/46ee93e0/connectors/examples/petstore-connector/src/main/resources/camel-connector-schema.json
----------------------------------------------------------------------
diff --git a/connectors/examples/petstore-connector/src/main/resources/camel-connector-schema.json b/connectors/examples/petstore-connector/src/main/resources/camel-connector-schema.json
index d2e33ed..3018d5b 100644
--- a/connectors/examples/petstore-connector/src/main/resources/camel-connector-schema.json
+++ b/connectors/examples/petstore-connector/src/main/resources/camel-connector-schema.json
@@ -17,9 +17,9 @@
     "version": "2.19.0-SNAPSHOT"
   },
   "componentProperties": {
+    "specificationUri": { "kind": "property", "displayName": "Specification Uri", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.net.URI", "deprecated": false, "secret": false, "defaultValue": "http://petstore.swagger.io/v2/swagger.json", "description": "Path to the Swagger specification file. The scheme host base path are taken from this specification but these can be overriden with properties on the component or endpoint level. If not given the component tries to load swagger.json resource. Note that the host defined on the component and endpoint of this Component should contain the scheme hostname and optionally the port in the URI syntax (i.e. https://api.example.com:8080). Can be overiden in endpoint configuration." }
   },
   "properties": {
-    "specificationUri": { "kind": "path", "displayName": "Specification Uri", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.net.URI", "deprecated": false, "secret": false, "defaultValue": "http://petstore.swagger.io/v2/swagger.json", "description": "Path to the Swagger specification file. The scheme host base path are taken from this specification but these can be overriden with properties on the component or endpoint level. If not given the component tries to load swagger.json resource. Note that the host defined on the component and endpoint of this Component should contain the scheme hostname and optionally the port in the URI syntax (i.e. https://api.example.com:8080). Overrides component configuration." },
     "operationId": { "kind": "path", "displayName": "Operation Id", "group": "producer", "label": "producer", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "ID of the operation from the Swagger specification." }
   }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/46ee93e0/connectors/examples/petstore-connector/src/main/resources/camel-connector.json
----------------------------------------------------------------------
diff --git a/connectors/examples/petstore-connector/src/main/resources/camel-connector.json b/connectors/examples/petstore-connector/src/main/resources/camel-connector.json
index fdc9d26..7039fbc 100644
--- a/connectors/examples/petstore-connector/src/main/resources/camel-connector.json
+++ b/connectors/examples/petstore-connector/src/main/resources/camel-connector.json
@@ -15,8 +15,10 @@
   "pattern": "To",
   "inputDataType": "none",
   "outputDataType": "json",
-  "endpointOptions": [ "specificationUri", "operationId" ],
-  "endpointValues": {
+  "componentOptions": [ "specificationUri" ],
+  "globalOptions": [ "specificationUri" ],
+  "endpointOptions": [ "operationId" ],
+  "componentValues": {
     "specificationUri": "http://petstore.swagger.io/v2/swagger.json"
   }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/46ee93e0/connectors/examples/petstore-example/Readme.md
----------------------------------------------------------------------
diff --git a/connectors/examples/petstore-example/Readme.md b/connectors/examples/petstore-example/Readme.md
new file mode 100644
index 0000000..60e717b
--- /dev/null
+++ b/connectors/examples/petstore-example/Readme.md
@@ -0,0 +1,26 @@
+## 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.
+
+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/46ee93e0/connectors/examples/petstore-example/pom.xml
----------------------------------------------------------------------
diff --git a/connectors/examples/petstore-example/pom.xml b/connectors/examples/petstore-example/pom.xml
new file mode 100644
index 0000000..851ed33
--- /dev/null
+++ b/connectors/examples/petstore-example/pom.xml
@@ -0,0 +1,127 @@
+<?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>
+
+  <groupId>org.foo</groupId>
+  <artifactId>petstore-example</artifactId>
+  <name>Camel :: Connectors :: Examples :: PetStore Example</name>
+  <description>PetStore Example</description>
+  <packaging>jar</packaging>
+
+  <dependencyManagement>
+    <dependencies>
+      <!-- Spring Boot BOM -->
+      <dependency>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-dependencies</artifactId>
+        <version>${spring-boot-version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+      <!-- Camel BOM -->
+      <dependency>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-spring-boot-dependencies</artifactId>
+        <version>${project.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+
+    <!-- spring-boot -->
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-web</artifactId>
+      <version>${spring-boot-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-actuator</artifactId>
+      <version>${spring-boot-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-undertow</artifactId>
+      <version>${spring-boot-version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring-boot-starter</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <!-- connectors used in this example -->
+    <dependency>
+      <groupId>org.foo</groupId>
+      <artifactId>petstore-connector</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+  </dependencies>
+
+  <build>
+
+    <plugins>
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+        <version>${spring-boot-version}</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>repackage</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+  <profiles>
+    <profile>
+      <id>jdk9-build</id>
+      <activation>
+        <jdk>9</jdk>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <configuration>
+              <argLine>--add-modules java.xml.bind</argLine>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/46ee93e0/connectors/examples/petstore-example/src/main/java/org/foo/PetStoreApplication.java
----------------------------------------------------------------------
diff --git a/connectors/examples/petstore-example/src/main/java/org/foo/PetStoreApplication.java b/connectors/examples/petstore-example/src/main/java/org/foo/PetStoreApplication.java
new file mode 100644
index 0000000..04ba954
--- /dev/null
+++ b/connectors/examples/petstore-example/src/main/java/org/foo/PetStoreApplication.java
@@ -0,0 +1,34 @@
+/**
+ * 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.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+//CHECKSTYLE:OFF
+@SpringBootApplication
+public class PetStoreApplication {
+
+    /**
+     * A main method to start this application.
+     */
+    public static void main(String[] args) {
+        SpringApplication.run(PetStoreApplication.class, args);
+    }
+
+}
+//CHECKSTYLE:ON
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/46ee93e0/connectors/examples/petstore-example/src/main/java/org/foo/PetStoreRoute.java
----------------------------------------------------------------------
diff --git a/connectors/examples/petstore-example/src/main/java/org/foo/PetStoreRoute.java b/connectors/examples/petstore-example/src/main/java/org/foo/PetStoreRoute.java
new file mode 100644
index 0000000..9287f99
--- /dev/null
+++ b/connectors/examples/petstore-example/src/main/java/org/foo/PetStoreRoute.java
@@ -0,0 +1,34 @@
+/**
+ * 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;
+import org.springframework.stereotype.Component;
+
+/**
+ * Camel route that uses the petstore connector
+ */
+@Component
+public class PetStoreRoute extends RouteBuilder {
+
+    @Override
+    public void configure() throws Exception {
+        from("timer:store?period=5000")
+            .to("petstore?operationId=getInventory")
+            .log("Pets in the store ${body}");
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/46ee93e0/connectors/examples/petstore-example/src/main/resources/application.properties
----------------------------------------------------------------------
diff --git a/connectors/examples/petstore-example/src/main/resources/application.properties b/connectors/examples/petstore-example/src/main/resources/application.properties
new file mode 100644
index 0000000..23023fe
--- /dev/null
+++ b/connectors/examples/petstore-example/src/main/resources/application.properties
@@ -0,0 +1,3 @@
+camel.springboot.name=PetStore
+
+camel.connector.petstore.specification-uri=http://petstore.swagger.io/v2/swagger.json
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/46ee93e0/connectors/examples/pom.xml
----------------------------------------------------------------------
diff --git a/connectors/examples/pom.xml b/connectors/examples/pom.xml
index 15eeb81..49eaa84 100644
--- a/connectors/examples/pom.xml
+++ b/connectors/examples/pom.xml
@@ -41,6 +41,7 @@
     <module>twitter-salesforce-example</module>
     <module>salesforce-upsert-contact-connector</module>
     <module>petstore-connector</module>
+    <module>petstore-example</module>
   </modules>
 
 </project>
\ No newline at end of file


[3/3] camel git commit: CAMEL-11126: allow connector to be scheduled

Posted by da...@apache.org.
CAMEL-11126: allow connector to be scheduled


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

Branch: refs/heads/master
Commit: c912cd8aec6d81ba9080dada179db71a10457b9a
Parents: 46ee93e
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Apr 11 10:46:13 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Apr 11 10:46:13 2017 +0200

----------------------------------------------------------------------
 .../camel/maven/connector/ConnectorMojo.java    |  20 ++++
 .../SpringBootAutoConfigurationMojo.java        |   2 +-
 .../maven/connector/model/ComponentModel.java   |   6 --
 .../component/connector/ConnectorModel.java     |  21 ++++
 .../connector/DefaultConnectorComponent.java    | 105 +++++++++++++++++--
 .../SchedulerTimerConnectorEndpoint.java        |  79 ++++++++++++++
 .../main/resources/camel-connector-schema.json  |   7 +-
 .../src/main/resources/camel-connector.json     |   8 +-
 connectors/examples/petstore-example/Readme.md  |  34 +++---
 .../src/main/java/org/foo/PetStoreRoute.java    |   3 +-
 .../src/main/resources/application.properties   |   1 +
 11 files changed, 249 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c912cd8a/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 3894b4f..2f6d95e 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
@@ -24,6 +24,7 @@ import java.io.InputStream;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.Arrays;
+import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
@@ -282,6 +283,25 @@ public class ConnectorMojo extends AbstractJarMojo {
         Map values = (Map) dto.get("endpointValues");
         Map overrides = (Map) dto.get("endpointOverrides");
 
+        // if the dto is scheduled then we need to add timer options
+        if ("timer".equals(dto.get("scheduler"))) {
+            // include the period option from the timer as we use that
+            Map<String, String> period = new LinkedHashMap<>();
+            period.put("name", "schedulerPeriod");
+            period.put("kind", "parameter");
+            period.put("displayName", "Period");
+            period.put("group", "consumer");
+            period.put("type", "integer");
+            period.put("javaType", "long");
+            period.put("deprecated", "false");
+            period.put("secret", "false");
+            period.put("defaultValue", "1000");
+            period.put("description", "Delay in milli seconds between scheduling (executing)");
+
+            getLog().debug("Connector is using scheduler: timer");
+            rows.add(period);
+        }
+
         StringBuilder sb = new StringBuilder();
         sb.append("  \"properties\": {\n");
 

http://git-wip-us.apache.org/repos/asf/camel/blob/c912cd8a/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/SpringBootAutoConfigurationMojo.java
----------------------------------------------------------------------
diff --git a/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/SpringBootAutoConfigurationMojo.java b/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/SpringBootAutoConfigurationMojo.java
index ba4ddbb..997878a 100644
--- a/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/SpringBootAutoConfigurationMojo.java
+++ b/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/SpringBootAutoConfigurationMojo.java
@@ -408,7 +408,7 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
     private static ComponentModel generateComponentModel(String json) {
         List<Map<String, String>> rows = JSonSchemaHelper.parseJsonSchema("component", json, false);
 
-        ComponentModel component = new ComponentModel(true);
+        ComponentModel component = new ComponentModel();
         component.setScheme(getSafeValue("scheme", rows));
         component.setSyntax(getSafeValue("syntax", rows));
         component.setAlternativeSyntax(getSafeValue("alternativeSyntax", rows));

http://git-wip-us.apache.org/repos/asf/camel/blob/c912cd8a/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/model/ComponentModel.java
----------------------------------------------------------------------
diff --git a/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/model/ComponentModel.java b/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/model/ComponentModel.java
index d5cd4d2..2cacb78 100644
--- a/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/model/ComponentModel.java
+++ b/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/model/ComponentModel.java
@@ -21,8 +21,6 @@ import java.util.List;
 
 public class ComponentModel {
 
-    private final boolean coreOnly;
-
     private String kind;
     private String scheme;
     private String syntax;
@@ -41,10 +39,6 @@ public class ComponentModel {
     private String version;
     private final List<ComponentOptionModel> componentOptions = new ArrayList<ComponentOptionModel>();
 
-    public ComponentModel(boolean coreOnly) {
-        this.coreOnly = coreOnly;
-    }
-
     public String getKind() {
         return kind;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/c912cd8a/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/ConnectorModel.java
----------------------------------------------------------------------
diff --git a/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/ConnectorModel.java b/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/ConnectorModel.java
index 12da630..3d14336 100644
--- a/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/ConnectorModel.java
+++ b/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/ConnectorModel.java
@@ -44,6 +44,7 @@ final class ConnectorModel {
     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_SCHEME_PATTERN = Pattern.compile("\"baseScheme\"\\s?:\\s?\"([\\w|.-]+)\".*");
+    private static final Pattern SCHEDULER_PATTERN = Pattern.compile("\"scheduler\"\\s?:\\s?\"([\\w|.-]+)\".*");
     private static final Pattern INPUT_DATA_TYPE_PATTERN = Pattern.compile("\"inputDataType\"\\s?:\\s?\"(\\*|[\\w|.:*]+)\".*");
     private static final Pattern OUTPUT_DATA_TYPE_PATTERN = Pattern.compile("\"outputDataType\"\\s?:\\s?\"([\\w|.:*]+)\".*");
 
@@ -53,6 +54,7 @@ final class ConnectorModel {
 
     private String baseScheme;
     private String baseJavaType;
+    private String scheduler;
     private String connectorJSon;
     private String connectorName;
     private DataType inputDataType;
@@ -90,6 +92,14 @@ final class ConnectorModel {
         return baseJavaType;
     }
 
+    public String getScheduler() {
+        if (scheduler == null) {
+            scheduler = extractScheduler(lines.get());
+        }
+
+        return scheduler;
+    }
+
     public String getConnectorName() {
         if (connectorName == null) {
             connectorName = extractName(lines.get());
@@ -223,6 +233,17 @@ final class ConnectorModel {
         return null;
     }
 
+    private static String extractScheduler(List<String> json) {
+        for (String line : json) {
+            line = line.trim();
+            Matcher matcher = SCHEDULER_PATTERN.matcher(line);
+            if (matcher.matches()) {
+                return matcher.group(1);
+            }
+        }
+        return null;
+    }
+
     private static String extractBaseScheme(List<String> json) {
         for (String line : json) {
             line = line.trim();

http://git-wip-us.apache.org/repos/asf/camel/blob/c912cd8a/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
index 4f3fd15..192ebf1 100644
--- 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
@@ -18,7 +18,9 @@ package org.apache.camel.component.connector;
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Modifier;
+import java.net.URI;
 import java.net.URISyntaxException;
+import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
@@ -33,6 +35,7 @@ import org.apache.camel.impl.DefaultComponent;
 import org.apache.camel.impl.verifier.ResultBuilder;
 import org.apache.camel.impl.verifier.ResultErrorBuilder;
 import org.apache.camel.util.IntrospectionSupport;
+import org.apache.camel.util.URISupport;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -63,12 +66,18 @@ public abstract class DefaultConnectorComponent extends DefaultComponent impleme
 
     @Override
     protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
+        // if we extracted any scheduler query parameters we would need to rebuild the uri without them
+        int before = parameters.size();
+        Map<String, Object> schedulerOptions = extractSchedulerOptions(parameters);
+        int after = parameters.size();
+        if (schedulerOptions != null && before != after) {
+            URI u = new URI(uri);
+            u = URISupport.createRemainingURI(u, parameters);
+            uri = u.toString();
+        }
+        // grab the regular query parameters
         Map<String, String> options = buildEndpointOptions(remaining, parameters);
 
-        // clean-up parameters so that validation won't fail later on
-        // in DefaultConnectorComponent.validateParameters()
-        parameters.clear();
-
         String scheme = model.getBaseScheme();
 
         // now create the endpoint instance which either happens with a new
@@ -84,7 +93,21 @@ public abstract class DefaultConnectorComponent extends DefaultComponent impleme
             log.info("Connector resolved: {} -> {}", sanitizeUri(uri), sanitizeUri(delegateUri));
         }
 
-        return new DefaultConnectorEndpoint(uri, this, delegate, model.getInputDataType(), model.getOutputDataType());
+        Endpoint answer;
+        // are we scheduler based?
+        if ("timer".equals(model.getScheduler())) {
+            SchedulerTimerConnectorEndpoint endpoint = new SchedulerTimerConnectorEndpoint(uri, this, delegate, model.getInputDataType(), model.getOutputDataType());
+            setProperties(endpoint, schedulerOptions);
+            answer = endpoint;
+        } else {
+            answer = new DefaultConnectorEndpoint(uri, this, delegate, model.getInputDataType(), model.getOutputDataType());
+        }
+
+        // clean-up parameters so that validation won't fail later on
+        // in DefaultConnectorComponent.validateParameters()
+        parameters.clear();
+
+        return answer;
     }
 
     @Override
@@ -296,6 +319,53 @@ public abstract class DefaultConnectorComponent extends DefaultComponent impleme
         return null;
     }
 
+    /**
+     * Extracts the scheduler options from the parameters.
+     * <p/>
+     * These options start with <tt>scheduler</tt> in their key name, such as <tt>schedulerPeriod</tt>
+     * which is removed from parameters, and transformed into keys without the <tt>scheduler</tt> prefix.
+     *
+     * @return the scheduler options, or <tt>null</tt> if scheduler not enabled
+     */
+    private Map<String, Object> extractSchedulerOptions(Map<String, Object> parameters) {
+        if (model.getScheduler() != null) {
+            // include default options first
+            Map<String, Object> answer = new LinkedHashMap<>();
+            model.getDefaultEndpointOptions().forEach((key, value) -> {
+                String schedulerKey = asSchedulerKey(key);
+                if (schedulerKey != null) {
+                    answer.put(schedulerKey, value);
+                }
+            });
+
+            // and then override with from parameters
+            for (Iterator<Map.Entry<String, Object>> it = parameters.entrySet().iterator(); it.hasNext();) {
+                Map.Entry<String, Object> entry = it.next();
+                String schedulerKey = asSchedulerKey(entry.getKey());
+                if (schedulerKey != null) {
+                    Object value = entry.getValue();
+                    answer.put(schedulerKey, value);
+                    // and remove as it should not be part of regular parameters
+                    it.remove();
+                }
+            }
+            return answer;
+        }
+
+        return null;
+    }
+
+    private static String asSchedulerKey(String key) {
+        if (key.startsWith("scheduler")) {
+            String name = key.substring(9);
+            // and lower case first char
+            name = Character.toLowerCase(name.charAt(0)) + name.substring(1);
+            return name;
+        } else {
+            return null;
+        }
+    }
+
     private Map<String, String> buildEndpointOptions(String remaining, Map<String, Object> parameters) throws URISyntaxException {
         String scheme = model.getBaseScheme();
         Map<String, String> defaultOptions = model.getDefaultEndpointOptions();
@@ -305,8 +375,13 @@ public abstract class DefaultConnectorComponent extends DefaultComponent impleme
 
         // default options from connector json
         if (!defaultOptions.isEmpty()) {
-            defaultOptions.forEach((k, v) -> addConnectorOption(options, k, v));
+            defaultOptions.forEach((key, value) -> {
+                if (isValidConnectionOption(key, value)) {
+                    addConnectorOption(options, key, value);
+                }
+            });
         }
+
         // options from query parameters
         for (Map.Entry<String, Object> entry : parameters.entrySet()) {
             String key = entry.getKey();
@@ -314,7 +389,9 @@ public abstract class DefaultConnectorComponent extends DefaultComponent impleme
             if (entry.getValue() != null) {
                 value = entry.getValue().toString();
             }
-            addConnectorOption(options, key, value);
+            if (isValidConnectionOption(key, value)) {
+                addConnectorOption(options, key, value);
+            }
         }
 
         // add extra options from remaining (context-path)
@@ -322,13 +399,25 @@ public abstract class DefaultConnectorComponent extends DefaultComponent impleme
             String targetUri = scheme + ":" + remaining;
             Map<String, String> extra = catalog.endpointProperties(targetUri);
             if (extra != null && !extra.isEmpty()) {
-                extra.forEach((k, v) -> addConnectorOption(options, k, v));
+                extra.forEach((key, value) -> {
+                    if (isValidConnectionOption(key, value)) {
+                        addConnectorOption(options, key, value);
+                    }
+                });
             }
         }
 
         return options;
     }
 
+    private boolean isValidConnectionOption(String key, String value) {
+        // skip specific option if its a scheduler
+        if (model.getScheduler() != null && asSchedulerKey(key) != null) {
+            return false;
+        }
+        return true;
+    }
+
     private static Constructor getPublicDefaultConstructor(Class<?> clazz) {
         for (Constructor ctr : clazz.getConstructors()) {
             if (Modifier.isPublic(ctr.getModifiers()) && ctr.getParameterCount() == 0) {

http://git-wip-us.apache.org/repos/asf/camel/blob/c912cd8a/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/SchedulerTimerConnectorEndpoint.java
----------------------------------------------------------------------
diff --git a/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/SchedulerTimerConnectorEndpoint.java b/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/SchedulerTimerConnectorEndpoint.java
new file mode 100644
index 0000000..c8c4e9d
--- /dev/null
+++ b/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/SchedulerTimerConnectorEndpoint.java
@@ -0,0 +1,79 @@
+/**
+ * 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.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Processor;
+import org.apache.camel.api.management.ManagedAttribute;
+import org.apache.camel.api.management.ManagedResource;
+import org.apache.camel.processor.Pipeline;
+
+/**
+ * A connector which is scheduler based from a timer endpoint. This allows to use a connector from a Camel route that
+ * is scheduled. For example a foo connector would otherwise have to be manually scheduled, eg
+ * <pre>
+ *     from("timer:something?period=2000")
+ *       .to("foo:hello")
+ *       .log("Foo says ${body}");
+ * </pre>
+ * .. can now be done without the manual timer
+ * <pre>
+ *     from("foo:hello?schedulePeriod=2000")
+ *       .log("Foo says ${body}");
+ * </pre>
+ * <p/>
+ * This requires the connector to have configured: <tt>"scheduler": "timer"</tt> such as shown in the petstore-connector.
+ */
+@ManagedResource(description = "Managed Scheduled TimerConnector Endpoint")
+public class SchedulerTimerConnectorEndpoint extends DefaultConnectorEndpoint {
+
+    private long period = 1000;
+
+    public SchedulerTimerConnectorEndpoint(String endpointUri, ConnectorComponent component, Endpoint endpoint, DataType inputDataType, DataType outputDataType) {
+        super(endpointUri, component, endpoint, inputDataType, outputDataType);
+    }
+
+    @Override
+    public Consumer createConsumer(Processor processor) throws Exception {
+        // special as we are scheduler based and then need to create a timer consumer that then calls the producer
+        List<Processor> children = new ArrayList<>(2);
+        children.add(createProducer());
+        children.add(processor);
+        Processor pipeline = Pipeline.newInstance(getCamelContext(), children);
+
+        // create a timer consumer which wraps calling the producer and then the intended processor
+        String name = getComponent().getComponentName();
+        String uri = "timer:" + name + "?period=" + period;
+
+        Consumer consumer = getCamelContext().getEndpoint(uri).createConsumer(pipeline);
+        configureConsumer(consumer);
+        return consumer;
+    }
+
+    @ManagedAttribute(description = "Delay in milli seconds between scheduling (executing)")
+    public long getPeriod() {
+        return period;
+    }
+
+    public void setPeriod(long period) {
+        this.period = period;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c912cd8a/connectors/examples/petstore-connector/src/main/resources/camel-connector-schema.json
----------------------------------------------------------------------
diff --git a/connectors/examples/petstore-connector/src/main/resources/camel-connector-schema.json b/connectors/examples/petstore-connector/src/main/resources/camel-connector-schema.json
index 3018d5b..17302d8 100644
--- a/connectors/examples/petstore-connector/src/main/resources/camel-connector-schema.json
+++ b/connectors/examples/petstore-connector/src/main/resources/camel-connector-schema.json
@@ -9,7 +9,7 @@
     "label": "api,rest",
     "deprecated": false,
     "async": false,
-    "producerOnly": true,
+    "consumerOnly": true,
     "lenientProperties": false,
     "javaType": "org.foo.connector.PetStoreComponent",
     "groupId": "org.foo",
@@ -17,9 +17,10 @@
     "version": "2.19.0-SNAPSHOT"
   },
   "componentProperties": {
-    "specificationUri": { "kind": "property", "displayName": "Specification Uri", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.net.URI", "deprecated": false, "secret": false, "defaultValue": "http://petstore.swagger.io/v2/swagger.json", "description": "Path to the Swagger specification file. The scheme host base path are taken from this specification but these can be overriden with properties on the component or endpoint level. If not given the component tries to load swagger.json resource. Note that the host defined on the component and endpoint of this Component should contain the scheme hostname and optionally the port in the URI syntax (i.e. https://api.example.com:8080). Can be overiden in endpoint configuration." }
+    "specificationUri": { "kind": "property", "displayName": "Specification Uri", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.net.URI", "deprecated": false, "secret": false, "defaultValue": "http://petstore.swagger.io/v2/swagger.json", "description": "Path to the Swagger specification file. The scheme host base path are taken from this specification but these can be overriden with properties on the component or endpoint level. If not given the component tries to load swagger.json resource. Note that the host defined on the component and endpoint of this Component should contain the scheme hostname and optionally the port in the URI syntax (i.e. https://api.example.com:8080). Can be overriden in endpoint configuration." }
   },
   "properties": {
-    "operationId": { "kind": "path", "displayName": "Operation Id", "group": "producer", "label": "producer", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "ID of the operation from the Swagger specification." }
+    "operationId": { "kind": "path", "displayName": "Operation Id", "group": "producer", "label": "producer", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "ID of the operation from the Swagger specification." },
+    "schedulerPeriod": { "kind": "parameter", "displayName": "Period", "group": "consumer", "required": false, "type": "integer", "javaType": "long", "deprecated": false, "secret": false, "defaultValue": 5000, "description": "Delay in milli seconds between scheduling (executing)" }
   }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/c912cd8a/connectors/examples/petstore-connector/src/main/resources/camel-connector.json
----------------------------------------------------------------------
diff --git a/connectors/examples/petstore-connector/src/main/resources/camel-connector.json b/connectors/examples/petstore-connector/src/main/resources/camel-connector.json
index 7039fbc..463c5e5 100644
--- a/connectors/examples/petstore-connector/src/main/resources/camel-connector.json
+++ b/connectors/examples/petstore-connector/src/main/resources/camel-connector.json
@@ -12,13 +12,17 @@
   "version": "2.19.0-SNAPSHOT",
   "description": "Pets in the store",
   "labels": [ "api", "rest" ],
-  "pattern": "To",
+  "pattern": "From",
+  "scheduler": "timer",
   "inputDataType": "none",
   "outputDataType": "json",
   "componentOptions": [ "specificationUri" ],
   "globalOptions": [ "specificationUri" ],
-  "endpointOptions": [ "operationId" ],
+  "endpointOptions": [ "operationId", "schedulerPeriod" ],
   "componentValues": {
     "specificationUri": "http://petstore.swagger.io/v2/swagger.json"
+  },
+  "endpointValues": {
+    "schedulerPeriod": 5000
   }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/c912cd8a/connectors/examples/petstore-example/Readme.md
----------------------------------------------------------------------
diff --git a/connectors/examples/petstore-example/Readme.md b/connectors/examples/petstore-example/Readme.md
index 60e717b..873a67e 100644
--- a/connectors/examples/petstore-example/Readme.md
+++ b/connectors/examples/petstore-example/Readme.md
@@ -1,26 +1,30 @@
-## Foo Bar and Wine Example
+## PetStore 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.
+This is an example that uses the `petstore` Camel connectors.
 
 ### How to run
 
 This example can be run from the command line using:
 
-    mvn camel:run
-    
-### Apache Camel IDEA Plugin
+    mvn spring-boot:run
     
-You can use tooling such as the Apache Camel IDEA Plugin to offer code assistance while create the Camel route.
+### Scheduled connector
+
+The `petstore` connector is a scheduled connector which means it has built-in
+a Camel `timer` endpoint as the starting point, so you start from the connector
+in a Camel route as shown below:
+
+```
+    from("petstore?operationId=getInventory&schedulerPeriod=2000")
+        .log("Pets in the store ${body}");
 
-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.
+```
 
-The following screenshot shows hows the `foo` connector only has two options to configure:
+What happens is that Camel will transform this into a route that looks like:
 
-![Foo Connector in IDEA](img/foo-connector-options-idea.png?raw=true)
+```
+    from("timer:petstore?period=2000")
+        .to("petstore?operationId=getInventory")
+        .log("Pets in the store ${body}");
 
+```
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/c912cd8a/connectors/examples/petstore-example/src/main/java/org/foo/PetStoreRoute.java
----------------------------------------------------------------------
diff --git a/connectors/examples/petstore-example/src/main/java/org/foo/PetStoreRoute.java b/connectors/examples/petstore-example/src/main/java/org/foo/PetStoreRoute.java
index 9287f99..cd22f83 100644
--- a/connectors/examples/petstore-example/src/main/java/org/foo/PetStoreRoute.java
+++ b/connectors/examples/petstore-example/src/main/java/org/foo/PetStoreRoute.java
@@ -27,8 +27,7 @@ public class PetStoreRoute extends RouteBuilder {
 
     @Override
     public void configure() throws Exception {
-        from("timer:store?period=5000")
-            .to("petstore?operationId=getInventory")
+        from("petstore?operationId=getInventory&schedulerPeriod=2000")
             .log("Pets in the store ${body}");
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/c912cd8a/connectors/examples/petstore-example/src/main/resources/application.properties
----------------------------------------------------------------------
diff --git a/connectors/examples/petstore-example/src/main/resources/application.properties b/connectors/examples/petstore-example/src/main/resources/application.properties
index 23023fe..e9ab8a5 100644
--- a/connectors/examples/petstore-example/src/main/resources/application.properties
+++ b/connectors/examples/petstore-example/src/main/resources/application.properties
@@ -1,3 +1,4 @@
 camel.springboot.name=PetStore
 
+# the url for the swagger doc
 camel.connector.petstore.specification-uri=http://petstore.swagger.io/v2/swagger.json
\ No newline at end of file