jamesnetherton commented on code in PR #8009:
URL: https://github.com/apache/camel-quarkus/pull/8009#discussion_r2589166144


##########
extensions/ibm-cos/deployment/src/main/java/org/apache/camel/quarkus/component/ibm/cos/deployment/IbmCosProcessor.java:
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.ibm.cos.deployment;
+
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.stream.Stream;
+
+import com.ibm.cloud.objectstorage.ClientConfiguration;
+import com.ibm.cloud.objectstorage.auth.DefaultAWSCredentialsProviderChain;
+import com.ibm.cloud.objectstorage.auth.InstanceProfileCredentialsProvider;
+import com.ibm.cloud.objectstorage.client.builder.AwsClientBuilder;
+import com.ibm.cloud.objectstorage.event.SDKProgressPublisher;
+import com.ibm.cloud.objectstorage.oauth.Token;
+import com.ibm.cloud.objectstorage.regions.AwsRegionProviderChain;
+import com.ibm.cloud.objectstorage.regions.InstanceMetadataRegionProvider;
+import com.ibm.cloud.objectstorage.retry.PredefinedBackoffStrategies;
+import com.ibm.cloud.objectstorage.retry.PredefinedRetryPolicies;
+import com.ibm.cloud.objectstorage.services.s3.internal.AWSS3V4Signer;
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import 
io.quarkus.deployment.builditem.nativeimage.NativeImageProxyDefinitionBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import 
io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
+
+class IbmCosProcessor {
+
+    private static final String FEATURE = "camel-ibm-cos";
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+
+    @BuildStep
+    void runtimeInitialized(BuildProducer<RuntimeInitializedClassBuildItem> 
runtimeInitialized) {
+        Stream.of(
+                ClientConfiguration.class.getName(),
+                AwsClientBuilder.class.getName(),
+                AwsRegionProviderChain.class.getName(),
+                InstanceMetadataRegionProvider.class.getName())
+                .map(RuntimeInitializedClassBuildItem::new)
+                .forEach(runtimeInitialized::produce);
+    }
+
+    @BuildStep
+    void reflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClasses) 
{
+        // The camel component supports only this AWSS3V4Signer method, might 
need to register other AbstractAWSSigner subclass if it changes
+        
reflectiveClasses.produce(ReflectiveClassBuildItem.builder(AWSS3V4Signer.class).methods().constructors().build());
+
+        
reflectiveClasses.produce(ReflectiveClassBuildItem.builder(Token.class).methods().constructors().build());
+
+        // TODO: to remove when 
https://github.com/IBM/ibm-cos-sdk-java/issues/74 is implemented, released and 
integrated in Camel
+        reflectiveClasses
+                
.produce(ReflectiveClassBuildItem.builder(ScheduledThreadPoolExecutor.class).methods().constructors().build());
+    }
+
+    @BuildStep
+    NativeImageProxyDefinitionBuildItem nativeImageProxyDefinitions() {
+        return new 
NativeImageProxyDefinitionBuildItem("org.apache.http.conn.HttpClientConnectionManager",
+                "org.apache.http.pool.ConnPoolControl", 
"com.ibm.cloud.objectstorage.http.conn.Wrapped");
+    }
+
+    @BuildStep
+    void initializeRandomRelatedClassesAtRuntime(
+            BuildProducer<RuntimeInitializedClassBuildItem> 
runtimeInitializedClasses) {
+        Stream.of(
+                "org.apache.http.impl.auth.NTLMEngineImpl",

Review Comment:
   See previous comment about Apache HTTP client.



##########
integration-tests/ibm-cos/pom.xml:
##########
@@ -51,6 +63,14 @@
             <artifactId>rest-assured</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+               <groupId>org.awaitility</groupId>
+               <artifactId>awaitility</artifactId>
+        </dependency>

Review Comment:
   Unused `awaitility` dependency?
   
   If not, probably needs to be `test` scope.



##########
integration-tests/ibm-cos/pom.xml:
##########
@@ -39,6 +39,18 @@
             <groupId>io.quarkus</groupId>
             <artifactId>quarkus-resteasy</artifactId>
         </dependency>
+        <dependency>
+               <groupId>org.apache.camel.quarkus</groupId>
+               <artifactId>camel-quarkus-direct</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-resteasy-jackson</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-resteasy-jsonb</artifactId>
+        </dependency>

Review Comment:
   Usually you'd pick one JAX-RS JSON serialization library. Either Jackson or 
jsonb.
   
   I'd be interested to see what happens if you use only jsonb. Will the native 
tests still work? It might indicate that you need to add `quarkus-jackson` to 
the `ibm-cos` extension.



##########
extensions/ibm-cos/deployment/src/main/java/org/apache/camel/quarkus/component/ibm/cos/deployment/IbmCosProcessor.java:
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.ibm.cos.deployment;
+
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.stream.Stream;
+
+import com.ibm.cloud.objectstorage.ClientConfiguration;
+import com.ibm.cloud.objectstorage.auth.DefaultAWSCredentialsProviderChain;
+import com.ibm.cloud.objectstorage.auth.InstanceProfileCredentialsProvider;
+import com.ibm.cloud.objectstorage.client.builder.AwsClientBuilder;
+import com.ibm.cloud.objectstorage.event.SDKProgressPublisher;
+import com.ibm.cloud.objectstorage.oauth.Token;
+import com.ibm.cloud.objectstorage.regions.AwsRegionProviderChain;
+import com.ibm.cloud.objectstorage.regions.InstanceMetadataRegionProvider;
+import com.ibm.cloud.objectstorage.retry.PredefinedBackoffStrategies;
+import com.ibm.cloud.objectstorage.retry.PredefinedRetryPolicies;
+import com.ibm.cloud.objectstorage.services.s3.internal.AWSS3V4Signer;
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import 
io.quarkus.deployment.builditem.nativeimage.NativeImageProxyDefinitionBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import 
io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
+
+class IbmCosProcessor {
+
+    private static final String FEATURE = "camel-ibm-cos";
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+
+    @BuildStep
+    void runtimeInitialized(BuildProducer<RuntimeInitializedClassBuildItem> 
runtimeInitialized) {
+        Stream.of(
+                ClientConfiguration.class.getName(),
+                AwsClientBuilder.class.getName(),
+                AwsRegionProviderChain.class.getName(),
+                InstanceMetadataRegionProvider.class.getName())
+                .map(RuntimeInitializedClassBuildItem::new)
+                .forEach(runtimeInitialized::produce);
+    }
+
+    @BuildStep
+    void reflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClasses) 
{
+        // The camel component supports only this AWSS3V4Signer method, might 
need to register other AbstractAWSSigner subclass if it changes
+        
reflectiveClasses.produce(ReflectiveClassBuildItem.builder(AWSS3V4Signer.class).methods().constructors().build());
+
+        
reflectiveClasses.produce(ReflectiveClassBuildItem.builder(Token.class).methods().constructors().build());
+
+        // TODO: to remove when 
https://github.com/IBM/ibm-cos-sdk-java/issues/74 is implemented, released and 
integrated in Camel
+        reflectiveClasses
+                
.produce(ReflectiveClassBuildItem.builder(ScheduledThreadPoolExecutor.class).methods().constructors().build());
+    }
+
+    @BuildStep
+    NativeImageProxyDefinitionBuildItem nativeImageProxyDefinitions() {
+        return new 
NativeImageProxyDefinitionBuildItem("org.apache.http.conn.HttpClientConnectionManager",
+                "org.apache.http.pool.ConnPoolControl", 
"com.ibm.cloud.objectstorage.http.conn.Wrapped");
+    }

Review Comment:
   Any native support required for the Apache HTTP client you can get from 
`camel-quarkus-support-httpclient`.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to