You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2021/01/28 10:47:41 UTC

[camel-quarkus] branch camel-master updated: Fix infinispan extension and clean up redundant substitutions

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

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


The following commit(s) were added to refs/heads/camel-master by this push:
     new 8231127  Fix infinispan extension and clean up redundant substitutions
8231127 is described below

commit 8231127b394c6df70a9918803a4bc992e0ab60c1
Author: James Netherton <ja...@gmail.com>
AuthorDate: Thu Jan 28 10:46:10 2021 +0000

    Fix infinispan extension and clean up redundant substitutions
---
 extensions/infinispan/deployment/pom.xml           |   4 -
 .../infinispan/deployment/InfinispanProcessor.java |  12 +++
 extensions/infinispan/runtime/pom.xml              |  15 ----
 .../graal/SubstituteDefaultCacheManager.java       | 100 ---------------------
 .../runtime/graal/SubstituteInfinispanManager.java |  36 --------
 5 files changed, 12 insertions(+), 155 deletions(-)

diff --git a/extensions/infinispan/deployment/pom.xml b/extensions/infinispan/deployment/pom.xml
index 9326010..1beb5a8 100644
--- a/extensions/infinispan/deployment/pom.xml
+++ b/extensions/infinispan/deployment/pom.xml
@@ -38,10 +38,6 @@
             <artifactId>quarkus-jaxb-deployment</artifactId>
         </dependency>
         <dependency>
-            <groupId>io.quarkus</groupId>
-            <artifactId>quarkus-caffeine-deployment</artifactId>
-        </dependency>
-        <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-core-deployment</artifactId>
         </dependency>
diff --git a/extensions/infinispan/deployment/src/main/java/org/apache/camel/quarkus/component/infinispan/deployment/InfinispanProcessor.java b/extensions/infinispan/deployment/src/main/java/org/apache/camel/quarkus/component/infinispan/deployment/InfinispanProcessor.java
index f305db1..3a2316b 100644
--- a/extensions/infinispan/deployment/src/main/java/org/apache/camel/quarkus/component/infinispan/deployment/InfinispanProcessor.java
+++ b/extensions/infinispan/deployment/src/main/java/org/apache/camel/quarkus/component/infinispan/deployment/InfinispanProcessor.java
@@ -18,6 +18,9 @@ package org.apache.camel.quarkus.component.infinispan.deployment;
 
 import io.quarkus.deployment.annotations.BuildStep;
 import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import org.apache.camel.component.infinispan.InfinispanProducer;
+import org.apache.camel.component.infinispan.remote.InfinispanRemoteProducer;
 
 class InfinispanProcessor {
 
@@ -27,4 +30,13 @@ class InfinispanProcessor {
     FeatureBuildItem feature() {
         return new FeatureBuildItem(FEATURE);
     }
+
+    // TOOD: This can be removed after this is implemented:
+    // https://github.com/apache/camel-quarkus/issues/2176
+    @BuildStep
+    ReflectiveClassBuildItem registerForReflection() {
+        return new ReflectiveClassBuildItem(true, false,
+                InfinispanProducer.class.getName(),
+                InfinispanRemoteProducer.class.getName());
+    }
 }
diff --git a/extensions/infinispan/runtime/pom.xml b/extensions/infinispan/runtime/pom.xml
index aa9aea2..1df845e 100644
--- a/extensions/infinispan/runtime/pom.xml
+++ b/extensions/infinispan/runtime/pom.xml
@@ -58,10 +58,6 @@
             <groupId>io.quarkus</groupId>
             <artifactId>quarkus-jaxb</artifactId>
         </dependency>
-        <dependency>
-            <groupId>io.quarkus</groupId>
-            <artifactId>quarkus-caffeine</artifactId>
-        </dependency>
 
         <dependency>
             <groupId>org.infinispan</groupId>
@@ -87,17 +83,6 @@
                </exclusion>
             </exclusions>
         </dependency>
-
-        <dependency>
-            <groupId>org.apache.camel</groupId>
-            <artifactId>camel-caffeine-lrucache</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.graalvm.nativeimage</groupId>
-            <artifactId>svm</artifactId>
-            <scope>provided</scope>
-        </dependency>
     </dependencies>
 
     <build>
diff --git a/extensions/infinispan/runtime/src/main/java/org/apache/camel/quarkus/infinispan/runtime/graal/SubstituteDefaultCacheManager.java b/extensions/infinispan/runtime/src/main/java/org/apache/camel/quarkus/infinispan/runtime/graal/SubstituteDefaultCacheManager.java
deleted file mode 100644
index 7ed2456..0000000
--- a/extensions/infinispan/runtime/src/main/java/org/apache/camel/quarkus/infinispan/runtime/graal/SubstituteDefaultCacheManager.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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.infinispan.runtime.graal;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import com.oracle.svm.core.annotate.Substitute;
-import com.oracle.svm.core.annotate.TargetClass;
-import org.infinispan.configuration.cache.Configuration;
-import org.infinispan.configuration.global.GlobalConfiguration;
-import org.infinispan.configuration.parsing.ConfigurationBuilderHolder;
-import org.infinispan.manager.DefaultCacheManager;
-
-@TargetClass(DefaultCacheManager.class)
-final class SubstituteDefaultCacheManager {
-
-    @Substitute
-    public SubstituteDefaultCacheManager() {
-        throw new RuntimeException("DefaultCacheManager not supported in native image mode");
-    }
-
-    @Substitute
-    public SubstituteDefaultCacheManager(boolean start) {
-        throw new RuntimeException("DefaultCacheManager not supported in native image mode");
-    }
-
-    @Substitute
-    public SubstituteDefaultCacheManager(Configuration defaultConfiguration) {
-        throw new RuntimeException("DefaultCacheManager not supported in native image mode");
-    }
-
-    @Substitute
-    public SubstituteDefaultCacheManager(Configuration defaultConfiguration, boolean start) {
-        throw new RuntimeException("DefaultCacheManager not supported in native image mode");
-    }
-
-    @Substitute
-    public SubstituteDefaultCacheManager(GlobalConfiguration globalConfiguration) {
-        throw new RuntimeException("DefaultCacheManager not supported in native image mode");
-    }
-
-    @Substitute
-    public SubstituteDefaultCacheManager(GlobalConfiguration globalConfiguration, boolean start) {
-        throw new RuntimeException("DefaultCacheManager not supported in native image mode");
-    }
-
-    @Substitute
-    public SubstituteDefaultCacheManager(GlobalConfiguration globalConfiguration,
-            Configuration defaultConfiguration) {
-        throw new RuntimeException("DefaultCacheManager not supported in native image mode");
-    }
-
-    @Substitute
-    public SubstituteDefaultCacheManager(GlobalConfiguration globalConfiguration,
-            Configuration defaultConfiguration,
-            boolean start) {
-        throw new RuntimeException("DefaultCacheManager not supported in native image mode");
-    }
-
-    @Substitute
-    public SubstituteDefaultCacheManager(String configurationFile) throws IOException {
-        throw new RuntimeException("DefaultCacheManager not supported in native image mode");
-    }
-
-    @Substitute
-    public SubstituteDefaultCacheManager(String configurationFile, boolean start) throws IOException {
-        throw new RuntimeException("DefaultCacheManager not supported in native image mode");
-    }
-
-    @Substitute
-    public SubstituteDefaultCacheManager(InputStream configurationStream) throws IOException {
-        throw new RuntimeException("DefaultCacheManager not supported in native image mode");
-    }
-
-    @Substitute
-    public SubstituteDefaultCacheManager(InputStream configurationStream, boolean start)
-            throws IOException {
-        throw new RuntimeException("DefaultCacheManager not supported in native image mode");
-    }
-
-    @Substitute
-    public SubstituteDefaultCacheManager(ConfigurationBuilderHolder holder, boolean start) {
-        throw new RuntimeException("DefaultCacheManager not supported in native image mode");
-    }
-}
diff --git a/extensions/infinispan/runtime/src/main/java/org/apache/camel/quarkus/infinispan/runtime/graal/SubstituteInfinispanManager.java b/extensions/infinispan/runtime/src/main/java/org/apache/camel/quarkus/infinispan/runtime/graal/SubstituteInfinispanManager.java
deleted file mode 100644
index 196dce7..0000000
--- a/extensions/infinispan/runtime/src/main/java/org/apache/camel/quarkus/infinispan/runtime/graal/SubstituteInfinispanManager.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.infinispan.runtime.graal;
-
-import com.oracle.svm.core.annotate.Alias;
-import com.oracle.svm.core.annotate.Substitute;
-import com.oracle.svm.core.annotate.TargetClass;
-import org.apache.camel.component.infinispan.InfinispanManager;
-import org.apache.camel.util.ObjectHelper;
-import org.infinispan.commons.api.BasicCache;
-import org.infinispan.commons.api.BasicCacheContainer;
-
-@TargetClass(InfinispanManager.class)
-final class SubstituteInfinispanManager {
-    @Alias
-    private BasicCacheContainer cacheContainer;
-
-    @Substitute
-    public <K, V> BasicCache<K, V> getCache(String cacheName) {
-        return ObjectHelper.isEmpty(cacheName) ? cacheContainer.getCache() : cacheContainer.getCache(cacheName);
-    }
-}