Search in sources :

Example 1 with OperationFunction

use of org.jboss.as.clustering.controller.OperationFunction in project wildfly by wildfly.

the class RemoteClusterOperationExecutor method execute.

@Override
public ModelNode execute(OperationContext context, ModelNode op, Operation<Map.Entry<String, RemoteCacheManagerMXBean>> operation) throws OperationFailedException {
    ServiceName name = InfinispanClientRequirement.REMOTE_CONTAINER.getServiceName(context, UnaryCapabilityNameResolver.PARENT);
    FunctionExecutor<RemoteCacheContainer> executor = this.executors.get(name);
    Function<RemoteCacheContainer, Map.Entry<String, RemoteCacheManagerMXBean>> mapper = new Function<RemoteCacheContainer, Map.Entry<String, RemoteCacheManagerMXBean>>() {

        @Override
        public Map.Entry<String, RemoteCacheManagerMXBean> apply(RemoteCacheContainer container) {
            String cluster = context.getCurrentAddressValue();
            return new AbstractMap.SimpleImmutableEntry<>(cluster, container);
        }
    };
    return (executor != null) ? executor.execute(new OperationFunction<>(context, op, mapper, operation)) : null;
}
Also used : OperationFunction(org.jboss.as.clustering.controller.OperationFunction) Function(java.util.function.Function) RemoteCacheManagerMXBean(org.infinispan.client.hotrod.jmx.RemoteCacheManagerMXBean) RemoteCacheContainer(org.wildfly.clustering.infinispan.client.RemoteCacheContainer) OperationFunction(org.jboss.as.clustering.controller.OperationFunction) ServiceName(org.jboss.msc.service.ServiceName) AbstractMap(java.util.AbstractMap) Map(java.util.Map)

Example 2 with OperationFunction

use of org.jboss.as.clustering.controller.OperationFunction in project wildfly by wildfly.

the class CacheOperationExecutor method execute.

@Override
public ModelNode execute(OperationContext context, ModelNode op, Operation<C> operation) throws OperationFailedException {
    ServiceName name = InfinispanCacheRequirement.CACHE.getServiceName(context, this.resolver);
    FunctionExecutor<Cache<?, ?>> executor = this.executors.get(name);
    return (executor != null) ? executor.execute(new OperationFunction<>(context, op, this, operation)) : null;
}
Also used : OperationFunction(org.jboss.as.clustering.controller.OperationFunction) ServiceName(org.jboss.msc.service.ServiceName) Cache(org.infinispan.Cache)

Example 3 with OperationFunction

use of org.jboss.as.clustering.controller.OperationFunction in project wildfly by wildfly.

the class BackupOperationExecutor method execute.

@Override
public ModelNode execute(OperationContext context, ModelNode operation, Operation<Map.Entry<String, XSiteAdminOperations>> executable) throws OperationFailedException {
    ServiceName name = InfinispanCacheRequirement.CACHE.getServiceName(context, BinaryCapabilityNameResolver.GRANDPARENT_PARENT);
    Function<Cache<?, ?>, Map.Entry<String, XSiteAdminOperations>> mapper = new Function<Cache<?, ?>, Map.Entry<String, XSiteAdminOperations>>() {

        @Override
        public Map.Entry<String, XSiteAdminOperations> apply(Cache<?, ?> cache) {
            String site = context.getCurrentAddressValue();
            return new AbstractMap.SimpleImmutableEntry<>(site, cache.getAdvancedCache().getComponentRegistry().getLocalComponent(XSiteAdminOperations.class));
        }
    };
    FunctionExecutor<Cache<?, ?>> executor = this.executors.get(name);
    return (executor != null) ? executor.execute(new OperationFunction<>(context, operation, mapper, executable)) : null;
}
Also used : OperationFunction(org.jboss.as.clustering.controller.OperationFunction) Function(java.util.function.Function) OperationFunction(org.jboss.as.clustering.controller.OperationFunction) ServiceName(org.jboss.msc.service.ServiceName) XSiteAdminOperations(org.infinispan.xsite.XSiteAdminOperations) AbstractMap(java.util.AbstractMap) Map(java.util.Map) Cache(org.infinispan.Cache)

Example 4 with OperationFunction

use of org.jboss.as.clustering.controller.OperationFunction in project wildfly by wildfly.

the class RemoteCacheOperationExecutor method execute.

@Override
public ModelNode execute(OperationContext context, ModelNode op, Operation<RemoteCacheClientStatisticsMXBean> operation) throws OperationFailedException {
    ServiceName name = InfinispanClientRequirement.REMOTE_CONTAINER.getServiceName(context, UnaryCapabilityNameResolver.PARENT);
    FunctionExecutor<RemoteCacheContainer> executor = this.executors.get(name);
    return (executor != null) ? executor.execute(new OperationFunction<>(context, op, new RemoteCacheClientStatisticsFactory(context.getCurrentAddressValue()), operation)) : null;
}
Also used : RemoteCacheContainer(org.wildfly.clustering.infinispan.client.RemoteCacheContainer) OperationFunction(org.jboss.as.clustering.controller.OperationFunction) ServiceName(org.jboss.msc.service.ServiceName)

Example 5 with OperationFunction

use of org.jboss.as.clustering.controller.OperationFunction in project wildfly by wildfly.

the class ProxyOperationExecutor method execute.

@Override
public ModelNode execute(OperationContext context, ModelNode operation, Operation<ModClusterServiceMBean> executable) throws OperationFailedException {
    ServiceName serviceName = ProxyConfigurationResourceDefinition.Capability.SERVICE.getDefinition().getCapabilityServiceName(context.getCurrentAddress());
    FunctionExecutor<ModClusterServiceMBean> executor = this.executors.get(serviceName);
    return (executor != null) ? executor.execute(new OperationFunction<>(context, operation, Function.identity(), executable)) : null;
}
Also used : ModClusterServiceMBean(org.jboss.modcluster.ModClusterServiceMBean) OperationFunction(org.jboss.as.clustering.controller.OperationFunction) ServiceName(org.jboss.msc.service.ServiceName)

Aggregations

OperationFunction (org.jboss.as.clustering.controller.OperationFunction)5 ServiceName (org.jboss.msc.service.ServiceName)5 AbstractMap (java.util.AbstractMap)2 Map (java.util.Map)2 Function (java.util.function.Function)2 Cache (org.infinispan.Cache)2 RemoteCacheContainer (org.wildfly.clustering.infinispan.client.RemoteCacheContainer)2 RemoteCacheManagerMXBean (org.infinispan.client.hotrod.jmx.RemoteCacheManagerMXBean)1 XSiteAdminOperations (org.infinispan.xsite.XSiteAdminOperations)1 ModClusterServiceMBean (org.jboss.modcluster.ModClusterServiceMBean)1