/*
 * JBoss, Home of Professional Open Source
 * Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors
 * as indicated by the @authors tag. All rights reserved.
 * See the copyright.txt in the distribution for a
 * full listing of individual contributors.
 *
 * This copyrighted material is made available to anyone wishing to use,
 * modify, copy, or redistribute it subject to the terms and conditions
 * of the GNU Lesser General Public License, v. 2.1.
 * This program is distributed in the hope that it will be useful, but WITHOUT A
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
 * You should have received a copy of the GNU Lesser General Public License,
 * v.2.1 along with this distribution; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA  02110-1301, USA.
 */
package org.jboss.as.host.controller.operations;


import org.jboss.as.controller.BasicOperationResult;
import org.jboss.as.controller.OperationFailedException;
import org.jboss.as.controller.OperationResult;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.GROUP;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.NAME;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REMOVE;

import java.util.Locale;

import org.jboss.as.controller.ModelAddOperationHandler;
import org.jboss.as.controller.OperationContext;
import org.jboss.as.controller.ResultHandler;
import org.jboss.as.controller.descriptions.DescriptionProvider;
import org.jboss.as.controller.descriptions.common.InterfaceDescription;
import org.jboss.dmr.ModelNode;

/**
*
* @author <a href="kabir.khan@jboss.com">Kabir Khan</a>
* @version $Revision: 1.1 $
*/
public class ServerRemoveHandler implements ModelAddOperationHandler, DescriptionProvider {

    public static final String OPERATION_NAME = REMOVE;

    public static final ServerRemoveHandler INSTANCE = new ServerRemoveHandler();

    /**
     * Create the InterfaceRemoveHandler
     */
    protected ServerRemoveHandler() {
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public OperationResult execute(final OperationContext context, final ModelNode operation, final ResultHandler resultHandler) throws OperationFailedException {
        try {
            ModelNode compensating = ServerAddHandler.getAddServerOperation(operation.get(OP_ADDR), operation.get(NAME), operation.get(GROUP));
            resultHandler.handleResultComplete();
            return new BasicOperationResult(compensating);
        }
        catch (Exception e) {
            throw new OperationFailedException(new ModelNode().set(e.getLocalizedMessage()));
        }
    }

    @Override
    public ModelNode getModelDescription(final Locale locale) {
        return InterfaceDescription.getInterfaceRemoveOperation(locale);
    }
}

@@ -1013,166 +1013,8 @@
 ;%0A%0A%0A
-import org.jboss.as.controller.BasicOperationResult;%0Aimport org.jboss.as.controller.OperationFailedException;%0Aimport org.jboss.as.controller.OperationResult;%0A
 impo
@@ -1409,80 +1409,241 @@
 ler.
-ModelAddOperationHandler;%0Aimport org.jboss.as.controller.OperationContex
+BasicOperationResult;%0Aimport org.jboss.as.controller.ModelRemoveOperationHandler;%0Aimport org.jboss.as.controller.OperationContext;%0Aimport org.jboss.as.controller.OperationFailedException;%0Aimport org.jboss.as.controller.OperationResul
 t;%0Ai
@@ -2000,19 +2000,22 @@
 ts Model
-Add
+Remove
 Operatio

ServerRemove should remove, not add