Skip to content

Commit

Permalink
Extract org.wildfly.clustering.infinispan.client module from org.wild…
Browse files Browse the repository at this point in the history
…fly.clustering.infinispan.spi
  • Loading branch information
pferraro committed May 22, 2019
1 parent 928dafa commit a1e7034
Show file tree
Hide file tree
Showing 23 changed files with 211 additions and 28 deletions.
54 changes: 54 additions & 0 deletions clustering/infinispan/client/pom.xml
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ JBoss, Home of Professional Open Source.
~ Copyright 2018, Red Hat, Inc., and individual contributors
~ as indicated by the @author tags. See the copyright.txt file in the
~ distribution for a full listing of individual contributors.
~
~ This is free software; you can redistribute it and/or modify it
~ under the terms of the GNU Lesser General Public License as
~ published by the Free Software Foundation; either version 2.1 of
~ the License, or (at your option) any later version.
~
~ This software is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
~ Lesser General Public License for more details.
~
~ You should have received a copy of the GNU Lesser General Public
~ License along with this software; if not, write to the Free
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->

<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-clustering-infinispan</artifactId>
<!--
Maintain separation between the artifact id and the version to help prevent
merge conflicts between commits changing the GA and those changing the V.
-->
<version>17.0.0.Beta1-SNAPSHOT</version>
</parent>

<artifactId>wildfly-clustering-infinispan-client</artifactId>
<packaging>jar</packaging>

<name>WildFly: Infinispan Client SPI</name>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>wildfly-clustering-common</artifactId>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-client-hotrod</artifactId>
</dependency>
</dependencies>
</project>
@@ -0,0 +1,62 @@
/*
* JBoss, Home of Professional Open Source.
* Copyright 2018, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/

package org.wildfly.clustering.infinispan.client;

import org.infinispan.client.hotrod.configuration.Configuration;
import org.jboss.as.clustering.controller.UnaryRequirementServiceNameFactory;
import org.jboss.as.clustering.controller.UnaryServiceNameFactory;
import org.jboss.as.clustering.controller.UnaryServiceNameFactoryProvider;
import org.wildfly.clustering.service.UnaryRequirement;

/**
* @author Paul Ferraro
*/
public enum InfinispanClientRequirement implements UnaryRequirement, UnaryServiceNameFactoryProvider {

REMOTE_CONTAINER("org.wildfly.clustering.infinispan.remote-cache-container", RemoteCacheContainer.class),
REMOTE_CONTAINER_CONFIGURATION("org.wildfly.clustering.infinispan.remote-cache-container-configuration", Configuration.class),
;
private final String name;
private final Class<?> type;
private final UnaryServiceNameFactory factory = new UnaryRequirementServiceNameFactory(this);

InfinispanClientRequirement(String name, Class<?> type) {
this.name = name;
this.type = type;
}

@Override
public String getName() {
return this.name;
}

@Override
public Class<?> getType() {
return this.type;
}

@Override
public UnaryServiceNameFactory getServiceNameFactory() {
return this.factory;
}
}
Expand Up @@ -20,12 +20,12 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/

package org.wildfly.clustering.infinispan.spi;
package org.wildfly.clustering.infinispan.client;

import org.infinispan.client.hotrod.RemoteCacheManagerAdmin;

/**
* Exposes Infinispan's {@link org.infinispan.client.hotrod.RemoteCacheContainer} additionally exposing the name of the
* Exposes Infinispan's {@link org.wildfly.clustering.infinispan.client.client.hotrod.RemoteCacheContainer} additionally exposing the name of the
* remote cache container and an administration utility.
*
* @author Radoslav Husar
Expand Down
4 changes: 4 additions & 0 deletions clustering/infinispan/extension/pom.xml
Expand Up @@ -50,6 +50,10 @@
<groupId>${project.groupId}</groupId>
<artifactId>wildfly-clustering-jgroups-extension</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>wildfly-clustering-infinispan-client</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>wildfly-clustering-infinispan-spi</artifactId>
Expand Down
Expand Up @@ -51,7 +51,7 @@
import org.infinispan.persistence.spi.SegmentedAdvancedLoadWriteStore;
import org.jboss.as.clustering.infinispan.InfinispanLogger;
import org.reactivestreams.Publisher;
import org.wildfly.clustering.infinispan.spi.RemoteCacheContainer;
import org.wildfly.clustering.infinispan.client.RemoteCacheContainer;

import io.reactivex.Flowable;
import io.reactivex.functions.Consumer;
Expand Down
Expand Up @@ -29,7 +29,7 @@
import org.infinispan.configuration.cache.AbstractStoreConfiguration;
import org.infinispan.configuration.cache.AsyncStoreConfiguration;
import org.infinispan.configuration.cache.SingletonStoreConfiguration;
import org.wildfly.clustering.infinispan.spi.RemoteCacheContainer;
import org.wildfly.clustering.infinispan.client.RemoteCacheContainer;

/**
* @author Radoslav Husar
Expand Down
Expand Up @@ -30,7 +30,7 @@
import org.infinispan.configuration.cache.AbstractStoreConfiguration;
import org.infinispan.configuration.cache.AbstractStoreConfigurationBuilder;
import org.infinispan.configuration.cache.PersistenceConfigurationBuilder;
import org.wildfly.clustering.infinispan.spi.RemoteCacheContainer;
import org.wildfly.clustering.infinispan.client.RemoteCacheContainer;

/**
* @author Radoslav Husar
Expand Down
Expand Up @@ -34,7 +34,7 @@
import org.jboss.as.controller.registry.AttributeAccess;
import org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder;
import org.jboss.dmr.ModelType;
import org.wildfly.clustering.infinispan.spi.InfinispanRequirement;
import org.wildfly.clustering.infinispan.client.InfinispanClientRequirement;

/**
* Resource description for the addressable resource:
Expand All @@ -49,7 +49,7 @@ public class HotRodStoreResourceDefinition extends StoreResourceDefinition {

public enum Attribute implements org.jboss.as.clustering.controller.Attribute {
CACHE_CONFIGURATION("cache-configuration", ModelType.STRING, null),
REMOTE_CACHE_CONTAINER("remote-cache-container", ModelType.STRING, new CapabilityReference(Capability.PERSISTENCE, InfinispanRequirement.REMOTE_CONTAINER)),
REMOTE_CACHE_CONTAINER("remote-cache-container", ModelType.STRING, new CapabilityReference(Capability.PERSISTENCE, InfinispanClientRequirement.REMOTE_CONTAINER)),
;

private final AttributeDefinition definition;
Expand Down
Expand Up @@ -32,8 +32,8 @@
import org.jboss.as.controller.PathAddress;
import org.jboss.dmr.ModelNode;
import org.jboss.msc.service.ServiceBuilder;
import org.wildfly.clustering.infinispan.spi.InfinispanRequirement;
import org.wildfly.clustering.infinispan.spi.RemoteCacheContainer;
import org.wildfly.clustering.infinispan.client.InfinispanClientRequirement;
import org.wildfly.clustering.infinispan.client.RemoteCacheContainer;
import org.wildfly.clustering.service.ServiceConfigurator;
import org.wildfly.clustering.service.ServiceSupplierDependency;
import org.wildfly.clustering.service.SupplierDependency;
Expand All @@ -54,7 +54,7 @@ public class HotRodStoreServiceConfigurator extends StoreServiceConfigurator<Hot
public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException {
this.cacheConfiguration = CACHE_CONFIGURATION.resolveModelAttribute(context, model).asStringOrNull();
String remoteCacheContainerName = REMOTE_CACHE_CONTAINER.resolveModelAttribute(context, model).asString();
this.remoteCacheContainer = new ServiceSupplierDependency<>(InfinispanRequirement.REMOTE_CONTAINER.getServiceName(context, remoteCacheContainerName));
this.remoteCacheContainer = new ServiceSupplierDependency<>(InfinispanClientRequirement.REMOTE_CONTAINER.getServiceName(context, remoteCacheContainerName));
return super.configure(context, model);
}

Expand Down
Expand Up @@ -29,7 +29,7 @@
import org.infinispan.client.hotrod.configuration.TransactionMode;
import org.infinispan.commons.api.BasicCache;
import org.infinispan.commons.marshall.Marshaller;
import org.wildfly.clustering.infinispan.spi.RemoteCacheContainer;
import org.wildfly.clustering.infinispan.client.RemoteCacheContainer;

import java.util.Set;

Expand Down
Expand Up @@ -48,7 +48,7 @@
import org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder;
import org.jboss.dmr.ModelNode;
import org.jboss.dmr.ModelType;
import org.wildfly.clustering.infinispan.spi.InfinispanRequirement;
import org.wildfly.clustering.infinispan.client.InfinispanClientRequirement;
import org.wildfly.clustering.service.UnaryRequirement;

/**
Expand All @@ -65,8 +65,8 @@ public static PathElement pathElement(String containerName) {
}

public enum Capability implements CapabilityProvider {
CONTAINER(InfinispanRequirement.REMOTE_CONTAINER),
CONFIGURATION(InfinispanRequirement.REMOTE_CONTAINER_CONFIGURATION),
CONTAINER(InfinispanClientRequirement.REMOTE_CONTAINER),
CONFIGURATION(InfinispanClientRequirement.REMOTE_CONTAINER_CONFIGURATION),
;

private final org.jboss.as.clustering.controller.Capability capability;
Expand Down
Expand Up @@ -39,8 +39,8 @@
import org.jboss.msc.service.ServiceBuilder;
import org.jboss.msc.service.ServiceController;
import org.jboss.msc.service.ServiceTarget;
import org.wildfly.clustering.infinispan.spi.InfinispanRequirement;
import org.wildfly.clustering.infinispan.spi.RemoteCacheContainer;
import org.wildfly.clustering.infinispan.client.InfinispanClientRequirement;
import org.wildfly.clustering.infinispan.client.RemoteCacheContainer;
import org.wildfly.clustering.service.AsyncServiceConfigurator;
import org.wildfly.clustering.service.FunctionalService;
import org.wildfly.clustering.service.ServiceConfigurator;
Expand All @@ -63,7 +63,7 @@ public RemoteCacheContainerServiceConfigurator(PathAddress address) {

@Override
public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException {
this.configuration = new ServiceSupplierDependency<>(InfinispanRequirement.REMOTE_CONTAINER_CONFIGURATION.getServiceName(context, this.name));
this.configuration = new ServiceSupplierDependency<>(InfinispanClientRequirement.REMOTE_CONTAINER_CONFIGURATION.getServiceName(context, this.name));
return this;
}

Expand Down
Expand Up @@ -50,7 +50,7 @@
import org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder;
import org.jboss.dmr.ModelNode;
import org.jboss.dmr.ModelType;
import org.wildfly.clustering.infinispan.spi.InfinispanRequirement;
import org.wildfly.clustering.infinispan.client.InfinispanClientRequirement;

/**
* Resource definition for the transaction component of a remote cache container.
Expand Down Expand Up @@ -104,7 +104,7 @@ public RemoteTransactionResourceDefinition() {
@Override
public ManagementResourceRegistration register(ManagementResourceRegistration parent) {
ManagementResourceRegistration registration = parent.registerSubModel(new RemoteTransactionResourceDefinition());
Capability dependentCapability = new UnaryRequirementCapability(InfinispanRequirement.REMOTE_CONTAINER_CONFIGURATION, UnaryCapabilityNameResolver.PARENT);
Capability dependentCapability = new UnaryRequirementCapability(InfinispanClientRequirement.REMOTE_CONTAINER_CONFIGURATION, UnaryCapabilityNameResolver.PARENT);
ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver())
.addAttributes(Attribute.class)
// Add a requirement on the tm capability to the parent cache capability
Expand Down
3 changes: 2 additions & 1 deletion clustering/infinispan/pom.xml
Expand Up @@ -42,7 +42,8 @@
<name>WildFly: Infinispan modules</name>

<modules>
<module>extension</module>
<module>client</module>
<module>spi</module>
<module>extension</module>
</modules>
</project>
4 changes: 0 additions & 4 deletions clustering/infinispan/spi/pom.xml
Expand Up @@ -58,10 +58,6 @@
<groupId>org.infinispan</groupId>
<artifactId>infinispan-core</artifactId>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-client-hotrod</artifactId>
</dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
Expand Down
Expand Up @@ -22,7 +22,6 @@

package org.wildfly.clustering.infinispan.spi;

import org.infinispan.client.hotrod.configuration.Configuration;
import org.infinispan.configuration.global.GlobalConfiguration;
import org.jboss.as.clustering.controller.UnaryRequirementServiceNameFactory;
import org.jboss.as.clustering.controller.UnaryServiceNameFactory;
Expand All @@ -38,8 +37,6 @@ public enum InfinispanRequirement implements UnaryRequirement, UnaryServiceNameF
CONTAINER("org.wildfly.clustering.infinispan.cache-container", CacheContainer.class),
CONFIGURATION("org.wildfly.clustering.infinispan.cache-container-configuration", GlobalConfiguration.class),
KEY_AFFINITY_FACTORY("org.wildfly.clustering.infinispan.key-affinity-factory", KeyAffinityServiceFactory.class),
REMOTE_CONTAINER("org.wildfly.clustering.infinispan.remote-cache-container", RemoteCacheContainer.class),
REMOTE_CONTAINER_CONFIGURATION("org.wildfly.clustering.infinispan.remote-cache-container-configuration", Configuration.class),
;
private final String name;
private final Class<?> type;
Expand Down
10 changes: 10 additions & 0 deletions feature-pack/pom.xml
Expand Up @@ -2464,6 +2464,16 @@
</exclusions>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>wildfly-clustering-infinispan-client</artifactId>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>wildfly-clustering-infinispan-extension</artifactId>
Expand Down
Expand Up @@ -65,6 +65,7 @@
<module name="org.wildfly.clustering.api"/>
<module name="org.wildfly.clustering.ee.infinispan"/>
<module name="org.wildfly.clustering.ee.spi"/>
<module name="org.wildfly.clustering.infinispan.client"/>
<module name="org.wildfly.clustering.infinispan.spi"/>
<module name="org.wildfly.clustering.jgroups.spi"/>
<module name="org.wildfly.clustering.marshalling.api"/>
Expand Down
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
~ JBoss, Home of Professional Open Source.
~ Copyright 2010, Red Hat, Inc., and individual contributors
~ as indicated by the @author tags. See the copyright.txt file in the
~ distribution for a full listing of individual contributors.
~
~ This is free software; you can redistribute it and/or modify it
~ under the terms of the GNU Lesser General Public License as
~ published by the Free Software Foundation; either version 2.1 of
~ the License, or (at your option) any later version.
~
~ This software is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
~ Lesser General Public License for more details.
~
~ You should have received a copy of the GNU Lesser General Public
~ License along with this software; if not, write to the Free
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->

<module xmlns="urn:jboss:module:1.5" name="org.wildfly.clustering.infinispan.client">
<properties>
<property name="jboss.api" value="private"/>
</properties>

<resources>
<artifact name="${org.wildfly:wildfly-clustering-infinispan-client}"/>
</resources>

<dependencies>
<module name="javax.api"/>
<module name="org.infinispan.client.hotrod"/>
<module name="org.infinispan.commons"/>
<module name="org.jboss.as.clustering.common"/>
<module name="org.jboss.as.controller"/>
<module name="org.wildfly.clustering.service"/>
<module name="org.jboss.msc"/>
</dependencies>
</module>
Expand Up @@ -35,7 +35,6 @@
<module name="javax.api"/>
<module name="com.github.ben-manes.caffeine"/>
<module name="org.infinispan"/>
<module name="org.infinispan.client.hotrod"/>
<module name="org.infinispan.commons"/>
<module name="org.jboss.as.clustering.common"/>
<module name="org.jboss.as.controller"/>
Expand Down
Expand Up @@ -47,6 +47,7 @@
<module name="org.jboss.msc"/>
<module name="org.jboss.staxmapper"/>
<module name="org.jboss.vfs"/>
<module name="org.wildfly.clustering.infinispan.client"/>
<module name="org.wildfly.clustering.infinispan.spi"/>
<module name="org.wildfly.clustering.service"/>
<module name="org.wildfly.clustering.web.infinispan"/>
Expand Down

0 comments on commit a1e7034

Please sign in to comment.