org.wildfly.extension.clustering.ejb.InfinispanBeanManagementResourceDefinition Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wildfly-clustering-ejb-extension Show documentation
Show all versions of wildfly-clustering-ejb-extension Show documentation
Installs an extension that provides the distributable-ejb subsystem, that defines a set of profiles for use by distributable ejb applications.
/*
* Copyright The WildFly Authors
* SPDX-License-Identifier: Apache-2.0
*/
package org.wildfly.extension.clustering.ejb;
import java.util.function.UnaryOperator;
import org.jboss.as.clustering.controller.CapabilityReference;
import org.jboss.as.clustering.controller.SimpleResourceDescriptorConfigurator;
import org.jboss.as.controller.AttributeDefinition;
import org.jboss.as.controller.PathElement;
import org.jboss.as.controller.SimpleAttributeDefinitionBuilder;
import org.jboss.as.controller.registry.AttributeAccess.Flag;
import org.jboss.dmr.ModelType;
import org.wildfly.clustering.infinispan.service.InfinispanCacheRequirement;
import org.wildfly.clustering.infinispan.service.InfinispanDefaultCacheRequirement;
/**
* Definition of the /subsystem=distributable-ejb/infinispan-bean-management=* resource.
*
* @author Paul Ferraro
* @author Richard Achmatowicz
*/
public class InfinispanBeanManagementResourceDefinition extends BeanManagementResourceDefinition {
static PathElement pathElement(String name) {
return PathElement.pathElement("infinispan-bean-management", name);
}
static final PathElement WILDCARD_PATH = pathElement(PathElement.WILDCARD_VALUE);
enum Attribute implements org.jboss.as.clustering.controller.Attribute, UnaryOperator {
CACHE_CONTAINER("cache-container", ModelType.STRING) {
@Override
public SimpleAttributeDefinitionBuilder apply(SimpleAttributeDefinitionBuilder builder) {
return builder.setRequired(true).setCapabilityReference(new CapabilityReference(Capability.BEAN_MANAGEMENT_PROVIDER, InfinispanDefaultCacheRequirement.CONFIGURATION));
}
},
CACHE("cache", ModelType.STRING) {
@Override
public SimpleAttributeDefinitionBuilder apply(SimpleAttributeDefinitionBuilder builder) {
return builder.setCapabilityReference(new CapabilityReference(Capability.BEAN_MANAGEMENT_PROVIDER, InfinispanCacheRequirement.CONFIGURATION, CACHE_CONTAINER));
}
},
;
private final AttributeDefinition definition;
Attribute(String name, ModelType type) {
this.definition = this.apply(new SimpleAttributeDefinitionBuilder(name, type)
.setRequired(false)
.setFlags(Flag.RESTART_RESOURCE_SERVICES)
).build();
}
@Override
public AttributeDefinition getDefinition() {
return this.definition;
}
}
InfinispanBeanManagementResourceDefinition() {
super(WILDCARD_PATH, new SimpleResourceDescriptorConfigurator<>(Attribute.class), InfinispanBeanManagementServiceConfigurator::new);
}
}