Search in sources :

Example 6 with InjectedValueDependency

use of org.wildfly.clustering.service.InjectedValueDependency in project wildfly by wildfly.

the class JChannelFactoryBuilder method configure.

@Override
public Builder<ChannelFactory> configure(OperationContext context, ModelNode model) throws OperationFailedException {
    PathAddress address = context.getCurrentAddress();
    Resource resource = context.readResource(PathAddress.EMPTY_ADDRESS);
    Optional<PathElement> transport = resource.getChildren(TransportResourceDefinition.WILDCARD_PATH.getKey()).stream().map(Resource.ResourceEntry::getPathElement).findFirst();
    if (!transport.isPresent()) {
        throw JGroupsLogger.ROOT_LOGGER.transportNotDefined(this.getName());
    }
    this.transport = new InjectedValueDependency<>(new SingletonProtocolServiceNameProvider(address, transport.get()), TransportConfiguration.class);
    this.protocols = resource.getChildren(ProtocolResourceDefinition.WILDCARD_PATH.getKey()).stream().map(entry -> new InjectedValueDependency<>(new ProtocolServiceNameProvider(address, entry.getPathElement()), ProtocolConfiguration.class)).collect(Collectors.toList());
    this.relay = resource.hasChild(RelayResourceDefinition.PATH) ? new InjectedValueDependency<>(new SingletonProtocolServiceNameProvider(address, RelayResourceDefinition.PATH), RelayConfiguration.class) : null;
    return this;
}
Also used : ProtocolConfiguration(org.wildfly.clustering.jgroups.spi.ProtocolConfiguration) PathElement(org.jboss.as.controller.PathElement) InjectedValueDependency(org.wildfly.clustering.service.InjectedValueDependency) PathAddress(org.jboss.as.controller.PathAddress) Resource(org.jboss.as.controller.registry.Resource) TransportConfiguration(org.wildfly.clustering.jgroups.spi.TransportConfiguration)

Aggregations

InjectedValueDependency (org.wildfly.clustering.service.InjectedValueDependency)6 PathAddress (org.jboss.as.controller.PathAddress)3 ServiceName (org.jboss.msc.service.ServiceName)3 ServiceTarget (org.jboss.msc.service.ServiceTarget)3 ValueDependency (org.wildfly.clustering.service.ValueDependency)3 ResourceServiceBuilder (org.jboss.as.clustering.controller.ResourceServiceBuilder)2 OperationContext (org.jboss.as.controller.OperationContext)2 OperationFailedException (org.jboss.as.controller.OperationFailedException)2 OutboundSocketBinding (org.jboss.as.network.OutboundSocketBinding)2 SocketBinding (org.jboss.as.network.SocketBinding)2 ModelNode (org.jboss.dmr.ModelNode)2 Module (org.jboss.modules.Module)2 ServiceBuilder (org.jboss.msc.service.ServiceBuilder)2 ServiceController (org.jboss.msc.service.ServiceController)2 ValueService (org.jboss.msc.service.ValueService)2 InjectedValue (org.jboss.msc.value.InjectedValue)2 Value (org.jboss.msc.value.Value)2 Builder (org.wildfly.clustering.service.Builder)2 InetSocketAddress (java.net.InetSocketAddress)1 NetworkInterface (java.net.NetworkInterface)1