All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jboss.as.clustering.infinispan.subsystem.ComponentResourceDefinition Maven / Gradle / Ivy

There is a newer version: 34.0.0.Final
Show newest version
/*
 * Copyright The WildFly Authors
 * SPDX-License-Identifier: Apache-2.0
 */
package org.jboss.as.clustering.infinispan.subsystem;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.jboss.as.clustering.controller.ChildResourceDefinition;
import org.jboss.as.clustering.controller.ManagementResourceRegistration;
import org.jboss.as.controller.PathElement;
import org.jboss.as.controller.descriptions.ResourceDescriptionResolver;
import org.wildfly.clustering.infinispan.service.InfinispanServiceDescriptor;
import org.wildfly.service.descriptor.BinaryServiceDescriptor;
import org.wildfly.subsystem.service.ResourceServiceConfigurator;

/**
 * @author Paul Ferraro
 */
public abstract class ComponentResourceDefinition extends ChildResourceDefinition implements ResourceServiceConfigurator {

    static PathElement pathElement(String name) {
        return PathElement.pathElement("component", name);
    }

    static  BinaryServiceDescriptor serviceDescriptor(PathElement path, Class type) {
        return serviceDescriptor(List.of(path), type);
    }

    static  BinaryServiceDescriptor serviceDescriptor(List paths, Class type) {
        Stream.Builder builder = Stream.builder().add(InfinispanServiceDescriptor.CACHE_CONFIGURATION.getName());
        for (PathElement path : paths) {
            builder.accept(path.getKey());
            if (!path.isWildcard()) {
                builder.accept(path.getValue());
            }
        }
        return BinaryServiceDescriptor.of(builder.build().collect(Collectors.joining(".")), type);
    }

    ComponentResourceDefinition(PathElement path) {
        super(path, InfinispanExtension.SUBSYSTEM_RESOLVER.createChildResolver(path));
    }

    ComponentResourceDefinition(PathElement path, ResourceDescriptionResolver resolver) {
        super(path, resolver);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy