Executes request command

@param command REST request representation
@return Future wrapper of REST response
@throws RestEndpointIOException In case of error
@see Maybe
510927
@Override
    public final <RQ, RS> Maybe<Response<RS>> executeRequest(RestCommand<RQ, RS> command)
            throws RestEndpointIOException {
        URI uri = spliceUrl(command.getUri());
        HttpUriRequest rq;
        Serializer serializer;
        switch (command.getHttpMethod()) {
        case GET:
            rq = new HttpGet(uri);
            break;
        case POST:
            if (command.isMultipart()) {
                MultiPartRequest rqData = (MultiPartRequest) command.getRequest();
                rq = buildMultipartRequest(uri, rqData);
            } else {
                serializer = getSupportedSerializer(command.getRequest());
                rq = new HttpPost(uri);
                ((HttpPost) rq)
                        .setEntity(new ByteArrayEntity(serializer.serialize(command.getRequest()), ContentType.create(
                                serializer.getMimeType())));
            }
            break;
        case PUT:
            serializer = getSupportedSerializer(command.getRequest());
            rq = new HttpPut(uri);
            ((HttpPut) rq).setEntity(new ByteArrayEntity(serializer.serialize(command.getRequest()), ContentType.create(
                    serializer.getMimeType())));
            break;
        case DELETE:
            rq = new HttpDelete(uri);
            break;
        case PATCH:
            serializer = getSupportedSerializer(command.getRequest());
            rq = new HttpPatch(uri);
            ((HttpPatch) rq)
                    .setEntity(new ByteArrayEntity(serializer.serialize(command.getRequest()), ContentType.create(
                            serializer.getMimeType())));
            break;
        default:
            throw new IllegalArgumentException("Method '" + command.getHttpMethod() + "' is unsupported");
        }

        return executeInternal(rq, new TypeConverterCallback<RS>(serializers, command.getResponseType()));
    }
818310
private ServerCommandID createServerCommand(String command) throws IOException {
        FileInputStream fis = null;
        BufferedReader reader = null;

        try {
            fis = new FileInputStream(commandFile);
            reader = new BufferedReader(new InputStreamReader(fis));
            String line = reader.readLine();
            if (line == null)
                line = "";

            return new ServerCommandID(line, command);
        } finally {
            if (!Utils.tryToClose(reader)) {
                Utils.tryToClose(fis);
            }
        }
    }
1104983
public void executeCommand(String command, List<String> parameters) {

        if (null == command) {
            return;
        }

        if (m_echo) {
            // echo the command to STDOUT
            m_out.print(command);
            for (int i = 0; i < parameters.size(); i++) {
                m_out.print(" '");
                m_out.print(parameters.get(i));
                m_out.print("'");
            }
            m_out.println();
        }

        // prepare to lookup a method in CmsObject or CmsShellCommands
        boolean executed = false;
        Iterator<CmsCommandObject> i = m_commandObjects.iterator();
        while (!executed && i.hasNext()) {
            CmsCommandObject cmdObj = i.next();
            executed = cmdObj.executeMethod(command, parameters);
        }

        if (!executed) {
            // method not found
            m_out.println();
            StringBuffer commandMsg = new StringBuffer(command).append("(");
            for (int j = 0; j < parameters.size(); j++) {
                commandMsg.append("value");
                if (j < (parameters.size() - 1)) {
                    commandMsg.append(", ");
                }
            }
            commandMsg.append(")");

            m_out.println(m_messages.key(Messages.GUI_SHELL_METHOD_NOT_FOUND_1, commandMsg.toString()));
            m_out.println(m_messages.key(Messages.GUI_SHELL_HR_0));
            ((CmsShellCommands)m_shellCommands).help();
        }
    }
1163368
protected ProcessOutput executeProcess(String command,FaxActionType faxActionType)
    {
        //execute process
        ProcessOutput processOutput=ProcessExecutorHelper.executeProcess(this,command);

        //validate process output
        this.processOutputValidator.validateProcessOutput(this,processOutput,faxActionType);
        
        return processOutput;
    }
109920
@NotNull
    protected <A, R> Optional<R> restExceptionBarrier(
            Command<A, R> command,
            Mode mode,
            @Nullable A param
    ) {
        try {
            return executor.execute(command, mode, param);
        } catch (Exception | AssertionError e) {
            if (e instanceof ServiceException) {
                throw (ServiceException)e;
//            if (e instanceof WebApplicationException) {
//                throw (WebApplicationException)e;
            } else {
                //should never arrive here. nothing we can do.
                String msg = "Unexpected late exception translation for: "+e.getMessage();
                logger.error(msg);
                throw InternalServerErrorServiceExceptions.internalServerError(msg);
            }
        }
    }
165845
public synchronized void execute(Runnable command) {
        if (active.get()) {
            stop();
            this.command = command;
            start();
        } else {
            this.command = command;
        }
    }
1290425
protected Runnable wrapTask(Runnable command) {
    final Callable<Object> wrapped = wrapTask(Executors.callable(command, null));
    return new Runnable() {
      @Override
      public void run() {
        try {
          wrapped.call();
        } catch (Exception e) {
          throwIfUnchecked(e);
          throw new RuntimeException(e);
        }
      }
    };
  }
754351
public String executeCommandOnServlet(String command) {
    try {
      return getCommandResponseAsString(command);
    } catch (IOException e) {
      if (e instanceof ConnectException) {
        throw new SeleniumException(e.getMessage(), e);
      }
      e.printStackTrace();
      throw new UnsupportedOperationException("Catch body broken: IOException from " + command +
          " -> " + e, e);
    }
  }
315993
private CompletableFuture<ExecuteResponse> execute(ExecuteRequest request) {
    return getService(request).thenCompose(service -> service.execute(request));
  }
873610
@Override
    public final <RS> Maybe<Response<RS>> get(String resource, Class<RS> clazz)
            throws RestEndpointIOException {
        HttpGet get = new HttpGet(spliceUrl(resource));
        return executeInternal(get, new ClassConverterCallback<RS>(serializers, clazz));
    }
183137
private void processCommand(List<String> command) throws Exception {
        processBuilder.command(command);
        Process p = processBuilder.start();
        checkReturnCode(p, processBuilder.command().toString(), ReturnCode.OK.getValue(), ReturnCode.ALREADY_EXISTS.getValue());
        if (!acceptLicense) {
            throw new BuildException("To install a feature, you must accept the feature's license terms and conditions.");
        }
    }
953890
@Override
    protected <T> CompletableFuture<T> doExecute(Command<T> command) throws Exception {
        final CompletableFuture<T> future = new CompletableFuture<>();
        executor.execute(() -> {
            try {
                future.complete(blockingExecute(command));
            } catch (Throwable t) {
                future.completeExceptionally(t);
            }
        });
        return future;
    }
85144
protected static String runCommand(String... command) {
		try {
			final Process p = Runtime.getRuntime().exec(command);
			if (p == null) {
				return null;
			}
			final StringBuilder bStr = new StringBuilder();
			try (InputStream standardOutput = p.getInputStream()) {
				final byte[] buffer = new byte[BUFFER_SIZE];
				int len;
				while ((len = standardOutput.read(buffer)) > 0) {
					bStr.append(new String(buffer, 0, len));
				}
				p.waitFor();
				return bStr.toString();
			}
		} catch (Exception e) {
			return null;
		}
	}
505763
def request(self, api_commands, *, timeout=None):
        """"""
        if not isinstance(api_commands, list):
            return self._execute(api_commands, timeout=timeout)

        command_results = []

        for api_command in api_commands:
            result = self._execute(api_command, timeout=timeout)
            command_results.append(result)

        return command_results
73114
def executeCommand(self, command):
        
        if not command.strip():
            return self.waitForInput()
        
        # store the current block
        self._history.append(command)
        self._currentHistoryIndex = len(self._history)
        
        lines = []
        for line in command.split('\n'):
            line = re.sub('^>>> ', '', line)
            line = re.sub('^\.\.\. ', '', line)
            lines.append(line)
        
        command = '\n'.join(lines)
        
        # ensure we are at the end
        self.moveCursor(QTextCursor.End)
        self.scrollToEnd()
        self.insertPlainText('\n')
        cmdresult = None
        
        try:
            cmdresult = eval(command, self.scope(), self.scope())
        
        except SyntaxError:
            exec(command) in self.scope(), self.scope()
        
        else:
            if cmdresult is not None:
                # check to see if the command we executed actually caused
                # the destruction of this object -- if it did, then
                # the commands below will error
                if self.isDestroyed():
                    return
                
                try:
                    result = projex.text.nativestring(repr(cmdresult))
                except:
                    result = '<<< error formatting result to utf-8 >>>'
                
                self.information(result)
        
        finally:
            self.waitForInput()
517687
private <T> void submitCommand(Command<T> command, CompletableFuture<T> future) {
    CommandRequest request = CommandRequest.builder()
      .withSession(state.getSessionId())
      .withSequence(state.nextCommandRequest())
      .withCommand(command)
      .build();
    submitCommand(request, future);
  }
402116
public void executeOnDaemon(Runnable command) {

        int id = 0;
        final Runnable commandToRun = command;

        synchronized (this) {
            this.daemonId++;
            id = this.daemonId;
        }

        final String runId = name + " : DMN" + id; // d185137.2

        Thread t = (Thread) AccessController.doPrivileged(new PrivilegedAction()
        { // d185137.2
            public Object run()
        {
            // return new Thread(commandToRun); // d185137.2
            Thread temp = new Thread(commandToRun, runId); // d185137.2
            temp.setDaemon(true);
            return temp;
        }
        });
        t.start();
    }