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 2016/11/07 16:50:48 UTC

[02/10] camel git commit: CAMEL-10434: Camel catalog support different runtimes to provide their supported list of components etc.

CAMEL-10434: Camel catalog support different runtimes to provide their supported list of components etc.


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

Branch: refs/heads/camel-2.18.x
Commit: fc27052429fa025f318b8890daeb765d2fd9c802
Parents: 10a8507
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Nov 7 13:11:55 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Nov 7 16:45:55 2016 +0100

----------------------------------------------------------------------
 platforms/catalog-provider-karaf/pom.xml        | 110 +++++++++++++++++++
 .../catalog/karaf/KarafRuntimeProvider.java     |  58 ++++++++++
 .../camel/catalog/DefaultCamelCatalog.java      |   2 +
 .../camel/catalog/DefaultRuntimeProvider.java   |  10 +-
 .../apache/camel/catalog/RuntimeProvider.java   |  10 ++
 platforms/pom.xml                               |   7 +-
 6 files changed, 194 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/fc270524/platforms/catalog-provider-karaf/pom.xml
----------------------------------------------------------------------
diff --git a/platforms/catalog-provider-karaf/pom.xml b/platforms/catalog-provider-karaf/pom.xml
new file mode 100644
index 0000000..9aafd73
--- /dev/null
+++ b/platforms/catalog-provider-karaf/pom.xml
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+  <!--
+    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.
+  -->
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>platforms</artifactId>
+    <version>2.19.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>camel-catalog-provider-karaf</artifactId>
+  <packaging>jar</packaging>
+  <name>Camel :: Platforms :: Catalog :: Provider Karaf</name>
+  <description>Camel Catalog Karaf</description>
+
+  <properties>
+    <camel.osgi.export.pkg>
+      org.apache.camel.catalog.karaf
+    </camel.osgi.export.pkg>
+  </properties>
+
+  <dependencies>
+
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-catalog</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </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>
+
+  </dependencies>
+
+  <build>
+    <plugins>
+
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>${maven-resources-plugin-version}</version>
+        <executions>
+          <execution>
+            <id>copy-resources</id>
+            <phase>compile</phase>
+            <goals>
+              <goal>copy-resources</goal>
+            </goals>
+            <configuration>
+              <outputDirectory>${basedir}/target/resources</outputDirectory>
+              <resources>
+                <resource>
+                  <directory>../karaf/features/target/classes</directory>
+                  <includes>
+                    <include>features.xml</include>
+                  </includes>
+                </resource>
+              </resources>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+
+    </plugins>
+
+  </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/fc270524/platforms/catalog-provider-karaf/src/main/java/org/apache/camel/catalog/karaf/KarafRuntimeProvider.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-provider-karaf/src/main/java/org/apache/camel/catalog/karaf/KarafRuntimeProvider.java b/platforms/catalog-provider-karaf/src/main/java/org/apache/camel/catalog/karaf/KarafRuntimeProvider.java
new file mode 100644
index 0000000..071d6e9
--- /dev/null
+++ b/platforms/catalog-provider-karaf/src/main/java/org/apache/camel/catalog/karaf/KarafRuntimeProvider.java
@@ -0,0 +1,58 @@
+/**
+ * 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
+ * <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.apache.camel.catalog.karaf;
+
+import java.util.List;
+
+import org.apache.camel.catalog.CamelCatalog;
+import org.apache.camel.catalog.RuntimeProvider;
+
+public class KarafRuntimeProvider implements RuntimeProvider {
+
+    private CamelCatalog camelCatalog;
+
+    @Override
+    public CamelCatalog getCamelCatalog() {
+        return camelCatalog;
+    }
+
+    @Override
+    public void setCamelCatalog(CamelCatalog camelCatalog) {
+        this.camelCatalog = camelCatalog;
+    }
+
+    @Override
+    public String getProviderName() {
+        return "karaf";
+    }
+
+    @Override
+    public List<String> findComponentNames() {
+        // parse the karaf features xml file
+        return null;
+    }
+
+    @Override
+    public List<String> findDataFormatNames() {
+        return null;
+    }
+
+    @Override
+    public List<String> findLanguageNames() {
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/fc270524/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
----------------------------------------------------------------------
diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
index 33ffccf..e498a7b 100644
--- a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
+++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
@@ -122,6 +122,8 @@ public class DefaultCamelCatalog implements CamelCatalog {
     @Override
     public void setRuntimeProvider(RuntimeProvider runtimeProvider) {
         this.runtimeProvider = runtimeProvider;
+        // inject CamelCatalog to the provider
+        this.runtimeProvider.setCamelCatalog(this);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/fc270524/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultRuntimeProvider.java
----------------------------------------------------------------------
diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultRuntimeProvider.java b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultRuntimeProvider.java
index f3e97d7..a18d193 100644
--- a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultRuntimeProvider.java
+++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultRuntimeProvider.java
@@ -27,7 +27,10 @@ public class DefaultRuntimeProvider implements RuntimeProvider {
     private static final String DATA_FORMATS_CATALOG = "org/apache/camel/catalog/dataformats.properties";
     private static final String LANGUAGE_CATALOG = "org/apache/camel/catalog/languages.properties";
 
-    private final CamelCatalog camelCatalog;
+    private CamelCatalog camelCatalog;
+
+    public DefaultRuntimeProvider() {
+    }
 
     public DefaultRuntimeProvider(CamelCatalog camelCatalog) {
         this.camelCatalog = camelCatalog;
@@ -39,6 +42,11 @@ public class DefaultRuntimeProvider implements RuntimeProvider {
     }
 
     @Override
+    public void setCamelCatalog(CamelCatalog camelCatalog) {
+        this.camelCatalog = camelCatalog;
+    }
+
+    @Override
     public String getProviderName() {
         return "default";
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/fc270524/platforms/catalog/src/main/java/org/apache/camel/catalog/RuntimeProvider.java
----------------------------------------------------------------------
diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/RuntimeProvider.java b/platforms/catalog/src/main/java/org/apache/camel/catalog/RuntimeProvider.java
index f3e8744..2ab844f 100644
--- a/platforms/catalog/src/main/java/org/apache/camel/catalog/RuntimeProvider.java
+++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/RuntimeProvider.java
@@ -25,12 +25,22 @@ import java.util.List;
  */
 public interface RuntimeProvider {
 
+    // TODO: maven archetype GAV
+    // original GAV
+    // spring-boot GAV
+    // karaf feature name
+
     /**
      * Gets the {@link CamelCatalog}
      */
     CamelCatalog getCamelCatalog();
 
     /**
+     * Sets the {@link CamelCatalog} to use
+     */
+    void setCamelCatalog(CamelCatalog camelCatalog);
+
+    /**
      * Name of provider such as <tt>default</tt>, <tt>karaf</tt>, <tt>spring-boot</tt>
      */
     String getProviderName();

http://git-wip-us.apache.org/repos/asf/camel/blob/fc270524/platforms/pom.xml
----------------------------------------------------------------------
diff --git a/platforms/pom.xml b/platforms/pom.xml
index 289fea7..d0811ac 100644
--- a/platforms/pom.xml
+++ b/platforms/pom.xml
@@ -32,11 +32,14 @@
   <packaging>pom</packaging>
 
   <modules>
+    <module>commands</module>
+    <module>karaf</module>
+    <module>spring-boot</module>
+    <!-- run catalog last -->
     <module>catalog</module>
     <module>catalog-lucene</module>
     <module>catalog-maven</module>
-    <module>commands</module>
-    <module>karaf</module>
+    <module>catalog-provider-karaf</module>
   </modules>
 
 </project>