Search in sources :

Example 1 with ModClusterServiceMBean

use of org.jboss.modcluster.ModClusterServiceMBean in project wildfly by wildfly.

the class LegacyProxyHandler method executeRuntimeStep.

@Override
protected void executeRuntimeStep(OperationContext context, ModelNode op) throws OperationFailedException {
    String name = Operations.getName(op);
    LegacyProxyOperation operation = this.operations.get(name);
    PathAddress proxyAddress = LegacyMetricOperationsRegistration.translateProxyPath(context, context.getCurrentAddress());
    ServiceName serviceName = ProxyConfigurationResourceDefinition.Capability.SERVICE.getServiceName(proxyAddress);
    FunctionExecutor<ModClusterServiceMBean> executor = this.executors.get(serviceName);
    if (executor != null) {
        executor.execute(new ExceptionFunction<ModClusterServiceMBean, Void, OperationFailedException>() {

            @Override
            public Void apply(ModClusterServiceMBean service) throws OperationFailedException {
                operation.execute(context, op, service);
                return null;
            }
        });
    } else {
        context.completeStep(OperationContext.ResultHandler.NOOP_RESULT_HANDLER);
    }
}
Also used : ModClusterServiceMBean(org.jboss.modcluster.ModClusterServiceMBean) ServiceName(org.jboss.msc.service.ServiceName) PathAddress(org.jboss.as.controller.PathAddress) OperationFailedException(org.jboss.as.controller.OperationFailedException)

Example 2 with ModClusterServiceMBean

use of org.jboss.modcluster.ModClusterServiceMBean 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)

Example 3 with ModClusterServiceMBean

use of org.jboss.modcluster.ModClusterServiceMBean in project wildfly by wildfly.

the class ModClusterSubsystemResourceDefinition method register.

@SuppressWarnings("deprecation")
@Override
public void register(SubsystemRegistration parent) {
    ManagementResourceRegistration registration = parent.registerSubsystemModel(this);
    registration.registerOperationHandler(GenericSubsystemDescribeHandler.DEFINITION, GenericSubsystemDescribeHandler.INSTANCE);
    ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver());
    ServiceValueExecutorRegistry<ModClusterServiceMBean> registry = new ServiceValueExecutorRegistry<>();
    ResourceServiceHandler handler = new ModClusterSubsystemServiceHandler(registry);
    new SimpleResourceRegistration(descriptor, handler).register(registration);
    new ProxyConfigurationResourceDefinition(registry).register(registration);
    // Deprecated legacy operations which are exposed at the wrong location
    if (parent.isRuntimeOnlyRegistrationValid()) {
        new LegacyProxyHandler(registry).register(registration);
    }
}
Also used : ModClusterServiceMBean(org.jboss.modcluster.ModClusterServiceMBean) SimpleResourceRegistration(org.jboss.as.clustering.controller.SimpleResourceRegistration) ManagementResourceRegistration(org.jboss.as.clustering.controller.ManagementResourceRegistration) ServiceValueExecutorRegistry(org.jboss.as.clustering.controller.ServiceValueExecutorRegistry) ResourceServiceHandler(org.jboss.as.clustering.controller.ResourceServiceHandler) ResourceDescriptor(org.jboss.as.clustering.controller.ResourceDescriptor)

Aggregations

ModClusterServiceMBean (org.jboss.modcluster.ModClusterServiceMBean)3 ServiceName (org.jboss.msc.service.ServiceName)2 ManagementResourceRegistration (org.jboss.as.clustering.controller.ManagementResourceRegistration)1 OperationFunction (org.jboss.as.clustering.controller.OperationFunction)1 ResourceDescriptor (org.jboss.as.clustering.controller.ResourceDescriptor)1 ResourceServiceHandler (org.jboss.as.clustering.controller.ResourceServiceHandler)1 ServiceValueExecutorRegistry (org.jboss.as.clustering.controller.ServiceValueExecutorRegistry)1 SimpleResourceRegistration (org.jboss.as.clustering.controller.SimpleResourceRegistration)1 OperationFailedException (org.jboss.as.controller.OperationFailedException)1 PathAddress (org.jboss.as.controller.PathAddress)1