/** * Create a simple operation with no stream attachments. * * @param operation the DMR operation. Cannot be {@code null} * * @return the operation. Will not be {@code null} */ public static Operation create(final ModelNode operation) { return create(operation, Collections.<InputStream>emptyList()); } /**
@Override default ModelNode execute(ModelNode operation, OperationMessageHandler messageHandler) { return execute(Operation.Factory.create(operation), messageHandler); }
private OperationResponse runOperation(final ModelNode operation, final OperationMessageHandler messageHandler, final OperationAttachments attachments, boolean inVmCall) { Operation op = attachments == null ? Operation.Factory.create(operation) : Operation.Factory.create(operation, attachments.getInputStreams(), attachments.isAutoCloseStreams()); if (inVmCall) { return SecurityActions.runInVm(() -> executeInModelControllerCl(modelController::execute, op, messageHandler, ModelController.OperationTransactionControl.COMMIT)); } else { return executeInModelControllerCl(modelController::execute, op, messageHandler, ModelController.OperationTransactionControl.COMMIT); } }
/** * Execute an operation in another thread. * * @param operation the operation to execute * @return the future result of the operation */ default AsyncFuture<ModelNode> executeAsync(ModelNode operation) { return executeAsync(Operation.Factory.create(operation), OperationMessageHandler.DISCARD); }
/** * Execute an operation synchronously, optionally receiving progress reports. * * @param operation the operation to execute * @param messageHandler the message handler to use for operation progress reporting, or {@code null} for none * @return the result of the operation * @throws IOException if an I/O error occurs while executing the operation */ default ModelNode execute(ModelNode operation, OperationMessageHandler messageHandler) throws IOException { return execute(Operation.Factory.create(operation), messageHandler); }
@Override default ModelNode execute(ModelNode operation, OperationMessageHandler messageHandler) { return execute(Operation.Factory.create(operation), messageHandler); }
@Override default ModelNode execute(ModelNode operation) { return execute(Operation.Factory.create(operation), OperationMessageHandler.DISCARD); }
@Override default ModelNode execute(ModelNode operation) { return execute(Operation.Factory.create(operation), OperationMessageHandler.DISCARD); }
private OperationResponse runOperation(final ModelNode operation, final OperationMessageHandler messageHandler, final OperationAttachments attachments, boolean inVmCall) { Operation op = attachments == null ? Operation.Factory.create(operation) : Operation.Factory.create(operation, attachments.getInputStreams(), attachments.isAutoCloseStreams()); if (inVmCall) { return SecurityActions.runInVm(() -> executeInModelControllerCl(modelController::execute, op, messageHandler, ModelController.OperationTransactionControl.COMMIT)); } else { return executeInModelControllerCl(modelController::execute, op, messageHandler, ModelController.OperationTransactionControl.COMMIT); } }
/** * Execute an operation in another thread, optionally receiving progress reports. * * @param operation the operation to execute * @param messageHandler the message handler to use for operation progress reporting, or {@code null} for none * @return the future result of the operation */ default AsyncFuture<ModelNode> executeAsync(ModelNode operation, OperationMessageHandler messageHandler) { return executeAsync(Operation.Factory.create(operation), messageHandler); }
/** * Execute an operation synchronously. * * @param operation the operation to execute * @return the result of the operation * @throws IOException if an I/O error occurs while executing the operation */ default ModelNode execute(ModelNode operation) throws IOException{ return execute(Operation.Factory.create(operation), OperationMessageHandler.DISCARD); }
private Operation sanitizeOperation(Operation operation) { ModelNode sanitized = sanitizeOperation(operation.getOperation()); return Operation.Factory.create(sanitized, operation.getInputStreams(), operation.isAutoCloseStreams()); }
private Operation sanitizeOperation(Operation operation) { ModelNode sanitized = sanitizeOperation(operation.getOperation()); return Operation.Factory.create(sanitized, operation.getInputStreams(), operation.isAutoCloseStreams()); }