You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pp...@apache.org on 2022/02/03 11:50:46 UTC

[camel-quarkus] 03/05: Clean up usage of deprecated Quarkus APIs

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

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

commit 2f6a5362bb83fa908658a1d51920d3df0ca9fd35
Author: James Netherton <ja...@gmail.com>
AuthorDate: Wed Feb 2 07:50:19 2022 +0000

    Clean up usage of deprecated Quarkus APIs
---
 .../core/deployment/CamelNativeImageProcessor.java      |  7 ++++---
 .../camel/quarkus/core/deployment/CamelProcessor.java   |  6 ++++--
 .../quarkus/core/deployment/util/CamelSupport.java      |  2 +-
 .../quarkus/component/hl7/deployment/Hl7Processor.java  |  9 +++------
 .../component/shiro/deployment/ShiroProcessor.java      |  6 ------
 .../component/xchange/deployment/XchangeProcessor.java  | 17 +++++++----------
 6 files changed, 19 insertions(+), 28 deletions(-)

diff --git a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelNativeImageProcessor.java b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelNativeImageProcessor.java
index 34e8bd9..633bbde 100644
--- a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelNativeImageProcessor.java
+++ b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelNativeImageProcessor.java
@@ -190,7 +190,7 @@ public class CamelNativeImageProcessor {
 
         if (config.runtimeCatalog.models) {
             for (ApplicationArchive archive : archives.getAllApplicationArchives()) {
-                for (Path root : archive.getRootDirs()) {
+                for (Path root : archive.getRootDirectories()) {
                     final Path resourcePath = root.resolve(CamelContextHelper.MODEL_DOCUMENTATION_PREFIX);
 
                     if (!Files.isDirectory(resourcePath)) {
@@ -250,8 +250,9 @@ public class CamelNativeImageProcessor {
         final PathFilter pathFilter = builder.build();
 
         Stream<Path> archiveRootDirs = archives.getAllApplicationArchives().stream()
-                .peek(archive -> LOGGER.debug("Scanning resources for native inclusion from archive at {}", archive.getPaths()))
-                .flatMap(archive -> archive.getRootDirs().toList().stream());
+                .peek(archive -> LOGGER.debug("Scanning resources for native inclusion from archive at {}",
+                        archive.getResolvedPaths()))
+                .flatMap(archive -> archive.getRootDirectories().stream());
         String[] selectedClassNames = pathFilter.scanClassNames(archiveRootDirs);
         if (selectedClassNames.length > 0) {
             reflectiveClasses.produce(new ReflectiveClassBuildItem(true, true, selectedClassNames));
diff --git a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelProcessor.java b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelProcessor.java
index 8151449..0440d7b 100644
--- a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelProcessor.java
+++ b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelProcessor.java
@@ -43,6 +43,7 @@ import io.quarkus.deployment.builditem.ApplicationArchivesBuildItem;
 import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
 import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
 import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import io.quarkus.maven.dependency.ArtifactKey;
 import io.quarkus.runtime.RuntimeValue;
 import org.apache.camel.Converter;
 import org.apache.camel.impl.converter.BaseTypeConverterRegistry;
@@ -259,8 +260,9 @@ class CamelProcessor {
         Set<String> internalConverters = new HashSet<>();
         //ignore all @converters from org.apache.camel:camel-* dependencies
         for (ApplicationArchive archive : applicationArchives.getAllApplicationArchives()) {
-            if (archive.getArtifactKey() != null && "org.apache.camel".equals(archive.getArtifactKey().getGroupId())
-                    && archive.getArtifactKey().getArtifactId().startsWith("camel-")) {
+            ArtifactKey artifactKey = archive.getKey();
+            if (artifactKey != null && "org.apache.camel".equals(artifactKey.getGroupId())
+                    && artifactKey.getArtifactId().startsWith("camel-")) {
                 internalConverters.addAll(archive.getIndex().getAnnotations(DotName.createSimple(Converter.class.getName()))
                         .stream().filter(a -> a.target().kind() == AnnotationTarget.Kind.CLASS)
                         .map(a -> a.target().asClass().name().toString())
diff --git a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/util/CamelSupport.java b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/util/CamelSupport.java
index 8141335..c7ee46a 100644
--- a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/util/CamelSupport.java
+++ b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/util/CamelSupport.java
@@ -65,7 +65,7 @@ public final class CamelSupport {
         final Predicate<Path> filter = pathFilter.asPathPredicate();
 
         for (ApplicationArchive archive : archives.getAllApplicationArchives()) {
-            for (Path root : archive.getRootDirs()) {
+            for (Path root : archive.getRootDirectories()) {
                 final Path resourcePath = root.resolve(CAMEL_SERVICE_BASE_PATH);
 
                 if (!Files.isDirectory(resourcePath)) {
diff --git a/extensions/hl7/deployment/src/main/java/org/apache/camel/quarkus/component/hl7/deployment/Hl7Processor.java b/extensions/hl7/deployment/src/main/java/org/apache/camel/quarkus/component/hl7/deployment/Hl7Processor.java
index 3824fb9..bdb2a55 100644
--- a/extensions/hl7/deployment/src/main/java/org/apache/camel/quarkus/component/hl7/deployment/Hl7Processor.java
+++ b/extensions/hl7/deployment/src/main/java/org/apache/camel/quarkus/component/hl7/deployment/Hl7Processor.java
@@ -16,11 +16,8 @@
  */
 package org.apache.camel.quarkus.component.hl7.deployment;
 
-import java.util.List;
-
 import ca.uhn.hl7v2.model.Structure;
 import ca.uhn.hl7v2.model.Type;
-import io.quarkus.bootstrap.model.AppDependency;
 import io.quarkus.deployment.annotations.BuildProducer;
 import io.quarkus.deployment.annotations.BuildStep;
 import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
@@ -48,9 +45,9 @@ class Hl7Processor {
     @BuildStep
     void indexDependencies(BuildProducer<IndexDependencyBuildItem> indexedDependency, CurateOutcomeBuildItem curateOutcome) {
         // Index any optional hapi-structures dependencies present on the classpath
-        List<AppDependency> userDependencies = curateOutcome.getEffectiveModel().getUserDependencies();
-        userDependencies.stream()
-                .map(appDependency -> appDependency.getArtifact())
+        curateOutcome.getApplicationModel()
+                .getDependencies()
+                .stream()
                 .filter(appArtifact -> appArtifact.getGroupId().equals(CA_UHN_HAPI_GROUP_ID)
                         && appArtifact.getArtifactId().startsWith("hapi-structures-"))
                 .map(appArtifact -> new IndexDependencyBuildItem(appArtifact.getGroupId(), appArtifact.getArtifactId()))
diff --git a/extensions/shiro/deployment/src/main/java/org/apache/camel/quarkus/component/shiro/deployment/ShiroProcessor.java b/extensions/shiro/deployment/src/main/java/org/apache/camel/quarkus/component/shiro/deployment/ShiroProcessor.java
index daef76b..aa52101 100644
--- a/extensions/shiro/deployment/src/main/java/org/apache/camel/quarkus/component/shiro/deployment/ShiroProcessor.java
+++ b/extensions/shiro/deployment/src/main/java/org/apache/camel/quarkus/component/shiro/deployment/ShiroProcessor.java
@@ -28,7 +28,6 @@ import java.util.stream.Collectors;
 
 import io.quarkus.deployment.annotations.BuildStep;
 import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
-import io.quarkus.deployment.builditem.EnableAllSecurityServicesBuildItem;
 import io.quarkus.deployment.builditem.FeatureBuildItem;
 import io.quarkus.deployment.builditem.IndexDependencyBuildItem;
 import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
@@ -48,11 +47,6 @@ class ShiroProcessor {
     }
 
     @BuildStep
-    EnableAllSecurityServicesBuildItem enableAllSecurity() {
-        return new EnableAllSecurityServicesBuildItem();
-    }
-
-    @BuildStep
     ReflectiveClassBuildItem registerForReflection(CombinedIndexBuildItem combinedIndex) {
         List<String> reflectiveClasses = combinedIndex.getIndex()
                 .getAllKnownSubclasses(SHIRO_EXCEPTION_NAME)
diff --git a/extensions/xchange/deployment/src/main/java/org/apache/camel/quarkus/component/xchange/deployment/XchangeProcessor.java b/extensions/xchange/deployment/src/main/java/org/apache/camel/quarkus/component/xchange/deployment/XchangeProcessor.java
index ddb389a..467f3b2 100644
--- a/extensions/xchange/deployment/src/main/java/org/apache/camel/quarkus/component/xchange/deployment/XchangeProcessor.java
+++ b/extensions/xchange/deployment/src/main/java/org/apache/camel/quarkus/component/xchange/deployment/XchangeProcessor.java
@@ -17,11 +17,9 @@
 package org.apache.camel.quarkus.component.xchange.deployment;
 
 import java.lang.reflect.Modifier;
-import java.util.List;
 import java.util.stream.Stream;
 
-import io.quarkus.bootstrap.model.AppArtifact;
-import io.quarkus.bootstrap.model.AppDependency;
+import io.quarkus.bootstrap.model.ApplicationModel;
 import io.quarkus.deployment.annotations.BuildProducer;
 import io.quarkus.deployment.annotations.BuildStep;
 import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
@@ -34,6 +32,7 @@ import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBundleBuil
 import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
 import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
 import io.quarkus.deployment.pkg.builditem.CurateOutcomeBuildItem;
+import io.quarkus.maven.dependency.ResolvedDependency;
 import org.jboss.jandex.AnnotationInstance;
 import org.jboss.jandex.AnnotationTarget;
 import org.jboss.jandex.ClassInfo;
@@ -62,14 +61,12 @@ class XchangeProcessor {
             BuildProducer<NativeImageResourceBuildItem> nativeImageResource,
             CurateOutcomeBuildItem curateOutcome) {
 
-        List<AppDependency> userDependencies = curateOutcome.getEffectiveModel().getUserDependencies();
-        for (AppDependency dependency : userDependencies) {
-            AppArtifact artifact = dependency.getArtifact();
-
-            if (artifact.getGroupId().equals("org.knowm.xchange")) {
+        ApplicationModel applicationModel = curateOutcome.getApplicationModel();
+        for (ResolvedDependency dependency : applicationModel.getDependencies()) {
+            if (dependency.getGroupId().equals("org.knowm.xchange")) {
                 // Index any org.knowm.xchange dependencies present on the classpath as they contain the APIs for interacting with each crypto exchange
-                String artifactId = artifact.getArtifactId();
-                indexedDependency.produce(new IndexDependencyBuildItem(artifact.getGroupId(), artifactId));
+                String artifactId = dependency.getArtifactId();
+                indexedDependency.produce(new IndexDependencyBuildItem(dependency.getGroupId(), artifactId));
 
                 // Include crypto exchange metadata resources
                 String[] split = artifactId.split("-");