private static void checkNullRegistration(final ModelNode operation, final ImmutableManagementResourceRegistration toCheck) throws OperationFailedException { if (toCheck == null) { throw new OperationFailedException(new ModelNode(ControllerMessages.MESSAGES.noSuchResourceType(PathAddress.pathAddress(operation.get(OP_ADDR))))); } }
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { final ImmutableManagementResourceRegistration registry = context.getResourceRegistration(); if (registry == null) { throw new OperationFailedException(ControllerMessages.MESSAGES.noSuchResourceType(PathAddress.pathAddress(operation.get(OP_ADDR)))); } Set<String> childTypes = new TreeSet<String>(registry.getChildNames(PathAddress.EMPTY_ADDRESS)); final ModelNode result = context.getResult(); result.setEmptyList(); for (final String key : childTypes) { result.add(key); } context.stepCompleted(); } }
@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); } }
@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); } }
throw new OperationFailedException(ControllerMessages.MESSAGES.noSuchResourceType(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 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(); }
ImmutableManagementResourceRegistration child = registry.getSubModel(stepAddress); if (child == null) { context.getFailureDescription().set(MESSAGES.noSuchResourceType(stepAddress)); } else { context.getFailureDescription().set(MESSAGES.noHandlerForOperation(stepOpName, stepAddress));
ImmutableManagementResourceRegistration child = registry.getSubModel(stepAddress); if (child == null) { context.getFailureDescription().set(MESSAGES.noSuchResourceType(stepAddress)); } else { context.getFailureDescription().set(MESSAGES.noHandlerForOperation(stepOpName, stepAddress));
HostControllerExecutionSupport addSteps(final OperationContext context, final ModelNode operation, final ModelNode response, final boolean recordResponse) throws OperationFailedException { final PathAddress originalAddress = PathAddress.pathAddress(operation.get(OP_ADDR)); final ImmutableManagementResourceRegistration originalRegistration = context.getResourceRegistration(); final HostControllerExecutionSupport hostControllerExecutionSupport = HostControllerExecutionSupport.Factory.create(operation, localHostControllerInfo.getLocalHostName(), new LazyDomainModelProvider(context), ignoredDomainResourceRegistry); 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(ControllerMessages.MESSAGES.noSuchResourceType(originalAddress))); } addBasicStep(context, domainOp); } ServerOperationResolver resolver = new ServerOperationResolver(localHostControllerInfo.getLocalHostName(), serverProxies); ServerOperationsResolverHandler sorh = new ServerOperationsResolverHandler( resolver, hostControllerExecutionSupport, originalAddress, originalRegistration, response); context.addStep(sorh, OperationContext.Stage.DOMAIN); return hostControllerExecutionSupport; }
/** * 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(); }
ImmutableManagementResourceRegistration child = registry.getSubModel(relativeAddress); if (child == null) { errMsg = ControllerMessages.MESSAGES.noSuchResourceType(fullAddress); } else { errMsg = ControllerMessages.MESSAGES.noHandlerForOperation(opName, fullAddress);
final ImmutableManagementResourceRegistration registry = context.getResourceRegistration(); if (registry == null) { throw new OperationFailedException(ControllerMessages.MESSAGES.noSuchResourceType(PathAddress.pathAddress(operation.get(OP_ADDR))));