Skip to content

Commit

Permalink
Infinispan Client: add runtime SPI and deployment SPI modules
Browse files Browse the repository at this point in the history
Some constants from the Infinispan Client runtime module are moved
to the runtime SPI module, so that they can be used from other modules
that cannot directly depend on the Infinispan Client extension.

Two build items, `InfinispanClientBuildItem` and `InfinispanClientNameBuildItem`,
are moved from the Infinispan Client deployment module to the deployment SPI
module. This is technically a breaking change, because they are also moved
to a different package, but these build items don't seem to be used anywhere
outside of Quarkus, so it should be safe.
  • Loading branch information
Ladicek committed Oct 17, 2023
1 parent b2f007e commit 6b09b2b
Show file tree
Hide file tree
Showing 12 changed files with 99 additions and 12 deletions.
10 changes: 10 additions & 0 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1223,6 +1223,16 @@
<artifactId>quarkus-infinispan-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-infinispan-client-runtime-spi</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-infinispan-client-deployment-spi</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-infinispan-client-deployment</artifactId>
Expand Down
44 changes: 44 additions & 0 deletions extensions/infinispan-client/deployment-spi/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>quarkus-infinispan-client-parent</artifactId>
<groupId>io.quarkus</groupId>
<version>999-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-infinispan-client-deployment-spi</artifactId>
<name>Quarkus - Infinispan - Client - Deployment SPI</name>

<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-infinispan-client-runtime-spi</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-core-deployment</artifactId>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-client-hotrod-jakarta</artifactId>
<exclusions>
<exclusion>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-jboss-marshalling</artifactId>
</exclusion>
<exclusion>
<groupId>org.jboss.spec.javax.transaction</groupId>
<artifactId>jboss-transaction-api_1.2_spec</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.quarkus.infinispan.client.deployment;
package io.quarkus.infinispan.client.deployment.spi;

import org.infinispan.client.hotrod.RemoteCacheManager;

Expand All @@ -12,8 +12,7 @@ public final class InfinispanClientBuildItem extends MultiBuildItem {
private final RuntimeValue<RemoteCacheManager> client;
private final String name;

public InfinispanClientBuildItem(RuntimeValue<RemoteCacheManager> client,
String name) {
public InfinispanClientBuildItem(RuntimeValue<RemoteCacheManager> client, String name) {
this.client = client;
this.name = name;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.quarkus.infinispan.client.deployment;
package io.quarkus.infinispan.client.deployment.spi;

import io.quarkus.builder.item.MultiBuildItem;

Expand Down
4 changes: 4 additions & 0 deletions extensions/infinispan-client/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-infinispan-client</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-infinispan-client-deployment-spi</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-caffeine-deployment</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.infinispan.client.deployment.spi.InfinispanClientBuildItem;
import io.quarkus.infinispan.client.runtime.InfinispanClientUtil;
import io.quarkus.kubernetes.service.binding.spi.ServiceBindingQualifierBuildItem;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@
import io.quarkus.deployment.pkg.steps.NativeOrNativeSourcesBuild;
import io.quarkus.infinispan.client.InfinispanClientName;
import io.quarkus.infinispan.client.Remote;
import io.quarkus.infinispan.client.deployment.spi.InfinispanClientBuildItem;
import io.quarkus.infinispan.client.deployment.spi.InfinispanClientNameBuildItem;
import io.quarkus.infinispan.client.runtime.InfinispanClientBuildTimeConfig;
import io.quarkus.infinispan.client.runtime.InfinispanClientProducer;
import io.quarkus.infinispan.client.runtime.InfinispanClientUtil;
Expand Down Expand Up @@ -623,9 +625,9 @@ List<InfinispanClientBuildItem> infinispanClients(InfinispanRecorder recorder,
List<InfinispanClientNameBuildItem> infinispanClientNames,
// make sure all beans have been initialized
@SuppressWarnings("unused") BeanContainerBuildItem beanContainer) {
List<InfinispanClientBuildItem> result = new ArrayList<>(infinispanClientNames.size());
for (InfinispanClientNameBuildItem ic : infinispanClientNames) {
String name = ic.getName();
Set<String> names = infinispanClientNames.stream().map(icn -> icn.getName()).collect(Collectors.toSet());
List<InfinispanClientBuildItem> result = new ArrayList<>(names.size());
for (String name : names) {
result.add(new InfinispanClientBuildItem(recorder.getClient(name), name));
}
return result;
Expand Down
2 changes: 2 additions & 0 deletions extensions/infinispan-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
<packaging>pom</packaging>
<modules>
<module>deployment</module>
<module>deployment-spi</module>
<module>runtime</module>
<module>runtime-spi</module>
</modules>
</project>
15 changes: 15 additions & 0 deletions extensions/infinispan-client/runtime-spi/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>quarkus-infinispan-client-parent</artifactId>
<groupId>io.quarkus</groupId>
<version>999-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-infinispan-client-runtime-spi</artifactId>
<name>Quarkus - Infinispan - Client - Runtime SPI</name>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package io.quarkus.infinispan.client.runtime.spi;

public class InfinispanConstants {
public static final String DEFAULT_INFINISPAN_CLIENT_NAME = "<default>";
public static final String INFINISPAN_CLIENT_CONFIG_ROOT_NAME = "infinispan-client";
}
8 changes: 5 additions & 3 deletions extensions/infinispan-client/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-elytron-security-common</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-infinispan-client-runtime-spi</artifactId>
</dependency>
<dependency>
<groupId>org.wildfly.security</groupId>
<artifactId>wildfly-elytron-sasl-plain</artifactId>
Expand Down Expand Up @@ -75,9 +79,7 @@
</exclusion>
<exclusion>
<groupId>org.jboss.spec.javax.transaction</groupId>
<artifactId>
jboss-transaction-api_1.2_spec
</artifactId>
<artifactId>jboss-transaction-api_1.2_spec</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
import java.util.Collection;
import java.util.List;

import io.quarkus.infinispan.client.runtime.spi.InfinispanConstants;

public final class InfinispanClientUtil {

public static final String DEFAULT_INFINISPAN_DEV_SERVICE_NAME = "infinispan";
public static final String DEFAULT_INFINISPAN_CLIENT_NAME = "<default>";
public static final String INFINISPAN_CLIENT_CONFIG_ROOT_NAME = "infinispan-client";
public static final String DEFAULT_INFINISPAN_CLIENT_NAME = InfinispanConstants.DEFAULT_INFINISPAN_CLIENT_NAME;
public static final String INFINISPAN_CLIENT_CONFIG_ROOT_NAME = InfinispanConstants.INFINISPAN_CLIENT_CONFIG_ROOT_NAME;

public static boolean isDefault(String infinispanClientName) {
return DEFAULT_INFINISPAN_CLIENT_NAME.equals(infinispanClientName);
Expand Down

0 comments on commit 6b09b2b

Please sign in to comment.