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/06/21 11:38:15 UTC

[camel] branch master updated (ecbc6a8 -> 8358db1)

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

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


    from ecbc6a8  Regen
     new b4bcbb1  CAMEL-13663: camel-main-maven-plugin to generte spring-boot tooling metadata to fool Java editors to have code completions for Camel Main application.properties files.
     new 4ca51e3  CAMEL-13663: camel-main-maven-plugin to generte spring-boot tooling metadata to fool Java editors to have code completions for Camel Main application.properties files.
     new 8358db1  CAMEL-13663: camel-main-maven-plugin to generte spring-boot tooling metadata to fool Java editors to have code completions for Camel Main application.properties files.

The 3 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.


Summary of changes:
 catalog/camel-main-maven-plugin/pom.xml            |   7 ++
 .../src/main/docs/camel-main-maven-plugin.adoc     |   1 +
 .../org/apache/camel/maven/AbstractMainMojo.java   |  88 +++++++++++++---
 .../org/apache/camel/maven/GenerateHelper.java     | 111 +++++++++++++++++++++
 .../java/org/apache/camel/maven/GenerateMojo.java  |  97 ++++++++++++++++--
 5 files changed, 280 insertions(+), 24 deletions(-)
 create mode 100644 catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/GenerateHelper.java


[camel] 01/03: CAMEL-13663: camel-main-maven-plugin to generte spring-boot tooling metadata to fool Java editors to have code completions for Camel Main application.properties files.

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

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

commit b4bcbb14fcd0d9248f67e73dbbdbebb3f2f42557
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Jun 21 12:42:14 2019 +0200

    CAMEL-13663: camel-main-maven-plugin to generte spring-boot tooling metadata to fool Java editors to have code completions for Camel Main application.properties files.
---
 .../org/apache/camel/maven/AbstractMainMojo.java   |  88 +++++--
 .../java/org/apache/camel/maven/GenerateMojo.java  |  35 +++
 examples/camel-example-main-artemis/pom.xml        |   4 +-
 .../META-INF/spring-configuration-metadata.json    | 254 ++-------------------
 4 files changed, 134 insertions(+), 247 deletions(-)

diff --git a/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/AbstractMainMojo.java b/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/AbstractMainMojo.java
index bf4beaf..bd93300 100644
--- a/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/AbstractMainMojo.java
+++ b/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/AbstractMainMojo.java
@@ -41,6 +41,7 @@ import org.apache.camel.util.IOHelper;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
 import org.apache.maven.artifact.resolver.ArtifactResolver;
 import org.apache.maven.model.Dependency;
 import org.apache.maven.plugin.MojoExecutionException;
@@ -75,6 +76,8 @@ public abstract class AbstractMainMojo extends AbstractExecMojo {
 
     protected transient ClassLoader classLoader;
 
+    protected transient ClassLoader sourcesClassLoader;
+
     protected transient CamelCatalog catalog;
 
     protected transient Reflections reflections;
@@ -215,7 +218,7 @@ public abstract class AbstractMainMojo extends AbstractExecMojo {
     protected Set<String> resolveCamelComponentsFromClasspath() throws MojoFailureException {
         Set<String> components = new TreeSet<>();
         try {
-            classLoader = getClassLoader();
+            classLoader = getClassLoader(false);
             Enumeration<URL> en = classLoader.getResources("META-INF/services/org/apache/camel/component.properties");
             while (en.hasMoreElements()) {
                 URL url = en.nextElement();
@@ -236,19 +239,38 @@ public abstract class AbstractMainMojo extends AbstractExecMojo {
         return components;
     }
 
+    protected ClassLoader getSourcesClassLoader() throws Exception {
+        if (sourcesClassLoader == null) {
+            try {
+                sourcesClassLoader = getClassLoader(true);
+            } catch (Throwable e) {
+                getLog().warn("Cannot download sources JAR to look for javadoc descriptions of the discovered options, due to: " + e.getMessage());
+            }
+        }
+        return sourcesClassLoader;
+    }
+
     /**
      * Set up a classloader for scanning
      */
-    private ClassLoader getClassLoader() throws MalformedURLException, MojoExecutionException {
+    private ClassLoader getClassLoader(boolean sourcesOnly) throws MalformedURLException, MojoExecutionException {
         Set<URL> classpathURLs = new LinkedHashSet<>();
 
         // add project classpath
-        URL mainClasses = new File(project.getBuild().getOutputDirectory()).toURI().toURL();
-        classpathURLs.add(mainClasses);
+        if (!sourcesOnly) {
+            URL mainClasses = new File(project.getBuild().getOutputDirectory()).toURI().toURL();
+            classpathURLs.add(mainClasses);
+        }
 
         // add maven dependencies
-        Set<Artifact> deps = project.getArtifacts();
-        deps.addAll(getAllNonTestScopedDependencies());
+        Set<Artifact> deps;
+        if (sourcesOnly) {
+            deps = new LinkedHashSet<>();
+            deps.addAll(getAllSourceOnlyDependencies(getAllNonTestScopedDependencies()));
+        } else {
+            deps = project.getArtifacts();
+            deps.addAll(getAllNonTestScopedDependencies());
+        }
         for (Artifact dep : deps) {
             File file = dep.getFile();
             if (file != null) {
@@ -257,7 +279,11 @@ public abstract class AbstractMainMojo extends AbstractExecMojo {
         }
 
         if (logClasspath) {
-            getLog().info("Classpath:");
+            if (sourcesOnly) {
+                getLog().info("Sources Classpath:");
+            } else {
+                getLog().info("Classpath:");
+            }
             for (URL url : classpathURLs) {
                 getLog().info("  " + url.getFile());
             }
@@ -271,7 +297,7 @@ public abstract class AbstractMainMojo extends AbstractExecMojo {
         for (Artifact artifact : getAllDependencies()) {
 
             // do not add test artifacts
-            if (!artifact.getScope().equals(Artifact.SCOPE_TEST)) {
+            if (!Artifact.SCOPE_TEST.equals(artifact.getScope())) {
 
                 if ("google-collections".equals(artifact.getArtifactId())) {
                     // skip this as we conflict with guava
@@ -295,15 +321,51 @@ public abstract class AbstractMainMojo extends AbstractExecMojo {
 
     // generic method to retrieve all the transitive dependencies
     private Collection<Artifact> getAllDependencies() {
-        List<Artifact> artifacts = new ArrayList<>();
+        List<Artifact> answer = new ArrayList<>();
 
         for (Iterator<?> dependencies = project.getDependencies().iterator(); dependencies.hasNext();) {
-            Dependency dependency = (Dependency) dependencies.next();
-            Artifact art = repositorySystem.createDependencyArtifact(dependency);
-            artifacts.add(art);
+            Dependency dep = (Dependency) dependencies.next();
+            Artifact art = repositorySystem.createDependencyArtifact(dep);
+            if (!art.isResolved()) {
+                ArtifactResolutionRequest req = new ArtifactResolutionRequest();
+                req.setArtifact(art);
+                req.setResolveTransitively(true);
+                req.setLocalRepository(localRepository);
+                req.setRemoteRepositories(remoteRepositories);
+                ArtifactResolutionResult res = artifactResolver.resolve(req);
+                if (res.isSuccess()) {
+                    answer.addAll(res.getArtifacts());
+                }
+            } else {
+                answer.add(art);
+            }
         }
 
-        return artifacts;
+        return answer;
+    }
+
+    private Collection<Artifact> getAllSourceOnlyDependencies(Collection<Artifact> artifacts) {
+        List<Artifact> answer = new ArrayList<>();
+
+        for (Artifact art : artifacts) {
+            Artifact sourceArt = repositorySystem.createArtifactWithClassifier(art.getGroupId(), art.getArtifactId(), art.getVersion(), art.getType(), "sources");
+            if (!sourceArt.isResolved()) {
+                ArtifactResolutionRequest req = new ArtifactResolutionRequest();
+                req.setArtifact(sourceArt);
+                req.setResolveTransitively(false);
+                req.setLocalRepository(localRepository);
+                req.setRemoteRepositories(remoteRepositories);
+                ArtifactResolutionResult res = artifactResolver.resolve(req);
+                if (res.isSuccess()) {
+                    for (Artifact a : res.getArtifacts()) {
+                        answer.add(a);
+                    }
+                }
+            } else {
+                answer.add(sourceArt);
+            }
+        }
+        return answer;
     }
 
     static String safeJavaType(String javaType) {
diff --git a/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/GenerateMojo.java b/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/GenerateMojo.java
index 0dd59d3..dc460e6 100644
--- a/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/GenerateMojo.java
+++ b/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/GenerateMojo.java
@@ -23,16 +23,23 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
+import java.net.JarURLConnection;
+import java.net.URL;
 import java.util.ArrayList;
+import java.util.Enumeration;
 import java.util.List;
 import java.util.Properties;
 import java.util.Set;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.logging.FileHandler;
 import java.util.stream.Collectors;
 
 import org.apache.camel.maven.model.AutowireData;
 import org.apache.camel.maven.model.SpringBootData;
 import org.apache.camel.support.IntrospectionSupport;
 import org.apache.camel.support.PatternHelper;
+import org.apache.camel.util.FileUtil;
 import org.apache.camel.util.IOHelper;
 import org.apache.camel.util.OrderedProperties;
 import org.apache.camel.util.StringHelper;
@@ -178,6 +185,20 @@ public class GenerateMojo extends AbstractMainMojo {
                                 extraSetterMethods(best, setters);
                                 // sort the setters
                                 setters.sort((o1, o2) -> o1.getName().compareToIgnoreCase(o2.getName()));
+
+                                String javaSource = null;
+                                if (!setters.isEmpty()) {
+                                    String path = best.getName().replace('.', '/') + ".java";
+                                    getLog().debug("Loading Java source: " + path);
+
+                                    InputStream is = getSourcesClassLoader().getResourceAsStream(path);
+                                    if (is != null) {
+                                        javaSource = IOHelper.loadText(is);
+                                        IOHelper.close(is);
+                                    }
+                                    getLog().info("Loaded source code: " + javaSource);
+                                }
+
                                 for (Method m : setters) {
                                     String shortHand = IntrospectionSupport.getSetterShorthandName(m);
                                     String bootName = camelCaseToDash(shortHand);
@@ -185,6 +206,9 @@ public class GenerateMojo extends AbstractMainMojo {
                                     String bootJavaType = m.getParameterTypes()[0].getName();
                                     String sourceType = best.getName();
                                     getLog().debug("Spring Boot option: " + bootKey);
+
+                                    // find the setter method and grab the javadoc
+
                                     String desc = "Auto discovered option from class: " + best.getName() + " to set the option via setter: " + m.getName();
                                     springBootData.add(new SpringBootData(bootKey, springBootJavaType(bootJavaType), desc, sourceType, null));
                                 }
@@ -441,4 +465,15 @@ public class GenerateMojo extends AbstractMainMojo {
         }
     }
 
+    public static void main(String[] args) throws Exception {
+        JarFile jar = new JarFile("/Users/davsclaus/.m2/repository/org/springframework/spring-jms/5.1.8.RELEASE/spring-jms-5.1.8.RELEASE-sources.jar");
+        System.out.println(jar);
+        JarEntry en = jar.getJarEntry("org/springframework/jms/connection/CachingConnectionFactory.java");
+        System.out.println(en);
+        InputStream is = jar.getInputStream(en);
+        String source = IOHelper.loadText(is);
+        IOHelper.close(is);
+        System.out.println(source);
+    }
+
 }
diff --git a/examples/camel-example-main-artemis/pom.xml b/examples/camel-example-main-artemis/pom.xml
index f1ea8df..5d0ddc0 100644
--- a/examples/camel-example-main-artemis/pom.xml
+++ b/examples/camel-example-main-artemis/pom.xml
@@ -113,13 +113,13 @@
                 <artifactId>camel-main-maven-plugin</artifactId>
                 <version>${project.version}</version>
                 <configuration>
-                    <logClasspath>false</logClasspath>
+                    <logClasspath>true</logClasspath>
                     <!-- lets show which options are unmapped -->
                     <!-- <logUnmapped>true</logUnmapped> -->
                     <!-- just include only the jms component -->
                     <!-- <include>jms</include> -->
                     <!-- to use spring caching connection factory instead of the default -->
-                    <!-- <mappings>javax.jms.ConnectionFactory=#class:org.springframework.jms.connection.CachingConnectionFactory</mappings> -->
+                     <mappings>javax.jms.ConnectionFactory=#class:org.springframework.jms.connection.CachingConnectionFactory</mappings>
                 </configuration>
                 <executions>
                     <execution>
diff --git a/examples/camel-example-main-artemis/src/main/resources/META-INF/spring-configuration-metadata.json b/examples/camel-example-main-artemis/src/main/resources/META-INF/spring-configuration-metadata.json
index c787468..06960b3 100644
--- a/examples/camel-example-main-artemis/src/main/resources/META-INF/spring-configuration-metadata.json
+++ b/examples/camel-example-main-artemis/src/main/resources/META-INF/spring-configuration-metadata.json
@@ -784,256 +784,46 @@
       "description": "The connection factory to be use. A connection factory must be configured either on the component or endpoint."
     },
     {
-      "name": "camel.component.jms.connection-factory.auto-group",
+      "name": "camel.component.jms.connection-factory.cache-consumers",
       "type": "java.lang.Boolean",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setAutoGroup"
+      "sourceType": "org.springframework.jms.connection.CachingConnectionFactory",
+      "description": "Auto discovered option from class: org.springframework.jms.connection.CachingConnectionFactory to set the option via setter: setCacheConsumers"
     },
     {
-      "name": "camel.component.jms.connection-factory.block-on-acknowledge",
+      "name": "camel.component.jms.connection-factory.cache-producers",
       "type": "java.lang.Boolean",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setBlockOnAcknowledge"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.block-on-durable-send",
-      "type": "java.lang.Boolean",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setBlockOnDurableSend"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.block-on-non-durable-send",
-      "type": "java.lang.Boolean",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setBlockOnNonDurableSend"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.cache-destinations",
-      "type": "java.lang.Boolean",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setCacheDestinations"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.cache-large-messages-client",
-      "type": "java.lang.Boolean",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setCacheLargeMessagesClient"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.call-failover-timeout",
-      "type": "java.lang.Long",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setCallFailoverTimeout"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.call-timeout",
-      "type": "java.lang.Long",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setCallTimeout"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.client-failure-check-period",
-      "type": "java.lang.Long",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setClientFailureCheckPeriod"
+      "sourceType": "org.springframework.jms.connection.CachingConnectionFactory",
+      "description": "Auto discovered option from class: org.springframework.jms.connection.CachingConnectionFactory to set the option via setter: setCacheProducers"
     },
     {
       "name": "camel.component.jms.connection-factory.client-id",
       "type": "java.lang.String",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setClientID"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.compress-large-message",
-      "type": "java.lang.Boolean",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setCompressLargeMessage"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.confirmation-window-size",
-      "type": "java.lang.Integer",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setConfirmationWindowSize"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.connection-load-balancing-policy-class-name",
-      "type": "java.lang.String",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setConnectionLoadBalancingPolicyClassName"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.connection-ttl",
-      "type": "java.lang.Long",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setConnectionTTL"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.consumer-max-rate",
-      "type": "java.lang.Integer",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setConsumerMaxRate"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.consumer-window-size",
-      "type": "java.lang.Integer",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setConsumerWindowSize"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.deserialization-black-list",
-      "type": "java.lang.String",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setDeserializationBlackList"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.deserialization-white-list",
-      "type": "java.lang.String",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setDeserializationWhiteList"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.dups-ok-batch-size",
-      "type": "java.lang.Integer",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setDupsOKBatchSize"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.enable1x-prefixes",
-      "type": "java.lang.Boolean",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setEnable1xPrefixes"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.enable-shared-client-id",
-      "type": "java.lang.Boolean",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setEnableSharedClientID"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.failover-on-initial-connection",
-      "type": "java.lang.Boolean",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setFailoverOnInitialConnection"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.group-id",
-      "type": "java.lang.String",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setGroupID"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.ignore-jta",
-      "type": "java.lang.Boolean",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setIgnoreJTA"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.incoming-interceptor-list",
-      "type": "java.lang.String",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setIncomingInterceptorList"
+      "sourceType": "org.springframework.jms.connection.CachingConnectionFactory",
+      "description": "Auto discovered option from class: org.springframework.jms.connection.CachingConnectionFactory to set the option via setter: setClientId"
     },
     {
-      "name": "camel.component.jms.connection-factory.initial-connect-attempts",
-      "type": "java.lang.Integer",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setInitialConnectAttempts"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.initial-message-packet-size",
-      "type": "java.lang.Integer",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setInitialMessagePacketSize"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.max-retry-interval",
-      "type": "java.lang.Long",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setMaxRetryInterval"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.min-large-message-size",
-      "type": "java.lang.Integer",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setMinLargeMessageSize"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.outgoing-interceptor-list",
-      "type": "java.lang.String",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setOutgoingInterceptorList"
+      "name": "camel.component.jms.connection-factory.exception-listener",
+      "type": "javax.jms.ExceptionListener",
+      "sourceType": "org.springframework.jms.connection.CachingConnectionFactory",
+      "description": "Auto discovered option from class: org.springframework.jms.connection.CachingConnectionFactory to set the option via setter: setExceptionListener"
     },
     {
-      "name": "camel.component.jms.connection-factory.pre-acknowledge",
+      "name": "camel.component.jms.connection-factory.reconnect-on-exception",
       "type": "java.lang.Boolean",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setPreAcknowledge"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.producer-max-rate",
-      "type": "java.lang.Integer",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setProducerMaxRate"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.producer-window-size",
-      "type": "java.lang.Integer",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setProducerWindowSize"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.protocol-manager-factory-str",
-      "type": "java.lang.String",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setProtocolManagerFactoryStr"
+      "sourceType": "org.springframework.jms.connection.CachingConnectionFactory",
+      "description": "Auto discovered option from class: org.springframework.jms.connection.CachingConnectionFactory to set the option via setter: setReconnectOnException"
     },
     {
-      "name": "camel.component.jms.connection-factory.reconnect-attempts",
+      "name": "camel.component.jms.connection-factory.session-cache-size",
       "type": "java.lang.Integer",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setReconnectAttempts"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.retry-interval",
-      "type": "java.lang.Long",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setRetryInterval"
+      "sourceType": "org.springframework.jms.connection.CachingConnectionFactory",
+      "description": "Auto discovered option from class: org.springframework.jms.connection.CachingConnectionFactory to set the option via setter: setSessionCacheSize"
     },
     {
-      "name": "camel.component.jms.connection-factory.retry-interval-multiplier",
-      "type": "double",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setRetryIntervalMultiplier"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.scheduled-thread-pool-max-size",
-      "type": "java.lang.Integer",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setScheduledThreadPoolMaxSize"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.thread-pool-max-size",
-      "type": "java.lang.Integer",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setThreadPoolMaxSize"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.transaction-batch-size",
-      "type": "java.lang.Integer",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setTransactionBatchSize"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.use-global-pools",
-      "type": "java.lang.Boolean",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setUseGlobalPools"
-    },
-    {
-      "name": "camel.component.jms.connection-factory.use-topology-for-load-balancing",
-      "type": "java.lang.Boolean",
-      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
-      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setUseTopologyForLoadBalancing"
+      "name": "camel.component.jms.connection-factory.target-connection-factory",
+      "type": "javax.jms.ConnectionFactory",
+      "sourceType": "org.springframework.jms.connection.CachingConnectionFactory",
+      "description": "Auto discovered option from class: org.springframework.jms.connection.CachingConnectionFactory to set the option via setter: setTargetConnectionFactory"
     },
     {
       "name": "camel.component.jms.username",


[camel] 02/03: CAMEL-13663: camel-main-maven-plugin to generte spring-boot tooling metadata to fool Java editors to have code completions for Camel Main application.properties files.

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

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

commit 4ca51e34fb5f1ebf44147045998281ca568855db
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Jun 21 13:12:06 2019 +0200

    CAMEL-13663: camel-main-maven-plugin to generte spring-boot tooling metadata to fool Java editors to have code completions for Camel Main application.properties files.
---
 catalog/camel-main-maven-plugin/pom.xml            |   7 ++
 .../src/main/docs/camel-main-maven-plugin.adoc     |   1 +
 .../org/apache/camel/maven/GenerateHelper.java     | 111 +++++++++++++++++++++
 .../java/org/apache/camel/maven/GenerateMojo.java  |  77 ++++++++------
 examples/camel-example-main-artemis/pom.xml        |   4 +-
 .../META-INF/spring-configuration-metadata.json    |   6 +-
 .../src/main/resources/application.properties      |   2 +
 7 files changed, 171 insertions(+), 37 deletions(-)

diff --git a/catalog/camel-main-maven-plugin/pom.xml b/catalog/camel-main-maven-plugin/pom.xml
index f5e0d54..dbe295b 100644
--- a/catalog/camel-main-maven-plugin/pom.xml
+++ b/catalog/camel-main-maven-plugin/pom.xml
@@ -119,6 +119,13 @@
             <version>${project.version}</version>
         </dependency>
 
+        <!-- java source parser -->
+        <dependency>
+            <groupId>org.jboss.forge.roaster</groupId>
+            <artifactId>roaster-jdt</artifactId>
+            <version>${roaster-version}</version>
+        </dependency>
+
         <!-- logging -->
         <dependency>
             <groupId>org.apache.logging.log4j</groupId>
diff --git a/catalog/camel-main-maven-plugin/src/main/docs/camel-main-maven-plugin.adoc b/catalog/camel-main-maven-plugin/src/main/docs/camel-main-maven-plugin.adoc
index 34f9007..b904168 100644
--- a/catalog/camel-main-maven-plugin/src/main/docs/camel-main-maven-plugin.adoc
+++ b/catalog/camel-main-maven-plugin/src/main/docs/camel-main-maven-plugin.adoc
@@ -169,6 +169,7 @@ The maven plugin *generate* goal supports the following options which can be con
 | logUnmapped | false | When autowiring has detected multiple implementations (2 or more) of a given interface, which cannot be mapped, should they be logged so you can see and add manual mapping if needed.
 | downloadVersion | true | Whether to allow downloading Camel catalog version from the internet.
   This is needed if the project * uses a different Camel version than this plugin is using by default.
+| downloadSourceJars | true | Whether to allow downloading -source JARs when generating spring boot tooling to include javadoc as description for discovered options.
 | exclude | | To exclude autowiring specific properties with these key names. You can also configure a single entry and separate the excludes with comma.
 | include | | To include autowiring specific properties with these key names. You can also configure a single entry and separate the includes with comma.
 | mappings | | To setup special mappings between known types as key=value pairs. You can also configure a single entry and separate the mappings with comma.
diff --git a/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/GenerateHelper.java b/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/GenerateHelper.java
new file mode 100644
index 0000000..9f6f8ef
--- /dev/null
+++ b/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/GenerateHelper.java
@@ -0,0 +1,111 @@
+/*
+ * 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.maven;
+
+public final class GenerateHelper {
+
+    private static final String VALID_CHARS = ".,-='/\\!&%():;#${}";
+
+    private GenerateHelper() {
+    }
+
+    /**
+     * Sanitizes the javadoc to removed invalid characters so it can be used as json description
+     *
+     * @param javadoc  the javadoc
+     * @return the text that is valid as json
+     */
+    public static String sanitizeDescription(String javadoc, boolean summary) {
+        if (javadoc == null || javadoc.isEmpty()) {
+            return null;
+        }
+
+        // lets just use what java accepts as identifiers
+        StringBuilder sb = new StringBuilder();
+
+        // split into lines
+        String[] lines = javadoc.split("\n");
+
+        boolean first = true;
+        for (String line : lines) {
+            line = line.trim();
+
+            if (line.startsWith("**")) {
+                continue;
+            }
+            // remove leading javadoc *
+            if (line.startsWith("*")) {
+                line = line.substring(1);
+                line = line.trim();
+            }
+
+            // terminate if we reach @param, @return or @deprecated as we only want the javadoc summary
+            if (line.startsWith("@param") || line.startsWith("@return") || line.startsWith("@deprecated")) {
+                break;
+            }
+
+            // skip lines that are javadoc references
+            if (line.startsWith("@")) {
+                continue;
+            }
+
+            // remove all XML tags
+            line = line.replaceAll("<.*?>", "");
+
+            // remove all inlined javadoc links, eg such as {@link org.apache.camel.spi.Registry}
+            // use #? to remove leading # in case its a local reference
+            line = line.replaceAll("\\{\\@\\w+\\s#?([\\w.#(\\d,)]+)\\}", "$1");
+
+            // we are starting from a new line, so add a whitespace
+            if (!first) {
+                sb.append(' ');
+            }
+
+            // create a new line
+            StringBuilder cb = new StringBuilder();
+            for (char c : line.toCharArray()) {
+                if (Character.isJavaIdentifierPart(c) || VALID_CHARS.indexOf(c) != -1) {
+                    cb.append(c);
+                } else if (Character.isWhitespace(c)) {
+                    // always use space as whitespace, also for line feeds etc
+                    cb.append(' ');
+                }
+            }
+
+            // append data
+            String s = cb.toString().trim();
+            sb.append(s);
+
+            boolean empty = s.isEmpty();
+            boolean endWithDot = s.endsWith(".");
+            boolean haveText = sb.length() > 0;
+
+            if (haveText && summary && (empty || endWithDot)) {
+                // if we only want a summary, then skip at first empty line we encounter, or if the sentence ends with a dot
+                break;
+            }
+
+            first = false;
+        }
+
+        // remove double whitespaces, and trim
+        String s = sb.toString();
+        s = s.replaceAll("\\s+", " ");
+        return s.trim();
+    }
+
+}
diff --git a/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/GenerateMojo.java b/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/GenerateMojo.java
index dc460e6..158fe84 100644
--- a/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/GenerateMojo.java
+++ b/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/GenerateMojo.java
@@ -1,13 +1,13 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ *      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.
@@ -23,23 +23,16 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
-import java.net.JarURLConnection;
-import java.net.URL;
 import java.util.ArrayList;
-import java.util.Enumeration;
 import java.util.List;
 import java.util.Properties;
 import java.util.Set;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.logging.FileHandler;
 import java.util.stream.Collectors;
 
 import org.apache.camel.maven.model.AutowireData;
 import org.apache.camel.maven.model.SpringBootData;
 import org.apache.camel.support.IntrospectionSupport;
 import org.apache.camel.support.PatternHelper;
-import org.apache.camel.util.FileUtil;
 import org.apache.camel.util.IOHelper;
 import org.apache.camel.util.OrderedProperties;
 import org.apache.camel.util.StringHelper;
@@ -50,6 +43,11 @@ import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.plugins.annotations.ResolutionScope;
 
+import org.jboss.forge.roaster.Roaster;
+import org.jboss.forge.roaster.model.source.JavaClassSource;
+import org.jboss.forge.roaster.model.source.MethodSource;
+
+import static org.apache.camel.maven.GenerateHelper.sanitizeDescription;
 import static org.apache.camel.util.StringHelper.camelCaseToDash;
 
 /**
@@ -71,6 +69,13 @@ public class GenerateMojo extends AbstractMainMojo {
     protected boolean springBootEnabled;
 
     /**
+     * Whether to allow downloading -source JARs when generating spring boot tooling to include
+     * javadoc as description for discovered options.
+     */
+    @Parameter(property = "camel.downloadSourceJars", defaultValue = "true")
+    protected boolean downloadSourceJars;
+
+    /**
      * When autowiring has detected multiple implementations (2 or more) of a given interface, which
      * cannot be mapped, should they be logged so you can see and add manual mapping if needed.
      */
@@ -165,12 +170,12 @@ public class GenerateMojo extends AbstractMainMojo {
                         Set<Class<?>> classes = reflections.getSubTypesOf(clazz);
                         // filter classes (must not be interfaces, must be public, must not be abstract, must be top level) and also a valid autowire class
                         classes = classes.stream().filter(
-                                c -> !c.isInterface()
-                                        && Modifier.isPublic(c.getModifiers())
-                                        && !Modifier.isAbstract(c.getModifiers())
-                                        && c.getEnclosingClass() == null
-                                        && isValidAutowireClass(c))
-                                .collect(Collectors.toSet());
+                            c -> !c.isInterface()
+                            && Modifier.isPublic(c.getModifiers())
+                            && !Modifier.isAbstract(c.getModifiers())
+                            && c.getEnclosingClass() == null
+                            && isValidAutowireClass(c))
+                            .collect(Collectors.toSet());
                         Class best = chooseBestKnownType(componentName, name, clazz, classes, mappingProperties);
                         if (best != null) {
                             key = "camel.component." + componentName + "." + dash;
@@ -186,17 +191,18 @@ public class GenerateMojo extends AbstractMainMojo {
                                 // sort the setters
                                 setters.sort((o1, o2) -> o1.getName().compareToIgnoreCase(o2.getName()));
 
-                                String javaSource = null;
-                                if (!setters.isEmpty()) {
+                                JavaClassSource javaClassSource = null;
+                                if (downloadSourceJars && !setters.isEmpty()) {
                                     String path = best.getName().replace('.', '/') + ".java";
                                     getLog().debug("Loading Java source: " + path);
 
                                     InputStream is = getSourcesClassLoader().getResourceAsStream(path);
                                     if (is != null) {
-                                        javaSource = IOHelper.loadText(is);
+                                        String text = IOHelper.loadText(is);
                                         IOHelper.close(is);
+                                        javaClassSource = (JavaClassSource) Roaster.parse(text);
                                     }
-                                    getLog().info("Loaded source code: " + javaSource);
+                                    getLog().debug("Loaded source code: " + clazz);
                                 }
 
                                 for (Method m : setters) {
@@ -208,8 +214,17 @@ public class GenerateMojo extends AbstractMainMojo {
                                     getLog().debug("Spring Boot option: " + bootKey);
 
                                     // find the setter method and grab the javadoc
+                                    String desc = extractJavaDocFromMethod(javaClassSource, m);
+                                    if (desc == null) {
+                                        desc = "";
+                                    } else {
+                                        desc = sanitizeDescription(desc, false);
+                                        if (!desc.endsWith(".")) {
+                                            desc += ". ";
+                                        }
+                                    }
+                                    desc += "Auto discovered option from class: " + best.getName() + " to set the option via setter: " + m.getName();
 
-                                    String desc = "Auto discovered option from class: " + best.getName() + " to set the option via setter: " + m.getName();
                                     springBootData.add(new SpringBootData(bootKey, springBootJavaType(bootJavaType), desc, sourceType, null));
                                 }
                             }
@@ -465,15 +480,15 @@ public class GenerateMojo extends AbstractMainMojo {
         }
     }
 
-    public static void main(String[] args) throws Exception {
-        JarFile jar = new JarFile("/Users/davsclaus/.m2/repository/org/springframework/spring-jms/5.1.8.RELEASE/spring-jms-5.1.8.RELEASE-sources.jar");
-        System.out.println(jar);
-        JarEntry en = jar.getJarEntry("org/springframework/jms/connection/CachingConnectionFactory.java");
-        System.out.println(en);
-        InputStream is = jar.getInputStream(en);
-        String source = IOHelper.loadText(is);
-        IOHelper.close(is);
-        System.out.println(source);
+    private static String extractJavaDocFromMethod(JavaClassSource clazz, Method method) {
+        if (clazz == null) {
+            return null;
+        }
+        MethodSource ms = clazz.getMethod(method.getName(), method.getParameterTypes()[0]);
+        if (ms != null) {
+            return ms.getJavaDoc().getText();
+        }
+        return null;
     }
 
 }
diff --git a/examples/camel-example-main-artemis/pom.xml b/examples/camel-example-main-artemis/pom.xml
index 5d0ddc0..c918bb2 100644
--- a/examples/camel-example-main-artemis/pom.xml
+++ b/examples/camel-example-main-artemis/pom.xml
@@ -40,12 +40,10 @@
     <dependencies>
 
         <!-- to have spring boot tooling support in IDEA you need spring-boot JARs on the classpath -->
-<!--
         <dependency>
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-spring-boot-starter</artifactId>
         </dependency>
--->
 
         <dependency>
             <groupId>org.apache.camel</groupId>
@@ -113,7 +111,7 @@
                 <artifactId>camel-main-maven-plugin</artifactId>
                 <version>${project.version}</version>
                 <configuration>
-                    <logClasspath>true</logClasspath>
+                    <logClasspath>false</logClasspath>
                     <!-- lets show which options are unmapped -->
                     <!-- <logUnmapped>true</logUnmapped> -->
                     <!-- just include only the jms component -->
diff --git a/examples/camel-example-main-artemis/src/main/resources/META-INF/spring-configuration-metadata.json b/examples/camel-example-main-artemis/src/main/resources/META-INF/spring-configuration-metadata.json
index 06960b3..c771da6 100644
--- a/examples/camel-example-main-artemis/src/main/resources/META-INF/spring-configuration-metadata.json
+++ b/examples/camel-example-main-artemis/src/main/resources/META-INF/spring-configuration-metadata.json
@@ -787,13 +787,13 @@
       "name": "camel.component.jms.connection-factory.cache-consumers",
       "type": "java.lang.Boolean",
       "sourceType": "org.springframework.jms.connection.CachingConnectionFactory",
-      "description": "Auto discovered option from class: org.springframework.jms.connection.CachingConnectionFactory to set the option via setter: setCacheConsumers"
+      "description": "Specify whether to cache JMS MessageConsumers per JMS Session instance(more specifically: one MessageConsumer per Destination, selector Stringand Session). Note that durable subscribers will only be cached untillogical closing of the Session handle.Default is true. Switch this to false in order to alwaysrecreate MessageConsumers on demand.Auto discovered option from class: org.springframework.jms.connection.CachingConnectionFactory to set the option via setter: setC [...]
     },
     {
       "name": "camel.component.jms.connection-factory.cache-producers",
       "type": "java.lang.Boolean",
       "sourceType": "org.springframework.jms.connection.CachingConnectionFactory",
-      "description": "Auto discovered option from class: org.springframework.jms.connection.CachingConnectionFactory to set the option via setter: setCacheProducers"
+      "description": "Specify whether to cache JMS MessageProducers per JMS Session instance(more specifically: one MessageProducer per Destination and Session).Default is true. Switch this to false in order to alwaysrecreate MessageProducers on demand.Auto discovered option from class: org.springframework.jms.connection.CachingConnectionFactory to set the option via setter: setCacheProducers"
     },
     {
       "name": "camel.component.jms.connection-factory.client-id",
@@ -817,7 +817,7 @@
       "name": "camel.component.jms.connection-factory.session-cache-size",
       "type": "java.lang.Integer",
       "sourceType": "org.springframework.jms.connection.CachingConnectionFactory",
-      "description": "Auto discovered option from class: org.springframework.jms.connection.CachingConnectionFactory to set the option via setter: setSessionCacheSize"
+      "description": "Specify the desired size for the JMS Session cache (per JMS Session type).This cache size is the maximum limit for the number of cached Sessionsper session acknowledgement type (auto, client, dups_ok, transacted).As a consequence, the actual number of cached Sessions may be up tofour times as high as the specified value - in the unlikely caseof mixing and matching different acknowledgement types.Default is 1: caching a single Session, (re-)creating further ones onde [...]
     },
     {
       "name": "camel.component.jms.connection-factory.target-connection-factory",
diff --git a/examples/camel-example-main-artemis/src/main/resources/application.properties b/examples/camel-example-main-artemis/src/main/resources/application.properties
index 309db5c..14ea669 100644
--- a/examples/camel-example-main-artemis/src/main/resources/application.properties
+++ b/examples/camel-example-main-artemis/src/main/resources/application.properties
@@ -29,6 +29,8 @@ camel.main.jmx-enabled = false
 # which contains some additional autowires so we only need here to specify the URL to the broker
 camel.component.jms.connection-factory.brokerURL=tcp://localhost:61616
 
+camel.component.jms.connection-factory.cl
+
 # in case you want to use Spring's CachingConnectionFactory, you can configure it as follows:
 # (then you don't need the camel-main-maven-plugin, as you can explicit configure it all here)
 ### camel.component.jms.connectionFactory=#class:org.springframework.jms.connection.CachingConnectionFactory


[camel] 03/03: CAMEL-13663: camel-main-maven-plugin to generte spring-boot tooling metadata to fool Java editors to have code completions for Camel Main application.properties files.

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

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

commit 8358db18de5ea3d72ec01e937a2a36a0e5aa0243
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Jun 21 13:29:27 2019 +0200

    CAMEL-13663: camel-main-maven-plugin to generte spring-boot tooling metadata to fool Java editors to have code completions for Camel Main application.properties files.
---
 .../java/org/apache/camel/maven/GenerateMojo.java  |  43 +++-
 examples/camel-example-main-artemis/pom.xml        |   4 +-
 .../META-INF/spring-configuration-metadata.json    | 254 +++++++++++++++++++--
 .../src/main/resources/application.properties      |   2 -
 4 files changed, 269 insertions(+), 34 deletions(-)

diff --git a/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/GenerateMojo.java b/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/GenerateMojo.java
index 158fe84..51b2989 100644
--- a/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/GenerateMojo.java
+++ b/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/GenerateMojo.java
@@ -198,9 +198,14 @@ public class GenerateMojo extends AbstractMainMojo {
 
                                     InputStream is = getSourcesClassLoader().getResourceAsStream(path);
                                     if (is != null) {
-                                        String text = IOHelper.loadText(is);
-                                        IOHelper.close(is);
-                                        javaClassSource = (JavaClassSource) Roaster.parse(text);
+                                        try {
+                                            String text = IOHelper.loadText(is);
+                                            IOHelper.close(is);
+                                            javaClassSource = (JavaClassSource) Roaster.parse(text);
+                                        } catch (IOException e) {
+                                            // ignore
+                                            getLog().warn("Cannot load Java source: " + path + " from classpath due " + e.getMessage());
+                                        }
                                     }
                                     getLog().debug("Loaded source code: " + clazz);
                                 }
@@ -215,13 +220,11 @@ public class GenerateMojo extends AbstractMainMojo {
 
                                     // find the setter method and grab the javadoc
                                     String desc = extractJavaDocFromMethod(javaClassSource, m);
-                                    if (desc == null) {
+                                    desc = sanitizeDescription(desc, false);
+                                    if (desc == null || desc.isEmpty()) {
                                         desc = "";
                                     } else {
-                                        desc = sanitizeDescription(desc, false);
-                                        if (!desc.endsWith(".")) {
-                                            desc += ". ";
-                                        }
+                                        desc += ". ";
                                     }
                                     desc += "Auto discovered option from class: " + best.getName() + " to set the option via setter: " + m.getName();
 
@@ -480,7 +483,7 @@ public class GenerateMojo extends AbstractMainMojo {
         }
     }
 
-    private static String extractJavaDocFromMethod(JavaClassSource clazz, Method method) {
+    private String extractJavaDocFromMethod(JavaClassSource clazz, Method method) {
         if (clazz == null) {
             return null;
         }
@@ -488,6 +491,28 @@ public class GenerateMojo extends AbstractMainMojo {
         if (ms != null) {
             return ms.getJavaDoc().getText();
         }
+
+        // maybe its from the super class
+        String st = clazz.getSuperType();
+        if (st != null && !"java.lang.Object".equals(st) && !"Object".equals(st)) {
+            st = clazz.resolveType(st);
+            // find this file cia classloader
+            String path = st.replace('.', '/') + ".java";
+            InputStream is = sourcesClassLoader.getResourceAsStream(path);
+            if (is != null) {
+                String text = null;
+                try {
+                    text = IOHelper.loadText(is);
+                    IOHelper.close(is);
+                    clazz = (JavaClassSource) Roaster.parse(text);
+                    getLog().debug("Loaded source code: " + clazz);
+                    return extractJavaDocFromMethod(clazz, method);
+                } catch (IOException e) {
+                    // ignore
+                    getLog().warn("Cannot load Java source: " + path + " from classpath due " + e.getMessage());
+                }
+            }
+        }
         return null;
     }
 
diff --git a/examples/camel-example-main-artemis/pom.xml b/examples/camel-example-main-artemis/pom.xml
index c918bb2..f1ea8df 100644
--- a/examples/camel-example-main-artemis/pom.xml
+++ b/examples/camel-example-main-artemis/pom.xml
@@ -40,10 +40,12 @@
     <dependencies>
 
         <!-- to have spring boot tooling support in IDEA you need spring-boot JARs on the classpath -->
+<!--
         <dependency>
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-spring-boot-starter</artifactId>
         </dependency>
+-->
 
         <dependency>
             <groupId>org.apache.camel</groupId>
@@ -117,7 +119,7 @@
                     <!-- just include only the jms component -->
                     <!-- <include>jms</include> -->
                     <!-- to use spring caching connection factory instead of the default -->
-                     <mappings>javax.jms.ConnectionFactory=#class:org.springframework.jms.connection.CachingConnectionFactory</mappings>
+                    <!-- <mappings>javax.jms.ConnectionFactory=#class:org.springframework.jms.connection.CachingConnectionFactory</mappings> -->
                 </configuration>
                 <executions>
                     <execution>
diff --git a/examples/camel-example-main-artemis/src/main/resources/META-INF/spring-configuration-metadata.json b/examples/camel-example-main-artemis/src/main/resources/META-INF/spring-configuration-metadata.json
index c771da6..c787468 100644
--- a/examples/camel-example-main-artemis/src/main/resources/META-INF/spring-configuration-metadata.json
+++ b/examples/camel-example-main-artemis/src/main/resources/META-INF/spring-configuration-metadata.json
@@ -784,46 +784,256 @@
       "description": "The connection factory to be use. A connection factory must be configured either on the component or endpoint."
     },
     {
-      "name": "camel.component.jms.connection-factory.cache-consumers",
+      "name": "camel.component.jms.connection-factory.auto-group",
       "type": "java.lang.Boolean",
-      "sourceType": "org.springframework.jms.connection.CachingConnectionFactory",
-      "description": "Specify whether to cache JMS MessageConsumers per JMS Session instance(more specifically: one MessageConsumer per Destination, selector Stringand Session). Note that durable subscribers will only be cached untillogical closing of the Session handle.Default is true. Switch this to false in order to alwaysrecreate MessageConsumers on demand.Auto discovered option from class: org.springframework.jms.connection.CachingConnectionFactory to set the option via setter: setC [...]
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setAutoGroup"
     },
     {
-      "name": "camel.component.jms.connection-factory.cache-producers",
+      "name": "camel.component.jms.connection-factory.block-on-acknowledge",
       "type": "java.lang.Boolean",
-      "sourceType": "org.springframework.jms.connection.CachingConnectionFactory",
-      "description": "Specify whether to cache JMS MessageProducers per JMS Session instance(more specifically: one MessageProducer per Destination and Session).Default is true. Switch this to false in order to alwaysrecreate MessageProducers on demand.Auto discovered option from class: org.springframework.jms.connection.CachingConnectionFactory to set the option via setter: setCacheProducers"
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setBlockOnAcknowledge"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.block-on-durable-send",
+      "type": "java.lang.Boolean",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setBlockOnDurableSend"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.block-on-non-durable-send",
+      "type": "java.lang.Boolean",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setBlockOnNonDurableSend"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.cache-destinations",
+      "type": "java.lang.Boolean",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setCacheDestinations"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.cache-large-messages-client",
+      "type": "java.lang.Boolean",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setCacheLargeMessagesClient"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.call-failover-timeout",
+      "type": "java.lang.Long",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setCallFailoverTimeout"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.call-timeout",
+      "type": "java.lang.Long",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setCallTimeout"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.client-failure-check-period",
+      "type": "java.lang.Long",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setClientFailureCheckPeriod"
     },
     {
       "name": "camel.component.jms.connection-factory.client-id",
       "type": "java.lang.String",
-      "sourceType": "org.springframework.jms.connection.CachingConnectionFactory",
-      "description": "Auto discovered option from class: org.springframework.jms.connection.CachingConnectionFactory to set the option via setter: setClientId"
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setClientID"
     },
     {
-      "name": "camel.component.jms.connection-factory.exception-listener",
-      "type": "javax.jms.ExceptionListener",
-      "sourceType": "org.springframework.jms.connection.CachingConnectionFactory",
-      "description": "Auto discovered option from class: org.springframework.jms.connection.CachingConnectionFactory to set the option via setter: setExceptionListener"
+      "name": "camel.component.jms.connection-factory.compress-large-message",
+      "type": "java.lang.Boolean",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setCompressLargeMessage"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.confirmation-window-size",
+      "type": "java.lang.Integer",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setConfirmationWindowSize"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.connection-load-balancing-policy-class-name",
+      "type": "java.lang.String",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setConnectionLoadBalancingPolicyClassName"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.connection-ttl",
+      "type": "java.lang.Long",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setConnectionTTL"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.consumer-max-rate",
+      "type": "java.lang.Integer",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setConsumerMaxRate"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.consumer-window-size",
+      "type": "java.lang.Integer",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setConsumerWindowSize"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.deserialization-black-list",
+      "type": "java.lang.String",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setDeserializationBlackList"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.deserialization-white-list",
+      "type": "java.lang.String",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setDeserializationWhiteList"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.dups-ok-batch-size",
+      "type": "java.lang.Integer",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setDupsOKBatchSize"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.enable1x-prefixes",
+      "type": "java.lang.Boolean",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setEnable1xPrefixes"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.enable-shared-client-id",
+      "type": "java.lang.Boolean",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setEnableSharedClientID"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.failover-on-initial-connection",
+      "type": "java.lang.Boolean",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setFailoverOnInitialConnection"
     },
     {
-      "name": "camel.component.jms.connection-factory.reconnect-on-exception",
+      "name": "camel.component.jms.connection-factory.group-id",
+      "type": "java.lang.String",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setGroupID"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.ignore-jta",
       "type": "java.lang.Boolean",
-      "sourceType": "org.springframework.jms.connection.CachingConnectionFactory",
-      "description": "Auto discovered option from class: org.springframework.jms.connection.CachingConnectionFactory to set the option via setter: setReconnectOnException"
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setIgnoreJTA"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.incoming-interceptor-list",
+      "type": "java.lang.String",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setIncomingInterceptorList"
     },
     {
-      "name": "camel.component.jms.connection-factory.session-cache-size",
+      "name": "camel.component.jms.connection-factory.initial-connect-attempts",
       "type": "java.lang.Integer",
-      "sourceType": "org.springframework.jms.connection.CachingConnectionFactory",
-      "description": "Specify the desired size for the JMS Session cache (per JMS Session type).This cache size is the maximum limit for the number of cached Sessionsper session acknowledgement type (auto, client, dups_ok, transacted).As a consequence, the actual number of cached Sessions may be up tofour times as high as the specified value - in the unlikely caseof mixing and matching different acknowledgement types.Default is 1: caching a single Session, (re-)creating further ones onde [...]
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setInitialConnectAttempts"
     },
     {
-      "name": "camel.component.jms.connection-factory.target-connection-factory",
-      "type": "javax.jms.ConnectionFactory",
-      "sourceType": "org.springframework.jms.connection.CachingConnectionFactory",
-      "description": "Auto discovered option from class: org.springframework.jms.connection.CachingConnectionFactory to set the option via setter: setTargetConnectionFactory"
+      "name": "camel.component.jms.connection-factory.initial-message-packet-size",
+      "type": "java.lang.Integer",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setInitialMessagePacketSize"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.max-retry-interval",
+      "type": "java.lang.Long",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setMaxRetryInterval"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.min-large-message-size",
+      "type": "java.lang.Integer",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setMinLargeMessageSize"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.outgoing-interceptor-list",
+      "type": "java.lang.String",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setOutgoingInterceptorList"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.pre-acknowledge",
+      "type": "java.lang.Boolean",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setPreAcknowledge"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.producer-max-rate",
+      "type": "java.lang.Integer",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setProducerMaxRate"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.producer-window-size",
+      "type": "java.lang.Integer",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setProducerWindowSize"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.protocol-manager-factory-str",
+      "type": "java.lang.String",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setProtocolManagerFactoryStr"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.reconnect-attempts",
+      "type": "java.lang.Integer",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setReconnectAttempts"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.retry-interval",
+      "type": "java.lang.Long",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setRetryInterval"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.retry-interval-multiplier",
+      "type": "double",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setRetryIntervalMultiplier"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.scheduled-thread-pool-max-size",
+      "type": "java.lang.Integer",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setScheduledThreadPoolMaxSize"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.thread-pool-max-size",
+      "type": "java.lang.Integer",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setThreadPoolMaxSize"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.transaction-batch-size",
+      "type": "java.lang.Integer",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setTransactionBatchSize"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.use-global-pools",
+      "type": "java.lang.Boolean",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setUseGlobalPools"
+    },
+    {
+      "name": "camel.component.jms.connection-factory.use-topology-for-load-balancing",
+      "type": "java.lang.Boolean",
+      "sourceType": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory",
+      "description": "Auto discovered option from class: org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory to set the option via setter: setUseTopologyForLoadBalancing"
     },
     {
       "name": "camel.component.jms.username",
diff --git a/examples/camel-example-main-artemis/src/main/resources/application.properties b/examples/camel-example-main-artemis/src/main/resources/application.properties
index 14ea669..309db5c 100644
--- a/examples/camel-example-main-artemis/src/main/resources/application.properties
+++ b/examples/camel-example-main-artemis/src/main/resources/application.properties
@@ -29,8 +29,6 @@ camel.main.jmx-enabled = false
 # which contains some additional autowires so we only need here to specify the URL to the broker
 camel.component.jms.connection-factory.brokerURL=tcp://localhost:61616
 
-camel.component.jms.connection-factory.cl
-
 # in case you want to use Spring's CachingConnectionFactory, you can configure it as follows:
 # (then you don't need the camel-main-maven-plugin, as you can explicit configure it all here)
 ### camel.component.jms.connectionFactory=#class:org.springframework.jms.connection.CachingConnectionFactory