private static void checkNullFlags(final ModelNode operation, final Set<OperationEntry.Flag> toCheck) throws OperationFailedException { if (toCheck == null) { throw new OperationFailedException(new ModelNode(ControllerMessages.MESSAGES.noHandlerForOperation( operation.require(OP).asString(), PathAddress.pathAddress(operation.get(OP_ADDR))))); } }
/** * Directly handles the op in the standard way the default prepare step handler would * @param context the operation execution context * @param operation the operation * @throws OperationFailedException if no handler is registered for the operation */ private void addBasicStep(OperationContext context, ModelNode operation) throws OperationFailedException { final String operationName = operation.require(OP).asString(); final OperationStepHandler stepHandler = context.getResourceRegistration().getOperationHandler(PathAddress.EMPTY_ADDRESS, operationName); if(stepHandler != null) { context.addStep(operation, stepHandler, OperationContext.Stage.MODEL); } else { throw new OperationFailedException(new ModelNode(ControllerMessages.MESSAGES.noHandlerForOperation(operationName, PathAddress.pathAddress(operation.get(OP_ADDR))))); } }
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { if (MGMT_OP_LOGGER.isTraceEnabled()) { MGMT_OP_LOGGER.trace("Executing " + operation.get(OP) + " " + operation.get(OP_ADDR)); } final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR)); final String operationName = operation.require(OP).asString(); final OperationStepHandler stepHandler = rootRegistration.getOperationHandler(address, operationName); if(stepHandler != null) { context.addStep(stepHandler, OperationContext.Stage.MODEL); } else { ImmutableManagementResourceRegistration child = rootRegistration.getSubModel(address); if (child == null) { context.getFailureDescription().set(MESSAGES.noSuchResourceType(address)); } else { context.getFailureDescription().set(MESSAGES.noHandlerForOperation(operationName, address)); } } context.completeStep(OperationContext.ResultHandler.NOOP_RESULT_HANDLER); } }
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { if (MGMT_OP_LOGGER.isTraceEnabled()) { MGMT_OP_LOGGER.tracef("Executing %s %s", operation.get(OP), operation.get(OP_ADDR)); } final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR)); final String operationName = operation.require(OP).asString(); final OperationStepHandler stepHandler = resolveOperationHandler(address, operationName); if(stepHandler != null) { context.addStep(stepHandler, OperationContext.Stage.MODEL); } else { ImmutableManagementResourceRegistration child = rootRegistration.getSubModel(address); if (child == null) { context.getFailureDescription().set(MESSAGES.noSuchResourceType(address)); } else { context.getFailureDescription().set(MESSAGES.noHandlerForOperation(operationName, address)); } } context.completeStep(OperationContext.ResultHandler.NOOP_RESULT_HANDLER); } }
context.getFailureDescription().set(MESSAGES.noSuchResourceType(stepAddress)); } else { context.getFailureDescription().set(MESSAGES.noHandlerForOperation(stepOpName, stepAddress));
/** * Directly handles the op in the standard way the default prepare step handler would * @param context the operation execution context * @param operation the operation * @throws OperationFailedException if there is no handler registered for the operation */ private void executeDirect(OperationContext context, ModelNode operation) throws OperationFailedException { if (HOST_CONTROLLER_LOGGER.isTraceEnabled()) { HOST_CONTROLLER_LOGGER.tracef("%s executing direct", getClass().getSimpleName()); } final String operationName = operation.require(OP).asString(); OperationStepHandler stepHandler = null; final ImmutableManagementResourceRegistration registration = context.getResourceRegistration(); if (registration != null) { stepHandler = registration.getOperationHandler(PathAddress.EMPTY_ADDRESS, operationName); } if(stepHandler != null) { context.addStep(stepHandler, OperationContext.Stage.MODEL); } else { PathAddress pathAddress = PathAddress.pathAddress(operation.get(OP_ADDR)); if (registration == null) { context.getFailureDescription().set(ControllerMessages.MESSAGES.noSuchResourceType(pathAddress)); } else { context.getFailureDescription().set(ControllerMessages.MESSAGES.noHandlerForOperation(operationName, pathAddress)); } } context.stepCompleted(); }
context.getFailureDescription().set(MESSAGES.noSuchResourceType(stepAddress)); } else { context.getFailureDescription().set(MESSAGES.noHandlerForOperation(stepOpName, stepAddress));
/** * Directly handles the op in the standard way the default prepare step handler would * @param context the operation execution context * @param operation the operation * @throws OperationFailedException if there is no handler registered for the operation */ private void executeDirect(OperationContext context, ModelNode operation) throws OperationFailedException { if (HOST_CONTROLLER_LOGGER.isTraceEnabled()) { HOST_CONTROLLER_LOGGER.trace("Executing direct"); } final String operationName = operation.require(OP).asString(); OperationStepHandler stepHandler = null; final ImmutableManagementResourceRegistration registration = context.getResourceRegistration(); if (registration != null) { stepHandler = registration.getOperationHandler(PathAddress.EMPTY_ADDRESS, operationName); } if(stepHandler != null) { context.addStep(stepHandler, OperationContext.Stage.MODEL); } else { PathAddress pathAddress = PathAddress.pathAddress(operation.require(OP_ADDR)); if (registration == null) { context.getFailureDescription().set(ControllerMessages.MESSAGES.noSuchResourceType(pathAddress)); } else { context.getFailureDescription().set(ControllerMessages.MESSAGES.noHandlerForOperation(operationName, pathAddress)); } } context.stepCompleted(); }
errMsg = ControllerMessages.MESSAGES.noSuchResourceType(fullAddress); } else { errMsg = ControllerMessages.MESSAGES.noHandlerForOperation(opName, fullAddress);