You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2020/02/13 07:18:20 UTC

[camel-quarkus] 02/02: Ensure that catalog files are added to the native image #686 (fix findings)

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

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

commit 95a081e05cc86f81b51acddfe5cf17c6634847b8
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Wed Feb 12 10:53:15 2020 +0100

    Ensure that catalog files are added to the native image #686 (fix findings)
---
 .../org/apache/camel/quarkus/core/CamelConfig.java   | 20 +++++++++-----------
 .../camel/quarkus/core/CamelRuntimeCatalog.java      |  8 ++++----
 .../java/org/apache/camel/quarkus/core/Flags.java    |  5 ++++-
 3 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelConfig.java b/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelConfig.java
index 4873c5e..1b2c75c 100644
--- a/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelConfig.java
+++ b/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelConfig.java
@@ -39,7 +39,7 @@ public class CamelConfig {
     public ServiceConfig service;
 
     /**
-     * Build time configuration options for CamelRuntimeCatalog.
+     * Build time configuration options for {@link org.apache.camel.runtimecatalog.RuntimeCamelCatalog}.
      */
     @ConfigItem
     public RuntimeCatalogConfig runtimeCatalog;
@@ -183,16 +183,11 @@ public class CamelConfig {
     @ConfigGroup
     public static class RuntimeCatalogConfig {
         /**
-         * Enable {@link CamelRuntimeCatalog} functionaries.
-         */
-        @ConfigItem(defaultValue = "true")
-        public boolean enabled;
-
-        /**
          * Used to control the resolution of components catalog info.
          * <p>
          * Note that when building native images, this flag determine if the json metadata files related to components
-         * discovered at build time have to be included in the final binary.
+         * discovered at build time have to be included in the final binary. In JVM mode there is no real benefit of
+         * setting this flag to {@code false} if not to make the behavior consistent with native mode.
          */
         @ConfigItem(defaultValue = "true")
         public boolean components;
@@ -201,7 +196,8 @@ public class CamelConfig {
          * Used to control the resolution of languages catalog info.
          * <p>
          * Note that when building native images, this flag determine if the json metadata files related to languages
-         * discovered at build time have to be included in the final binary.
+         * discovered at build time have to be included in the final binary. In JVM mode there is no real benefit of
+         * setting this flag to {@code false} if not to make the behavior consistent with native mode.
          */
         @ConfigItem(defaultValue = "true")
         public boolean languages;
@@ -210,7 +206,8 @@ public class CamelConfig {
          * Used to control the resolution of dataformats catalog info.
          * <p>
          * Note that when building native images, this flag determine if the json metadata files related to dataformats
-         * discovered at build time have to be included in the final binary.
+         * discovered at build time have to be included in the final binary. In JVM mode there is no real benefit of
+         * setting this flag to {@code false} if not to make the behavior consistent with native mode.
          */
         @ConfigItem(defaultValue = "true")
         public boolean dataformats;
@@ -219,7 +216,8 @@ public class CamelConfig {
          * Used to control the resolution of model catalog info.
          * <p>
          * Note that when building native images, this flag determine if the json metadata files related to models
-         * has to be included in the final binary.
+         * has to be included in the final binary. In JVM mode there is no real benefit of setting this flag to
+         * {@code false} if not to make the behavior consistent with native mode.
          */
         @ConfigItem(defaultValue = "true")
         public boolean models;
diff --git a/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelRuntimeCatalog.java b/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelRuntimeCatalog.java
index 2f82322..5b56b9c 100644
--- a/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelRuntimeCatalog.java
+++ b/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelRuntimeCatalog.java
@@ -30,7 +30,7 @@ public class CamelRuntimeCatalog extends DefaultRuntimeCamelCatalog {
 
     @Override
     public String modelJSonSchema(String name) {
-        if (!config.enabled || !config.models) {
+        if (!config.models) {
             return null;
         }
 
@@ -39,7 +39,7 @@ public class CamelRuntimeCatalog extends DefaultRuntimeCamelCatalog {
 
     @Override
     public String componentJSonSchema(String name) {
-        if (!config.enabled || !config.components) {
+        if (!config.components) {
             return null;
         }
 
@@ -48,7 +48,7 @@ public class CamelRuntimeCatalog extends DefaultRuntimeCamelCatalog {
 
     @Override
     public String dataFormatJSonSchema(String name) {
-        if (!config.enabled || !config.dataformats) {
+        if (!config.dataformats) {
             return null;
         }
 
@@ -57,7 +57,7 @@ public class CamelRuntimeCatalog extends DefaultRuntimeCamelCatalog {
 
     @Override
     public String languageJSonSchema(String name) {
-        if (!config.enabled || !config.languages) {
+        if (!config.languages) {
             return null;
         }
 
diff --git a/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/Flags.java b/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/Flags.java
index fe94b6d..a62c51d 100644
--- a/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/Flags.java
+++ b/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/Flags.java
@@ -45,7 +45,10 @@ public final class Flags {
     public static final class RuntimeCatalogEnabled implements BooleanSupplier {
         @Override
         public boolean getAsBoolean() {
-            return asBoolean("quarkus.camel.runtime-catalog.enabled", true);
+            return asBoolean("quarkus.camel.runtime-catalog.components", true)
+                    || asBoolean("quarkus.camel.runtime-catalog.languages", true)
+                    || asBoolean("quarkus.camel.runtime-catalog.dataformats", true)
+                    || asBoolean("quarkus.camel.runtime-catalog.models", true);
         }
     }
 }