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

org.jboss.as.clustering.controller.SimpleResourceServiceHandler Maven / Gradle / Ivy

Go to download

The code in this module is not explicitly related to clustering, but rather contains resuable code used by clustering modules and any modules that integrate with clustering.

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.controller;

import org.jboss.as.controller.OperationContext;
import org.jboss.as.controller.OperationFailedException;
import org.jboss.dmr.ModelNode;

/**
 * Simple {@link ResourceServiceHandler} that installs/removes a single service via a {@link ResourceServiceConfiguratorFactory}.
 * @author Paul Ferraro
 */
public class SimpleResourceServiceHandler implements ResourceServiceHandler {

    private ResourceServiceConfiguratorFactory factory;

    public SimpleResourceServiceHandler(ResourceServiceConfiguratorFactory factory) {
        this.factory = factory;
    }

    @Override
    public void installServices(OperationContext context, ModelNode model) throws OperationFailedException {
        this.factory.createServiceConfigurator(context.getCurrentAddress()).configure(context, model).build(context.getServiceTarget()).install();
    }

    @Override
    public void removeServices(OperationContext context, ModelNode model) throws OperationFailedException {
        context.removeService(this.factory.createServiceConfigurator(context.getCurrentAddress()).getServiceName());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy