/** * Creates a new exception with the failure message from the result. * * @param message the message to prepend to the failure message * @param operation the operation which failed * @param result the result of the operation */ public OperationExecutionException(final String message, final Operation operation, final ModelNode result) { this(message, operation.getOperation(), result); }
/** @return always the {@code operation} object itself, possibly modified */ Operation adjust(Operation operation) { if (!options.isDomain) { return operation; } // this relies on an assumption that Operation.getOperation always returns the underlying ModelNode // and not a copy (see also ControllerClientAssumptionTest) adjust(operation.getOperation()); return operation; }
@Override public ModelNode execute(Operation operation, OperationMessageHandler messageHandler) throws IOException { return ModelControllerImpl.this.execute(operation.getOperation(), messageHandler, OperationTransactionControl.COMMIT, operation); }
@Override public AsyncFuture<ModelNode> executeAsync(final Operation operation, final OperationMessageHandler messageHandler) { return executeAsync(operation.getOperation(), messageHandler, operation); }
protected OperationResponse internalExecute(final Operation operation, final OperationMessageHandler handler, final ModelController.OperationTransactionControl control, final OperationStepHandler prepareStep, final boolean attemptLock, final boolean partialModel) { return controller.internalExecute(operation.getOperation(), handler, control, operation, prepareStep, attemptLock, partialModel); }
@Override public AsyncFuture<ModelNode> executeAsync(final Operation operation, final OperationMessageHandler messageHandler) { return executeAsync(operation.getOperation(), messageHandler, operation, ResponseConverter.TO_MODEL_NODE); }
@Override public AsyncFuture<OperationResponse> executeOperationAsync(Operation operation, OperationMessageHandler messageHandler) { return executeAsync(operation.getOperation(), messageHandler, operation, ResponseConverter.TO_OPERATION_RESPONSE); }
protected OperationResponse internalExecute(final Operation operation, final OperationMessageHandler handler, final ModelController.OperationTransactionControl control, final OperationStepHandler prepareStep, final boolean attemptLock, final boolean partialModel) { return controller.internalExecute(operation.getOperation(), handler, control, operation, prepareStep, attemptLock, partialModel); }
private static ModelNode executeOperation(final ModelControllerClient client, final Operation op, boolean unwrapResult) throws IOException, MgmtOperationException { ModelNode ret = client.execute(op); if (!unwrapResult) return ret; if (!SUCCESS.equals(ret.get(OUTCOME).asString())) { throw new MgmtOperationException("Management operation failed: " + ret.get(FAILURE_DESCRIPTION), op.getOperation(), ret); } return ret.get(RESULT); } }
private static ModelNode executeOperation(final ModelControllerClient client, final Operation op, boolean unwrapResult) throws IOException, MgmtOperationException { ModelNode ret = client.execute(op); if (!unwrapResult) return ret; if (!SUCCESS.equals(ret.get(OUTCOME).asString())) { throw new MgmtOperationException("Management operation failed: " + ret.get(FAILURE_DESCRIPTION), op.getOperation(), ret); } return ret.get(RESULT); } }
@Override public ModelNode execute(Operation operation) throws IOException { if (!operation.getInputStreams().isEmpty()) { throw new IllegalStateException("Operation has one or more attachments which is not allowed."); } return execute(operation.getOperation()); }
protected ModelNode executeOp(Operation operation) throws PatchingException { try { return client.execute(operation); } catch (IOException e) { throw new PatchingException("Failed to execute operation " + operation.getOperation(), e); } } }
protected ModelNode executeOp(Operation operation) throws PatchingException { try { return client.execute(operation); } catch (IOException e) { throw new PatchingException("Failed to execute operation " + operation.getOperation(), e); } } }
@Override public OperationResponse execute(Operation operation, OperationMessageHandler handler, OperationTransactionControl control) { SecurityIdentity securityIdentity = securityIdentitySupplier.get(); return securityIdentity.runAs((PrivilegedAction<OperationResponse>) () -> internalExecute(operation.getOperation(), handler, control, operation, prepareStep, false, partialModelIndicator.isModelPartial())); }
@Override public OperationResponse execute(Operation operation, OperationMessageHandler handler, OperationTransactionControl control) { SecurityIdentity securityIdentity = securityIdentitySupplier.get(); return securityIdentity.runAs((PrivilegedAction<OperationResponse>) () -> internalExecute(operation.getOperation(), handler, control, operation, prepareStep, false, partialModelIndicator.isModelPartial())); }
protected OperationResponse internalExecute(final Operation operation, final OperationMessageHandler handler, final ModelController.OperationTransactionControl control, final OperationStepHandler prepareStep, final boolean attemptLock) { return controller.internalExecute(operation.getOperation(), handler, control, operation, prepareStep, attemptLock, getPartialModelIndicator().isModelPartial()); }
protected OperationResponse internalExecute(final Operation operation, final OperationMessageHandler handler, final ModelController.OperationTransactionControl control, final OperationStepHandler prepareStep, final boolean attemptLock) { return controller.internalExecute(operation.getOperation(), handler, control, operation, prepareStep, attemptLock, getPartialModelIndicator().isModelPartial()); }
private Operation sanitizeOperation(Operation operation) { ModelNode sanitized = sanitizeOperation(operation.getOperation()); return Operation.Factory.create(sanitized, operation.getInputStreams(), operation.isAutoCloseStreams()); }
@Override public ModelNodeResult execute(Operation operation) throws IOException { checkClosed(); operation = adjustOperationForDomain.adjust(operation); log.debugf("Executing operation %s", ModelNodeOperationToCliString.convert(operation.getOperation())); log.tracef("JSON format:%n%s", operation.getOperation().toJSONString(false)); ModelNode result = client.execute(operation); return new ModelNodeResult(result); }
private Operation sanitizeOperation(Operation operation) { ModelNode sanitized = sanitizeOperation(operation.getOperation()); return Operation.Factory.create(sanitized, operation.getInputStreams(), operation.isAutoCloseStreams()); }