Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   * JBoss, Home of Professional Open Source.
   * Copyright 2011, Red Hat, Inc., and individual contributors
   * as indicated by the @author tags. See the copyright.txt file in the
   * distribution for a full listing of individual contributors.
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * Lesser General Public License for more details.
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site:
 import static;
 import static;
 import static;
 import static;
 import java.util.Map;
Performs the host specific overall execution of an operation on a slave, on behalf of the domain controller.

Brian Stansberry (c) 2011 Red Hat Inc.
 public class OperationSlaveStepHandler {
     private final Map<StringProxyControllerserverProxies;
     private final ExtensionRegistry extensionRegistry;
     OperationSlaveStepHandler(final LocalHostControllerInfo localHostControllerInfoMap<StringProxyControllerserverProxies,
                               IgnoredDomainResourceRegistry ignoredDomainResourceRegistryExtensionRegistry extensionRegistry) {
         this. = localHostControllerInfo;
         this. = serverProxies;
         this. = ignoredDomainResourceRegistry;
         this. = extensionRegistry;
     void intialize(ApplyMissingDomainModelResourcesHandler applyMissingDomainModelResourcesHandler) {
         this. = applyMissingDomainModelResourcesHandler;
     void execute(OperationContext contextModelNode operationthrows OperationFailedException {
         ModelNode headers = operation.get();
             int id = headers.remove(.).asInt();
         final HostControllerExecutionSupport hostControllerExecutionSupport = addSteps(contextoperationnulltrue);
         //Add the missing resources step first
         if (missingResources != null) {
             ModelNode applyMissingResourcesOp = ApplyMissingDomainModelResourcesHandler.createPiggyBackedMissingDataOperation(missingResources);
         // In case the actual operation fails make sure the result still gets formatted
         context.completeStep(new OperationContext.RollbackHandler() {
             public void handleRollback(OperationContext contextModelNode operation) {
                 if (hostControllerExecutionSupport.getDomainOperation() != null) {
                     final ModelNode domainResult = hostControllerExecutionSupport.getFormattedDomainResult(context.getResult());
    HostControllerExecutionSupport addSteps(final OperationContext contextfinal ModelNode operationfinal ModelNode responsefinal boolean recordResponsethrows OperationFailedException {
        final PathAddress originalAddress = PathAddress.pathAddress(operation.get());
        final ImmutableManagementResourceRegistration originalRegistration = context.getResourceRegistration();
        final HostControllerExecutionSupport hostControllerExecutionSupport =
        ModelNode domainOp = hostControllerExecutionSupport.getDomainOperation();
        if (domainOp != null) {
            // Only require an existing registration if the domain op is not ignored
            if (originalRegistration == null) {
                throw new OperationFailedException(new ModelNode(..noSuchResourceType(originalAddress)));
        return hostControllerExecutionSupport;

Directly handles the op in the standard way the default prepare step handler would

context the operation execution context
operation the operation
Throws: if no handler is registered for the operation
    private void addBasicStep(OperationContext contextModelNode operationthrows OperationFailedException {
        final String operationName = operation.require().asString();
        final OperationStepHandler stepHandler = context.getResourceRegistration().getOperationHandler(.operationName);
        if(stepHandler != null) {
        } else {
            throw new OperationFailedException(new ModelNode(..noHandlerForOperation(operationName, PathAddress.pathAddress(operation.get()))));

Lazily provides a copy of the domain model
    private static class LazyDomainModelProvider implements HostControllerExecutionSupport.DomainModelProvider {
        private final OperationContext context;
        private Resource domainModelResource;
        private LazyDomainModelProvider(OperationContext context) {
            this. = context;
        public Resource getDomainModel() {
            if ( == null) {
                 = .readResourceFromRoot(.true);
            return ;
New to GrepCode? Check out our FAQ X