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 2015/03/15 11:19:08 UTC

[1/3] camel git commit: Component docs for camel-paho

Repository: camel
Updated Branches:
  refs/heads/master 5ce5a5441 -> c0e3bdf1d


Component docs for camel-paho


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

Branch: refs/heads/master
Commit: d21b9b93ec1d59691f3e46aea5281b1222f2b2b3
Parents: 5ce5a54
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Mar 15 11:16:18 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Mar 15 11:16:18 2015 +0100

----------------------------------------------------------------------
 components/camel-paho/pom.xml                   | 101 ++++++++++---------
 .../camel/component/paho/PahoComponent.java     |  12 ++-
 .../camel/component/paho/PahoEndpoint.java      |  24 +++--
 parent/pom.xml                                  |   1 +
 4 files changed, 75 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/d21b9b93/components/camel-paho/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-paho/pom.xml b/components/camel-paho/pom.xml
index 7245efc..363bc93 100644
--- a/components/camel-paho/pom.xml
+++ b/components/camel-paho/pom.xml
@@ -18,61 +18,62 @@
 <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/xsd/maven-4.0.0.xsd">
 
-    <modelVersion>4.0.0</modelVersion>
+  <modelVersion>4.0.0</modelVersion>
 
-    <parent>
-        <groupId>org.apache.camel</groupId>
-        <artifactId>components</artifactId>
-        <version>2.16-SNAPSHOT</version>
-    </parent>
+  <parent>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>components</artifactId>
+    <version>2.16-SNAPSHOT</version>
+  </parent>
 
-    <artifactId>camel-paho</artifactId>
-    <packaging>bundle</packaging>
-    <name>Camel :: Paho</name>
-    <description>Camel Eclipse Paho support</description>
+  <artifactId>camel-paho</artifactId>
+  <packaging>bundle</packaging>
+  <name>Camel :: Paho</name>
+  <description>Camel Eclipse Paho support</description>
 
-    <properties>
-        <camel.osgi.export.pkg>org.apache.camel.component.paho.*</camel.osgi.export.pkg>
-        <camel.osgi.export.service>org.apache.camel.spi.ComponentResolver;component=paho</camel.osgi.export.service>
-    </properties>
+  <properties>
+    <camel.osgi.export.pkg>org.apache.camel.component.paho.*</camel.osgi.export.pkg>
+    <camel.osgi.export.service>org.apache.camel.spi.ComponentResolver;component=paho</camel.osgi.export.service>
+  </properties>
 
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.camel</groupId>
-            <artifactId>camel-core</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.paho</groupId>
-            <artifactId>org.eclipse.paho.client.mqttv3</artifactId>
-            <version>1.0.2</version>
-        </dependency>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.paho</groupId>
+      <artifactId>org.eclipse.paho.client.mqttv3</artifactId>
+      <version>${paho-version}</version>
+    </dependency>
 
-        <dependency>
-            <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.activemq</groupId>
-            <artifactId>activemq-broker</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.activemq</groupId>
-            <artifactId>activemq-mqtt</artifactId>
-            <version>${activemq-version}</version>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>activemq-broker</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>activemq-mqtt</artifactId>
+      <version>${activemq-version}</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
 
-    <repositories>
-        <repository>
-            <id>eclipse-paho</id>
-            <url>https://repo.eclipse.org/content/repositories/paho-releases</url>
-            <snapshots>
-                <enabled>false</enabled>
-            </snapshots>
-        </repository>
-    </repositories>
+  <!-- TODO: avoid third party repos - we should only use from maven central -->
+  <repositories>
+    <repository>
+      <id>eclipse-paho</id>
+      <url>https://repo.eclipse.org/content/repositories/paho-releases</url>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+    </repository>
+  </repositories>
 
 </project>

http://git-wip-us.apache.org/repos/asf/camel/blob/d21b9b93/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java
index 98e80b0..1d69a9b 100644
--- a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java
+++ b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoComponent.java
@@ -19,14 +19,18 @@ package org.apache.camel.component.paho;
 import java.util.Map;
 
 import org.apache.camel.Endpoint;
-import org.apache.camel.impl.DefaultComponent;
+import org.apache.camel.impl.UriEndpointComponent;
 
-public class PahoComponent extends DefaultComponent {
+public class PahoComponent extends UriEndpointComponent {
+
+    public PahoComponent() {
+        super(PahoEndpoint.class);
+    }
 
     @Override
-    protected Endpoint createEndpoint(String uri, String s1, Map<String, Object> options) throws Exception {
+    protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
         PahoEndpoint pahoEndpoint = new PahoEndpoint(uri, this);
-        setProperties(pahoEndpoint, options);
+        setProperties(pahoEndpoint, parameters);
         return pahoEndpoint;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/d21b9b93/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java
index b1380dd..f2b634e 100644
--- a/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java
+++ b/components/camel-paho/src/main/java/org/apache/camel/component/paho/PahoEndpoint.java
@@ -16,41 +16,47 @@
  */
 package org.apache.camel.component.paho;
 
-import static java.lang.System.nanoTime;
-
 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;
 import org.eclipse.paho.client.mqttv3.MqttClient;
 import org.eclipse.paho.client.mqttv3.MqttClientPersistence;
 import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
 import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
 import org.eclipse.paho.client.mqttv3.persist.MqttDefaultFilePersistence;
+
+import static java.lang.System.nanoTime;
 import static org.apache.camel.component.paho.PahoPersistence.MEMORY;
 
+@UriEndpoint(scheme = "paho", consumerClass = PahoConsumer.class, label = "messaging", syntax = "paho:topic")
 public class PahoEndpoint extends DefaultEndpoint {
 
     // Configuration members
 
+    @UriPath @Metadata(required = "true")
+    private String topic;
+    @UriParam
     private String clientId = "camel-" + nanoTime();
-
+    @UriParam(defaultValue = "tcp://localhost:1883")
     private String brokerUrl = "tcp://localhost:1883";
-
-    private String topic;
-
+    @UriParam(defaultValue = "2")
     private int qos = 2;
-
+    @UriParam(defaultValue = "MEMORY")
     private PahoPersistence persistence = MEMORY;
 
     // Collaboration members
-
+    @UriParam
     private MqttConnectOptions connectOptions;
 
     // Auto-configuration members
 
-    private MqttClient client;
+    private transient MqttClient client;
 
     public PahoEndpoint(String uri, Component component) {
         super(uri, component);

http://git-wip-us.apache.org/repos/asf/camel/blob/d21b9b93/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 1790d87..7bd2760 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -367,6 +367,7 @@
     <oro-bundle-version>2.0.8_6</oro-bundle-version>
     <oscache-bundle-version>2.4_5</oscache-bundle-version>
     <osgi-version>4.3.1</osgi-version>
+    <paho-version>1.0.2</paho-version>
     <paranamer-bundle-version>2.6_1</paranamer-bundle-version>
     <pax-exam-version>4.3.0</pax-exam-version>
     <pax-tiny-bundle-version>1.3.1</pax-tiny-bundle-version>


[2/3] camel git commit: Add camel-paho to kit

Posted by da...@apache.org.
Add camel-paho to kit


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

Branch: refs/heads/master
Commit: e2bfd30769ddf4224e81aa867990d667bff432ba
Parents: d21b9b9
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Mar 15 11:17:40 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Mar 15 11:17:40 2015 +0100

----------------------------------------------------------------------
 apache-camel/pom.xml                             | 4 ++++
 apache-camel/src/main/descriptors/common-bin.xml | 1 +
 parent/pom.xml                                   | 5 +++++
 3 files changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/e2bfd307/apache-camel/pom.xml
----------------------------------------------------------------------
diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml
index 92d2e0a..f39f2d7 100644
--- a/apache-camel/pom.xml
+++ b/apache-camel/pom.xml
@@ -552,6 +552,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
+      <artifactId>camel-paho</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
       <artifactId>camel-paxlogging</artifactId>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/e2bfd307/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 7515fa8..f044822 100644
--- a/apache-camel/src/main/descriptors/common-bin.xml
+++ b/apache-camel/src/main/descriptors/common-bin.xml
@@ -150,6 +150,7 @@
         <include>org.apache.camel.component.olingo2:camel-olingo2</include>
         <include>org.apache.camel:camel-openshift</include>
         <include>org.apache.camel:camel-optaplanner</include>
+        <include>org.apache.camel:camel-paho</include>
         <include>org.apache.camel:camel-paxlogging</include>
         <include>org.apache.camel:camel-pgevent</include>
         <include>org.apache.camel:camel-printer</include>

http://git-wip-us.apache.org/repos/asf/camel/blob/e2bfd307/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 7bd2760..394684f 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -1217,6 +1217,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-paho</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-paxlogging</artifactId>
         <version>${project.version}</version>
       </dependency>


[3/3] camel git commit: Add camel-paho to osgi features

Posted by da...@apache.org.
Add camel-paho to osgi features


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

Branch: refs/heads/master
Commit: c0e3bdf1d9f55e1bf2ac978211f6ec0f742b07b4
Parents: e2bfd30
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Mar 15 11:20:49 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Mar 15 11:20:49 2015 +0100

----------------------------------------------------------------------
 .../features/src/main/resources/features.xml    |  5 +++
 .../apache/camel/itest/karaf/CamelPahoTest.java | 40 ++++++++++++++++++++
 2 files changed, 45 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c0e3bdf1/platforms/karaf/features/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml
index 9b72923..71c8db3 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -1086,6 +1086,11 @@
     <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax-inject/${javax-inject-bundle-version}</bundle>
     <bundle>mvn:org.apache.camel/camel-optaplanner/${project.version}</bundle>
   </feature>
+  <feature name='camel-paho' version='${project.version}' resolver='(obr)' start-level='50'>
+    <feature version='${project.version}'>camel-core</feature>
+    <bundle>mvn:org.eclipse.paho/org.eclipse.paho.client.mqttv3/${paho-version}</bundle>
+    <bundle>mvn:org.apache.camel/camel-paho/${project.version}</bundle>
+  </feature>
   <feature name='camel-paxlogging' version='${project.version}' resolver='(obr)' start-level='50'>
     <feature version='${project.version}'>camel-core</feature>
     <bundle>mvn:org.apache.camel/camel-paxlogging/${project.version}</bundle>

http://git-wip-us.apache.org/repos/asf/camel/blob/c0e3bdf1/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelPahoTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelPahoTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelPahoTest.java
new file mode 100644
index 0000000..9ec0e81
--- /dev/null
+++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelPahoTest.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.apache.camel.itest.karaf;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+
+@RunWith(PaxExam.class)
+public class CamelPahoTest extends AbstractFeatureTest {
+
+    public static final String COMPONENT = extractName(CamelPahoTest.class);
+
+    @Test
+    public void test() throws Exception {
+        testComponent(COMPONENT);
+    }
+
+    @Configuration
+    public static Option[] configure() {
+        return configure(COMPONENT);
+    }
+
+}
\ No newline at end of file