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 2019/10/08 13:09:31 UTC

[camel-quarkus] branch catalog created (now f13311b)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a change to branch catalog
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git.


      at f13311b  Fixes #75: Adding camel-quarkus-catalog

This branch includes the following new commits:

     new 536e639  #75: Adding camel-quarkus-catalog (work in progress)
     new 75ab871  #75: Adding camel-quarkus-catalog (work in progress)
     new 7c4c07d  #75: Adding camel-quarkus-catalog (work in progress)
     new ea24f6f  #75: Adding camel-quarkus-catalog (work in progress)
     new 450aec4  #75: Adding camel-quarkus-catalog (work in progress)
     new 99330d3  #75: Adding camel-quarkus-catalog (work in progress)
     new 442ff6d  #75: Adding camel-quarkus-catalog (work in progress)
     new 5ce1483  #75: Adding camel-quarkus-catalog (work in progress)
     new 2049ca3  #75: Adding camel-quarkus-catalog (work in progress)
     new af153f0  #75: Adding camel-quarkus-catalog (work in progress)
     new 4bad575  #75: Adding camel-quarkus-catalog (work in progress)
     new f13311b  Fixes #75: Adding camel-quarkus-catalog

The 12 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[camel-quarkus] 04/12: #75: Adding camel-quarkus-catalog (work in progress)

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch catalog
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit ea24f6fb3989cf967fcbb10181646a92c692738b
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Oct 8 09:52:02 2019 +0200

    #75: Adding camel-quarkus-catalog (work in progress)
---
 catalog/camel-quarkus-catalog/pom.xml              |  27 +++
 .../catalog/quarkus/QuarkusRuntimeProvider.java    | 146 +++++++++++++++
 .../src/main/resources/META-INF/LICENSE.txt        | 203 +++++++++++++++++++++
 .../src/main/resources/META-INF/NOTICE.txt         |  11 ++
 .../quarkus/QuarkusRuntimeProviderTest.java        | 144 +++++++++++++++
 5 files changed, 531 insertions(+)

diff --git a/catalog/camel-quarkus-catalog/pom.xml b/catalog/camel-quarkus-catalog/pom.xml
index b478b09..380305a 100644
--- a/catalog/camel-quarkus-catalog/pom.xml
+++ b/catalog/camel-quarkus-catalog/pom.xml
@@ -39,6 +39,33 @@
             <version>${camel.version}</version>
         </dependency>
 
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.12</version>
+            <scope>test</scope>
+        </dependency>
+
+        <!-- logging -->
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-api</artifactId>
+            <version>2.12.1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-core</artifactId>
+            <version>2.12.1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-slf4j-impl</artifactId>
+            <version>2.12.1</version>
+            <scope>test</scope>
+        </dependency>
+
     </dependencies>
 
     <build>
diff --git a/catalog/camel-quarkus-catalog/src/main/java/org/apache/camel/catalog/quarkus/QuarkusRuntimeProvider.java b/catalog/camel-quarkus-catalog/src/main/java/org/apache/camel/catalog/quarkus/QuarkusRuntimeProvider.java
new file mode 100644
index 0000000..b1c37c6
--- /dev/null
+++ b/catalog/camel-quarkus-catalog/src/main/java/org/apache/camel/catalog/quarkus/QuarkusRuntimeProvider.java
@@ -0,0 +1,146 @@
+/*
+ * 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.catalog.quarkus;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.catalog.CamelCatalog;
+import org.apache.camel.catalog.CatalogHelper;
+import org.apache.camel.catalog.RuntimeProvider;
+
+/**
+ * A Quarkus based {@link RuntimeProvider} which only includes the supported Camel components, data formats, and languages
+ * which can be installed in Quarkus using the Camel extensions.
+ */
+public class QuarkusRuntimeProvider implements RuntimeProvider {
+
+    private static final String COMPONENT_DIR = "org/apache/camel/catalog/quarkus/components";
+    private static final String DATAFORMAT_DIR = "org/apache/camel/catalog/quarkus/dataformats";
+    private static final String LANGUAGE_DIR = "org/apache/camel/catalog/quarkus/languages";
+    private static final String OTHER_DIR = "org/apache/camel/catalog/quarkus/others";
+    private static final String COMPONENTS_CATALOG = "org/apache/camel/catalog/quarkus/components.properties";
+    private static final String DATA_FORMATS_CATALOG = "org/apache/camel/catalog/quarkus/dataformats.properties";
+    private static final String LANGUAGE_CATALOG = "org/apache/camel/catalog/quarkus/languages.properties";
+    private static final String OTHER_CATALOG = "org/apache/camel/catalog/quarkus/others.properties";
+
+    private CamelCatalog camelCatalog;
+
+    @Override
+    public CamelCatalog getCamelCatalog() {
+        return camelCatalog;
+    }
+
+    @Override
+    public void setCamelCatalog(CamelCatalog camelCatalog) {
+        this.camelCatalog = camelCatalog;
+    }
+
+    @Override
+    public String getProviderName() {
+        return "quarkus";
+    }
+
+    @Override
+    public String getProviderGroupId() {
+        return "org.apache.camel.quarkus";
+    }
+
+    @Override
+    public String getProviderArtifactId() {
+        return "camel-quarkus-catalog";
+    }
+
+    @Override
+    public String getComponentJSonSchemaDirectory() {
+        return COMPONENT_DIR;
+    }
+
+    @Override
+    public String getDataFormatJSonSchemaDirectory() {
+        return DATAFORMAT_DIR;
+    }
+
+    @Override
+    public String getLanguageJSonSchemaDirectory() {
+        return LANGUAGE_DIR;
+    }
+
+    @Override
+    public String getOtherJSonSchemaDirectory() {
+        return OTHER_DIR;
+    }
+
+    @Override
+    public List<String> findComponentNames() {
+        List<String> names = new ArrayList<>();
+        InputStream is = camelCatalog.getVersionManager().getResourceAsStream(COMPONENTS_CATALOG);
+        if (is != null) {
+            try {
+                CatalogHelper.loadLines(is, names);
+            } catch (IOException e) {
+                // ignore
+            }
+        }
+        return names;
+    }
+
+    @Override
+    public List<String> findDataFormatNames() {
+        List<String> names = new ArrayList<>();
+        InputStream is = camelCatalog.getVersionManager().getResourceAsStream(DATA_FORMATS_CATALOG);
+        if (is != null) {
+            try {
+                CatalogHelper.loadLines(is, names);
+            } catch (IOException e) {
+                // ignore
+            }
+        }
+        return names;
+    }
+
+    @Override
+    public List<String> findLanguageNames() {
+        List<String> names = new ArrayList<>();
+        InputStream is = camelCatalog.getVersionManager().getResourceAsStream(LANGUAGE_CATALOG);
+        if (is != null) {
+            try {
+                CatalogHelper.loadLines(is, names);
+            } catch (IOException e) {
+                // ignore
+            }
+        }
+        return names;
+    }
+
+    @Override
+    public List<String> findOtherNames() {
+        List<String> names = new ArrayList<>();
+        InputStream is = camelCatalog.getVersionManager().getResourceAsStream(OTHER_CATALOG);
+        if (is != null) {
+            try {
+                CatalogHelper.loadLines(is, names);
+            } catch (IOException e) {
+                // ignore
+            }
+        }
+        return names;
+    }
+
+}
diff --git a/catalog/camel-quarkus-catalog/src/main/resources/META-INF/LICENSE.txt b/catalog/camel-quarkus-catalog/src/main/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ b/catalog/camel-quarkus-catalog/src/main/resources/META-INF/LICENSE.txt
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
diff --git a/catalog/camel-quarkus-catalog/src/main/resources/META-INF/NOTICE.txt b/catalog/camel-quarkus-catalog/src/main/resources/META-INF/NOTICE.txt
new file mode 100644
index 0000000..2e215bf
--- /dev/null
+++ b/catalog/camel-quarkus-catalog/src/main/resources/META-INF/NOTICE.txt
@@ -0,0 +1,11 @@
+   =========================================================================
+   ==  NOTICE file corresponding to the section 4 d of                    ==
+   ==  the Apache License, Version 2.0,                                   ==
+   ==  in this case for the Apache Camel distribution.                    ==
+   =========================================================================
+
+   This product includes software developed by
+   The Apache Software Foundation (http://www.apache.org/).
+
+   Please read the different LICENSE files present in the licenses directory of
+   this distribution.
diff --git a/catalog/camel-quarkus-catalog/src/test/java/org/apache/camel/catalog/quarkus/QuarkusRuntimeProviderTest.java b/catalog/camel-quarkus-catalog/src/test/java/org/apache/camel/catalog/quarkus/QuarkusRuntimeProviderTest.java
new file mode 100644
index 0000000..1c8e2e9
--- /dev/null
+++ b/catalog/camel-quarkus-catalog/src/test/java/org/apache/camel/catalog/quarkus/QuarkusRuntimeProviderTest.java
@@ -0,0 +1,144 @@
+/*
+ * 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.catalog.quarkus;
+
+import java.util.List;
+
+import org.apache.camel.catalog.CamelCatalog;
+import org.apache.camel.catalog.DefaultCamelCatalog;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+// TODO: Update
+
+@Ignore
+public class QuarkusRuntimeProviderTest {
+
+    static CamelCatalog catalog;
+
+    @BeforeClass
+    public static void createCamelCatalog() {
+        catalog = new DefaultCamelCatalog();
+        catalog.setRuntimeProvider(new QuarkusRuntimeProvider());
+    }
+
+    @Test
+    public void testGetVersion() throws Exception {
+        String version = catalog.getCatalogVersion();
+        assertNotNull(version);
+
+        String loaded = catalog.getLoadedVersion();
+        assertNotNull(loaded);
+        assertEquals(version, loaded);
+    }
+
+    @Test
+    public void testProviderName() throws Exception {
+        assertEquals("quarkus", catalog.getRuntimeProvider().getProviderName());
+    }
+
+    @Test
+    public void testFindComponentNames() throws Exception {
+        List<String> names = catalog.findComponentNames();
+
+        assertNotNull(names);
+        assertFalse(names.isEmpty());
+
+        assertTrue(names.contains("file"));
+        assertTrue(names.contains("ftp"));
+        assertTrue(names.contains("jms"));
+        // camel-pax-logging does not work in quarkus
+        assertFalse(names.contains("paxlogging"));
+    }
+
+    @Test
+    public void testFindDataFormatNames() throws Exception {
+        List<String> names = catalog.findDataFormatNames();
+
+        assertNotNull(names);
+        assertFalse(names.isEmpty());
+
+        assertTrue(names.contains("bindy-csv"));
+        assertTrue(names.contains("zipdeflater"));
+        assertTrue(names.contains("zipfile"));
+    }
+
+    @Test
+    public void testFindLanguageNames() throws Exception {
+        List<String> names = catalog.findLanguageNames();
+
+        assertNotNull(names);
+        assertFalse(names.isEmpty());
+
+        assertTrue(names.contains("simple"));
+        assertTrue(names.contains("spel"));
+        assertTrue(names.contains("xpath"));
+    }
+
+    @Test
+    public void testFindOtherNames() throws Exception {
+        List<String> names = catalog.findOtherNames();
+
+        assertNotNull(names);
+        assertFalse(names.isEmpty());
+
+        assertTrue(names.contains("hystrix"));
+        assertTrue(names.contains("spring-boot"));
+        assertTrue(names.contains("zipkin"));
+
+        assertFalse(names.contains("blueprint"));
+    }
+
+    @Test
+    public void testComponentArtifactId() throws Exception {
+        String json = catalog.componentJSonSchema("ftp");
+
+        assertNotNull(json);
+        assertTrue(json.contains("camel-ftp-starter"));
+    }
+
+    @Test
+    public void testDataFormatArtifactId() throws Exception {
+        String json = catalog.dataFormatJSonSchema("bindy-csv");
+
+        assertNotNull(json);
+        assertTrue(json.contains("camel-bindy-starter"));
+    }
+
+    @Test
+    public void testLanguageArtifactId() throws Exception {
+        String json = catalog.languageJSonSchema("spel");
+
+        assertNotNull(json);
+        assertTrue(json.contains("camel-spring-starter"));
+    }
+
+    @Test
+    public void testOtherArtifactId() throws Exception {
+        String json = catalog.otherJSonSchema("zipkin");
+
+        assertNotNull(json);
+        assertTrue(json.contains("camel-zipkin-starter"));
+    }
+
+}


[camel-quarkus] 01/12: #75: Adding camel-quarkus-catalog (work in progress)

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch catalog
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 536e6394e605c67efa023dfe916ac0c29b23ee7c
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Oct 8 08:51:58 2019 +0200

    #75: Adding camel-quarkus-catalog (work in progress)
---
 pom.xml               |  1 +
 tooling/maven/pom.xml | 40 ++++++++++++++++++++++++++++++++++++++++
 tooling/pom.xml       | 38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 79 insertions(+)

diff --git a/pom.xml b/pom.xml
index f93af19..3220cf1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,6 +74,7 @@
         <module>poms/bom</module>
         <module>poms/bom-deployment</module>
         <module>poms/build-parent</module>
+        <module>poms/tooling</module>
         <module>extensions</module>
         <module>integration-tests</module>
         <module>examples</module>
diff --git a/tooling/maven/pom.xml b/tooling/maven/pom.xml
new file mode 100644
index 0000000..4ec1b6c
--- /dev/null
+++ b/tooling/maven/pom.xml
@@ -0,0 +1,40 @@
+<?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/xsd/maven-4.0.0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-tooling</artifactId>
+        <version>0.2.1-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-quarkus-tooling-maven</artifactId>
+    <packaging>pom</packaging>
+
+    <name>Camel Quarkus :: Tooling :: Maven</name>
+
+    <modules>
+        <!--
+        <module></module>
+    -->
+    </modules>
+
+</project>
diff --git a/tooling/pom.xml b/tooling/pom.xml
new file mode 100644
index 0000000..366832e
--- /dev/null
+++ b/tooling/pom.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-parent</artifactId>
+        <version>0.2.1-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-quarkus-tooling</artifactId>
+    <packaging>pom</packaging>
+
+    <name>Camel Quarkus :: Tooling</name>
+
+    <modules>
+        <module>maven</module>
+    </modules>
+
+</project>


[camel-quarkus] 07/12: #75: Adding camel-quarkus-catalog (work in progress)

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch catalog
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 442ff6d3a64cf681efec90beb45077712c9dd70a
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Oct 8 12:24:10 2019 +0200

    #75: Adding camel-quarkus-catalog (work in progress)
---
 extensions/reactive-executor/pom.xml               |   1 +
 extensions/reactive-executor/runtime/pom.xml       |   5 +
 tooling/maven/package-maven-plugin/pom.xml         |   7 +
 .../apache/camel/quarkus/maven/PackageHelper.java  |  29 ++++
 .../quarkus/maven/PrepareCatalogQuarkusMojo.java   | 146 ++++++++++++++++++++-
 .../src/main/resources/other-template.mvel         |  14 ++
 6 files changed, 195 insertions(+), 7 deletions(-)

diff --git a/extensions/reactive-executor/pom.xml b/extensions/reactive-executor/pom.xml
index 8236bbe..d668925 100644
--- a/extensions/reactive-executor/pom.xml
+++ b/extensions/reactive-executor/pom.xml
@@ -31,6 +31,7 @@
     <artifactId>camel-quarkus-reactive-executor-parent</artifactId>
     <name>Camel Quarkus :: Core :: Reactive Executor</name>
     <packaging>pom</packaging>
+
     <modules>
         <module>deployment</module>
         <module>runtime</module>
diff --git a/extensions/reactive-executor/runtime/pom.xml b/extensions/reactive-executor/runtime/pom.xml
index 9751130..d44377e 100644
--- a/extensions/reactive-executor/runtime/pom.xml
+++ b/extensions/reactive-executor/runtime/pom.xml
@@ -28,6 +28,11 @@
 
     <artifactId>camel-quarkus-reactive-executor</artifactId>
     <name>Camel Quarkus :: Core :: Reactive Executor :: Runtime</name>
+    <description>To use Quarkus reactive executor with Camel</description>
+
+    <properties>
+        <firstVersion>0.2.1</firstVersion>
+    </properties>
 
     <dependencyManagement>
         <dependencies>
diff --git a/tooling/maven/package-maven-plugin/pom.xml b/tooling/maven/package-maven-plugin/pom.xml
index db07ee0..3e4af4d 100644
--- a/tooling/maven/package-maven-plugin/pom.xml
+++ b/tooling/maven/package-maven-plugin/pom.xml
@@ -84,6 +84,13 @@
             <groupId>org.sonatype.plexus</groupId>
             <artifactId>plexus-build-api</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>org.mvel</groupId>
+            <artifactId>mvel2</artifactId>
+            <version>2.4.4.Final</version>
+        </dependency>
+
     </dependencies>
 
     <build>
diff --git a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PackageHelper.java b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PackageHelper.java
index 098c99c..f84cdf6 100644
--- a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PackageHelper.java
+++ b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PackageHelper.java
@@ -67,6 +67,35 @@ public final class PackageHelper {
         }
     }
 
+    /**
+     * Converts the value to use title style instead of dash cased
+     */
+    public static String camelDashToTitle(String value) {
+        StringBuilder sb = new StringBuilder(value.length());
+        boolean dash = false;
+
+        for (char c : value.toCharArray()) {
+            if ('-' == c) {
+                dash = true;
+                continue;
+            }
+
+            if (dash) {
+                sb.append(' ');
+                sb.append(Character.toUpperCase(c));
+            } else {
+                // upper case first
+                if (sb.length() == 0) {
+                    sb.append(Character.toUpperCase(c));
+                } else {
+                    sb.append(c);
+                }
+            }
+            dash = false;
+        }
+        return sb.toString();
+    }
+
     public static void writeText(File file, String text) throws IOException {
         FileOutputStream fos = new FileOutputStream(file, false);
         try {
diff --git a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
index 4609c78..1a1abaf 100644
--- a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
+++ b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
@@ -23,11 +23,15 @@ import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.LinkedHashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.regex.Pattern;
 
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
@@ -37,7 +41,13 @@ import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.plugins.annotations.ResolutionScope;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectHelper;
+import org.apache.maven.project.ProjectBuilder;
+import org.apache.maven.project.ProjectBuildingException;
+import org.apache.maven.project.ProjectBuildingResult;
+import org.apache.maven.repository.RepositorySystem;
+import org.mvel2.templates.TemplateRuntime;
 
+import static org.apache.camel.quarkus.maven.PackageHelper.camelDashToTitle;
 import static org.apache.camel.quarkus.maven.PackageHelper.loadText;
 
 /**
@@ -46,6 +56,10 @@ import static org.apache.camel.quarkus.maven.PackageHelper.loadText;
 @Mojo(name = "prepare-catalog-quarkus", threadSafe = true, requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME)
 public class PrepareCatalogQuarkusMojo extends AbstractMojo {
 
+    private static final String[] EXCLUDE_EXTENSIONS = {
+            "http-common", "jetty-common", "support", "xml-common", "xstream-common"
+    };
+
     private static final Pattern GROUP_PATTERN = Pattern.compile("\"groupId\": \"(org.apache.camel)\"");
     private static final Pattern ARTIFACT_PATTERN = Pattern.compile("\"artifactId\": \"camel-(.*)\"");
     private static final Pattern VERSION_PATTERN = Pattern.compile("\"version\": \"(.*)\"");
@@ -56,7 +70,20 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
     @Parameter(property = "project", required = true, readonly = true)
     protected MavenProject project;
 
+    @Component
+    private RepositorySystem repositorySystem;
+
+    @Component
+    private ProjectBuilder mavenProjectBuilder;
+
+    @Parameter(defaultValue = "${session}", readonly = true)
+    private MavenSession session;
+
+    @Component
+    private MavenProjectHelper projectHelper;
+
     /**
+     *
      * The output directory for components catalog
      */
     @Parameter(defaultValue = "${project.build.directory}/classes/org/apache/camel/catalog/quarkus/components")
@@ -87,12 +114,6 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
     protected File extensionsDir;
 
     /**
-     * Maven ProjectHelper.
-     */
-    @Component
-    private MavenProjectHelper projectHelper;
-
-    /**
      * Execute goal.
      *
      * @throws MojoExecutionException execution of the main class or one of the
@@ -105,6 +126,7 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
         executeComponents(extensions);
         executeLanguages(extensions);
         executeDataFormats(extensions);
+        executeOthers(extensions);
     }
 
     protected void executeComponents(Set<String> extensions) throws MojoExecutionException, MojoFailureException {
@@ -325,6 +347,103 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
         }
     }
 
+    protected void executeOthers(Set<String> extensions) throws MojoExecutionException, MojoFailureException {
+        // make sure to create out dir
+        othersOutDir.mkdirs();
+
+
+        for (String extension : extensions) {
+            // skip if the extension is already one of the following
+            boolean component = new File(componentsOutDir, extension + ".json").exists();
+            boolean language = new File(languagesOutDir, extension + ".json").exists();
+            boolean dataFormat = new File(dataFormatsOutDir, extension + ".json").exists();
+            if (component || language || dataFormat) {
+                continue;
+            }
+
+            try {
+                MavenProject extPom = getMavenProject("org.apache.camel.quarkus", "camel-quarkus-" + extension, project.getVersion());
+
+                Map<String, Object> model = new HashMap<>();
+                model.put("name", extension);
+                String title = extPom.getProperties().getProperty("title");
+                if (title == null) {
+                    title = camelDashToTitle(extension);
+                }
+                model.put("title", title);
+                model.put("description", extPom.getDescription());
+                if (extPom.getName() != null && extPom.getName().contains("(deprecated)")) {
+                    model.put("deprecated", "true");
+                } else {
+                    model.put("deprecated", "false");
+                }
+                model.put("firstVersion", extPom.getProperties().getOrDefault("firstVersion", "1.0.0"));
+                model.put("label", extPom.getProperties().getOrDefault("label", "quarkus"));
+                model.put("groupId", "org.apache.camel.quarkus");
+                model.put("artifactId", "camel-quarkus-" + extension);
+                model.put("version", project.getVersion());
+
+                String text = templateOther(model);
+
+                // write new json file
+                File to = new File(othersOutDir, extension + ".json");
+                FileOutputStream fos = new FileOutputStream(to, false);
+
+                fos.write(text.getBytes());
+
+                fos.close();
+
+            } catch (IOException e) {
+                throw new MojoFailureException("Cannot write json file " + extension, e);
+            } catch (ProjectBuildingException e) {
+                throw new MojoFailureException("Error loading pom.xml from extension " + extension, e);
+            }
+        }
+
+        File all = new File(othersOutDir, "../others.properties");
+        try {
+            FileOutputStream fos = new FileOutputStream(all, false);
+
+            String[] names = othersOutDir.list();
+            List<String> others = new ArrayList<>();
+            // sort the names
+            for (String name : names) {
+                if (name.endsWith(".json")) {
+                    // strip out .json from the name
+                    String otherName = name.substring(0, name.length() - 5);
+                    others.add(otherName);
+                }
+            }
+
+            Collections.sort(others);
+            for (String name : others) {
+                fos.write(name.getBytes());
+                fos.write("\n".getBytes());
+            }
+
+            fos.close();
+
+        } catch (IOException e) {
+            throw new MojoFailureException("Error writing to file " + all);
+        }
+    }
+
+    private MavenProject getMavenProject(String groupId, String artifactId, String version) throws ProjectBuildingException {
+        Artifact pomArtifact = repositorySystem.createProjectArtifact(groupId, artifactId, version);
+        ProjectBuildingResult build = mavenProjectBuilder.build(pomArtifact, session.getProjectBuildingRequest());
+        return build.getProject();
+    }
+
+    private String templateOther(Map model) throws MojoExecutionException {
+        try {
+            String template = loadText(getClass().getClassLoader().getResourceAsStream("other-template.mvel"));
+            String out = (String) TemplateRuntime.eval(template, model);
+            return out;
+        } catch (Exception e) {
+            throw new MojoExecutionException("Error processing mvel template. Reason: " + e, e);
+        }
+    }
+
     private static boolean isCamelComponent(List<String> components, String name) {
         return components.stream().anyMatch(c -> c.equals(name));
     }
@@ -344,7 +463,11 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
         if (names != null) {
             for (File name : names) {
                 if (name.isDirectory()) {
-                    answer.add(name.getName());
+                    boolean excluded = isExcludedExtension(name.getName());
+                    boolean active = new File(name, "pom.xml").exists();
+                    if (!excluded && active) {
+                        answer.add(name.getName());
+                    }
                 }
             }
         }
@@ -354,4 +477,13 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
         return answer;
     }
 
+    private static boolean isExcludedExtension(String name) {
+        for (String exclude : EXCLUDE_EXTENSIONS) {
+            if (exclude.equals(name)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
 }
diff --git a/tooling/maven/package-maven-plugin/src/main/resources/other-template.mvel b/tooling/maven/package-maven-plugin/src/main/resources/other-template.mvel
new file mode 100644
index 0000000..1d57f31
--- /dev/null
+++ b/tooling/maven/package-maven-plugin/src/main/resources/other-template.mvel
@@ -0,0 +1,14 @@
+{
+ "other": {
+    "name": "@{name}",
+    "kind": "other",
+    "title": "@{title}",
+    "description": "@{description}",
+    "deprecated": @{deprecated},
+    "firstVersion": "@{firstVersion}",
+    "label": "@{label}",
+    "groupId": "@{groupId}",
+    "artifactId": "@{artifactId}",
+    "version": "@{version}"
+  }
+}
\ No newline at end of file


[camel-quarkus] 06/12: #75: Adding camel-quarkus-catalog (work in progress)

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch catalog
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 99330d3364ea408ada45778bf55fcc9e6bef4447
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Oct 8 11:27:32 2019 +0200

    #75: Adding camel-quarkus-catalog (work in progress)
---
 .../quarkus/maven/PrepareCatalogQuarkusMojo.java   | 158 ++++++++++++++++++++-
 1 file changed, 157 insertions(+), 1 deletion(-)

diff --git a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
index 03824cb..4609c78 100644
--- a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
+++ b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
@@ -103,13 +103,15 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
     public void execute() throws MojoExecutionException, MojoFailureException {
         Set<String> extensions = findExtensions();
         executeComponents(extensions);
+        executeLanguages(extensions);
+        executeDataFormats(extensions);
     }
 
     protected void executeComponents(Set<String> extensions) throws MojoExecutionException, MojoFailureException {
         getLog().info("Copying all Camel extension json descriptors");
 
         // grab components from camel-catalog
-        List catalogComponents = null;
+        List catalogComponents;
         try {
             InputStream is = getClass().getClassLoader().getResourceAsStream("org/apache/camel/catalog/components.properties");
             String text = loadText(is);
@@ -177,10 +179,164 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
         }
     }
 
+    protected void executeLanguages(Set<String> extensions) throws MojoExecutionException, MojoFailureException {
+        // TODO: include core languages
+        getLog().info("Copying all Camel extension json descriptors");
+
+        // grab languages from camel-catalog
+        List catalogLanguages;
+        try {
+            InputStream is = getClass().getClassLoader().getResourceAsStream("org/apache/camel/catalog/languages.properties");
+            String text = loadText(is);
+            catalogLanguages = Arrays.asList(text.split("\n"));
+            getLog().info("Loaded " + catalogLanguages.size() + " languages from camel-catalog");
+        } catch (IOException e) {
+            throw new MojoFailureException("Error loading resource from camel-catalog due " + e.getMessage(), e);
+        }
+
+        // make sure to create out dir
+        languagesOutDir.mkdirs();
+
+        for (String extension : extensions) {
+            if (!isCamelLanguage(catalogLanguages, extension)) {
+                continue;
+            }
+
+            // for quarkus we need to amend the json file to use the quarkus maven GAV
+            try {
+                InputStream is = getClass().getClassLoader().getResourceAsStream("org/apache/camel/catalog/languages/" + extension + ".json");
+                String text = loadText(is);
+
+                text = GROUP_PATTERN.matcher(text).replaceFirst("\"groupId\": \"org.apache.camel.quarkus\"");
+                text = ARTIFACT_PATTERN.matcher(text).replaceFirst("\"artifactId\": \"camel-quarkus-$1\"");
+                text = VERSION_PATTERN.matcher(text).replaceFirst("\"version\": \"" + project.getVersion() + "\"");
+
+                // write new json file
+                File to = new File(languagesOutDir, extension + ".json");
+                FileOutputStream fos = new FileOutputStream(to, false);
+
+                fos.write(text.getBytes());
+
+                fos.close();
+
+            } catch (IOException e) {
+                throw new MojoFailureException("Cannot write json file " + extension, e);
+            }
+        }
+
+        File all = new File(languagesOutDir, "../languages.properties");
+        try {
+            FileOutputStream fos = new FileOutputStream(all, false);
+
+            String[] names = languagesOutDir.list();
+            List<String> languages = new ArrayList<>();
+            // sort the names
+            for (String name : names) {
+                if (name.endsWith(".json")) {
+                    // strip out .json from the name
+                    String languageName = name.substring(0, name.length() - 5);
+                    languages.add(languageName);
+                }
+            }
+
+            Collections.sort(languages);
+            for (String name : languages) {
+                fos.write(name.getBytes());
+                fos.write("\n".getBytes());
+            }
+
+            fos.close();
+
+        } catch (IOException e) {
+            throw new MojoFailureException("Error writing to file " + all);
+        }
+    }
+
+    protected void executeDataFormats(Set<String> extensions) throws MojoExecutionException, MojoFailureException {
+        // TODO: include core data formats
+        getLog().info("Copying all Camel extension json descriptors");
+
+        // grab dataformats from camel-catalog
+        List catalogDataFormats;
+        try {
+            InputStream is = getClass().getClassLoader().getResourceAsStream("org/apache/camel/catalog/dataformats.properties");
+            String text = loadText(is);
+            catalogDataFormats = Arrays.asList(text.split("\n"));
+            getLog().info("Loaded " + catalogDataFormats.size() + " dataformats from camel-catalog");
+        } catch (IOException e) {
+            throw new MojoFailureException("Error loading resource from camel-catalog due " + e.getMessage(), e);
+        }
+
+        // make sure to create out dir
+        dataFormatsOutDir.mkdirs();
+
+        for (String extension : extensions) {
+            if (!isCamelDataFormat(catalogDataFormats, extension)) {
+                continue;
+            }
+
+            // for quarkus we need to amend the json file to use the quarkus maven GAV
+            try {
+                InputStream is = getClass().getClassLoader().getResourceAsStream("org/apache/camel/catalog/dataformats/" + extension + ".json");
+                String text = loadText(is);
+
+                text = GROUP_PATTERN.matcher(text).replaceFirst("\"groupId\": \"org.apache.camel.quarkus\"");
+                text = ARTIFACT_PATTERN.matcher(text).replaceFirst("\"artifactId\": \"camel-quarkus-$1\"");
+                text = VERSION_PATTERN.matcher(text).replaceFirst("\"version\": \"" + project.getVersion() + "\"");
+
+                // write new json file
+                File to = new File(dataFormatsOutDir, extension + ".json");
+                FileOutputStream fos = new FileOutputStream(to, false);
+
+                fos.write(text.getBytes());
+
+                fos.close();
+
+            } catch (IOException e) {
+                throw new MojoFailureException("Cannot write json file " + extension, e);
+            }
+        }
+
+        File all = new File(dataFormatsOutDir, "../dataformats.properties");
+        try {
+            FileOutputStream fos = new FileOutputStream(all, false);
+
+            String[] names = dataFormatsOutDir.list();
+            List<String> dataFormats = new ArrayList<>();
+            // sort the names
+            for (String name : names) {
+                if (name.endsWith(".json")) {
+                    // strip out .json from the name
+                    String dataFormatName = name.substring(0, name.length() - 5);
+                    dataFormats.add(dataFormatName);
+                }
+            }
+
+            Collections.sort(dataFormats);
+            for (String name : dataFormats) {
+                fos.write(name.getBytes());
+                fos.write("\n".getBytes());
+            }
+
+            fos.close();
+
+        } catch (IOException e) {
+            throw new MojoFailureException("Error writing to file " + all);
+        }
+    }
+
     private static boolean isCamelComponent(List<String> components, String name) {
         return components.stream().anyMatch(c -> c.equals(name));
     }
 
+    private static boolean isCamelLanguage(List<String> languages, String name) {
+        return languages.stream().anyMatch(c -> c.equals(name));
+    }
+
+    private static boolean isCamelDataFormat(List<String> dataFormats, String name) {
+        return dataFormats.stream().anyMatch(c -> c.equals(name));
+    }
+
     private Set<String> findExtensions() {
         Set<String> answer = new LinkedHashSet<>();
 


[camel-quarkus] 03/12: #75: Adding camel-quarkus-catalog (work in progress)

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch catalog
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 7c4c07d5906481759d0dce041b78357a352920b9
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Oct 8 09:42:02 2019 +0200

    #75: Adding camel-quarkus-catalog (work in progress)
---
 catalog/camel-quarkus-catalog/pom.xml              |  66 ++++
 catalog/pom.xml                                    |  38 +++
 pom.xml                                            |   3 +-
 .../quarkus/maven/PrepareCatalogQuarkusMojo.java   | 338 ++-------------------
 4 files changed, 123 insertions(+), 322 deletions(-)

diff --git a/catalog/camel-quarkus-catalog/pom.xml b/catalog/camel-quarkus-catalog/pom.xml
new file mode 100644
index 0000000..b478b09
--- /dev/null
+++ b/catalog/camel-quarkus-catalog/pom.xml
@@ -0,0 +1,66 @@
+<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
+         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.quarkus</groupId>
+        <artifactId>catalog</artifactId>
+        <version>0.2.1-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-catalog-quarkus</artifactId>
+    <packaging>jar</packaging>
+    <name>Camel Quarkus :: Camel Quarkus Catalog</name>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-catalog</artifactId>
+            <version>${camel.version}</version>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+
+            <!-- generate and include all components in the catalog -->
+            <plugin>
+                <groupId>org.apache.camel.quarkus</groupId>
+                <artifactId>camel-quarkus-package-maven-plugin</artifactId>
+                <version>${project.version}</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>prepare-catalog-quarkus</goal>
+                        </goals>
+                        <phase>process-resources</phase>
+                    </execution>
+                </executions>
+            </plugin>
+
+        </plugins>
+
+    </build>
+
+</project>
diff --git a/catalog/pom.xml b/catalog/pom.xml
new file mode 100644
index 0000000..e5a90f6
--- /dev/null
+++ b/catalog/pom.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-parent</artifactId>
+        <version>0.2.1-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>catalog</artifactId>
+    <packaging>pom</packaging>
+
+    <name>Camel Quarkus :: Catalog</name>
+
+    <modules>
+        <module>camel-quarkus-catalog</module>
+    </modules>
+
+</project>
diff --git a/pom.xml b/pom.xml
index 3220cf1..81f7c2d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,8 +74,9 @@
         <module>poms/bom</module>
         <module>poms/bom-deployment</module>
         <module>poms/build-parent</module>
-        <module>poms/tooling</module>
+        <module>tooling</module>
         <module>extensions</module>
+        <module>catalog</module>
         <module>integration-tests</module>
         <module>examples</module>
         <module>docs</module>
diff --git a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
index 59027a7..b8b53d2 100644
--- a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
+++ b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
@@ -60,50 +60,32 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
     /**
      * The output directory for components catalog
      */
-    @Parameter(defaultValue = "${project.build.directory}/classes/org/apache/camel/catalog/springboot/components")
+    @Parameter(defaultValue = "${project.build.directory}/classes/org/apache/camel/catalog/quarkus/components")
     protected File componentsOutDir;
 
     /**
      * The output directory for dataformats catalog
      */
-    @Parameter(defaultValue = "${project.build.directory}/classes/org/apache/camel/catalog/springboot/dataformats")
+    @Parameter(defaultValue = "${project.build.directory}/classes/org/apache/camel/catalog/quarkus/dataformats")
     protected File dataFormatsOutDir;
 
     /**
      * The output directory for languages catalog
      */
-    @Parameter(defaultValue = "${project.build.directory}/classes/org/apache/camel/catalog/springboot/languages")
+    @Parameter(defaultValue = "${project.build.directory}/classes/org/apache/camel/catalog/quarkus/languages")
     protected File languagesOutDir;
 
     /**
      * The output directory for others catalog
      */
-    @Parameter(defaultValue = "${project.build.directory}/classes/org/apache/camel/catalog/springboot/others")
+    @Parameter(defaultValue = "${project.build.directory}/classes/org/apache/camel/catalog/quarkus/others")
     protected File othersOutDir;
 
     /**
-     * The directory where all spring-boot starters are
+     * The directory where all quarkus extension starters are
      */
-    @Parameter(defaultValue = "${project.build.directory}/../../../platforms/spring-boot/quarkus-starter")
-    protected File componentsStarterDir;
-
-    /**
-     * The components directory where all the Apache Camel components are
-     */
-    @Parameter(defaultValue = "${project.build.directory}/../../../components")
-    protected File componentsDir;
-
-    /**
-     * The camel-core directory
-     */
-    @Parameter(defaultValue = "${project.build.directory}/../../../core/camel-core-engine")
-    protected File coreDir;
-
-    /**
-     * The camel-base directory
-     */
-    @Parameter(defaultValue = "${project.build.directory}/../../../core/camel-base")
-    protected File baseDir;
+    @Parameter(defaultValue = "${project.build.directory}/../../../extensions")
+    protected File extensionsDir;
 
     /**
      * Maven ProjectHelper.
@@ -120,14 +102,11 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
      */
     @Override
     public void execute() throws MojoExecutionException, MojoFailureException {
-        Set<String> starters = findSpringBootStarters();
-        executeComponents(starters);
-        executeDataFormats(starters);
-        executeLanguages(starters);
-        executeOthers(starters);
+        Set<String> starters = findExtensions();
+        //executeComponents(starters);
     }
 
-    protected void executeComponents(Set<String> starters) throws MojoExecutionException, MojoFailureException {
+    /*protected void executeComponents(Set<String> starters) throws MojoExecutionException, MojoFailureException {
         getLog().info("Copying all Camel component json descriptors");
 
         // lets use sorted set/maps
@@ -230,288 +209,7 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
         } catch (IOException e) {
             throw new MojoFailureException("Error writing to file " + all);
         }
-    }
-
-    protected void executeDataFormats(Set<String> starters) throws MojoExecutionException, MojoFailureException {
-        getLog().info("Copying all Camel dataformat json descriptors");
-
-        // lets use sorted set/maps
-        Set<File> jsonFiles = new TreeSet<>();
-        Set<File> dataFormatFiles = new TreeSet<>();
-
-        // find all data formats from the components directory
-        if (componentsDir != null && componentsDir.isDirectory()) {
-            File[] dataFormats = componentsDir.listFiles();
-            if (dataFormats != null) {
-                for (File dir : dataFormats) {
-                    if (dir.isDirectory() && !"target".equals(dir.getName())) {
-                        // the directory must be in the list of known starters
-                        if (!starters.contains(dir.getName())) {
-                            continue;
-                        }
-                        // this module must be active with a source folder
-                        File src = new File(dir, "src");
-                        boolean active = src.isDirectory() && src.exists();
-                        if (!active) {
-                            continue;
-                        }
-                        File target = new File(dir, "target/classes");
-                        findDataFormatFilesRecursive(target, jsonFiles, dataFormatFiles, new CamelDataFormatsFileFilter());
-                    }
-                }
-            }
-        }
-        if (coreDir != null && coreDir.isDirectory()) {
-            File target = new File(coreDir, "target/classes");
-            findDataFormatFilesRecursive(target, jsonFiles, dataFormatFiles, new CamelDataFormatsFileFilter());
-        }
-
-        getLog().info("Found " + dataFormatFiles.size() + " dataformat.properties files");
-        getLog().info("Found " + jsonFiles.size() + " dataformat json files");
-
-        // make sure to create out dir
-        dataFormatsOutDir.mkdirs();
-
-        for (File file : jsonFiles) {
-            // for spring-boot we need to amend the json file to use -starter as the artifact-id
-            try {
-                String text = loadText(new FileInputStream(file));
-
-                text = ARTIFACT_PATTERN.matcher(text).replaceFirst("\"artifactId\": \"camel-$1-starter\"");
-
-                // write new json file
-                File to = new File(dataFormatsOutDir, file.getName());
-                FileOutputStream fos = new FileOutputStream(to, false);
-
-                fos.write(text.getBytes());
-
-                fos.close();
-
-            } catch (IOException e) {
-                throw new MojoFailureException("Cannot write json file " + file, e);
-            }
-        }
-
-        File all = new File(dataFormatsOutDir, "../dataformats.properties");
-        try {
-            FileOutputStream fos = new FileOutputStream(all, false);
-
-            String[] names = dataFormatsOutDir.list();
-            List<String> dataFormats = new ArrayList<>();
-            // sort the names
-            for (String name : names) {
-                if (name.endsWith(".json")) {
-                    // strip out .json from the name
-                    String dataFormatName = name.substring(0, name.length() - 5);
-                    dataFormats.add(dataFormatName);
-                }
-            }
-
-            Collections.sort(dataFormats);
-            for (String name : dataFormats) {
-                fos.write(name.getBytes());
-                fos.write("\n".getBytes());
-            }
-
-            fos.close();
-
-        } catch (IOException e) {
-            throw new MojoFailureException("Error writing to file " + all);
-        }
-    }
-
-    protected void executeLanguages(Set<String> starters) throws MojoExecutionException, MojoFailureException {
-        getLog().info("Copying all Camel language json descriptors");
-
-        // lets use sorted set/maps
-        Set<File> jsonFiles = new TreeSet<>();
-        Set<File> languageFiles = new TreeSet<>();
-
-        // find all languages from the components directory
-        if (componentsDir != null && componentsDir.isDirectory()) {
-            File[] languages = componentsDir.listFiles();
-            if (languages != null) {
-                for (File dir : languages) {
-                    // the directory must be in the list of known starters
-                    if (!starters.contains(dir.getName())) {
-                        continue;
-                    }
-                    // this module must be active with a source folder
-                    File src = new File(dir, "src");
-                    boolean active = src.isDirectory() && src.exists();
-                    if (!active) {
-                        continue;
-                    }
-                    if (dir.isDirectory() && !"target".equals(dir.getName())) {
-                        File target = new File(dir, "target/classes");
-                        findLanguageFilesRecursive(target, jsonFiles, languageFiles, new CamelLanguagesFileFilter());
-                    }
-                }
-            }
-        }
-        if (baseDir != null && baseDir.isDirectory()) {
-            File target = new File(baseDir, "target/classes");
-            findLanguageFilesRecursive(target, jsonFiles, languageFiles, new CamelLanguagesFileFilter());
-            // also look in camel-jaxp
-            target = new File(coreDir, "../camel-jaxp/target/classes");
-            findLanguageFilesRecursive(target, jsonFiles, languageFiles, new CamelLanguagesFileFilter());
-        }
-
-        getLog().info("Found " + languageFiles.size() + " language.properties files");
-        getLog().info("Found " + jsonFiles.size() + " language json files");
-
-        // make sure to create out dir
-        languagesOutDir.mkdirs();
-
-        for (File file : jsonFiles) {
-            // for spring-boot we need to amend the json file to use -starter as the artifact-id
-            try {
-                String text = loadText(new FileInputStream(file));
-
-                text = ARTIFACT_PATTERN.matcher(text).replaceFirst("\"artifactId\": \"camel-$1-starter\"");
-
-                // write new json file
-                File to = new File(languagesOutDir, file.getName());
-                FileOutputStream fos = new FileOutputStream(to, false);
-
-                fos.write(text.getBytes());
-
-                fos.close();
-
-            } catch (IOException e) {
-                throw new MojoFailureException("Cannot write json file " + file, e);
-            }
-        }
-
-        File all = new File(languagesOutDir, "../languages.properties");
-        try {
-            FileOutputStream fos = new FileOutputStream(all, false);
-
-            String[] names = languagesOutDir.list();
-            List<String> languages = new ArrayList<>();
-            // sort the names
-            for (String name : names) {
-                if (name.endsWith(".json")) {
-                    // strip out .json from the name
-                    String languageName = name.substring(0, name.length() - 5);
-                    languages.add(languageName);
-                }
-            }
-
-            Collections.sort(languages);
-            for (String name : languages) {
-                fos.write(name.getBytes());
-                fos.write("\n".getBytes());
-            }
-
-            fos.close();
-
-        } catch (IOException e) {
-            throw new MojoFailureException("Error writing to file " + all);
-        }
-    }
-
-    protected void executeOthers(Set<String> starters) throws MojoExecutionException, MojoFailureException {
-        getLog().info("Copying all Camel other json descriptors");
-
-        // lets use sorted set/maps
-        Set<File> jsonFiles = new TreeSet<>();
-        Set<File> otherFiles = new TreeSet<>();
-
-        // find all other from the components directory
-        if (componentsDir != null && componentsDir.isDirectory()) {
-            File[] others = componentsDir.listFiles();
-            if (others != null) {
-                for (File dir : others) {
-                    // the directory must be in the list of known starters
-                    if (!starters.contains(dir.getName())) {
-                        continue;
-                    }
-
-                    // skip these special cases
-                    boolean special = "camel-core-osgi".equals(dir.getName())
-                        || "camel-core-xml".equals(dir.getName())
-                        || "camel-http-common".equals(dir.getName())
-                        || "camel-jetty-common".equals(dir.getName());
-                    boolean special2 = "camel-as2".equals(dir.getName())
-                        || "camel-box".equals(dir.getName())
-                        || "camel-linkedin".equals(dir.getName())
-                        || "camel-olingo2".equals(dir.getName())
-                        || "camel-olingo4".equals(dir.getName())
-                        || "camel-servicenow".equals(dir.getName())
-                        || "camel-salesforce".equals(dir.getName());
-                    if (special || special2) {
-                        continue;
-                    }
-
-                    // this module must be active with a source folder
-                    File src = new File(dir, "src");
-                    boolean active = src.isDirectory() && src.exists();
-                    if (!active) {
-                        continue;
-                    }
-
-                    if (dir.isDirectory() && !"target".equals(dir.getName())) {
-                        File target = new File(dir, "target/classes");
-                        findOtherFilesRecursive(target, jsonFiles, otherFiles, new CamelOthersFileFilter());
-                    }
-                }
-            }
-        }
-
-        getLog().info("Found " + otherFiles.size() + " other.properties files");
-        getLog().info("Found " + jsonFiles.size() + " other json files");
-
-        // make sure to create out dir
-        othersOutDir.mkdirs();
-
-        for (File file : jsonFiles) {
-            // for spring-boot we need to amend the json file to use -starter as the artifact-id
-            try {
-                String text = loadText(new FileInputStream(file));
-
-                text = ARTIFACT_PATTERN.matcher(text).replaceFirst("\"artifactId\": \"camel-$1-starter\"");
-
-                // write new json file
-                File to = new File(othersOutDir, file.getName());
-                FileOutputStream fos = new FileOutputStream(to, false);
-
-                fos.write(text.getBytes());
-
-                fos.close();
-
-            } catch (IOException e) {
-                throw new MojoFailureException("Cannot write json file " + file, e);
-            }
-        }
-
-        File all = new File(othersOutDir, "../others.properties");
-        try {
-            FileOutputStream fos = new FileOutputStream(all, false);
-
-            String[] names = othersOutDir.list();
-            List<String> others = new ArrayList<>();
-            // sort the names
-            for (String name : names) {
-                if (name.endsWith(".json")) {
-                    // strip out .json from the name
-                    String otherName = name.substring(0, name.length() - 5);
-                    others.add(otherName);
-                }
-            }
-
-            Collections.sort(others);
-            for (String name : others) {
-                fos.write(name.getBytes());
-                fos.write("\n".getBytes());
-            }
-
-            fos.close();
-
-        } catch (IOException e) {
-            throw new MojoFailureException("Error writing to file " + all);
-        }
-    }
+    } */
 
     private void findComponentFilesRecursive(File dir, Set<File> found, Set<File> components, FileFilter filter) {
         File[] files = dir.listFiles(filter);
@@ -693,21 +391,19 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
         }
     }
 
-    private Set<String> findSpringBootStarters() {
+    private Set<String> findExtensions() {
         Set<String> answer = new LinkedHashSet<>();
 
-        String[] names = componentsStarterDir.list();
+        File[] names = extensionsDir.listFiles();
         if (names != null) {
-            for (String name : names) {
-                if (name.startsWith("camel-") && name.endsWith("-starter")) {
-                    // remove ending -starter
-                    String regular = name.substring(0, name.length() - 8);
-                    answer.add(regular);
+            for (File name : names) {
+                if (name.isDirectory()) {
+                    answer.add(name.getName());
                 }
             }
         }
 
-        getLog().info("Found " + answer.size() + " Camel Spring Boot starters from: " + componentsStarterDir);
+        getLog().info("Found " + answer.size() + " Camel Quarkus Extensions from: " + extensionsDir);
 
         return answer;
     }


[camel-quarkus] 12/12: Fixes #75: Adding camel-quarkus-catalog

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch catalog
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit f13311b21f3717f6806cc70f94f73b537744eee0
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Oct 8 15:09:17 2019 +0200

    Fixes #75: Adding camel-quarkus-catalog
---
 .../quarkus/QuarkusRuntimeProviderTest.java        | 53 +++++++++++++---------
 .../quarkus/maven/PrepareCatalogQuarkusMojo.java   | 19 ++++++--
 2 files changed, 47 insertions(+), 25 deletions(-)

diff --git a/catalog/camel-quarkus-catalog/src/test/java/org/apache/camel/catalog/quarkus/QuarkusRuntimeProviderTest.java b/catalog/camel-quarkus-catalog/src/test/java/org/apache/camel/catalog/quarkus/QuarkusRuntimeProviderTest.java
index 1c8e2e9..5867c5b 100644
--- a/catalog/camel-quarkus-catalog/src/test/java/org/apache/camel/catalog/quarkus/QuarkusRuntimeProviderTest.java
+++ b/catalog/camel-quarkus-catalog/src/test/java/org/apache/camel/catalog/quarkus/QuarkusRuntimeProviderTest.java
@@ -21,7 +21,6 @@ import java.util.List;
 import org.apache.camel.catalog.CamelCatalog;
 import org.apache.camel.catalog.DefaultCamelCatalog;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
@@ -29,9 +28,6 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
-// TODO: Update
-
-@Ignore
 public class QuarkusRuntimeProviderTest {
 
     static CamelCatalog catalog;
@@ -64,9 +60,15 @@ public class QuarkusRuntimeProviderTest {
         assertNotNull(names);
         assertFalse(names.isEmpty());
 
-        assertTrue(names.contains("file"));
-        assertTrue(names.contains("ftp"));
-        assertTrue(names.contains("jms"));
+        assertTrue(names.contains("aws-eks"));
+        assertTrue(names.contains("bean"));
+        assertTrue(names.contains("direct"));
+        assertTrue(names.contains("imap"));
+        assertTrue(names.contains("imaps"));
+        assertTrue(names.contains("jdbc"));
+        assertTrue(names.contains("log"));
+        assertTrue(names.contains("servlet"));
+        assertTrue(names.contains("twitter-search"));
         // camel-pax-logging does not work in quarkus
         assertFalse(names.contains("paxlogging"));
     }
@@ -78,8 +80,8 @@ public class QuarkusRuntimeProviderTest {
         assertNotNull(names);
         assertFalse(names.isEmpty());
 
-        assertTrue(names.contains("bindy-csv"));
-        assertTrue(names.contains("zipdeflater"));
+        assertTrue(names.contains("csv"));
+        assertTrue(names.contains("mime-multipart"));
         assertTrue(names.contains("zipfile"));
     }
 
@@ -90,9 +92,15 @@ public class QuarkusRuntimeProviderTest {
         assertNotNull(names);
         assertFalse(names.isEmpty());
 
+        // core languages
+        assertTrue(names.contains("constant"));
         assertTrue(names.contains("simple"));
-        assertTrue(names.contains("spel"));
-        assertTrue(names.contains("xpath"));
+
+        // quarkus-bean
+        assertTrue(names.contains("bean"));
+
+        // spring expression language are not in quarkus
+        assertFalse(names.contains("spel"));
     }
 
     @Test
@@ -102,43 +110,44 @@ public class QuarkusRuntimeProviderTest {
         assertNotNull(names);
         assertFalse(names.isEmpty());
 
-        assertTrue(names.contains("hystrix"));
-        assertTrue(names.contains("spring-boot"));
-        assertTrue(names.contains("zipkin"));
+        assertTrue(names.contains("core-cloud"));
+        assertTrue(names.contains("platform-http"));
+        assertTrue(names.contains("reactive-executor"));
 
         assertFalse(names.contains("blueprint"));
+        assertFalse(names.contains("hystrix"));
     }
 
     @Test
     public void testComponentArtifactId() throws Exception {
-        String json = catalog.componentJSonSchema("ftp");
+        String json = catalog.componentJSonSchema("salesforce");
 
         assertNotNull(json);
-        assertTrue(json.contains("camel-ftp-starter"));
+        assertTrue(json.contains("camel-quarkus-salesforce"));
     }
 
     @Test
     public void testDataFormatArtifactId() throws Exception {
-        String json = catalog.dataFormatJSonSchema("bindy-csv");
+        String json = catalog.dataFormatJSonSchema("csv");
 
         assertNotNull(json);
-        assertTrue(json.contains("camel-bindy-starter"));
+        assertTrue(json.contains("camel-quarkus-csv"));
     }
 
     @Test
     public void testLanguageArtifactId() throws Exception {
-        String json = catalog.languageJSonSchema("spel");
+        String json = catalog.languageJSonSchema("bean");
 
         assertNotNull(json);
-        assertTrue(json.contains("camel-spring-starter"));
+        assertTrue(json.contains("camel-quarkus-bean"));
     }
 
     @Test
     public void testOtherArtifactId() throws Exception {
-        String json = catalog.otherJSonSchema("zipkin");
+        String json = catalog.otherJSonSchema("reactive-executor");
 
         assertNotNull(json);
-        assertTrue(json.contains("camel-zipkin-starter"));
+        assertTrue(json.contains("camel-quarkus-reactive-executor"));
     }
 
 }
diff --git a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
index 17bf3d2..3c84881 100644
--- a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
+++ b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
@@ -160,7 +160,12 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
     }
 
     protected void executeLanguages(Set<String> artifactIds) throws MojoExecutionException, MojoFailureException {
-        doExecute(artifactIds, "languages", languagesOutDir);
+        // include core languages (simple, header etc) and refer to camel-quarkus-core
+        Set<String> set = new LinkedHashSet<>();
+        set.add("camel-base");
+        set.addAll(artifactIds);
+
+        doExecute(set, "languages", languagesOutDir);
     }
 
     protected void executeDataFormats(Set<String> artifactIds) throws MojoExecutionException, MojoFailureException {
@@ -174,7 +179,7 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
             InputStream is = getClass().getClassLoader().getResourceAsStream("org/apache/camel/catalog/" + kind + ".properties");
             String text = loadText(is);
             catalog = Arrays.asList(text.split("\n"));
-            getLog().info("Loaded " + catalog.size() + " " + kind + " from camel-catalog");
+            getLog().debug("Loaded " + catalog.size() + " " + kind + " from camel-catalog");
         } catch (IOException e) {
             throw new MojoFailureException("Error loading resource from camel-catalog due " + e.getMessage(), e);
         }
@@ -200,7 +205,11 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
 
             for (String text : jsonFiles) {
                 text = GROUP_PATTERN.matcher(text).replaceFirst("\"groupId\": \"org.apache.camel.quarkus\"");
-                text = ARTIFACT_PATTERN.matcher(text).replaceFirst("\"artifactId\": \"camel-quarkus-$1\"");
+                if ("camel-base".equals(artifactId)) {
+                    text = ARTIFACT_PATTERN.matcher(text).replaceFirst("\"artifactId\": \"camel-quarkus-core\"");
+                } else {
+                    text = ARTIFACT_PATTERN.matcher(text).replaceFirst("\"artifactId\": \"camel-quarkus-$1\"");
+                }
                 text = VERSION_PATTERN.matcher(text).replaceFirst("\"version\": \"" + project.getVersion() + "\"");
 
                 Pattern pattern = null;
@@ -254,6 +263,8 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
 
             fos.close();
 
+            getLog().info("Added " + lines.size() + " " + kind + " to quarkus-camel-catalog");
+
         } catch (IOException e) {
             throw new MojoFailureException("Error writing to file " + all);
         }
@@ -338,6 +349,8 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
 
             fos.close();
 
+            getLog().info("Added " + others.size() + " others to quarkus-camel-catalog");
+
         } catch (IOException e) {
             throw new MojoFailureException("Error writing to file " + all);
         }


[camel-quarkus] 09/12: #75: Adding camel-quarkus-catalog (work in progress)

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch catalog
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 2049ca39508152dcc2c3dd08d3643593c0b2cc1c
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Oct 8 13:55:41 2019 +0200

    #75: Adding camel-quarkus-catalog (work in progress)
---
 .../quarkus/maven/PrepareCatalogQuarkusMojo.java   | 278 +++++----------------
 1 file changed, 68 insertions(+), 210 deletions(-)

diff --git a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
index 63163d7..3a32e46 100644
--- a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
+++ b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
@@ -66,6 +66,7 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
     };
 
     private static final Pattern SCHEME_PATTERN = Pattern.compile("\"scheme\": \"(.*)\"");
+    private static final Pattern NAME_PATTERN = Pattern.compile("\"name\": \"(.*)\"");
     private static final Pattern GROUP_PATTERN = Pattern.compile("\"groupId\": \"(org.apache.camel)\"");
     private static final Pattern ARTIFACT_PATTERN = Pattern.compile("\"artifactId\": \"camel-(.*)\"");
     private static final Pattern VERSION_PATTERN = Pattern.compile("\"version\": \"(.*)\"");
@@ -89,7 +90,6 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
     private MavenProjectHelper projectHelper;
 
     /**
-     *
      * The output directory for components catalog
      */
     @Parameter(defaultValue = "${project.build.directory}/classes/org/apache/camel/catalog/quarkus/components")
@@ -123,39 +123,22 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
      * Execute goal.
      *
      * @throws MojoExecutionException execution of the main class or one of the
-     *                                                        threads it generated failed.
+     *                                threads it generated failed.
      * @throws MojoFailureException   something bad happened...
      */
     @Override
     public void execute() throws MojoExecutionException, MojoFailureException {
         Set<String> extensions = findExtensions();
-        executeComponents(extensions);
-//        executeLanguages(extensions);
-//        executeDataFormats(extensions);
-//        executeOthers(extensions);
+        Set<String> artifacts = extractArtifactIds(extensions);
+        executeComponents(artifacts);
+        executeLanguages(artifacts);
+        executeDataFormats(artifacts);
+//        executeOthers(artifacts);
     }
 
-    protected void executeComponents(Set<String> extensions) throws MojoExecutionException, MojoFailureException {
-        getLog().info("Copying all Camel extension json descriptors");
-
-        // grab components from camel-catalog
-        List<String> catalogComponents;
-        try {
-            InputStream is = getClass().getClassLoader().getResourceAsStream("org/apache/camel/catalog/components.properties");
-            String text = loadText(is);
-            catalogComponents = Arrays.asList(text.split("\n"));
-            getLog().info("Loaded " + catalogComponents.size() + " components from camel-catalog");
-        } catch (IOException e) {
-            throw new MojoFailureException("Error loading resource from camel-catalog due " + e.getMessage(), e);
-        }
-
-        // make sure to create out dir
-        componentsOutDir.mkdirs();
-
+    private Set<String> extractArtifactIds(Set<String> extensions) throws MojoFailureException {
+        Set<String> answer = new LinkedHashSet<>();
         for (String extension : extensions) {
-
-            // grab GAB
-            String artifactId = null;
             try {
                 MavenProject extProject = getMavenProject("org.apache.camel.quarkus", "camel-quarkus-" + extension, project.getVersion());
                 // grab camel artifact
@@ -163,25 +146,50 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
                         .filter(p -> "org.apache.camel".equals(p.getGroupId()) && "compile".equals(p.getScope()))
                         .findFirst();
                 if (artifact.isPresent()) {
-                    artifactId = artifact.get().getArtifactId();
+                    String artifactId = artifact.get().getArtifactId();
+                    answer.add(artifactId);
                 }
             } catch (ProjectBuildingException e) {
                 throw new MojoFailureException("Cannot read pom.xml for extension " + extension, e);
             }
+        }
+        return answer;
+    }
 
-            if (artifactId == null) {
-                continue;
-            }
+    protected void executeComponents(Set<String> artifactIds) throws MojoExecutionException, MojoFailureException {
+        doExecute(artifactIds, "components", componentsOutDir);
+    }
 
-            getLog().info("Discovered camel-quarkus extension org.apache.camel.quarkus:" + artifactId);
+    protected void executeLanguages(Set<String> artifactIds) throws MojoExecutionException, MojoFailureException {
+        doExecute(artifactIds, "languages", languagesOutDir);
+    }
 
+    protected void executeDataFormats(Set<String> artifactIds) throws MojoExecutionException, MojoFailureException {
+        doExecute(artifactIds, "dataformats", dataFormatsOutDir);
+    }
+
+    protected void doExecute(Set<String> artifactIds, String kind, File outsDir) throws MojoExecutionException, MojoFailureException {
+        // grab from camel-catalog
+        List<String> catalog;
+        try {
+            InputStream is = getClass().getClassLoader().getResourceAsStream("org/apache/camel/catalog/" + kind + ".properties");
+            String text = loadText(is);
+            catalog = Arrays.asList(text.split("\n"));
+            getLog().info("Loaded " + catalog.size() + " " + kind + " from camel-catalog");
+        } catch (IOException e) {
+            throw new MojoFailureException("Error loading resource from camel-catalog due " + e.getMessage(), e);
+        }
+
+        // make sure to create out dir
+        outsDir.mkdirs();
+
+        for (String artifactId : artifactIds) {
             // for quarkus we need to amend the json file to use the quarkus maven GAV
             List<String> jsonFiles = new ArrayList<>();
             try {
-                for (String component : catalogComponents) {
-                    InputStream is = getClass().getClassLoader().getResourceAsStream("org/apache/camel/catalog/components/" + component + ".json");
+                for (String name : catalog) {
+                    InputStream is = getClass().getClassLoader().getResourceAsStream("org/apache/camel/catalog/" + kind + "/" + name + ".json");
                     String text = loadText(is);
-                    // see if it its a
                     boolean match = text.contains("\"artifactId\": \"" + artifactId + "\"");
                     if (match) {
                         jsonFiles.add(text);
@@ -192,192 +200,55 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
             }
 
             for (String text : jsonFiles) {
-                try {
-                    text = GROUP_PATTERN.matcher(text).replaceFirst("\"groupId\": \"org.apache.camel.quarkus\"");
-                    text = ARTIFACT_PATTERN.matcher(text).replaceFirst("\"artifactId\": \"camel-quarkus-$1\"");
-                    text = VERSION_PATTERN.matcher(text).replaceFirst("\"version\": \"" + project.getVersion() + "\"");
+                text = GROUP_PATTERN.matcher(text).replaceFirst("\"groupId\": \"org.apache.camel.quarkus\"");
+                text = ARTIFACT_PATTERN.matcher(text).replaceFirst("\"artifactId\": \"camel-quarkus-$1\"");
+                text = VERSION_PATTERN.matcher(text).replaceFirst("\"version\": \"" + project.getVersion() + "\"");
 
-                    Matcher matcher = SCHEME_PATTERN.matcher(text);
-                    if (matcher.find()) {
-                        String scheme = matcher.group(1);
+                Pattern pattern = null;
+                if ("components".equals(kind)) {
+                    pattern = SCHEME_PATTERN;
+                } else if ("languages".equals(kind)) {
+                    pattern = NAME_PATTERN;
+                } else if ("dataformats".equals(kind)) {
+                    pattern = NAME_PATTERN;
+                }
 
+                Matcher matcher = pattern.matcher(text);
+                if (matcher.find()) {
+                    String scheme = matcher.group(1);
+
+                    try {
                         // write new json file
-                        File to = new File(componentsOutDir, scheme + ".json");
+                        File to = new File(outsDir, scheme + ".json");
                         FileOutputStream fos = new FileOutputStream(to, false);
 
                         fos.write(text.getBytes());
 
                         fos.close();
+                    } catch (IOException e) {
+                        throw new MojoFailureException("Cannot write json file " + scheme, e);
                     }
-                } catch (IOException e) {
-                    throw new MojoFailureException("Cannot write json file " + extension, e);
                 }
             }
         }
 
-        File all = new File(componentsOutDir, "../components.properties");
+        File all = new File(outsDir, "../" + kind + ".properties");
         try {
             FileOutputStream fos = new FileOutputStream(all, false);
 
-            String[] names = componentsOutDir.list();
-            List<String> components = new ArrayList<>();
+            String[] names = outsDir.list();
+            List<String> lines = new ArrayList<>();
             // sort the names
             for (String name : names) {
                 if (name.endsWith(".json")) {
                     // strip out .json from the name
-                    String componentName = name.substring(0, name.length() - 5);
-                    components.add(componentName);
+                    String shortName = name.substring(0, name.length() - 5);
+                    lines.add(shortName);
                 }
             }
 
-            Collections.sort(components);
-            for (String name : components) {
-                fos.write(name.getBytes());
-                fos.write("\n".getBytes());
-            }
-
-            fos.close();
-
-        } catch (IOException e) {
-            throw new MojoFailureException("Error writing to file " + all);
-        }
-    }
-
-    protected void executeLanguages(Set<String> extensions) throws MojoExecutionException, MojoFailureException {
-        // TODO: include core languages
-        getLog().info("Copying all Camel extension json descriptors");
-
-        // grab languages from camel-catalog
-        List catalogLanguages;
-        try {
-            InputStream is = getClass().getClassLoader().getResourceAsStream("org/apache/camel/catalog/languages.properties");
-            String text = loadText(is);
-            catalogLanguages = Arrays.asList(text.split("\n"));
-            getLog().info("Loaded " + catalogLanguages.size() + " languages from camel-catalog");
-        } catch (IOException e) {
-            throw new MojoFailureException("Error loading resource from camel-catalog due " + e.getMessage(), e);
-        }
-
-        // make sure to create out dir
-        languagesOutDir.mkdirs();
-
-        for (String extension : extensions) {
-            if (!isCamelLanguage(catalogLanguages, extension)) {
-                continue;
-            }
-
-            // for quarkus we need to amend the json file to use the quarkus maven GAV
-            try {
-                InputStream is = getClass().getClassLoader().getResourceAsStream("org/apache/camel/catalog/languages/" + extension + ".json");
-                String text = loadText(is);
-
-                text = GROUP_PATTERN.matcher(text).replaceFirst("\"groupId\": \"org.apache.camel.quarkus\"");
-                text = ARTIFACT_PATTERN.matcher(text).replaceFirst("\"artifactId\": \"camel-quarkus-$1\"");
-                text = VERSION_PATTERN.matcher(text).replaceFirst("\"version\": \"" + project.getVersion() + "\"");
-
-                // write new json file
-                File to = new File(languagesOutDir, extension + ".json");
-                FileOutputStream fos = new FileOutputStream(to, false);
-
-                fos.write(text.getBytes());
-
-                fos.close();
-
-            } catch (IOException e) {
-                throw new MojoFailureException("Cannot write json file " + extension, e);
-            }
-        }
-
-        File all = new File(languagesOutDir, "../languages.properties");
-        try {
-            FileOutputStream fos = new FileOutputStream(all, false);
-
-            String[] names = languagesOutDir.list();
-            List<String> languages = new ArrayList<>();
-            // sort the names
-            for (String name : names) {
-                if (name.endsWith(".json")) {
-                    // strip out .json from the name
-                    String languageName = name.substring(0, name.length() - 5);
-                    languages.add(languageName);
-                }
-            }
-
-            Collections.sort(languages);
-            for (String name : languages) {
-                fos.write(name.getBytes());
-                fos.write("\n".getBytes());
-            }
-
-            fos.close();
-
-        } catch (IOException e) {
-            throw new MojoFailureException("Error writing to file " + all);
-        }
-    }
-
-    protected void executeDataFormats(Set<String> extensions) throws MojoExecutionException, MojoFailureException {
-        // TODO: include core data formats
-        getLog().info("Copying all Camel extension json descriptors");
-
-        // grab dataformats from camel-catalog
-        List catalogDataFormats;
-        try {
-            InputStream is = getClass().getClassLoader().getResourceAsStream("org/apache/camel/catalog/dataformats.properties");
-            String text = loadText(is);
-            catalogDataFormats = Arrays.asList(text.split("\n"));
-            getLog().info("Loaded " + catalogDataFormats.size() + " dataformats from camel-catalog");
-        } catch (IOException e) {
-            throw new MojoFailureException("Error loading resource from camel-catalog due " + e.getMessage(), e);
-        }
-
-        // make sure to create out dir
-        dataFormatsOutDir.mkdirs();
-
-        for (String extension : extensions) {
-            if (!isCamelDataFormat(catalogDataFormats, extension)) {
-                continue;
-            }
-
-            // for quarkus we need to amend the json file to use the quarkus maven GAV
-            try {
-                InputStream is = getClass().getClassLoader().getResourceAsStream("org/apache/camel/catalog/dataformats/" + extension + ".json");
-                String text = loadText(is);
-
-                text = GROUP_PATTERN.matcher(text).replaceFirst("\"groupId\": \"org.apache.camel.quarkus\"");
-                text = ARTIFACT_PATTERN.matcher(text).replaceFirst("\"artifactId\": \"camel-quarkus-$1\"");
-                text = VERSION_PATTERN.matcher(text).replaceFirst("\"version\": \"" + project.getVersion() + "\"");
-
-                // write new json file
-                File to = new File(dataFormatsOutDir, extension + ".json");
-                FileOutputStream fos = new FileOutputStream(to, false);
-
-                fos.write(text.getBytes());
-
-                fos.close();
-
-            } catch (IOException e) {
-                throw new MojoFailureException("Cannot write json file " + extension, e);
-            }
-        }
-
-        File all = new File(dataFormatsOutDir, "../dataformats.properties");
-        try {
-            FileOutputStream fos = new FileOutputStream(all, false);
-
-            String[] names = dataFormatsOutDir.list();
-            List<String> dataFormats = new ArrayList<>();
-            // sort the names
-            for (String name : names) {
-                if (name.endsWith(".json")) {
-                    // strip out .json from the name
-                    String dataFormatName = name.substring(0, name.length() - 5);
-                    dataFormats.add(dataFormatName);
-                }
-            }
-
-            Collections.sort(dataFormats);
-            for (String name : dataFormats) {
+            Collections.sort(lines);
+            for (String name : lines) {
                 fos.write(name.getBytes());
                 fos.write("\n".getBytes());
             }
@@ -393,7 +264,6 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
         // make sure to create out dir
         othersOutDir.mkdirs();
 
-
         for (String extension : extensions) {
             // skip if the extension is already one of the following
             boolean component = new File(componentsOutDir, extension + ".json").exists();
@@ -486,18 +356,6 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
         }
     }
 
-    private static boolean isCamelComponent(List<String> components, String name) {
-        return components.stream().anyMatch(c -> c.equals(name));
-    }
-
-    private static boolean isCamelLanguage(List<String> languages, String name) {
-        return languages.stream().anyMatch(c -> c.equals(name));
-    }
-
-    private static boolean isCamelDataFormat(List<String> dataFormats, String name) {
-        return dataFormats.stream().anyMatch(c -> c.equals(name));
-    }
-
     private Set<String> findExtensions() {
         Set<String> answer = new LinkedHashSet<>();
 


[camel-quarkus] 02/12: #75: Adding camel-quarkus-catalog (work in progress)

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch catalog
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 75ab87169268fbafac5f154744d8d7932371a116
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Oct 8 09:24:12 2019 +0200

    #75: Adding camel-quarkus-catalog (work in progress)
---
 tooling/maven/package-maven-plugin/pom.xml         | 103 +++
 .../apache/camel/quarkus/maven/PackageHelper.java  | 179 ++++++
 .../quarkus/maven/PrepareCatalogQuarkusMojo.java   | 715 +++++++++++++++++++++
 .../src/main/resources/META-INF/LICENSE.txt        | 203 ++++++
 .../src/main/resources/META-INF/NOTICE.txt         |  11 +
 .../camel-quarkus-package-maven-plugin.properties  |  16 +
 tooling/maven/pom.xml                              |   7 +-
 tooling/parent/pom.xml                             | 151 +++++
 tooling/pom.xml                                    |   1 +
 9 files changed, 1382 insertions(+), 4 deletions(-)

diff --git a/tooling/maven/package-maven-plugin/pom.xml b/tooling/maven/package-maven-plugin/pom.xml
new file mode 100644
index 0000000..db07ee0
--- /dev/null
+++ b/tooling/maven/package-maven-plugin/pom.xml
@@ -0,0 +1,103 @@
+<?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/xsd/maven-4.0.0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-tooling-maven</artifactId>
+        <version>0.2.1-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-quarkus-package-maven-plugin</artifactId>
+    <packaging>maven-plugin</packaging>
+
+    <name>Camel Quarkus :: Tooling :: Maven :: Camel Quarkus Package Maven Plugin</name>
+    <description>Maven plugin to help package Camel quarkus components and plugins</description>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.camel.quarkus</groupId>
+                <artifactId>tooling-parent</artifactId>
+                <version>${project.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-core</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.codehaus.plexus</groupId>
+                    <artifactId>plexus-classworlds</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.codehaus.plexus</groupId>
+                    <artifactId>plexus-component-annotations</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-artifact</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-plugin-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven.plugin-tools</groupId>
+            <artifactId>maven-plugin-annotations</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.plexus</groupId>
+            <artifactId>plexus-container-default</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.plexus</groupId>
+            <artifactId>plexus-utils</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.sonatype.plexus</groupId>
+            <artifactId>plexus-build-api</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-plugin-plugin</artifactId>
+                <configuration>
+                    <mojoDependencies>
+                        <dep>org.apache.maven:maven-plugin-api</dep>
+                    </mojoDependencies>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PackageHelper.java b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PackageHelper.java
new file mode 100644
index 0000000..098c99c
--- /dev/null
+++ b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PackageHelper.java
@@ -0,0 +1,179 @@
+/*
+ * 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.quarkus.maven;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.LineNumberReader;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+// TODO: Remove not needed stuff
+
+public final class PackageHelper {
+
+    private PackageHelper() {
+    }
+    
+    /**
+     * Loads the entire stream into memory as a String and returns it.
+     * <p/>
+     * <b>Notice:</b> This implementation appends a <tt>\n</tt> as line
+     * terminator at the of the text.
+     * <p/>
+     * Warning, don't use for crazy big streams :)
+     */
+    public static String loadText(InputStream in) throws IOException {
+        StringBuilder builder = new StringBuilder();
+        InputStreamReader isr = new InputStreamReader(in);
+        try {
+            BufferedReader reader = new LineNumberReader(isr);
+            while (true) {
+                String line = reader.readLine();
+                if (line != null) {
+                    builder.append(line);
+                    builder.append("\n");
+                } else {
+                    break;
+                }
+            }
+            return builder.toString();
+        } finally {
+            isr.close();
+            in.close();
+        }
+    }
+
+    public static void writeText(File file, String text) throws IOException {
+        FileOutputStream fos = new FileOutputStream(file, false);
+        try {
+            fos.write(text.getBytes());
+        } finally {
+            fos.close();
+        }
+    }
+
+    public static String after(String text, String after) {
+        if (!text.contains(after)) {
+            return null;
+        }
+        return text.substring(text.indexOf(after) + after.length());
+    }
+
+    /**
+     * Parses the text as a map (eg key=value)
+     * @param data the data
+     * @return the map
+     */
+    public static Map<String, String> parseAsMap(String data) {
+        Map<String, String> answer = new HashMap<>();
+        if (data != null) {
+            String[] lines = data.split("\n");
+            for (String line : lines) {
+                int idx = line.indexOf('=');
+                if (idx != -1) {
+                    String key = line.substring(0, idx);
+                    String value = line.substring(idx + 1);
+                    // remove ending line break for the values
+                    value = value.trim().replaceAll("\n", "");
+                    answer.put(key.trim(), value);
+                }
+            }
+        }
+        return answer;
+    }
+
+    public static Set<File> findJsonFiles(File dir, FileFilter filter) {
+        Set<File> files = new TreeSet<>();
+        findJsonFiles(dir, files, filter);
+
+        return files;
+    }
+
+    public static void findJsonFiles(File dir, Set<File> found, FileFilter filter) {
+        File[] files = dir.listFiles(filter);
+        if (files != null) {
+            for (File file : files) {
+                // skip files in root dirs as Camel does not store information there but others may do
+                boolean jsonFile = file.isFile() && file.getName().endsWith(".json");
+                if (jsonFile) {
+                    found.add(file);
+                } else if (file.isDirectory()) {
+                    findJsonFiles(file, found, filter);
+                }
+            }
+        }
+    }
+
+    public static class CamelComponentsModelFilter implements FileFilter {
+
+        @Override
+        public boolean accept(File pathname) {
+            return pathname.isDirectory() || pathname.getName().endsWith(".json");
+        }
+    }
+
+    public static class CamelOthersModelFilter implements FileFilter {
+
+        @Override
+        public boolean accept(File pathname) {
+            String name = pathname.getName();
+            boolean special = "camel-core-osgi".equals(name)
+                || "camel-core-xml".equals(name)
+                || "camel-http-common".equals(name)
+                || "camel-jetty-common".equals(name);
+            boolean special2 = "camel-as2".equals(name)
+                || "camel-box".equals(name)
+                || "camel-linkedin".equals(name)
+                || "camel-olingo2".equals(name)
+                || "camel-olingo4".equals(name)
+                || "camel-salesforce".equals(name);
+            if (special || special2) {
+                return false;
+            }
+
+            return pathname.isDirectory() || name.endsWith(".json");
+        }
+    }
+
+    public static File findCamelCoreDirectory(File dir) {
+        return findCamelDirectory(dir, "core/camel-core-engine");
+    }
+
+    public static File findCamelDirectory(File dir, String path) {
+        if (dir == null) {
+            return null;
+        }
+        Path p = dir.toPath().resolve(path);
+        if (Files.isDirectory(p)) {
+            return p.toFile();
+        } else {
+            // okay walk up the parent dir
+            return findCamelDirectory(dir.getParentFile(), path);
+        }
+    }
+
+}
diff --git a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
new file mode 100644
index 0000000..59027a7
--- /dev/null
+++ b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
@@ -0,0 +1,715 @@
+/*
+ * 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.quarkus.maven;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.channels.FileChannel;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.regex.Pattern;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectHelper;
+
+import static org.apache.camel.quarkus.maven.PackageHelper.loadText;
+
+/**
+ * Prepares the Quarkus provider camel catalog to include component it supports
+ */
+@Mojo(name = "prepare-catalog-quarkus", threadSafe = true)
+public class PrepareCatalogQuarkusMojo extends AbstractMojo {
+
+    public static final int BUFFER_SIZE = 128 * 1024;
+
+    private static final Pattern ARTIFACT_PATTERN = Pattern.compile("\"artifactId\": \"camel-(.*)\"");
+
+    /**
+     * The maven project.
+     */
+    @Parameter(property = "project", required = true, readonly = true)
+    protected MavenProject project;
+
+    /**
+     * The output directory for components catalog
+     */
+    @Parameter(defaultValue = "${project.build.directory}/classes/org/apache/camel/catalog/springboot/components")
+    protected File componentsOutDir;
+
+    /**
+     * The output directory for dataformats catalog
+     */
+    @Parameter(defaultValue = "${project.build.directory}/classes/org/apache/camel/catalog/springboot/dataformats")
+    protected File dataFormatsOutDir;
+
+    /**
+     * The output directory for languages catalog
+     */
+    @Parameter(defaultValue = "${project.build.directory}/classes/org/apache/camel/catalog/springboot/languages")
+    protected File languagesOutDir;
+
+    /**
+     * The output directory for others catalog
+     */
+    @Parameter(defaultValue = "${project.build.directory}/classes/org/apache/camel/catalog/springboot/others")
+    protected File othersOutDir;
+
+    /**
+     * The directory where all spring-boot starters are
+     */
+    @Parameter(defaultValue = "${project.build.directory}/../../../platforms/spring-boot/quarkus-starter")
+    protected File componentsStarterDir;
+
+    /**
+     * The components directory where all the Apache Camel components are
+     */
+    @Parameter(defaultValue = "${project.build.directory}/../../../components")
+    protected File componentsDir;
+
+    /**
+     * The camel-core directory
+     */
+    @Parameter(defaultValue = "${project.build.directory}/../../../core/camel-core-engine")
+    protected File coreDir;
+
+    /**
+     * The camel-base directory
+     */
+    @Parameter(defaultValue = "${project.build.directory}/../../../core/camel-base")
+    protected File baseDir;
+
+    /**
+     * Maven ProjectHelper.
+     */
+    @Component
+    private MavenProjectHelper projectHelper;
+
+    /**
+     * Execute goal.
+     *
+     * @throws MojoExecutionException execution of the main class or one of the
+     *                                                        threads it generated failed.
+     * @throws MojoFailureException   something bad happened...
+     */
+    @Override
+    public void execute() throws MojoExecutionException, MojoFailureException {
+        Set<String> starters = findSpringBootStarters();
+        executeComponents(starters);
+        executeDataFormats(starters);
+        executeLanguages(starters);
+        executeOthers(starters);
+    }
+
+    protected void executeComponents(Set<String> starters) throws MojoExecutionException, MojoFailureException {
+        getLog().info("Copying all Camel component json descriptors");
+
+        // lets use sorted set/maps
+        Set<File> jsonFiles = new TreeSet<>();
+        Set<File> componentFiles = new TreeSet<>();
+
+        // find all json files in components and camel-core
+        if (componentsDir != null && componentsDir.isDirectory()) {
+            File[] components = componentsDir.listFiles();
+            if (components != null) {
+                for (File dir : components) {
+                    if (dir.isDirectory() && !"target".equals(dir.getName())) {
+                        File target = new File(dir, "target/classes");
+
+                        // the directory must be in the list of known features
+                        if (!starters.contains(dir.getName())) {
+                            continue;
+                        }
+
+                        // special for some which is in a sub dir
+                        if ("camel-as2".equals(dir.getName())) {
+                            target = new File(dir, "camel-as2-component/target/classes");
+                        } else if ("camel-box".equals(dir.getName())) {
+                            target = new File(dir, "camel-box-component/target/classes");
+                        } else if ("camel-salesforce".equals(dir.getName())) {
+                            target = new File(dir, "camel-salesforce-component/target/classes");
+                        } else if ("camel-linkedin".equals(dir.getName())) {
+                            target = new File(dir, "camel-linkedin-component/target/classes");
+                        } else if ("camel-servicenow".equals(dir.getName())) {
+                            target = new File(dir, "camel-servicenow-component/target/classes");
+                        } else {
+                            // this module must be active with a source folder
+                            File src = new File(dir, "src");
+                            boolean active = src.isDirectory() && src.exists();
+                            if (!active) {
+                                continue;
+                            }
+                        }
+
+
+                        findComponentFilesRecursive(target, jsonFiles, componentFiles, new CamelComponentsFileFilter());
+                    }
+                }
+            }
+        }
+        if (coreDir != null && coreDir.isDirectory()) {
+            File target = new File(coreDir, "target/classes");
+            findComponentFilesRecursive(target, jsonFiles, componentFiles, new CamelComponentsFileFilter());
+        }
+
+        getLog().info("Found " + componentFiles.size() + " component.properties files");
+        getLog().info("Found " + jsonFiles.size() + " component json files");
+
+        // make sure to create out dir
+        componentsOutDir.mkdirs();
+
+        for (File file : jsonFiles) {
+            // for spring-boot we need to amend the json file to use -starter as the artifact-id
+            try {
+                String text = loadText(new FileInputStream(file));
+
+                text = ARTIFACT_PATTERN.matcher(text).replaceFirst("\"artifactId\": \"camel-$1-starter\"");
+
+                // write new json file
+                File to = new File(componentsOutDir, file.getName());
+                FileOutputStream fos = new FileOutputStream(to, false);
+
+                fos.write(text.getBytes());
+
+                fos.close();
+
+            } catch (IOException e) {
+                throw new MojoFailureException("Cannot write json file " + file, e);
+            }
+        }
+
+        File all = new File(componentsOutDir, "../components.properties");
+        try {
+            FileOutputStream fos = new FileOutputStream(all, false);
+
+            String[] names = componentsOutDir.list();
+            List<String> components = new ArrayList<>();
+            // sort the names
+            for (String name : names) {
+                if (name.endsWith(".json")) {
+                    // strip out .json from the name
+                    String componentName = name.substring(0, name.length() - 5);
+                    components.add(componentName);
+                }
+            }
+
+            Collections.sort(components);
+            for (String name : components) {
+                fos.write(name.getBytes());
+                fos.write("\n".getBytes());
+            }
+
+            fos.close();
+
+        } catch (IOException e) {
+            throw new MojoFailureException("Error writing to file " + all);
+        }
+    }
+
+    protected void executeDataFormats(Set<String> starters) throws MojoExecutionException, MojoFailureException {
+        getLog().info("Copying all Camel dataformat json descriptors");
+
+        // lets use sorted set/maps
+        Set<File> jsonFiles = new TreeSet<>();
+        Set<File> dataFormatFiles = new TreeSet<>();
+
+        // find all data formats from the components directory
+        if (componentsDir != null && componentsDir.isDirectory()) {
+            File[] dataFormats = componentsDir.listFiles();
+            if (dataFormats != null) {
+                for (File dir : dataFormats) {
+                    if (dir.isDirectory() && !"target".equals(dir.getName())) {
+                        // the directory must be in the list of known starters
+                        if (!starters.contains(dir.getName())) {
+                            continue;
+                        }
+                        // this module must be active with a source folder
+                        File src = new File(dir, "src");
+                        boolean active = src.isDirectory() && src.exists();
+                        if (!active) {
+                            continue;
+                        }
+                        File target = new File(dir, "target/classes");
+                        findDataFormatFilesRecursive(target, jsonFiles, dataFormatFiles, new CamelDataFormatsFileFilter());
+                    }
+                }
+            }
+        }
+        if (coreDir != null && coreDir.isDirectory()) {
+            File target = new File(coreDir, "target/classes");
+            findDataFormatFilesRecursive(target, jsonFiles, dataFormatFiles, new CamelDataFormatsFileFilter());
+        }
+
+        getLog().info("Found " + dataFormatFiles.size() + " dataformat.properties files");
+        getLog().info("Found " + jsonFiles.size() + " dataformat json files");
+
+        // make sure to create out dir
+        dataFormatsOutDir.mkdirs();
+
+        for (File file : jsonFiles) {
+            // for spring-boot we need to amend the json file to use -starter as the artifact-id
+            try {
+                String text = loadText(new FileInputStream(file));
+
+                text = ARTIFACT_PATTERN.matcher(text).replaceFirst("\"artifactId\": \"camel-$1-starter\"");
+
+                // write new json file
+                File to = new File(dataFormatsOutDir, file.getName());
+                FileOutputStream fos = new FileOutputStream(to, false);
+
+                fos.write(text.getBytes());
+
+                fos.close();
+
+            } catch (IOException e) {
+                throw new MojoFailureException("Cannot write json file " + file, e);
+            }
+        }
+
+        File all = new File(dataFormatsOutDir, "../dataformats.properties");
+        try {
+            FileOutputStream fos = new FileOutputStream(all, false);
+
+            String[] names = dataFormatsOutDir.list();
+            List<String> dataFormats = new ArrayList<>();
+            // sort the names
+            for (String name : names) {
+                if (name.endsWith(".json")) {
+                    // strip out .json from the name
+                    String dataFormatName = name.substring(0, name.length() - 5);
+                    dataFormats.add(dataFormatName);
+                }
+            }
+
+            Collections.sort(dataFormats);
+            for (String name : dataFormats) {
+                fos.write(name.getBytes());
+                fos.write("\n".getBytes());
+            }
+
+            fos.close();
+
+        } catch (IOException e) {
+            throw new MojoFailureException("Error writing to file " + all);
+        }
+    }
+
+    protected void executeLanguages(Set<String> starters) throws MojoExecutionException, MojoFailureException {
+        getLog().info("Copying all Camel language json descriptors");
+
+        // lets use sorted set/maps
+        Set<File> jsonFiles = new TreeSet<>();
+        Set<File> languageFiles = new TreeSet<>();
+
+        // find all languages from the components directory
+        if (componentsDir != null && componentsDir.isDirectory()) {
+            File[] languages = componentsDir.listFiles();
+            if (languages != null) {
+                for (File dir : languages) {
+                    // the directory must be in the list of known starters
+                    if (!starters.contains(dir.getName())) {
+                        continue;
+                    }
+                    // this module must be active with a source folder
+                    File src = new File(dir, "src");
+                    boolean active = src.isDirectory() && src.exists();
+                    if (!active) {
+                        continue;
+                    }
+                    if (dir.isDirectory() && !"target".equals(dir.getName())) {
+                        File target = new File(dir, "target/classes");
+                        findLanguageFilesRecursive(target, jsonFiles, languageFiles, new CamelLanguagesFileFilter());
+                    }
+                }
+            }
+        }
+        if (baseDir != null && baseDir.isDirectory()) {
+            File target = new File(baseDir, "target/classes");
+            findLanguageFilesRecursive(target, jsonFiles, languageFiles, new CamelLanguagesFileFilter());
+            // also look in camel-jaxp
+            target = new File(coreDir, "../camel-jaxp/target/classes");
+            findLanguageFilesRecursive(target, jsonFiles, languageFiles, new CamelLanguagesFileFilter());
+        }
+
+        getLog().info("Found " + languageFiles.size() + " language.properties files");
+        getLog().info("Found " + jsonFiles.size() + " language json files");
+
+        // make sure to create out dir
+        languagesOutDir.mkdirs();
+
+        for (File file : jsonFiles) {
+            // for spring-boot we need to amend the json file to use -starter as the artifact-id
+            try {
+                String text = loadText(new FileInputStream(file));
+
+                text = ARTIFACT_PATTERN.matcher(text).replaceFirst("\"artifactId\": \"camel-$1-starter\"");
+
+                // write new json file
+                File to = new File(languagesOutDir, file.getName());
+                FileOutputStream fos = new FileOutputStream(to, false);
+
+                fos.write(text.getBytes());
+
+                fos.close();
+
+            } catch (IOException e) {
+                throw new MojoFailureException("Cannot write json file " + file, e);
+            }
+        }
+
+        File all = new File(languagesOutDir, "../languages.properties");
+        try {
+            FileOutputStream fos = new FileOutputStream(all, false);
+
+            String[] names = languagesOutDir.list();
+            List<String> languages = new ArrayList<>();
+            // sort the names
+            for (String name : names) {
+                if (name.endsWith(".json")) {
+                    // strip out .json from the name
+                    String languageName = name.substring(0, name.length() - 5);
+                    languages.add(languageName);
+                }
+            }
+
+            Collections.sort(languages);
+            for (String name : languages) {
+                fos.write(name.getBytes());
+                fos.write("\n".getBytes());
+            }
+
+            fos.close();
+
+        } catch (IOException e) {
+            throw new MojoFailureException("Error writing to file " + all);
+        }
+    }
+
+    protected void executeOthers(Set<String> starters) throws MojoExecutionException, MojoFailureException {
+        getLog().info("Copying all Camel other json descriptors");
+
+        // lets use sorted set/maps
+        Set<File> jsonFiles = new TreeSet<>();
+        Set<File> otherFiles = new TreeSet<>();
+
+        // find all other from the components directory
+        if (componentsDir != null && componentsDir.isDirectory()) {
+            File[] others = componentsDir.listFiles();
+            if (others != null) {
+                for (File dir : others) {
+                    // the directory must be in the list of known starters
+                    if (!starters.contains(dir.getName())) {
+                        continue;
+                    }
+
+                    // skip these special cases
+                    boolean special = "camel-core-osgi".equals(dir.getName())
+                        || "camel-core-xml".equals(dir.getName())
+                        || "camel-http-common".equals(dir.getName())
+                        || "camel-jetty-common".equals(dir.getName());
+                    boolean special2 = "camel-as2".equals(dir.getName())
+                        || "camel-box".equals(dir.getName())
+                        || "camel-linkedin".equals(dir.getName())
+                        || "camel-olingo2".equals(dir.getName())
+                        || "camel-olingo4".equals(dir.getName())
+                        || "camel-servicenow".equals(dir.getName())
+                        || "camel-salesforce".equals(dir.getName());
+                    if (special || special2) {
+                        continue;
+                    }
+
+                    // this module must be active with a source folder
+                    File src = new File(dir, "src");
+                    boolean active = src.isDirectory() && src.exists();
+                    if (!active) {
+                        continue;
+                    }
+
+                    if (dir.isDirectory() && !"target".equals(dir.getName())) {
+                        File target = new File(dir, "target/classes");
+                        findOtherFilesRecursive(target, jsonFiles, otherFiles, new CamelOthersFileFilter());
+                    }
+                }
+            }
+        }
+
+        getLog().info("Found " + otherFiles.size() + " other.properties files");
+        getLog().info("Found " + jsonFiles.size() + " other json files");
+
+        // make sure to create out dir
+        othersOutDir.mkdirs();
+
+        for (File file : jsonFiles) {
+            // for spring-boot we need to amend the json file to use -starter as the artifact-id
+            try {
+                String text = loadText(new FileInputStream(file));
+
+                text = ARTIFACT_PATTERN.matcher(text).replaceFirst("\"artifactId\": \"camel-$1-starter\"");
+
+                // write new json file
+                File to = new File(othersOutDir, file.getName());
+                FileOutputStream fos = new FileOutputStream(to, false);
+
+                fos.write(text.getBytes());
+
+                fos.close();
+
+            } catch (IOException e) {
+                throw new MojoFailureException("Cannot write json file " + file, e);
+            }
+        }
+
+        File all = new File(othersOutDir, "../others.properties");
+        try {
+            FileOutputStream fos = new FileOutputStream(all, false);
+
+            String[] names = othersOutDir.list();
+            List<String> others = new ArrayList<>();
+            // sort the names
+            for (String name : names) {
+                if (name.endsWith(".json")) {
+                    // strip out .json from the name
+                    String otherName = name.substring(0, name.length() - 5);
+                    others.add(otherName);
+                }
+            }
+
+            Collections.sort(others);
+            for (String name : others) {
+                fos.write(name.getBytes());
+                fos.write("\n".getBytes());
+            }
+
+            fos.close();
+
+        } catch (IOException e) {
+            throw new MojoFailureException("Error writing to file " + all);
+        }
+    }
+
+    private void findComponentFilesRecursive(File dir, Set<File> found, Set<File> components, FileFilter filter) {
+        File[] files = dir.listFiles(filter);
+        if (files != null) {
+            for (File file : files) {
+                // skip files in root dirs as Camel does not store information there but others may do
+                boolean rootDir = "classes".equals(dir.getName()) || "META-INF".equals(dir.getName());
+                boolean jsonFile = !rootDir && file.isFile() && file.getName().endsWith(".json");
+                boolean componentFile = !rootDir && file.isFile() && file.getName().equals("component.properties");
+                if (jsonFile) {
+                    found.add(file);
+                } else if (componentFile) {
+                    components.add(file);
+                } else if (file.isDirectory()) {
+                    findComponentFilesRecursive(file, found, components, filter);
+                }
+            }
+        }
+    }
+
+    private void findDataFormatFilesRecursive(File dir, Set<File> found, Set<File> dataFormats, FileFilter filter) {
+        File[] files = dir.listFiles(filter);
+        if (files != null) {
+            for (File file : files) {
+                // skip files in root dirs as Camel does not store information there but others may do
+                boolean rootDir = "classes".equals(dir.getName()) || "META-INF".equals(dir.getName());
+                boolean jsonFile = !rootDir && file.isFile() && file.getName().endsWith(".json");
+                boolean dataFormatFile = !rootDir && file.isFile() && file.getName().equals("dataformat.properties");
+                if (jsonFile) {
+                    found.add(file);
+                } else if (dataFormatFile) {
+                    dataFormats.add(file);
+                } else if (file.isDirectory()) {
+                    findDataFormatFilesRecursive(file, found, dataFormats, filter);
+                }
+            }
+        }
+    }
+
+    private void findLanguageFilesRecursive(File dir, Set<File> found, Set<File> languages, FileFilter filter) {
+        File[] files = dir.listFiles(filter);
+        if (files != null) {
+            for (File file : files) {
+                // skip files in root dirs as Camel does not store information there but others may do
+                boolean rootDir = "classes".equals(dir.getName()) || "META-INF".equals(dir.getName());
+                boolean jsonFile = !rootDir && file.isFile() && file.getName().endsWith(".json");
+                boolean languageFile = !rootDir && file.isFile() && file.getName().equals("language.properties");
+                if (jsonFile) {
+                    found.add(file);
+                } else if (languageFile) {
+                    languages.add(file);
+                } else if (file.isDirectory()) {
+                    findLanguageFilesRecursive(file, found, languages, filter);
+                }
+            }
+        }
+    }
+
+    private void findOtherFilesRecursive(File dir, Set<File> found, Set<File> others, FileFilter filter) {
+        File[] files = dir.listFiles(filter);
+        if (files != null) {
+            for (File file : files) {
+                // skip files in root dirs as Camel does not store information there but others may do
+                boolean rootDir = "classes".equals(dir.getName()) || "META-INF".equals(dir.getName());
+                boolean jsonFile = rootDir && file.isFile() && file.getName().endsWith(".json");
+                boolean otherFile = !rootDir && file.isFile() && file.getName().equals("other.properties");
+                if (jsonFile) {
+                    found.add(file);
+                } else if (otherFile) {
+                    others.add(file);
+                } else if (file.isDirectory()) {
+                    findOtherFilesRecursive(file, found, others, filter);
+                }
+            }
+        }
+    }
+
+    private class CamelComponentsFileFilter implements FileFilter {
+
+        @Override
+        public boolean accept(File pathname) {
+            if (pathname.isDirectory() && pathname.getName().equals("model")) {
+                // do not check the camel-core model packages as there is no components there
+                return false;
+            }
+            if (pathname.isFile() && pathname.getName().endsWith(".json")) {
+                // must be a components json file
+                try {
+                    String json = loadText(new FileInputStream(pathname));
+                    return json != null && json.contains("\"kind\": \"component\"");
+                } catch (IOException e) {
+                    // ignore
+                }
+            }
+            return pathname.isDirectory() || (pathname.isFile() && pathname.getName().equals("component.properties"));
+        }
+    }
+
+    private class CamelDataFormatsFileFilter implements FileFilter {
+
+        @Override
+        public boolean accept(File pathname) {
+            if (pathname.isDirectory() && pathname.getName().equals("model")) {
+                // do not check the camel-core model packages as there is no components there
+                return false;
+            }
+            if (pathname.isFile() && pathname.getName().endsWith(".json")) {
+                // must be a dataformat json file
+                try {
+                    String json = loadText(new FileInputStream(pathname));
+                    return json != null && json.contains("\"kind\": \"dataformat\"");
+                } catch (IOException e) {
+                    // ignore
+                }
+            }
+            return pathname.isDirectory() || (pathname.isFile() && pathname.getName().equals("dataformat.properties"));
+        }
+    }
+
+    private class CamelLanguagesFileFilter implements FileFilter {
+
+        @Override
+        public boolean accept(File pathname) {
+            if (pathname.isDirectory() && pathname.getName().equals("model")) {
+                // do not check the camel-core model packages as there is no components there
+                return false;
+            }
+            if (pathname.isFile() && pathname.getName().endsWith(".json")) {
+                // must be a language json file
+                try {
+                    String json = loadText(new FileInputStream(pathname));
+                    return json != null && json.contains("\"kind\": \"language\"");
+                } catch (IOException e) {
+                    // ignore
+                }
+            }
+            return pathname.isDirectory() || (pathname.isFile() && pathname.getName().equals("language.properties"));
+        }
+    }
+
+    private class CamelOthersFileFilter implements FileFilter {
+
+        @Override
+        public boolean accept(File pathname) {
+            if (pathname.isFile() && pathname.getName().endsWith(".json")) {
+                // must be a language json file
+                try {
+                    String json = loadText(new FileInputStream(pathname));
+                    return json != null && json.contains("\"kind\": \"other\"");
+                } catch (IOException e) {
+                    // ignore
+                }
+            }
+            return pathname.isDirectory() || (pathname.isFile() && pathname.getName().equals("other.properties"));
+        }
+    }
+
+    public static void copyFile(File from, File to) throws IOException {
+        FileChannel in = null;
+        FileChannel out = null;
+        try (FileInputStream fis = new FileInputStream(from); FileOutputStream fos = new FileOutputStream(to)) {
+            try {
+                in = fis.getChannel();
+                out = fos.getChannel();
+
+                long size = in.size();
+                long position = 0;
+                while (position < size) {
+                    position += in.transferTo(position, BUFFER_SIZE, out);
+                }
+            } finally {
+                if (in != null) {
+                    in.close();
+                }
+                if (out != null) {
+                    out.close();
+                }
+            }
+        }
+    }
+
+    private Set<String> findSpringBootStarters() {
+        Set<String> answer = new LinkedHashSet<>();
+
+        String[] names = componentsStarterDir.list();
+        if (names != null) {
+            for (String name : names) {
+                if (name.startsWith("camel-") && name.endsWith("-starter")) {
+                    // remove ending -starter
+                    String regular = name.substring(0, name.length() - 8);
+                    answer.add(regular);
+                }
+            }
+        }
+
+        getLog().info("Found " + answer.size() + " Camel Spring Boot starters from: " + componentsStarterDir);
+
+        return answer;
+    }
+
+}
diff --git a/tooling/maven/package-maven-plugin/src/main/resources/META-INF/LICENSE.txt b/tooling/maven/package-maven-plugin/src/main/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ b/tooling/maven/package-maven-plugin/src/main/resources/META-INF/LICENSE.txt
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
diff --git a/tooling/maven/package-maven-plugin/src/main/resources/META-INF/NOTICE.txt b/tooling/maven/package-maven-plugin/src/main/resources/META-INF/NOTICE.txt
new file mode 100644
index 0000000..2e215bf
--- /dev/null
+++ b/tooling/maven/package-maven-plugin/src/main/resources/META-INF/NOTICE.txt
@@ -0,0 +1,11 @@
+   =========================================================================
+   ==  NOTICE file corresponding to the section 4 d of                    ==
+   ==  the Apache License, Version 2.0,                                   ==
+   ==  in this case for the Apache Camel distribution.                    ==
+   =========================================================================
+
+   This product includes software developed by
+   The Apache Software Foundation (http://www.apache.org/).
+
+   Please read the different LICENSE files present in the licenses directory of
+   this distribution.
diff --git a/tooling/maven/package-maven-plugin/src/main/resources/camel-quarkus-package-maven-plugin.properties b/tooling/maven/package-maven-plugin/src/main/resources/camel-quarkus-package-maven-plugin.properties
new file mode 100644
index 0000000..fa7a54b
--- /dev/null
+++ b/tooling/maven/package-maven-plugin/src/main/resources/camel-quarkus-package-maven-plugin.properties
@@ -0,0 +1,16 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
diff --git a/tooling/maven/pom.xml b/tooling/maven/pom.xml
index 4ec1b6c..95484e7 100644
--- a/tooling/maven/pom.xml
+++ b/tooling/maven/pom.xml
@@ -17,7 +17,8 @@
     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/xsd/maven-4.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/xsd/maven-4.0.0.xsd">
 
     <modelVersion>4.0.0</modelVersion>
     <parent>
@@ -32,9 +33,7 @@
     <name>Camel Quarkus :: Tooling :: Maven</name>
 
     <modules>
-        <!--
-        <module></module>
-    -->
+        <module>package-maven-plugin</module>
     </modules>
 
 </project>
diff --git a/tooling/parent/pom.xml b/tooling/parent/pom.xml
new file mode 100644
index 0000000..c801ef7
--- /dev/null
+++ b/tooling/parent/pom.xml
@@ -0,0 +1,151 @@
+<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
+         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>
+
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-tooling</artifactId>
+        <version>0.2.1-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>tooling-parent</artifactId>
+    <packaging>pom</packaging>
+
+    <name>Camel Quarkus :: Tooling Parent</name>
+    <description>Camel Quarkus Tooling Parent POM</description>
+
+    <properties>
+
+        <!-- TODO: Update these -->
+        <maven-version>3.6.2</maven-version>
+        <maven-maven-plugin-descriptor-version>2.2.1</maven-maven-plugin-descriptor-version>
+        <maven-project-version>2.2.1</maven-project-version>
+        <maven-dependency-tree-version>3.0.1</maven-dependency-tree-version>
+        <maven-plugin-annotations-version>3.6.0</maven-plugin-annotations-version>
+        <maven-reporting-api-version>3.0</maven-reporting-api-version>
+        <maven-reporting-impl-version>3.0.0</maven-reporting-impl-version>
+        <maven-resolver-version>1.4.1</maven-resolver-version>
+        <plexus-build-api-version>0.0.7</plexus-build-api-version>
+        <plexus-container-default-version>2.0.0</plexus-container-default-version>
+        <plexus-utils-version>3.2.1</plexus-utils-version>
+    </properties>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.maven</groupId>
+                <artifactId>maven-core</artifactId>
+                <version>${maven-version}</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>org.slf4j</groupId>
+                        <artifactId>slf4j-jdk14</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>org.slf4j</groupId>
+                        <artifactId>jcl-over-slf4j</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>org.slf4j</groupId>
+                        <artifactId>slf4j-nop</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.maven</groupId>
+                <artifactId>maven-artifact</artifactId>
+                <version>${maven-version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.maven</groupId>
+                <artifactId>maven-plugin-api</artifactId>
+                <version>${maven-version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.maven</groupId>
+                <artifactId>maven-compat</artifactId>
+                <version>${maven-version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.maven.plugin-tools</groupId>
+                <artifactId>maven-plugin-annotations</artifactId>
+                <version>${maven-plugin-annotations-version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.maven</groupId>
+                <artifactId>maven-plugin-descriptor</artifactId>
+                <version>${maven-maven-plugin-descriptor-version}</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>log4j</groupId>
+                        <artifactId>log4j</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.maven</groupId>
+                <artifactId>maven-project</artifactId>
+                <version>${maven-project-version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.maven.shared</groupId>
+                <artifactId>maven-dependency-tree</artifactId>
+                <version>${maven-dependency-tree-version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.maven.reporting</groupId>
+                <artifactId>maven-reporting-api</artifactId>
+                <version>${maven-reporting-api-version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.maven.reporting</groupId>
+                <artifactId>maven-reporting-impl</artifactId>
+                <version>${maven-reporting-impl-version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.maven.resolver</groupId>
+                <artifactId>maven-resolver-api</artifactId>
+                <version>${maven-resolver-version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.maven.resolver</groupId>
+                <artifactId>maven-resolver-util</artifactId>
+                <version>${maven-resolver-version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.codehaus.plexus</groupId>
+                <artifactId>plexus-container-default</artifactId>
+                <version>${plexus-container-default-version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.codehaus.plexus</groupId>
+                <artifactId>plexus-utils</artifactId>
+                <version>${plexus-utils-version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.sonatype.plexus</groupId>
+                <artifactId>plexus-build-api</artifactId>
+                <version>${plexus-build-api-version}</version>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+</project>
diff --git a/tooling/pom.xml b/tooling/pom.xml
index 366832e..adaa167 100644
--- a/tooling/pom.xml
+++ b/tooling/pom.xml
@@ -32,6 +32,7 @@
     <name>Camel Quarkus :: Tooling</name>
 
     <modules>
+        <module>parent</module>
         <module>maven</module>
     </modules>
 


[camel-quarkus] 11/12: #75: Adding camel-quarkus-catalog (work in progress)

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch catalog
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 4bad575aaafd648025ad74a2d4be6d5cd16fff4b
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Oct 8 14:31:30 2019 +0200

    #75: Adding camel-quarkus-catalog (work in progress)
---
 extensions/core-cloud/runtime/pom.xml              |  7 +++
 extensions/core/runtime/pom.xml                    |  7 +++
 extensions/platform-http/runtime/pom.xml           |  7 +++
 extensions/reactive-executor/runtime/pom.xml       |  2 +
 .../quarkus/maven/PrepareCatalogQuarkusMojo.java   | 53 +++++++++++++++++++---
 5 files changed, 70 insertions(+), 6 deletions(-)

diff --git a/extensions/core-cloud/runtime/pom.xml b/extensions/core-cloud/runtime/pom.xml
index b054ea5..abfd5d5 100644
--- a/extensions/core-cloud/runtime/pom.xml
+++ b/extensions/core-cloud/runtime/pom.xml
@@ -28,6 +28,13 @@
 
     <artifactId>camel-quarkus-core-cloud</artifactId>
     <name>Camel Quarkus :: Core :: Cloud :: Runtime</name>
+    <description>The Camel Quarkus core cloud module</description>
+
+    <properties>
+        <title>Camel Quarkus Core Cloud</title>
+        <firstVersion>0.2.0</firstVersion>
+        <label>core,cloud</label>
+    </properties>
 
     <dependencyManagement>
         <dependencies>
diff --git a/extensions/core/runtime/pom.xml b/extensions/core/runtime/pom.xml
index 5683b69..1f68914 100644
--- a/extensions/core/runtime/pom.xml
+++ b/extensions/core/runtime/pom.xml
@@ -27,6 +27,13 @@
 
     <artifactId>camel-quarkus-core</artifactId>
     <name>Camel Quarkus :: Core :: Runtime</name>
+    <description>The Camel Quarkus core module</description>
+
+    <properties>
+        <title>Camel Quarkus Core</title>
+        <firstVersion>0.2.0</firstVersion>
+        <label>core</label>
+    </properties>
 
     <dependencyManagement>
         <dependencies>
diff --git a/extensions/platform-http/runtime/pom.xml b/extensions/platform-http/runtime/pom.xml
index 73427a6..f8d74b0 100644
--- a/extensions/platform-http/runtime/pom.xml
+++ b/extensions/platform-http/runtime/pom.xml
@@ -30,6 +30,13 @@
 
     <artifactId>camel-quarkus-platform-http</artifactId>
     <name>Camel Quarkus :: Platform HTTP :: Runtime</name>
+    <description>HTTP platform component is used for integrating Camel HTTP with Quarkus HTTP layer</description>
+
+    <properties>
+        <title>Camel Quarkus Platform HTTP</title>
+        <firstVersion>0.2.1</firstVersion>
+        <label>core,http</label>
+    </properties>
 
     <dependencyManagement>
         <dependencies>
diff --git a/extensions/reactive-executor/runtime/pom.xml b/extensions/reactive-executor/runtime/pom.xml
index d44377e..0a1ea5d 100644
--- a/extensions/reactive-executor/runtime/pom.xml
+++ b/extensions/reactive-executor/runtime/pom.xml
@@ -31,7 +31,9 @@
     <description>To use Quarkus reactive executor with Camel</description>
 
     <properties>
+        <title>Camel Quarkus Reactive Executor</title>
         <firstVersion>0.2.1</firstVersion>
+        <label>core</label>
     </properties>
 
     <dependencyManagement>
diff --git a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
index 373df70..17bf3d2 100644
--- a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
+++ b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
@@ -17,6 +17,7 @@
 package org.apache.camel.quarkus.maven;
 
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -131,7 +132,7 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
         executeComponents(artifacts);
         executeLanguages(artifacts);
         executeDataFormats(artifacts);
-//        executeOthers(artifacts); // TODO: implement me
+        executeOthers(extensions);
     }
 
     private Set<String> extractArtifactIds(Set<String> extensions) throws MojoFailureException {
@@ -264,11 +265,15 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
 
         for (String extension : extensions) {
             // skip if the extension is already one of the following
-            boolean component = new File(componentsOutDir, extension + ".json").exists();
-            boolean language = new File(languagesOutDir, extension + ".json").exists();
-            boolean dataFormat = new File(dataFormatsOutDir, extension + ".json").exists();
-            if (component || language || dataFormat) {
-                continue;
+            try {
+                boolean component = isComponent(extension);
+                boolean language = isLanguage(extension);
+                boolean dataFormat = isDataFormat(extension);
+                if (component || language || dataFormat) {
+                    continue;
+                }
+            } catch (IOException e) {
+                throw new MojoFailureException("Error reading generated files for extension " + extension, e);
             }
 
             try {
@@ -338,6 +343,42 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
         }
     }
 
+    private boolean isComponent(String extension) throws IOException {
+        for (File file : componentsOutDir.listFiles()) {
+            FileInputStream fis = new FileInputStream(file);
+            String text = loadText(fis);
+            fis.close();
+            if (text.contains("camel-quarkus-" + extension)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private boolean isLanguage(String extension) throws IOException {
+        for (File file : languagesOutDir.listFiles()) {
+            FileInputStream fis = new FileInputStream(file);
+            String text = loadText(fis);
+            fis.close();
+            if (text.contains("camel-quarkus-" + extension)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private boolean isDataFormat(String extension) throws IOException {
+        for (File file : dataFormatsOutDir.listFiles()) {
+            FileInputStream fis = new FileInputStream(file);
+            String text = loadText(fis);
+            fis.close();
+            if (text.contains("camel-quarkus-" + extension)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     private MavenProject getMavenProject(String groupId, String artifactId, String version) throws ProjectBuildingException {
         Artifact pomArtifact = repositorySystem.createProjectArtifact(groupId, artifactId, version);
         ProjectBuildingResult build = mavenProjectBuilder.build(pomArtifact, session.getProjectBuildingRequest());


[camel-quarkus] 08/12: #75: Adding camel-quarkus-catalog (work in progress)

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch catalog
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 5ce148335900bde5644695f48c590d93dbdeb8f3
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Oct 8 13:40:36 2019 +0200

    #75: Adding camel-quarkus-catalog (work in progress)
---
 .../quarkus/maven/PrepareCatalogQuarkusMojo.java   | 76 +++++++++++++++++-----
 1 file changed, 59 insertions(+), 17 deletions(-)

diff --git a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
index 1a1abaf..63163d7 100644
--- a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
+++ b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
@@ -27,11 +27,14 @@ import java.util.HashMap;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 import java.util.Set;
+import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.execution.MavenSession;
+import org.apache.maven.model.Dependency;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
@@ -56,10 +59,13 @@ import static org.apache.camel.quarkus.maven.PackageHelper.loadText;
 @Mojo(name = "prepare-catalog-quarkus", threadSafe = true, requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME)
 public class PrepareCatalogQuarkusMojo extends AbstractMojo {
 
+    // TODO: match by artifact-id instead of directory name (mail -> camel-mail JAR -> component names (alias files, so copy over)
+
     private static final String[] EXCLUDE_EXTENSIONS = {
             "http-common", "jetty-common", "support", "xml-common", "xstream-common"
     };
 
+    private static final Pattern SCHEME_PATTERN = Pattern.compile("\"scheme\": \"(.*)\"");
     private static final Pattern GROUP_PATTERN = Pattern.compile("\"groupId\": \"(org.apache.camel)\"");
     private static final Pattern ARTIFACT_PATTERN = Pattern.compile("\"artifactId\": \"camel-(.*)\"");
     private static final Pattern VERSION_PATTERN = Pattern.compile("\"version\": \"(.*)\"");
@@ -124,16 +130,16 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
     public void execute() throws MojoExecutionException, MojoFailureException {
         Set<String> extensions = findExtensions();
         executeComponents(extensions);
-        executeLanguages(extensions);
-        executeDataFormats(extensions);
-        executeOthers(extensions);
+//        executeLanguages(extensions);
+//        executeDataFormats(extensions);
+//        executeOthers(extensions);
     }
 
     protected void executeComponents(Set<String> extensions) throws MojoExecutionException, MojoFailureException {
         getLog().info("Copying all Camel extension json descriptors");
 
         // grab components from camel-catalog
-        List catalogComponents;
+        List<String> catalogComponents;
         try {
             InputStream is = getClass().getClassLoader().getResourceAsStream("org/apache/camel/catalog/components.properties");
             String text = loadText(is);
@@ -147,29 +153,65 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
         componentsOutDir.mkdirs();
 
         for (String extension : extensions) {
-            if (!isCamelComponent(catalogComponents, extension)) {
+
+            // grab GAB
+            String artifactId = null;
+            try {
+                MavenProject extProject = getMavenProject("org.apache.camel.quarkus", "camel-quarkus-" + extension, project.getVersion());
+                // grab camel artifact
+                Optional<Dependency> artifact = extProject.getDependencies().stream()
+                        .filter(p -> "org.apache.camel".equals(p.getGroupId()) && "compile".equals(p.getScope()))
+                        .findFirst();
+                if (artifact.isPresent()) {
+                    artifactId = artifact.get().getArtifactId();
+                }
+            } catch (ProjectBuildingException e) {
+                throw new MojoFailureException("Cannot read pom.xml for extension " + extension, e);
+            }
+
+            if (artifactId == null) {
                 continue;
             }
 
+            getLog().info("Discovered camel-quarkus extension org.apache.camel.quarkus:" + artifactId);
+
             // for quarkus we need to amend the json file to use the quarkus maven GAV
+            List<String> jsonFiles = new ArrayList<>();
             try {
-                InputStream is = getClass().getClassLoader().getResourceAsStream("org/apache/camel/catalog/components/" + extension + ".json");
-                String text = loadText(is);
+                for (String component : catalogComponents) {
+                    InputStream is = getClass().getClassLoader().getResourceAsStream("org/apache/camel/catalog/components/" + component + ".json");
+                    String text = loadText(is);
+                    // see if it its a
+                    boolean match = text.contains("\"artifactId\": \"" + artifactId + "\"");
+                    if (match) {
+                        jsonFiles.add(text);
+                    }
+                }
+            } catch (IOException e) {
+                throw new MojoFailureException("Cannot read camel-catalog", e);
+            }
 
-                text = GROUP_PATTERN.matcher(text).replaceFirst("\"groupId\": \"org.apache.camel.quarkus\"");
-                text = ARTIFACT_PATTERN.matcher(text).replaceFirst("\"artifactId\": \"camel-quarkus-$1\"");
-                text = VERSION_PATTERN.matcher(text).replaceFirst("\"version\": \"" + project.getVersion() + "\"");
+            for (String text : jsonFiles) {
+                try {
+                    text = GROUP_PATTERN.matcher(text).replaceFirst("\"groupId\": \"org.apache.camel.quarkus\"");
+                    text = ARTIFACT_PATTERN.matcher(text).replaceFirst("\"artifactId\": \"camel-quarkus-$1\"");
+                    text = VERSION_PATTERN.matcher(text).replaceFirst("\"version\": \"" + project.getVersion() + "\"");
 
-                // write new json file
-                File to = new File(componentsOutDir, extension + ".json");
-                FileOutputStream fos = new FileOutputStream(to, false);
+                    Matcher matcher = SCHEME_PATTERN.matcher(text);
+                    if (matcher.find()) {
+                        String scheme = matcher.group(1);
 
-                fos.write(text.getBytes());
+                        // write new json file
+                        File to = new File(componentsOutDir, scheme + ".json");
+                        FileOutputStream fos = new FileOutputStream(to, false);
 
-                fos.close();
+                        fos.write(text.getBytes());
 
-            } catch (IOException e) {
-                throw new MojoFailureException("Cannot write json file " + extension, e);
+                        fos.close();
+                    }
+                } catch (IOException e) {
+                    throw new MojoFailureException("Cannot write json file " + extension, e);
+                }
             }
         }
 


[camel-quarkus] 05/12: #75: Adding camel-quarkus-catalog (work in progress)

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch catalog
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 450aec47f395be3f38ab5385d835a532f10674b4
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Oct 8 11:17:39 2019 +0200

    #75: Adding camel-quarkus-catalog (work in progress)
---
 catalog/camel-quarkus-catalog/pom.xml              |   8 +
 .../quarkus/maven/PrepareCatalogQuarkusMojo.java   | 280 +++------------------
 2 files changed, 43 insertions(+), 245 deletions(-)

diff --git a/catalog/camel-quarkus-catalog/pom.xml b/catalog/camel-quarkus-catalog/pom.xml
index 380305a..4d2c64d 100644
--- a/catalog/camel-quarkus-catalog/pom.xml
+++ b/catalog/camel-quarkus-catalog/pom.xml
@@ -76,6 +76,14 @@
                 <groupId>org.apache.camel.quarkus</groupId>
                 <artifactId>camel-quarkus-package-maven-plugin</artifactId>
                 <version>${project.version}</version>
+                <dependencies>
+                    <!-- include camel-catalog on classpath -->
+                    <dependency>
+                        <groupId>org.apache.camel</groupId>
+                        <artifactId>camel-catalog</artifactId>
+                        <version>${camel.version}</version>
+                    </dependency>
+                </dependencies>
                 <executions>
                     <execution>
                         <goals>
diff --git a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
index b8b53d2..03824cb 100644
--- a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
+++ b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
@@ -17,17 +17,15 @@
 package org.apache.camel.quarkus.maven;
 
 import java.io.File;
-import java.io.FileFilter;
-import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.nio.channels.FileChannel;
+import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
-import java.util.TreeSet;
 import java.util.regex.Pattern;
 
 import org.apache.maven.plugin.AbstractMojo;
@@ -36,6 +34,7 @@ import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectHelper;
 
@@ -44,12 +43,12 @@ import static org.apache.camel.quarkus.maven.PackageHelper.loadText;
 /**
  * Prepares the Quarkus provider camel catalog to include component it supports
  */
-@Mojo(name = "prepare-catalog-quarkus", threadSafe = true)
+@Mojo(name = "prepare-catalog-quarkus", threadSafe = true, requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME)
 public class PrepareCatalogQuarkusMojo extends AbstractMojo {
 
-    public static final int BUFFER_SIZE = 128 * 1024;
-
+    private static final Pattern GROUP_PATTERN = Pattern.compile("\"groupId\": \"(org.apache.camel)\"");
     private static final Pattern ARTIFACT_PATTERN = Pattern.compile("\"artifactId\": \"camel-(.*)\"");
+    private static final Pattern VERSION_PATTERN = Pattern.compile("\"version\": \"(.*)\"");
 
     /**
      * The maven project.
@@ -102,76 +101,43 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
      */
     @Override
     public void execute() throws MojoExecutionException, MojoFailureException {
-        Set<String> starters = findExtensions();
-        //executeComponents(starters);
+        Set<String> extensions = findExtensions();
+        executeComponents(extensions);
     }
 
-    /*protected void executeComponents(Set<String> starters) throws MojoExecutionException, MojoFailureException {
-        getLog().info("Copying all Camel component json descriptors");
-
-        // lets use sorted set/maps
-        Set<File> jsonFiles = new TreeSet<>();
-        Set<File> componentFiles = new TreeSet<>();
-
-        // find all json files in components and camel-core
-        if (componentsDir != null && componentsDir.isDirectory()) {
-            File[] components = componentsDir.listFiles();
-            if (components != null) {
-                for (File dir : components) {
-                    if (dir.isDirectory() && !"target".equals(dir.getName())) {
-                        File target = new File(dir, "target/classes");
-
-                        // the directory must be in the list of known features
-                        if (!starters.contains(dir.getName())) {
-                            continue;
-                        }
-
-                        // special for some which is in a sub dir
-                        if ("camel-as2".equals(dir.getName())) {
-                            target = new File(dir, "camel-as2-component/target/classes");
-                        } else if ("camel-box".equals(dir.getName())) {
-                            target = new File(dir, "camel-box-component/target/classes");
-                        } else if ("camel-salesforce".equals(dir.getName())) {
-                            target = new File(dir, "camel-salesforce-component/target/classes");
-                        } else if ("camel-linkedin".equals(dir.getName())) {
-                            target = new File(dir, "camel-linkedin-component/target/classes");
-                        } else if ("camel-servicenow".equals(dir.getName())) {
-                            target = new File(dir, "camel-servicenow-component/target/classes");
-                        } else {
-                            // this module must be active with a source folder
-                            File src = new File(dir, "src");
-                            boolean active = src.isDirectory() && src.exists();
-                            if (!active) {
-                                continue;
-                            }
-                        }
-
-
-                        findComponentFilesRecursive(target, jsonFiles, componentFiles, new CamelComponentsFileFilter());
-                    }
-                }
-            }
-        }
-        if (coreDir != null && coreDir.isDirectory()) {
-            File target = new File(coreDir, "target/classes");
-            findComponentFilesRecursive(target, jsonFiles, componentFiles, new CamelComponentsFileFilter());
-        }
+    protected void executeComponents(Set<String> extensions) throws MojoExecutionException, MojoFailureException {
+        getLog().info("Copying all Camel extension json descriptors");
 
-        getLog().info("Found " + componentFiles.size() + " component.properties files");
-        getLog().info("Found " + jsonFiles.size() + " component json files");
+        // grab components from camel-catalog
+        List catalogComponents = null;
+        try {
+            InputStream is = getClass().getClassLoader().getResourceAsStream("org/apache/camel/catalog/components.properties");
+            String text = loadText(is);
+            catalogComponents = Arrays.asList(text.split("\n"));
+            getLog().info("Loaded " + catalogComponents.size() + " components from camel-catalog");
+        } catch (IOException e) {
+            throw new MojoFailureException("Error loading resource from camel-catalog due " + e.getMessage(), e);
+        }
 
         // make sure to create out dir
         componentsOutDir.mkdirs();
 
-        for (File file : jsonFiles) {
-            // for spring-boot we need to amend the json file to use -starter as the artifact-id
+        for (String extension : extensions) {
+            if (!isCamelComponent(catalogComponents, extension)) {
+                continue;
+            }
+
+            // for quarkus we need to amend the json file to use the quarkus maven GAV
             try {
-                String text = loadText(new FileInputStream(file));
+                InputStream is = getClass().getClassLoader().getResourceAsStream("org/apache/camel/catalog/components/" + extension + ".json");
+                String text = loadText(is);
 
-                text = ARTIFACT_PATTERN.matcher(text).replaceFirst("\"artifactId\": \"camel-$1-starter\"");
+                text = GROUP_PATTERN.matcher(text).replaceFirst("\"groupId\": \"org.apache.camel.quarkus\"");
+                text = ARTIFACT_PATTERN.matcher(text).replaceFirst("\"artifactId\": \"camel-quarkus-$1\"");
+                text = VERSION_PATTERN.matcher(text).replaceFirst("\"version\": \"" + project.getVersion() + "\"");
 
                 // write new json file
-                File to = new File(componentsOutDir, file.getName());
+                File to = new File(componentsOutDir, extension + ".json");
                 FileOutputStream fos = new FileOutputStream(to, false);
 
                 fos.write(text.getBytes());
@@ -179,7 +145,7 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
                 fos.close();
 
             } catch (IOException e) {
-                throw new MojoFailureException("Cannot write json file " + file, e);
+                throw new MojoFailureException("Cannot write json file " + extension, e);
             }
         }
 
@@ -209,186 +175,10 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
         } catch (IOException e) {
             throw new MojoFailureException("Error writing to file " + all);
         }
-    } */
-
-    private void findComponentFilesRecursive(File dir, Set<File> found, Set<File> components, FileFilter filter) {
-        File[] files = dir.listFiles(filter);
-        if (files != null) {
-            for (File file : files) {
-                // skip files in root dirs as Camel does not store information there but others may do
-                boolean rootDir = "classes".equals(dir.getName()) || "META-INF".equals(dir.getName());
-                boolean jsonFile = !rootDir && file.isFile() && file.getName().endsWith(".json");
-                boolean componentFile = !rootDir && file.isFile() && file.getName().equals("component.properties");
-                if (jsonFile) {
-                    found.add(file);
-                } else if (componentFile) {
-                    components.add(file);
-                } else if (file.isDirectory()) {
-                    findComponentFilesRecursive(file, found, components, filter);
-                }
-            }
-        }
     }
 
-    private void findDataFormatFilesRecursive(File dir, Set<File> found, Set<File> dataFormats, FileFilter filter) {
-        File[] files = dir.listFiles(filter);
-        if (files != null) {
-            for (File file : files) {
-                // skip files in root dirs as Camel does not store information there but others may do
-                boolean rootDir = "classes".equals(dir.getName()) || "META-INF".equals(dir.getName());
-                boolean jsonFile = !rootDir && file.isFile() && file.getName().endsWith(".json");
-                boolean dataFormatFile = !rootDir && file.isFile() && file.getName().equals("dataformat.properties");
-                if (jsonFile) {
-                    found.add(file);
-                } else if (dataFormatFile) {
-                    dataFormats.add(file);
-                } else if (file.isDirectory()) {
-                    findDataFormatFilesRecursive(file, found, dataFormats, filter);
-                }
-            }
-        }
-    }
-
-    private void findLanguageFilesRecursive(File dir, Set<File> found, Set<File> languages, FileFilter filter) {
-        File[] files = dir.listFiles(filter);
-        if (files != null) {
-            for (File file : files) {
-                // skip files in root dirs as Camel does not store information there but others may do
-                boolean rootDir = "classes".equals(dir.getName()) || "META-INF".equals(dir.getName());
-                boolean jsonFile = !rootDir && file.isFile() && file.getName().endsWith(".json");
-                boolean languageFile = !rootDir && file.isFile() && file.getName().equals("language.properties");
-                if (jsonFile) {
-                    found.add(file);
-                } else if (languageFile) {
-                    languages.add(file);
-                } else if (file.isDirectory()) {
-                    findLanguageFilesRecursive(file, found, languages, filter);
-                }
-            }
-        }
-    }
-
-    private void findOtherFilesRecursive(File dir, Set<File> found, Set<File> others, FileFilter filter) {
-        File[] files = dir.listFiles(filter);
-        if (files != null) {
-            for (File file : files) {
-                // skip files in root dirs as Camel does not store information there but others may do
-                boolean rootDir = "classes".equals(dir.getName()) || "META-INF".equals(dir.getName());
-                boolean jsonFile = rootDir && file.isFile() && file.getName().endsWith(".json");
-                boolean otherFile = !rootDir && file.isFile() && file.getName().equals("other.properties");
-                if (jsonFile) {
-                    found.add(file);
-                } else if (otherFile) {
-                    others.add(file);
-                } else if (file.isDirectory()) {
-                    findOtherFilesRecursive(file, found, others, filter);
-                }
-            }
-        }
-    }
-
-    private class CamelComponentsFileFilter implements FileFilter {
-
-        @Override
-        public boolean accept(File pathname) {
-            if (pathname.isDirectory() && pathname.getName().equals("model")) {
-                // do not check the camel-core model packages as there is no components there
-                return false;
-            }
-            if (pathname.isFile() && pathname.getName().endsWith(".json")) {
-                // must be a components json file
-                try {
-                    String json = loadText(new FileInputStream(pathname));
-                    return json != null && json.contains("\"kind\": \"component\"");
-                } catch (IOException e) {
-                    // ignore
-                }
-            }
-            return pathname.isDirectory() || (pathname.isFile() && pathname.getName().equals("component.properties"));
-        }
-    }
-
-    private class CamelDataFormatsFileFilter implements FileFilter {
-
-        @Override
-        public boolean accept(File pathname) {
-            if (pathname.isDirectory() && pathname.getName().equals("model")) {
-                // do not check the camel-core model packages as there is no components there
-                return false;
-            }
-            if (pathname.isFile() && pathname.getName().endsWith(".json")) {
-                // must be a dataformat json file
-                try {
-                    String json = loadText(new FileInputStream(pathname));
-                    return json != null && json.contains("\"kind\": \"dataformat\"");
-                } catch (IOException e) {
-                    // ignore
-                }
-            }
-            return pathname.isDirectory() || (pathname.isFile() && pathname.getName().equals("dataformat.properties"));
-        }
-    }
-
-    private class CamelLanguagesFileFilter implements FileFilter {
-
-        @Override
-        public boolean accept(File pathname) {
-            if (pathname.isDirectory() && pathname.getName().equals("model")) {
-                // do not check the camel-core model packages as there is no components there
-                return false;
-            }
-            if (pathname.isFile() && pathname.getName().endsWith(".json")) {
-                // must be a language json file
-                try {
-                    String json = loadText(new FileInputStream(pathname));
-                    return json != null && json.contains("\"kind\": \"language\"");
-                } catch (IOException e) {
-                    // ignore
-                }
-            }
-            return pathname.isDirectory() || (pathname.isFile() && pathname.getName().equals("language.properties"));
-        }
-    }
-
-    private class CamelOthersFileFilter implements FileFilter {
-
-        @Override
-        public boolean accept(File pathname) {
-            if (pathname.isFile() && pathname.getName().endsWith(".json")) {
-                // must be a language json file
-                try {
-                    String json = loadText(new FileInputStream(pathname));
-                    return json != null && json.contains("\"kind\": \"other\"");
-                } catch (IOException e) {
-                    // ignore
-                }
-            }
-            return pathname.isDirectory() || (pathname.isFile() && pathname.getName().equals("other.properties"));
-        }
-    }
-
-    public static void copyFile(File from, File to) throws IOException {
-        FileChannel in = null;
-        FileChannel out = null;
-        try (FileInputStream fis = new FileInputStream(from); FileOutputStream fos = new FileOutputStream(to)) {
-            try {
-                in = fis.getChannel();
-                out = fos.getChannel();
-
-                long size = in.size();
-                long position = 0;
-                while (position < size) {
-                    position += in.transferTo(position, BUFFER_SIZE, out);
-                }
-            } finally {
-                if (in != null) {
-                    in.close();
-                }
-                if (out != null) {
-                    out.close();
-                }
-            }
-        }
+    private static boolean isCamelComponent(List<String> components, String name) {
+        return components.stream().anyMatch(c -> c.equals(name));
     }
 
     private Set<String> findExtensions() {


[camel-quarkus] 10/12: #75: Adding camel-quarkus-catalog (work in progress)

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch catalog
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit af153f0e56058e64fdafed17a444b14deaae95bc
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Oct 8 13:56:41 2019 +0200

    #75: Adding camel-quarkus-catalog (work in progress)
---
 .../apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
index 3a32e46..373df70 100644
--- a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
+++ b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
@@ -59,8 +59,6 @@ import static org.apache.camel.quarkus.maven.PackageHelper.loadText;
 @Mojo(name = "prepare-catalog-quarkus", threadSafe = true, requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME)
 public class PrepareCatalogQuarkusMojo extends AbstractMojo {
 
-    // TODO: match by artifact-id instead of directory name (mail -> camel-mail JAR -> component names (alias files, so copy over)
-
     private static final String[] EXCLUDE_EXTENSIONS = {
             "http-common", "jetty-common", "support", "xml-common", "xstream-common"
     };
@@ -133,7 +131,7 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
         executeComponents(artifacts);
         executeLanguages(artifacts);
         executeDataFormats(artifacts);
-//        executeOthers(artifacts);
+//        executeOthers(artifacts); // TODO: implement me
     }
 
     private Set<String> extractArtifactIds(Set<String> extensions) throws MojoFailureException {
@@ -378,12 +376,7 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
     }
 
     private static boolean isExcludedExtension(String name) {
-        for (String exclude : EXCLUDE_EXTENSIONS) {
-            if (exclude.equals(name)) {
-                return true;
-            }
-        }
-        return false;
+        return Arrays.asList(EXCLUDE_EXTENSIONS).contains(name);
     }
 
 }