You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/04/26 07:15:15 UTC

[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #2509: AtlasMap: Use jandex to discover the types we need to register for re…

lburgazzoli commented on a change in pull request #2509:
URL: https://github.com/apache/camel-quarkus/pull/2509#discussion_r620024123



##########
File path: extensions/atlasmap/deployment/src/main/java/org/apache/camel/quarkus/component/atlasmap/deployment/AtlasmapProcessor.java
##########
@@ -361,6 +75,35 @@ NativeImageResourceBuildItem resource() {
         return new NativeImageResourceBuildItem("META-INF/services/atlas/module/atlas.module");
     }
 
+    @BuildStep
+    void addDependencies(BuildProducer<IndexDependencyBuildItem> indexDependency) {
+        indexDependency.produce(new IndexDependencyBuildItem("io.atlasmap", "atlas-core"));
+        indexDependency.produce(new IndexDependencyBuildItem("io.atlasmap", "atlas-model"));
+        indexDependency.produce(new IndexDependencyBuildItem("io.atlasmap", "atlas-xml-model"));
+        indexDependency.produce(new IndexDependencyBuildItem("io.atlasmap", "atlas-java-model"));
+        indexDependency.produce(new IndexDependencyBuildItem("io.atlasmap", "atlas-json-model"));
+        indexDependency.produce(new IndexDependencyBuildItem("io.atlasmap", "atlas-csv-model"));
+        indexDependency.produce(new IndexDependencyBuildItem("io.atlasmap", "atlas-dfdl-model"));

Review comment:
       Can we open an issue to the atlas map project to include a jandex index ?

##########
File path: extensions/atlasmap/deployment/src/main/java/org/apache/camel/quarkus/component/atlasmap/deployment/AtlasmapProcessor.java
##########
@@ -361,6 +75,35 @@ NativeImageResourceBuildItem resource() {
         return new NativeImageResourceBuildItem("META-INF/services/atlas/module/atlas.module");
     }
 
+    @BuildStep
+    void addDependencies(BuildProducer<IndexDependencyBuildItem> indexDependency) {
+        indexDependency.produce(new IndexDependencyBuildItem("io.atlasmap", "atlas-core"));
+        indexDependency.produce(new IndexDependencyBuildItem("io.atlasmap", "atlas-model"));
+        indexDependency.produce(new IndexDependencyBuildItem("io.atlasmap", "atlas-xml-model"));
+        indexDependency.produce(new IndexDependencyBuildItem("io.atlasmap", "atlas-java-model"));
+        indexDependency.produce(new IndexDependencyBuildItem("io.atlasmap", "atlas-json-model"));
+        indexDependency.produce(new IndexDependencyBuildItem("io.atlasmap", "atlas-csv-model"));
+        indexDependency.produce(new IndexDependencyBuildItem("io.atlasmap", "atlas-dfdl-model"));
+    }
+
+    @BuildStep
+    ReflectiveClassBuildItem registerForReflection(CombinedIndexBuildItem combinedIndex) {
+        IndexView index = combinedIndex.getIndex();
+        // register Atlasmap model classes for serialize/deserialize
+        String[] dtos = index.getKnownClasses().stream().map(ci -> ci.name().toString())
+                .filter(n -> n.startsWith("io.atlasmap.v2")
+                        || n.startsWith("io.atlasmap.actions")
+                        || n.startsWith("io.atlasmap.converters")
+                        || n.startsWith("io.atlasmap.json.v2")
+                        || n.startsWith("io.atlasmap.java.v2")
+                        || n.startsWith("io.atlasmap.xml.v2")
+                        || n.startsWith("io.atlasmap.csv.v2")
+                        || n.startsWith("io.atlasmap.dfdl.v2"))

Review comment:
       I think it is fine for the moment to filter base on the package but wonder if we can switch to a more efficient way, like registering for reflection based on interfaces and SPIs.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org