Executes a command remotely, displays the command output and updates the internal state.<p>

@param command the command
@param arguments the arguments
490089
private void executeCommand(String command, List<String> arguments) {

        try {
            CmsShellCommandResult result = m_remoteShell.executeCommand(command, arguments);
            m_out.print(result.getOutput());
            updateState(result);
            if (m_exitCalled) {
                exit(0);
            } else if (m_hasError && (m_errorCode != -1)) {
                exit(m_errorCode);
            }
        } catch (RemoteException r) {
            r.printStackTrace(System.err);
            exit(1);
        }
    }
642010
public static void executeCommand(String[] args) throws Exception {
        String subCmd = (args.length > 0) ? args[0] : "";
        args = AdminToolUtils.copyArrayCutFirst(args);
        if(subCmd.equals("get")) {
            SubCommandQuotaGet.executeCommand(args);
        } else if(subCmd.equals("set")) {
            SubCommandQuotaSet.executeCommand(args);
        } else if(subCmd.equals("reserve-memory")) {
            SubCommandQuotaReserveMemory.executeCommand(args);
        } else if(subCmd.equals("unset")) {
            SubCommandQuotaUnset.executeCommand(args);
        } else {
            printHelp(System.out);
        }
    }
957999
public void process(final T command) {
        boolean traceStarted = false;
        incrementCommandsProcessed();
		DehydratedExecutionContext ctx = null;
		try {
            validateCommand(command);
			CommandResolver<T> resolver = createCommandResolver(command, tracer);
			ctx = resolver.resolveExecutionContext();
            List<ExecutionCommand> executionCommands = resolver.resolveExecutionCommands();
            if (executionCommands.size() > 1) {
                throw new CougarFrameworkException("Resolved >1 command in a non-batch call!");
            }
            ExecutionCommand exec = executionCommands.get(0);
            tracer.start(ctx.getRequestUUID(), exec.getOperationKey());
            traceStarted = true;
			executeCommand(exec, ctx);
		} catch(CougarException ce) {
            executeError(command, ctx, ce, traceStarted);
		} catch (Exception e) {
            executeError(command, ctx, new CougarFrameworkException("Unexpected exception while processing transport command", e), traceStarted);
		}
	}
67622
public void executeCommand(String command, Integer exitStatus, String envVar) throws Exception {
        if (exitStatus == null) {
            exitStatus = 0;
        }

        command = "set -o pipefail && alias grep='grep --color=never' && " + command;
        getRemoteSSHConnection().runCommand(command);
        setCommandResult(getRemoteSSHConnection().getResult());
        setCommandExitStatus(getRemoteSSHConnection().getExitStatus());
        runCommandLoggerAndEnvVar(exitStatus, envVar, Boolean.FALSE);

        Assertions.assertThat(getRemoteSSHConnection().getExitStatus()).isEqualTo(exitStatus);
    }
356557
function (command, id) {
        id = id || '';
        if (id) {
          this.queue.push(id);
        }
        SocketService.emit('execute', {
          command: command,
          id: id
        });
      }
551861
public static boolean runCommand(final Process p, final OutputStream output) {
        return runCommand(p, output, output, new ArrayList<String>());
    }
456936
public void doProcess(InputStream in, PrintWriter out, Map<String, Object> properties)
        throws RemoteException
    {
        String strCommand = this.getProperty(REMOTE_COMMAND, properties);
        try {
            if (CLOSE.equals(strCommand))
            {
                ((RemoteDatabase)m_remoteObject).close();
            }
            else if (GET_DB_PROPERTIES.equals(strCommand))
            {
                Map<String,Object> propIn = ((RemoteDatabase)m_remoteObject).getDBProperties();
                this.setReturnObject(out, propIn);
            }
            else if (SET_DB_PROPERTIES.equals(strCommand))
            {
                Map<String,Object> propIn = this.getNextPropertiesParam(in, PROPERTIES, properties);
                if (propIn != null)
                    properties.putAll(propIn);
                ((RemoteDatabase)m_remoteObject).setDBProperties(properties);
            }
            else if (COMMIT.equals(strCommand))
            {
                ((RemoteDatabase)m_remoteObject).commit();
            }
            else if (ROLLBACK.equals(strCommand))
            {
                ((RemoteDatabase)m_remoteObject).rollback();
            }
            else
                super.doProcess(in, out, properties);
        } catch (DBException ex)    {
            this.setReturnObject(out, ex);
        } catch (Exception ex)    {
            this.setReturnObject(out, ex);
        }
    }
339354
protected void configureIfNecessary(AbstractCommand command) {

		Assert.notNull(command, "command");

		if (getCommandConfigurer() != null) {
			if (!command.isFaceConfigured()) {
                getCommandConfigurer().configure(command);
			}
		}

	}
165845
public synchronized void execute(Runnable command) {
        if (active.get()) {
            stop();
            this.command = command;
            start();
        } else {
            this.command = command;
        }
    }
338287
public static void run(String[] command) throws IOException, RDF4JException, TrustyUriException {
		String cmd = command[0];
		String[] cmdArgs = Arrays.copyOfRange(command, 1, command.length);
		if (cmd.equals("CheckFile")) {
			CheckFile.main(cmdArgs);
		} else if (cmd.equals("ProcessFile")) {
			ProcessFile.main(cmdArgs);
		} else if (cmd.equals("CheckLargeRdf")) {
			CheckLargeRdf.main(cmdArgs);
		} else if (cmd.equals("TransformRdf")) {
			TransformRdf.main(cmdArgs);
		} else if (cmd.equals("TransformLargeRdf")) {
			TransformLargeRdf.main(cmdArgs);
		} else if (cmd.equals("CheckSortedRdf")) {
			CheckSortedRdf.main(cmdArgs);
		} else {
			System.err.println("ERROR: Unrecognized command " + cmd);
			System.exit(1);
		}
	}
347652
private Serializable executeCommand(RemoteCommand command, Serializable... args) throws RPCException
   {
      try
      {
         return command.execute(args);
      }
      catch (Throwable e)//NOSONAR
      {
         throw new RPCException(e.getMessage(), e);
      }
   }
759083
public boolean sendCommand(String command) {
        if (writer != null) {
            try {
                logger.info("Sending command " + command + " to remote host " + remoteHost);
                writer.write(command);
                writer.write('\r');
                writer.flush();
            } catch (IOException e) {
                logger.fatal("Error while sending command " + command + " to remote host " + remoteHost, e);
                return false;
            }
            return true;
        } else {
            return false;
        }
    }
423480
public static void executeCommand(String[] args) throws Exception {
        String subCmd = (args.length > 0) ? args[0] : "";
        args = AdminToolUtils.copyArrayCutFirst(args);
        if(subCmd.equals("fetch-entries")) {
            SubCommandStreamFetchEntries.executeCommand(args);
        } else if(subCmd.equals("fetch-keys")) {
            SubCommandStreamFetchKeys.executeCommand(args);
        } else if(subCmd.equals("mirror")) {
            SubCommandStreamMirror.executeCommand(args);
        } else if(subCmd.equals("update-entries")) {
            SubCommandStreamUpdateEntries.executeCommand(args);
        } else {
            printHelp(System.out);
        }
    }
1312951
public static void logCommandLineArguments( String[] args ) {
		if( args == null || args.length < 1 ) return;
		for( int i=0; i < args.length; i++ ) {
			logMessage("Cmd line arg["+i+"]="+args[i]);
		}
	}
423705
public static void executeSQL(final SQLiteDatabase database, String command) {
		// remove comments
		command = command.replaceAll("\\/\\*.*\\*\\/", "");
		command = command.replaceAll("--.*$", "");

		if (command.trim().length() > 0) {
			Logger.info(command);
			database.execSQL(command);
		}

	}
335587
public function execute($command, $arguments = array())
    {
        $options = $this->getOptions();
        $consoleDir = $this->getConsoleDir();

        if (null === $consoleDir) {
            return;
        }

        $argumentString = '';

        foreach ($arguments as $argument) {
            $argumentString .= escapeshellarg($argument) . ' ';
        }

        $this->executeCommand($consoleDir, $command . ' ' . $argumentString);
    }
1289596
public void doProcess(InputStream in, PrintWriter out, Map<String, Object> properties)
        throws RemoteException
    {
        String strCommand = this.getProperty(REMOTE_COMMAND, properties);
        try {
            if (OPEN.equals(strCommand))
            {
                String strKeyArea = this.getNextStringParam(in, KEY, properties);
                int iOpenMode = this.getNextIntParam(in, OPEN_MODE, properties);
                boolean bDirection = this.getNextBooleanParam(in, DIRECTION, properties);
                String strFields = this.getNextStringParam(in, FIELDS, properties);
                Object objInitialKey = this.getNextObjectParam(in, INITIAL_KEY, properties);
                Object objEndKey = this.getNextObjectParam(in, END_KEY, properties);
                byte[] byBehaviorData = (byte[])this.getNextObjectParam(in, BEHAVIOR_DATA, properties);
                ((RemoteTable)m_remoteObject).open(strKeyArea, iOpenMode, bDirection, strFields, objInitialKey, objEndKey, byBehaviorData);
            }
            else if (ADD.equals(strCommand))
            {
                Object objData = this.getNextObjectParam(in, DATA, properties);
                int iOpenMode = this.getNextIntParam(in, OPEN_MODE, properties);
                Object objReturn = ((RemoteTable)m_remoteObject).add(objData, iOpenMode);
                this.setReturnObject(out, objReturn);
            }
            else if (EDIT.equals(strCommand))
            {
                int iOpenMode = this.getNextIntParam(in, OPEN_MODE, properties);
                int iErrorCode = ((RemoteTable)m_remoteObject).edit(iOpenMode);
                this.setReturnObject(out, new Integer(iErrorCode));
            }
            else if (SET.equals(strCommand))
            {
                Object objData = this.getNextObjectParam(in, DATA, properties);
                int iOpenMode = this.getNextIntParam(in, OPEN_MODE, properties);
                ((RemoteTable)m_remoteObject).set(objData, iOpenMode);
            }
            else if (REMOVE.equals(strCommand))
            {
                Object objData = this.getNextObjectParam(in, DATA, properties);
                int iOpenMode = this.getNextIntParam(in, OPEN_MODE, properties);
                ((RemoteTable)m_remoteObject).remove(objData, iOpenMode);
            }
            else if (DO_MOVE.equals(strCommand))
            {
                int iRelPosition = this.getNextIntParam(in, POSITION, properties);
                int iCount = this.getNextIntParam(in, COUNT, properties);
                Object objReturn = ((RemoteTable)m_remoteObject).doMove(iRelPosition, iCount);
                this.setReturnObject(out, objReturn);
            }
            else if (SEEK.equals(strCommand))
            {
                String strSeekSign = this.getNextStringParam(in, SIGN, properties);
                int iOpenMode = this.getNextIntParam(in, OPEN_MODE, properties);
                String strKeyArea = this.getNextStringParam(in, KEY, properties);
                String strFields = this.getNextStringParam(in, FIELDS, properties);
                Object objKeyData = this.getNextObjectParam(in, KEY_DATA, properties);
                Object objReturn = ((RemoteTable)m_remoteObject).seek(strSeekSign, iOpenMode, strKeyArea, strFields, objKeyData);
                this.setReturnObject(out, objReturn);
            }
            else if (DO_SET_HANDLE.equals(strCommand))
            {
                Object bookmark = this.getNextObjectParam(in, BOOKMARK, properties);
                int iOpenMode = this.getNextIntParam(in, OPEN_MODE, properties);
                String strFields = this.getNextStringParam(in, FIELDS, properties);
                int iHandleType = this.getNextIntParam(in, TYPE, properties);
                Object objReturn = ((RemoteTable)m_remoteObject).doSetHandle(bookmark, iOpenMode, strFields, iHandleType);
                this.setReturnObject(out, objReturn);
            }
            else if (GET_LAST_MODIFIED.equals(strCommand))
            {
                int iHandleType = this.getNextIntParam(in, TYPE, properties);
                Object objReturn = ((RemoteTable)m_remoteObject).getLastModified(iHandleType);
                this.setReturnObject(out, objReturn);
            }
            else if (GET.equals(strCommand))
            {
                int iRowIndex = this.getNextIntParam(in, INDEX, properties);
                int iRowCount = this.getNextIntParam(in, COUNT, properties);
                Object objReturn = ((RemoteTable)m_remoteObject).get(iRowIndex, iRowCount);
                this.setReturnObject(out, objReturn);
            }
            else if (SET_REMOTE_PROPERTY.equals(strCommand))
            {
                String strProperty = this.getNextStringParam(in, KEY, properties);
                String strValue = this.getNextStringParam(in, VALUE, properties);
                ((RemoteTable)m_remoteObject).setRemoteProperty(strProperty, strValue);
            }
            else if (MAKE_FIELD_LIST.equals(strCommand))
            {
                String strFieldsToInclude = this.getNextStringParam(in, FIELDS, properties);
                Object objReturn = ((RemoteTable)m_remoteObject).makeFieldList(strFieldsToInclude);
                this.setReturnObject(out, objReturn);
            }
            else if (GET_REMOTE_DATABASE.equals(strCommand))
            {
                Map<String,Object> propIn = this.getNextPropertiesParam(in, PROPERTIES, properties);
                if (propIn != null)
                    properties.putAll(propIn);
                RemoteDatabase remoteDatabase = ((RemoteTable)m_remoteObject).getRemoteDatabase(properties);
                // First, see if this is in my list already?
                String strDBID = this.find(remoteDatabase);
                if (strDBID == null)
                {
                    strDBID = this.add(new DatabaseHolder((TaskHolder)this.getParentHolder(), remoteDatabase));
                }
                this.setReturnString(out, strDBID);
            }
            else
                super.doProcess(in, out, properties);
        } catch (DBException ex)    {
            this.setReturnObject(out, ex);
        } catch (Exception ex)    {
            this.setReturnObject(out, ex);
        }
    }