@Override public OperationResponse executeOperation(Operation operation, OperationMessageHandler messageHandler) throws IOException { return masterProxy.executeOperation(operation, messageHandler); }
@Override public OperationResponse executeOperation(Operation operation, OperationMessageHandler messageHandler) throws IOException { return masterProxy.executeOperation(operation, messageHandler); }
@Override public OperationResponse executeOperation(Operation operation, OperationMessageHandler messageHandler) throws IOException { return delegate.executeOperation(operation, messageHandler); }
@Override public OperationResponse executeOperation(Operation operation, OperationMessageHandler messageHandler) throws IOException { return provider.getDelegate().executeOperation(operation, messageHandler); }
@Override public OperationResponse executeOperation(final Operation operation, final OperationMessageHandler messageHandler) throws IOException { return context.runExFunction(o -> delegate.executeOperation(operation, messageHandler), null); }
/** * Execute an operation synchronously, optionally receiving progress reports. * <p> * Note that associated input-streams have to be closed by the caller, after the * operation completed {@link OperationAttachments#isAutoCloseStreams()}. * * @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(Operation operation, OperationMessageHandler messageHandler) throws IOException { try (OperationResponse or = executeOperation(operation, messageHandler)) { return or.getResponseNode(); } }
@Override public OperationResponse executeOperation(Operation operation, OperationMessageHandler messageHandler) throws IOException { Contexts existing = contextSelector.pushLocal(); try { return delegate.executeOperation(operation, messageHandler); } finally { contextSelector.restore(existing); } }
@Override public OperationResponse executeOperation(Operation operation, OperationMessageHandler messageHandler) throws IOException { Contexts existing = contextSelector.pushLocal(); try { return delegate.executeOperation(operation, messageHandler); } finally { contextSelector.restore(existing); } }
private OperationResponse execute(ModelNode request, boolean useWaitCursor) throws IOException { if(request.get(Util.OPERATION).asString().equals(Util.COMPOSITE) && (!request.get(Util.STEPS).isDefined() || request.get(Util.STEPS).asList().isEmpty())) { return OperationResponse.Factory.createSimple(new ModelNode("WARN: no request was sent as there were no server-side operations to execute")); } try { if (useWaitCursor) { cliGuiCtx.getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); } return client.get().executeOperation(OperationBuilder.create(request).build(), OperationMessageHandler.DISCARD); } finally { if (useWaitCursor) { cliGuiCtx.getMainWindow().setCursor(Cursor.getDefaultCursor()); } } }
private OperationResponse execute(ModelNode request, boolean useWaitCursor) throws IOException { if(request.get(Util.OPERATION).asString().equals(Util.COMPOSITE) && (!request.get(Util.STEPS).isDefined() || request.get(Util.STEPS).asList().isEmpty())) { return OperationResponse.Factory.createSimple(new ModelNode("WARN: no request was sent as there were no server-side operations to execute")); } try { if (useWaitCursor) { cliGuiCtx.getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); } return client.get().executeOperation(OperationBuilder.create(request).build(), OperationMessageHandler.DISCARD); } finally { if (useWaitCursor) { cliGuiCtx.getMainWindow().setCursor(Cursor.getDefaultCursor()); } } }
@Override protected void doHandle(CommandContext ctx) throws CommandLineException { final ModelNode request = buildRequest(ctx); Attachments attachments = getAttachments(ctx); OperationBuilder builder = new OperationBuilder(request, true); for (String path : attachments.getAttachedFiles()) { builder.addFileAsAttachment(new File(path)); } final ModelControllerClient client = ctx.getModelControllerClient(); final OperationResponse operationResponse; try { operationResponse = client.executeOperation(builder.build(), OperationMessageHandler.DISCARD); } catch (Exception e) { throw new CommandLineException("Failed to perform operation", e); } try { final ModelNode response = operationResponse.getResponseNode(); if (!Util.isSuccess(response)) { throw new CommandLineException(Util.getFailureDescription(response)); } handleResponse(ctx, operationResponse, Util.COMPOSITE.equals(request.get(Util.OPERATION).asString())); operationResponse.close(); } catch (IOException ex) { throw new CommandLineException("Failed to perform operation", ex); } }
@Override protected void doHandle(CommandContext ctx) throws CommandLineException { final ModelNode request = buildRequest(ctx); Attachments attachments = getAttachments(ctx); OperationBuilder builder = new OperationBuilder(request, true); for (String path : attachments.getAttachedFiles()) { builder.addFileAsAttachment(new File(path)); } final ModelControllerClient client = ctx.getModelControllerClient(); final OperationResponse operationResponse; try { operationResponse = client.executeOperation(builder.build(), OperationMessageHandler.DISCARD); } catch (Exception e) { throw new CommandLineException("Failed to perform operation", e); } try { final ModelNode response = operationResponse.getResponseNode(); if (!Util.isSuccess(response)) { throw new CommandLineException(Util.getFailureDescription(response)); } handleResponse(ctx, operationResponse, Util.COMPOSITE.equals(request.get(Util.OPERATION).asString())); operationResponse.close(); } catch (IOException ex) { throw new CommandLineException("Failed to perform operation", ex); } }
response = client.executeOperation(builder.build(), OperationMessageHandler.DISCARD); } catch(Exception e) { throw new CommandFormatException("Failed to perform operation: " + e.getLocalizedMessage());
response = client.executeOperation(builder.build(), OperationMessageHandler.DISCARD); } catch(Exception e) { throw new CommandFormatException("Failed to perform operation: " + e.getLocalizedMessage());