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 2022/01/10 09:39:29 UTC

[camel] branch main updated: CAMEL-15727: camel-cdi-main to have the Main class.

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

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


The following commit(s) were added to refs/heads/main by this push:
     new 71b7cb0  CAMEL-15727: camel-cdi-main to have the Main class.
71b7cb0 is described below

commit 71b7cb09018be3b335410c0a11c1fcfca070f952
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Jan 10 10:38:36 2022 +0100

    CAMEL-15727: camel-cdi-main to have the Main class.
---
 bom/camel-bom/pom.xml                              |  5 ++
 catalog/camel-allcomponents/pom.xml                |  4 ++
 .../org/apache/camel/catalog/others.properties     |  1 +
 .../org/apache/camel/catalog/others/cdi-main.json  | 15 +++++
 components/camel-cdi-main/pom.xml                  | 64 ++++++++++++++++++++++
 .../services/org/apache/camel/other.properties     |  7 +++
 .../src/generated/resources/cdi-main.json          | 15 +++++
 .../camel-cdi-main/src/main/docs/cdi-main.adoc     | 11 ++++
 .../src/main/java/org/apache/camel/cdi/Main.java   |  3 +-
 components/camel-cdi/pom.xml                       | 19 +++----
 components/pom.xml                                 |  1 +
 .../modules/others/examples/json/cdi-main.json     |  1 +
 docs/components/modules/others/nav.adoc            |  1 +
 docs/components/modules/others/pages/cdi-main.adoc |  1 +
 .../ROOT/pages/camel-3x-upgrade-guide-3_15.adoc    | 10 ++--
 parent/pom.xml                                     |  5 ++
 tooling/maven/camel-maven-plugin/pom.xml           |  4 +-
 .../main/java/org/apache/camel/maven/RunMojo.java  |  4 +-
 18 files changed, 150 insertions(+), 21 deletions(-)

diff --git a/bom/camel-bom/pom.xml b/bom/camel-bom/pom.xml
index 79f35dc..d403f58 100644
--- a/bom/camel-bom/pom.xml
+++ b/bom/camel-bom/pom.xml
@@ -418,6 +418,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-cdi-main</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-chatscript</artifactId>
         <version>${project.version}</version>
       </dependency>
diff --git a/catalog/camel-allcomponents/pom.xml b/catalog/camel-allcomponents/pom.xml
index 7688890..054e67a 100644
--- a/catalog/camel-allcomponents/pom.xml
+++ b/catalog/camel-allcomponents/pom.xml
@@ -287,6 +287,10 @@
 		</dependency>
 		<dependency>
 			<groupId>org.apache.camel</groupId>
+			<artifactId>camel-cdi-main</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.camel</groupId>
 			<artifactId>camel-cdi</artifactId>
 		</dependency>
 		<dependency>
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others.properties b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others.properties
index c2aa9fd..f3eeb14 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others.properties
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others.properties
@@ -2,6 +2,7 @@ attachments
 aws-xray
 caffeine-lrucache
 cdi
+cdi-main
 csimple-joor
 cxf-transport
 debug
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others/cdi-main.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others/cdi-main.json
new file mode 100644
index 0000000..a21b072
--- /dev/null
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others/cdi-main.json
@@ -0,0 +1,15 @@
+{
+  "other": {
+    "kind": "other",
+    "name": "cdi-main",
+    "title": "CDI Main",
+    "description": "Using Camel Main with CDI",
+    "deprecated": false,
+    "firstVersion": "3.15.0",
+    "label": "java",
+    "supportLevel": "Preview",
+    "groupId": "org.apache.camel",
+    "artifactId": "camel-cdi-main",
+    "version": "3.15.0-SNAPSHOT"
+  }
+}
diff --git a/components/camel-cdi-main/pom.xml b/components/camel-cdi-main/pom.xml
new file mode 100644
index 0000000..ef49c25
--- /dev/null
+++ b/components/camel-cdi-main/pom.xml
@@ -0,0 +1,64 @@
+<?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</groupId>
+        <artifactId>components</artifactId>
+        <version>3.15.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-cdi-main</artifactId>
+    <packaging>jar</packaging>
+
+    <name>Camel :: CDI Main</name>
+    <description>Using Camel Main with CDI</description>
+
+    <properties>
+        <firstVersion>3.15.0</firstVersion>
+        <label>java</label>
+        <title>CDI Main</title>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-cdi</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-main</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.deltaspike.cdictrl</groupId>
+            <artifactId>deltaspike-cdictrl-api</artifactId>
+            <version>${deltaspike-version}</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.enterprise</groupId>
+            <artifactId>cdi-api</artifactId>
+            <version>${cdi-api-2.0-version}</version>
+        </dependency>
+
+    </dependencies>
+
+</project>
diff --git a/components/camel-cdi-main/src/generated/resources/META-INF/services/org/apache/camel/other.properties b/components/camel-cdi-main/src/generated/resources/META-INF/services/org/apache/camel/other.properties
new file mode 100644
index 0000000..6720e62
--- /dev/null
+++ b/components/camel-cdi-main/src/generated/resources/META-INF/services/org/apache/camel/other.properties
@@ -0,0 +1,7 @@
+# Generated by camel build tools - do NOT edit this file!
+name=cdi-main
+groupId=org.apache.camel
+artifactId=camel-cdi-main
+version=3.15.0-SNAPSHOT
+projectName=Camel :: CDI Main
+projectDescription=Using Camel Main with CDI
diff --git a/components/camel-cdi-main/src/generated/resources/cdi-main.json b/components/camel-cdi-main/src/generated/resources/cdi-main.json
new file mode 100644
index 0000000..a21b072
--- /dev/null
+++ b/components/camel-cdi-main/src/generated/resources/cdi-main.json
@@ -0,0 +1,15 @@
+{
+  "other": {
+    "kind": "other",
+    "name": "cdi-main",
+    "title": "CDI Main",
+    "description": "Using Camel Main with CDI",
+    "deprecated": false,
+    "firstVersion": "3.15.0",
+    "label": "java",
+    "supportLevel": "Preview",
+    "groupId": "org.apache.camel",
+    "artifactId": "camel-cdi-main",
+    "version": "3.15.0-SNAPSHOT"
+  }
+}
diff --git a/components/camel-cdi-main/src/main/docs/cdi-main.adoc b/components/camel-cdi-main/src/main/docs/cdi-main.adoc
new file mode 100644
index 0000000..331530a
--- /dev/null
+++ b/components/camel-cdi-main/src/main/docs/cdi-main.adoc
@@ -0,0 +1,11 @@
+= CDI Main Component
+:doctitle: CDI Main
+:shortname: cdi-main
+:artifactid: camel-cdi-main
+:description: Using Camel Main with CDI
+:since: 3.15
+:supportlevel: Preview
+
+*Since Camel {since}*
+
+This module is used for running CDI standalone via a main class extended from `camel-main`.
diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/Main.java b/components/camel-cdi-main/src/main/java/org/apache/camel/cdi/Main.java
similarity index 98%
rename from components/camel-cdi/src/main/java/org/apache/camel/cdi/Main.java
rename to components/camel-cdi-main/src/main/java/org/apache/camel/cdi/Main.java
index b17ff62..aed8e28 100644
--- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/Main.java
+++ b/components/camel-cdi-main/src/main/java/org/apache/camel/cdi/Main.java
@@ -36,8 +36,7 @@ import static org.apache.camel.cdi.BeanManagerHelper.getReference;
 import static org.apache.deltaspike.cdise.api.CdiContainerLoader.getCdiContainer;
 
 /**
- * Camel CDI boot integration. Allows Camel and CDI to be booted up on the command line as a JVM process. See
- * http://camel.apache.org/camel-boot.html.
+ * Camel CDI boot integration. Allows Camel and CDI to be booted up on the command line as a JVM process.
  */
 @Vetoed
 public class Main extends MainCommandLineSupport {
diff --git a/components/camel-cdi/pom.xml b/components/camel-cdi/pom.xml
index 1832ca5..fea2dcb 100644
--- a/components/camel-cdi/pom.xml
+++ b/components/camel-cdi/pom.xml
@@ -65,11 +65,11 @@
     <dependencies>
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-support</artifactId>
+            <artifactId>camel-core-engine</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-main</artifactId>
+            <artifactId>camel-support</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.camel</groupId>
@@ -80,15 +80,7 @@
             <artifactId>camel-mock</artifactId>
         </dependency>
 
-        <!-- DeltaSpike is only used to provide Main support thus optional -->
-        <dependency>
-            <groupId>org.apache.deltaspike.cdictrl</groupId>
-            <artifactId>deltaspike-cdictrl-api</artifactId>
-            <version>${deltaspike-version}</version>
-            <optional>true</optional>
-        </dependency>
-
-        <!-- provided dependencies -->
+        <!-- deprecated xml -->
         <dependency>
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-core-xml</artifactId>
@@ -111,6 +103,11 @@
         <!-- test dependencies -->
         <dependency>
             <groupId>org.apache.camel</groupId>
+            <artifactId>camel-core-languages</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
             <artifactId>camel-bean</artifactId>
             <scope>test</scope>
         </dependency>
diff --git a/components/pom.xml b/components/pom.xml
index 033934a..020885b 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -114,6 +114,7 @@
         <module>camel-cassandraql</module>
         <module>camel-cbor</module>
         <module>camel-cdi</module>
+        <module>camel-cdi-main</module>
         <module>camel-chatscript</module>
         <module>camel-chunk</module>
         <module>camel-cm-sms</module>
diff --git a/docs/components/modules/others/examples/json/cdi-main.json b/docs/components/modules/others/examples/json/cdi-main.json
new file mode 120000
index 0000000..ad8a2d3
--- /dev/null
+++ b/docs/components/modules/others/examples/json/cdi-main.json
@@ -0,0 +1 @@
+../../../../../../components/camel-cdi-main/src/generated/resources/cdi-main.json
\ No newline at end of file
diff --git a/docs/components/modules/others/nav.adoc b/docs/components/modules/others/nav.adoc
index c716fe3..19cd38d 100644
--- a/docs/components/modules/others/nav.adoc
+++ b/docs/components/modules/others/nav.adoc
@@ -6,6 +6,7 @@
 ** xref:aws-xray.adoc[AWS XRay]
 ** xref:caffeine-lrucache.adoc[Caffeine Lrucache]
 ** xref:cdi.adoc[CDI]
+** xref:cdi-main.adoc[CDI Main]
 ** xref:csimple-joor.adoc[CSimple jOOR]
 ** xref:cxf-transport.adoc[CXF Transport]
 ** xref:debug.adoc[Debug]
diff --git a/docs/components/modules/others/pages/cdi-main.adoc b/docs/components/modules/others/pages/cdi-main.adoc
new file mode 120000
index 0000000..1d9c122
--- /dev/null
+++ b/docs/components/modules/others/pages/cdi-main.adoc
@@ -0,0 +1 @@
+../../../../../components/camel-cdi-main/src/main/docs/cdi-main.adoc
\ No newline at end of file
diff --git a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_15.adoc b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_15.adoc
index 65d8cc3..d4e33be 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_15.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_15.adoc
@@ -69,10 +69,6 @@ node in the JMX MBean tree.
 
 Removed deprecated operations on `CamelContextMBean` and `CamelRouteMBean`.
 
-=== camel-salesforce
-
-The `getResources` operation now returns a `Map<String, String>` instead of `RestResources`.
-
 === camel-util
 
 Deleted the `replaceAll` method of `org.apache.camel.util.StringHelper`. Please use the `replace` method of `java.lang.String` instead, as it is much faster from Java 11 onward.
@@ -110,6 +106,12 @@ This should correctly be done with `steps` as child of `from`:
 
 The JBang app that was previously named `CamelJBang` is now named `camel`. It is still possible to use the older name by installing it using `CamelJBang@apache/camel` but this approach is deprecated and should not be used in the future.
 
+=== camel-cdi
+
+The legacy XML in `camel-cdi` with `<camelContext>` is deprecated, instead the XML DSL route loader should be used.
+
+The `org.apache.camel.cdi.Main` class has moved from `camel-cdi` to `camel-cdi-main` JAR.
+
 === camel-karaf
 
 The `camel-endpointdsl` and `camel-componentdsl` is no longer supported on Apache Karaf.
diff --git a/parent/pom.xml b/parent/pom.xml
index 91b41e4..bb1d9d2 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -1117,6 +1117,11 @@
 			</dependency>
 			<dependency>
 				<groupId>org.apache.camel</groupId>
+				<artifactId>camel-cdi-main</artifactId>
+				<version>${project.version}</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.camel</groupId>
 				<artifactId>camel-cdi</artifactId>
 				<version>${project.version}</version>
 			</dependency>
diff --git a/tooling/maven/camel-maven-plugin/pom.xml b/tooling/maven/camel-maven-plugin/pom.xml
index 3079d23..8238da5 100644
--- a/tooling/maven/camel-maven-plugin/pom.xml
+++ b/tooling/maven/camel-maven-plugin/pom.xml
@@ -86,10 +86,10 @@
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-spring-javaconfig</artifactId>
         </dependency>
-        <!-- camel-cdi has Main class for running CDI -->
+        <!-- camel-cdi-main has Main class for running CDI -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-cdi</artifactId>
+            <artifactId>camel-cdi-main</artifactId>
         </dependency>
         <!-- for logging in color -->
         <dependency>
diff --git a/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java b/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
index c290477..2c85623 100644
--- a/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
+++ b/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
@@ -649,8 +649,8 @@ public class RunMojo extends AbstractExecMojo {
     private boolean detectCDIOnClassPath() {
         List<Dependency> deps = project.getCompileDependencies();
         for (Dependency dep : deps) {
-            if ("org.apache.camel".equals(dep.getGroupId()) && "camel-cdi".equals(dep.getArtifactId())) {
-                getLog().info("camel-cdi detected on classpath");
+            if ("org.apache.camel".equals(dep.getGroupId()) && "camel-cdi-main".equals(dep.getArtifactId())) {
+                getLog().info("camel-cdi-main detected on classpath");
                 return true;
             }
         }