Search in sources :

Example 1 with GroupAliasBuilderProvider

use of org.wildfly.clustering.spi.GroupAliasBuilderProvider in project wildfly by wildfly.

the class JGroupsTransportServiceHandler method removeServices.

@Override
public void removeServices(OperationContext context, ModelNode model) throws OperationFailedException {
    PathAddress address = context.getCurrentAddress();
    PathAddress containerAddress = address.getParent();
    String name = containerAddress.getLastElement().getValue();
    for (GroupAliasBuilderProvider provider : ServiceLoader.load(GroupAliasBuilderProvider.class, GroupAliasBuilderProvider.class.getClassLoader())) {
        for (ServiceNameProvider builder : provider.getBuilders(requirement -> CLUSTERING_CAPABILITIES.get(requirement).getServiceName(address), name, null)) {
            context.removeService(builder.getServiceName());
        }
    }
    EnumSet.allOf(CacheContainerComponent.class).stream().map(component -> component.getServiceName(containerAddress)).forEach(serviceName -> context.removeService(serviceName));
}
Also used : JGroupsTransportResourceDefinition(org.jboss.as.clustering.infinispan.subsystem.JGroupsTransportResourceDefinition) ServiceNameProvider(org.wildfly.clustering.service.ServiceNameProvider) PathAddress(org.jboss.as.controller.PathAddress) ServiceLoader(java.util.ServiceLoader) ServiceController(org.jboss.msc.service.ServiceController) OperationContext(org.jboss.as.controller.OperationContext) ResourceServiceHandler(org.jboss.as.clustering.controller.ResourceServiceHandler) OperationFailedException(org.jboss.as.controller.OperationFailedException) ModelNode(org.jboss.dmr.ModelNode) CapabilityServiceBuilder(org.jboss.as.clustering.controller.CapabilityServiceBuilder) ServiceTarget(org.jboss.msc.service.ServiceTarget) GroupAliasBuilderProvider(org.wildfly.clustering.spi.GroupAliasBuilderProvider) EnumSet(java.util.EnumSet) GroupAliasBuilderProvider(org.wildfly.clustering.spi.GroupAliasBuilderProvider) PathAddress(org.jboss.as.controller.PathAddress) ServiceNameProvider(org.wildfly.clustering.service.ServiceNameProvider)

Example 2 with GroupAliasBuilderProvider

use of org.wildfly.clustering.spi.GroupAliasBuilderProvider in project wildfly by wildfly.

the class JGroupsTransportServiceHandler method installServices.

@Override
public void installServices(OperationContext context, ModelNode model) throws OperationFailedException {
    PathAddress address = context.getCurrentAddress();
    PathAddress containerAddress = address.getParent();
    String name = containerAddress.getLastElement().getValue();
    ServiceTarget target = context.getServiceTarget();
    JGroupsTransportBuilder transportBuilder = new JGroupsTransportBuilder(containerAddress).configure(context, model);
    transportBuilder.build(target).setInitialMode(ServiceController.Mode.PASSIVE).install();
    new SiteBuilder(containerAddress).configure(context, model).build(target).setInitialMode(ServiceController.Mode.PASSIVE).install();
    String channel = transportBuilder.getChannel();
    for (GroupAliasBuilderProvider provider : ServiceLoader.load(GroupAliasBuilderProvider.class, GroupAliasBuilderProvider.class.getClassLoader())) {
        for (CapabilityServiceBuilder<?> builder : provider.getBuilders(requirement -> CLUSTERING_CAPABILITIES.get(requirement).getServiceName(address), name, channel)) {
            builder.configure(context).build(target).setInitialMode(ServiceController.Mode.ON_DEMAND).install();
        }
    }
}
Also used : GroupAliasBuilderProvider(org.wildfly.clustering.spi.GroupAliasBuilderProvider) PathAddress(org.jboss.as.controller.PathAddress) ServiceTarget(org.jboss.msc.service.ServiceTarget)

Example 3 with GroupAliasBuilderProvider

use of org.wildfly.clustering.spi.GroupAliasBuilderProvider in project wildfly by wildfly.

the class NoTransportServiceHandler method installServices.

@Override
public void installServices(OperationContext context, ModelNode model) throws OperationFailedException {
    PathAddress address = context.getCurrentAddress();
    PathAddress containerAddress = address.getParent();
    String name = containerAddress.getLastElement().getValue();
    ServiceTarget target = context.getServiceTarget();
    new NoTransportBuilder(containerAddress).build(target).install();
    new SiteBuilder(containerAddress).build(target).install();
    for (GroupAliasBuilderProvider provider : ServiceLoader.load(GroupAliasBuilderProvider.class, GroupAliasBuilderProvider.class.getClassLoader())) {
        for (CapabilityServiceBuilder<?> builder : provider.getBuilders(requirement -> CLUSTERING_CAPABILITIES.get(requirement).getServiceName(address), name, LocalGroupBuilderProvider.LOCAL)) {
            builder.configure(context).build(target).setInitialMode(ServiceController.Mode.ON_DEMAND).install();
        }
    }
}
Also used : GroupAliasBuilderProvider(org.wildfly.clustering.spi.GroupAliasBuilderProvider) PathAddress(org.jboss.as.controller.PathAddress) ServiceTarget(org.jboss.msc.service.ServiceTarget)

Example 4 with GroupAliasBuilderProvider

use of org.wildfly.clustering.spi.GroupAliasBuilderProvider in project wildfly by wildfly.

the class NoTransportServiceHandler method removeServices.

@Override
public void removeServices(OperationContext context, ModelNode model) {
    PathAddress address = context.getCurrentAddress();
    PathAddress containerAddress = address.getParent();
    String name = containerAddress.getLastElement().getValue();
    for (GroupAliasBuilderProvider provider : ServiceLoader.load(GroupAliasBuilderProvider.class, GroupAliasBuilderProvider.class.getClassLoader())) {
        for (ServiceNameProvider builder : provider.getBuilders(requirement -> CLUSTERING_CAPABILITIES.get(requirement).getServiceName(address), name, LocalGroupBuilderProvider.LOCAL)) {
            context.removeService(builder.getServiceName());
        }
    }
    EnumSet.allOf(CacheContainerComponent.class).stream().map(component -> component.getServiceName(containerAddress)).forEach(serviceName -> context.removeService(serviceName));
}
Also used : CLUSTERING_CAPABILITIES(org.jboss.as.clustering.infinispan.subsystem.TransportResourceDefinition.CLUSTERING_CAPABILITIES) ServiceNameProvider(org.wildfly.clustering.service.ServiceNameProvider) PathAddress(org.jboss.as.controller.PathAddress) ServiceLoader(java.util.ServiceLoader) ServiceController(org.jboss.msc.service.ServiceController) OperationContext(org.jboss.as.controller.OperationContext) ResourceServiceHandler(org.jboss.as.clustering.controller.ResourceServiceHandler) OperationFailedException(org.jboss.as.controller.OperationFailedException) LocalGroupBuilderProvider(org.wildfly.clustering.spi.LocalGroupBuilderProvider) ModelNode(org.jboss.dmr.ModelNode) CapabilityServiceBuilder(org.jboss.as.clustering.controller.CapabilityServiceBuilder) ServiceTarget(org.jboss.msc.service.ServiceTarget) GroupAliasBuilderProvider(org.wildfly.clustering.spi.GroupAliasBuilderProvider) EnumSet(java.util.EnumSet) GroupAliasBuilderProvider(org.wildfly.clustering.spi.GroupAliasBuilderProvider) PathAddress(org.jboss.as.controller.PathAddress) ServiceNameProvider(org.wildfly.clustering.service.ServiceNameProvider)

Example 5 with GroupAliasBuilderProvider

use of org.wildfly.clustering.spi.GroupAliasBuilderProvider in project wildfly by wildfly.

the class ForkServiceHandler method installServices.

@Override
public void installServices(OperationContext context, ModelNode model) throws OperationFailedException {
    super.installServices(context, model);
    PathAddress address = context.getCurrentAddress();
    String name = address.getLastElement().getValue();
    String channel = address.getParent().getLastElement().getValue();
    ServiceTarget target = context.getServiceTarget();
    new AliasServiceBuilder<>(FORK_CHANNEL_SOURCE.getServiceName(address), JGroupsRequirement.CHANNEL_FACTORY.getServiceName(context, channel), JGroupsRequirement.CHANNEL_FACTORY.getType()).build(target).install();
    new AliasServiceBuilder<>(FORK_CHANNEL_MODULE.getServiceName(address), JGroupsRequirement.CHANNEL_MODULE.getServiceName(context, channel), JGroupsRequirement.CHANNEL_MODULE.getType()).build(target).install();
    new AliasServiceBuilder<>(FORK_CHANNEL_CLUSTER.getServiceName(address), JGroupsRequirement.CHANNEL_CLUSTER.getServiceName(context, channel), JGroupsRequirement.CHANNEL_CLUSTER.getType()).build(target).install();
    new ChannelBuilder(FORK_CHANNEL.getServiceName(address), name).configure(context, model).build(target).install();
    new BinderServiceBuilder<>(JGroupsBindingFactory.createChannelBinding(name), JGroupsRequirement.CHANNEL.getServiceName(context, name), JGroupsRequirement.CHANNEL.getType()).build(target).install();
    new BinderServiceBuilder<>(JGroupsBindingFactory.createChannelFactoryBinding(name), JGroupsRequirement.CHANNEL_FACTORY.getServiceName(context, name), JGroupsRequirement.CHANNEL_FACTORY.getType()).build(target).install();
    for (GroupAliasBuilderProvider provider : ServiceLoader.load(GroupAliasBuilderProvider.class, GroupAliasBuilderProvider.class.getClassLoader())) {
        for (CapabilityServiceBuilder<?> builder : provider.getBuilders(requirement -> CLUSTERING_CAPABILITIES.get(requirement).getServiceName(address), name, channel)) {
            builder.configure(context).build(target).install();
        }
    }
}
Also used : BinderServiceBuilder(org.jboss.as.clustering.naming.BinderServiceBuilder) GroupAliasBuilderProvider(org.wildfly.clustering.spi.GroupAliasBuilderProvider) PathAddress(org.jboss.as.controller.PathAddress) ServiceTarget(org.jboss.msc.service.ServiceTarget) AliasServiceBuilder(org.wildfly.clustering.service.AliasServiceBuilder)

Aggregations

PathAddress (org.jboss.as.controller.PathAddress)9 GroupAliasBuilderProvider (org.wildfly.clustering.spi.GroupAliasBuilderProvider)9 ServiceTarget (org.jboss.msc.service.ServiceTarget)7 ServiceNameProvider (org.wildfly.clustering.service.ServiceNameProvider)3 EnumSet (java.util.EnumSet)2 ServiceLoader (java.util.ServiceLoader)2 CapabilityServiceBuilder (org.jboss.as.clustering.controller.CapabilityServiceBuilder)2 ResourceServiceHandler (org.jboss.as.clustering.controller.ResourceServiceHandler)2 BinderServiceBuilder (org.jboss.as.clustering.naming.BinderServiceBuilder)2 OperationContext (org.jboss.as.controller.OperationContext)2 OperationFailedException (org.jboss.as.controller.OperationFailedException)2 ModelNode (org.jboss.dmr.ModelNode)2 ServiceController (org.jboss.msc.service.ServiceController)2 LocalGroupBuilderProvider (org.wildfly.clustering.spi.LocalGroupBuilderProvider)2 JGroupsTransportResourceDefinition (org.jboss.as.clustering.infinispan.subsystem.JGroupsTransportResourceDefinition)1 CLUSTERING_CAPABILITIES (org.jboss.as.clustering.infinispan.subsystem.TransportResourceDefinition.CLUSTERING_CAPABILITIES)1 Resource (org.jboss.as.controller.registry.Resource)1 AliasServiceBuilder (org.wildfly.clustering.service.AliasServiceBuilder)1 GroupBuilderProvider (org.wildfly.clustering.spi.GroupBuilderProvider)1