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 2020/02/11 11:34:41 UTC

[GitHub] [camel-quarkus] ppalaga commented on a change in pull request #693: Add olingo4 extension

ppalaga commented on a change in pull request #693: Add olingo4 extension
URL: https://github.com/apache/camel-quarkus/pull/693#discussion_r377579292
 
 

 ##########
 File path: extensions/olingo4/deployment/src/main/java/org/apache/camel/quarkus/component/olingo4/deployment/Olingo4Processor.java
 ##########
 @@ -0,0 +1,66 @@
+/*
+ * 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.olingo4.deployment;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.AdditionalApplicationArchiveMarkerBuildItem;
+import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import org.apache.camel.component.olingo4.Olingo4AppEndpointConfiguration;
+import org.apache.camel.quarkus.core.deployment.UnbannedReflectiveBuildItem;
+import org.apache.olingo.server.core.ODataImpl;
+import org.jboss.jandex.DotName;
+import org.jboss.jandex.IndexView;
+
+class Olingo4Processor {
+
+    private static final String FEATURE = "camel-olingo4";
+    private static final DotName JSON_DESERIALIZE_DOT_NAME = DotName
+            .createSimple("com.fasterxml.jackson.databind.annotation.JsonDeserialize");
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+
+    @BuildStep
+    UnbannedReflectiveBuildItem whitelistOlingo4AppEndpointConfiguration() {
+        return new UnbannedReflectiveBuildItem(Olingo4AppEndpointConfiguration.class.getName());
+    }
+
+    @BuildStep
+    AdditionalApplicationArchiveMarkerBuildItem olingoArchiveMarker() {
+        return new AdditionalApplicationArchiveMarkerBuildItem("org/apache/olingo");
+    }
+
+    @BuildStep
+    void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass, CombinedIndexBuildItem combinedIndex) {
+        reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, ODataImpl.class));
+        reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, Olingo4AppEndpointConfiguration.class));
+
+        // Register Olingo Deserializer classes for reflection
+        IndexView index = combinedIndex.getIndex();
+        index.getAnnotations(JSON_DESERIALIZE_DOT_NAME)
 
 Review comment:
   I think this done by Quarkus Jackson extension. If that's really the case, we should perhaps prefer depending on them.

----------------------------------------------------------------
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


With regards,
Apache Git Services