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 2019/10/24 23:46:10 UTC

[camel-quarkus] 02/07: fhir: build time config options

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 d0962de71e96f71456b23b8e12246107d964a225
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Thu Oct 24 19:35:50 2019 +0200

    fhir: build time config options
---
 .../component/fhir/deployment/FhirProcessor.java   | 30 +++++++--------
 .../camel/quarkus/component/fhir/FhirConfig.java   | 43 ++++++++++++++++++++++
 .../camel/quarkus/component/fhir/FhirFlags.java    |  6 +--
 integration-tests/fhir/pom.xml                     |  4 +-
 .../fhir/src/main/resources/application.properties | 12 +++---
 5 files changed, 68 insertions(+), 27 deletions(-)

diff --git a/extensions/fhir/deployment/src/main/java/org/apache/camel/quarkus/component/fhir/deployment/FhirProcessor.java b/extensions/fhir/deployment/src/main/java/org/apache/camel/quarkus/component/fhir/deployment/FhirProcessor.java
index b2c52bf..583e15e 100644
--- a/extensions/fhir/deployment/src/main/java/org/apache/camel/quarkus/component/fhir/deployment/FhirProcessor.java
+++ b/extensions/fhir/deployment/src/main/java/org/apache/camel/quarkus/component/fhir/deployment/FhirProcessor.java
@@ -21,6 +21,7 @@ import java.util.Collection;
 import java.util.HashSet;
 import java.util.Properties;
 import java.util.Set;
+
 import ca.uhn.fhir.model.dstu2.FhirDstu2;
 import io.quarkus.deployment.annotations.BuildProducer;
 import io.quarkus.deployment.annotations.BuildStep;
@@ -48,7 +49,6 @@ import org.hl7.fhir.dstu3.hapi.ctx.FhirDstu3;
 import org.hl7.fhir.dstu3.model.Enumerations;
 
 class FhirProcessor {
-
     private static final String FEATURE = "camel-fhir";
 
     @BuildStep
@@ -65,20 +65,20 @@ class FhirProcessor {
     @BuildStep()
     ReflectiveClassBuildItem fhirEndpointConfiguration() {
         return new ReflectiveClassBuildItem(true, true,
-                FhirCreateEndpointConfiguration.class.getCanonicalName(),
-                FhirCapabilitiesEndpointConfiguration.class.getCanonicalName(),
-                FhirDeleteEndpointConfiguration.class.getCanonicalName(),
-                FhirHistoryEndpointConfiguration.class.getCanonicalName(),
-                FhirLoadPageEndpointConfiguration.class.getCanonicalName(),
-                FhirMetaEndpointConfiguration.class.getCanonicalName(),
-                FhirOperationEndpointConfiguration.class.getCanonicalName(),
-                FhirPatchEndpointConfiguration.class.getCanonicalName(),
-                FhirReadEndpointConfiguration.class.getCanonicalName(),
-                FhirSearchEndpointConfiguration.class.getCanonicalName(),
-                FhirTransactionEndpointConfiguration.class.getCanonicalName(),
-                FhirUpdateEndpointConfiguration.class.getCanonicalName(),
-                FhirValidateEndpointConfiguration.class.getCanonicalName(),
-                FhirConfiguration.class.getCanonicalName());
+                FhirCreateEndpointConfiguration.class,
+                FhirCapabilitiesEndpointConfiguration.class,
+                FhirDeleteEndpointConfiguration.class,
+                FhirHistoryEndpointConfiguration.class,
+                FhirLoadPageEndpointConfiguration.class,
+                FhirMetaEndpointConfiguration.class,
+                FhirOperationEndpointConfiguration.class,
+                FhirPatchEndpointConfiguration.class,
+                FhirReadEndpointConfiguration.class,
+                FhirSearchEndpointConfiguration.class,
+                FhirTransactionEndpointConfiguration.class,
+                FhirUpdateEndpointConfiguration.class,
+                FhirValidateEndpointConfiguration.class,
+                FhirConfiguration.class);
     }
 
     @BuildStep()
diff --git a/extensions/fhir/runtime/src/main/java/org/apache/camel/quarkus/component/fhir/FhirConfig.java b/extensions/fhir/runtime/src/main/java/org/apache/camel/quarkus/component/fhir/FhirConfig.java
new file mode 100644
index 0000000..a2b05f0
--- /dev/null
+++ b/extensions/fhir/runtime/src/main/java/org/apache/camel/quarkus/component/fhir/FhirConfig.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.fhir;
+
+import io.quarkus.runtime.annotations.ConfigItem;
+import io.quarkus.runtime.annotations.ConfigPhase;
+import io.quarkus.runtime.annotations.ConfigRoot;
+
+@ConfigRoot(name = "camel.fhir", phase = ConfigPhase.BUILD_TIME)
+public final class FhirConfig {
+
+    /**
+     * Enable FHIR DSTU2 Specs.
+     */
+    @ConfigItem(defaultValue = "true")
+    public boolean enableDstu2;
+
+    /**
+     * Enable FHIR DSTU3 Specs.
+     */
+    @ConfigItem(defaultValue = "false")
+    public boolean enableDstu3;
+
+    /**
+     * Enable FHIR R4 Specs.
+     */
+    @ConfigItem(defaultValue = "true")
+    public boolean enableR4;
+}
diff --git a/extensions/fhir/runtime/src/main/java/org/apache/camel/quarkus/component/fhir/FhirFlags.java b/extensions/fhir/runtime/src/main/java/org/apache/camel/quarkus/component/fhir/FhirFlags.java
index 0a3af8e..07053fa 100644
--- a/extensions/fhir/runtime/src/main/java/org/apache/camel/quarkus/component/fhir/FhirFlags.java
+++ b/extensions/fhir/runtime/src/main/java/org/apache/camel/quarkus/component/fhir/FhirFlags.java
@@ -26,21 +26,21 @@ public final class FhirFlags {
     public static final class Dstu2Enabled implements BooleanSupplier {
         @Override
         public boolean getAsBoolean() {
-            return ConfigProvider.getConfig().getOptionalValue("camel.fhir.enable-dstu2", Boolean.class).orElse(Boolean.TRUE);
+            return ConfigProvider.getConfig().getOptionalValue("quarkus.camel.fhir.enable-dstu2", Boolean.class).orElse(Boolean.TRUE);
         }
     }
 
     public static final class Dstu3Enabled implements BooleanSupplier {
         @Override
         public boolean getAsBoolean() {
-            return ConfigProvider.getConfig().getOptionalValue("camel.fhir.enable-dstu3", Boolean.class).orElse(Boolean.TRUE);
+            return ConfigProvider.getConfig().getOptionalValue("quarkus.camel.fhir.enable-dstu3", Boolean.class).orElse(Boolean.TRUE);
         }
     }
 
     public static final class R4Enabled implements BooleanSupplier {
         @Override
         public boolean getAsBoolean() {
-            return ConfigProvider.getConfig().getOptionalValue("camel.fhir.enable-r4", Boolean.class).orElse(Boolean.TRUE);
+            return ConfigProvider.getConfig().getOptionalValue("quarkus.camel.fhir.enable-r4", Boolean.class).orElse(Boolean.TRUE);
         }
     }
 }
\ No newline at end of file
diff --git a/integration-tests/fhir/pom.xml b/integration-tests/fhir/pom.xml
index 51ee3d8..41938c1 100644
--- a/integration-tests/fhir/pom.xml
+++ b/integration-tests/fhir/pom.xml
@@ -79,8 +79,8 @@
                 <artifactId>maven-surefire-plugin</artifactId>
                 <configuration>
                     <systemProperties combine.children="append">
-                        <camel.fhir.enable-dstu2>true</camel.fhir.enable-dstu2>
-                        <camel.fhir.enable-r4>true</camel.fhir.enable-r4>
+                        <quarkus.camel.fhir.enable-dstu2>true</quarkus.camel.fhir.enable-dstu2>
+                        <quarkus.camel.fhir.enable-r4>true</quarkus.camel.fhir.enable-r4>
                     </systemProperties>
                 </configuration>
             </plugin>
diff --git a/integration-tests/fhir/src/main/resources/application.properties b/integration-tests/fhir/src/main/resources/application.properties
index 06640a2..863922c 100644
--- a/integration-tests/fhir/src/main/resources/application.properties
+++ b/integration-tests/fhir/src/main/resources/application.properties
@@ -18,19 +18,17 @@
 # Quarkus
 #
 quarkus.ssl.native=true
-#
-# Quarkus :: Camel
-#
-quarkus.camel.disable-jaxb=false
+
 #
 # Quarkus :: Camel :: FHIR
 #
 # The HAPI-FHIR library, on which camel-fhir depends on, heavily uses reflection which affects performance in Quarkus
 # (memory footprint, build time, CPU resources etc...). For the sake of time, only DSTU3 (which is the default FHIR version)
 # tests are enabled for DSTU3 only by default.
-camel.fhir.enable-dstu2=false
-camel.fhir.enable-dstu3=true
-camel.fhir.enable-r4=false
+quarkus.camel.fhir.enable-dstu2=false
+quarkus.camel.fhir.enable-dstu3=true
+quarkus.camel.fhir.enable-r4=false
+
 #
 # Camel
 #