Handles a {@link RequestStopTransactionRejectedCommand}.

@param command the command which needs to be applied to the ChargingStation.
175084
@CommandHandler
    public void handle(RequestStopTransactionRejectedCommand command) {
        apply(new RequestStopTransactionRejectedEvent(command.getChargingStationId(), command.getTransactionId(), command.getIdentityContext()));
    }
1330263
protected void doExecuteCommand() {
        if (this.commandExecutor instanceof ParameterizableActionCommandExecutor) {
            ((ParameterizableActionCommandExecutor) this.commandExecutor).execute(getParameters());
        }
        else {
        	if (this.commandExecutor != null) {
        		this.commandExecutor.execute();
        	}
        }
    }
887396
private void invokeCommand(PrimitiveOperation operation, CompletableFuture<byte[]> future) {
    CommandRequest request = CommandRequest.builder()
        .withSession(state.getSessionId().id())
        .withSequence(state.nextCommandRequest())
        .withOperation(operation)
        .build();
    invokeCommand(request, future);
  }
689994
public <T extends KubernetesCommand> T command(T command) {
		action.setCommand(command);
		return command;
	}
622412
public <R> R executeAndQuery(ContextCommand<ROOT, R> cmd) {
        return Politician.beatAroundTheBush(() -> this.prevayler.execute(new InternalTransaction<>(cmd)));
    }
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);
    }
  }
153577
public static Runnable apply(final Runnable command, final EventExecutor eventExecutor) {
        ObjectUtil.checkNotNull(command, "command");
        ObjectUtil.checkNotNull(eventExecutor, "eventExecutor");
        return new Runnable() {
            @Override
            public void run() {
                setCurrentEventExecutor(eventExecutor);
                try {
                    command.run();
                } finally {
                    setCurrentEventExecutor(null);
                }
            }
        };
    }
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();
    }
47816
public static void postAction (
        Component source, String command, Object argument)
    {
        // slip things onto the event queue for later
        CommandEvent event = new CommandEvent(source, command, argument);
        EventQueue.invokeLater(new ActionInvoker(event));
    }
228877
@Override
	public void sendCommand(final BitfinexCommand command) {
		try {
			if (command instanceof BitfinexStreamSymbolToChannelIdResolverAware) {
				final BitfinexStreamSymbolToChannelIdResolverAware aware = (BitfinexStreamSymbolToChannelIdResolverAware) command;
				aware.setResolver(symbol -> {
					final Integer channelId = getChannelForSymbol(symbol);
					if (channelId == null) {
						throw new IllegalArgumentException("Unknown symbol: " + symbol);
					}
					return channelId;
				});
			}
			final String json = command.getCommand(this);
            logger.debug("Sent: {}", command);
			websocketEndpoint.sendMessage(json);
		} catch (final BitfinexCommandException e) {
			logger.error("Got Exception while sending command", e);
		}
	}
487555
public void requestBatteryLevel(int nodeId, int endpoint) {
		ZWaveNode node = this.getNode(nodeId);
		SerialMessage serialMessage = null;
		
		ZWaveBatteryCommandClass zwaveBatteryCommandClass = (ZWaveBatteryCommandClass)node.resolveCommandClass(ZWaveCommandClass.CommandClass.BATTERY, endpoint);
		
		if (zwaveBatteryCommandClass == null) {
			logger.error("No Command Class BATTERY found on node {}, instance/endpoint {} to request value.", nodeId, endpoint);
			return;
		}
			 
		serialMessage = node.encapsulate(zwaveBatteryCommandClass.getValueMessage(), zwaveBatteryCommandClass, endpoint);
		
		if (serialMessage != null)
			this.sendData(serialMessage);
	}
1229919
public void runCommand(String command) throws Exception {
        String result = "";
        String extras = "export PYTHONWARNINGS=\"ignore:Unverified HTTPS request\" && ";

        Channel channel = session.openChannel("exec");
        ((ChannelExec) channel).setCommand(extras + command);

        channel.setInputStream(null);
        ((ChannelExec) channel).setErrStream(System.err);

        InputStream in = channel.getInputStream();

        ((ChannelExec) channel).setPty(true);

        channel.connect();

        byte[] tmp = new byte[1024];
        while (true) {
            while (in.available() > 0) {
                int i = in.read(tmp, 0, 1024);
                if (i < 0) {
                    break;
                }
                result = result + new String(tmp, 0, i);
            }
            this.result = result;
            this.setResult(result);

            if (channel.isClosed()) {
                if (in.available() > 0) {
                    continue;
                }
                this.exitStatus = channel.getExitStatus();
                break;
            }
            try {
                Thread.sleep(1000);
            } catch (Exception ee) {
            }
        }

        channel.disconnect();
    }
211281
private void execute(Command command, CommandLineParser lineParser) {
        ConsoleWrapper wrappedConsole = new ConsoleWrapper(console);
        PrintWriter outputWriter = null;
        try {
            ParsedOptions options = lineParser.parseOptions(command.getOptions());
            outputWriter = OutputRedirection.determineOutputWriter(lineParser.getRedirectionList(), wrappedConsole);
            wrappedConsole.setWriter(outputWriter);
            command.execute(options, wrappedConsole);
        } catch (ConsoleTerminatedException e) {
            throw e;
        } catch (OptionParserException e) {
            wrappedConsole.writeError(e.getMessage());
            command.printHelp(wrappedConsole);
        } catch (Exception e) {
            log.error("Failed to execute command: " + lineParser.getCommandLine(), e);
        } finally {
            if (outputWriter != null) {
                outputWriter.close();
            }
        }
    }
766276
private synchronized void asyncResponse(String command, SocketChannel sc) {
        if (closed) {
            Utils.tryToClose(sc);
        } else {
            Thread thread = new Thread(new ResponseThread(command, sc), "kernel-" + command + "-command-response");

            // We allow a maximum of one outstanding status start or stop command
            Thread oldThread = responseThread.getAndSet(thread);
            if (oldThread != null) {
                oldThread.interrupt();
            }

            thread.start();
        }
    }
255364
public final void onPrepareCommand(GlobalTransaction globalTransaction, boolean local) {
      //NB: If I want to give up using the InboundInvocationHandler, I can create the remote transaction
      //here, just overriding the handlePrepareCommand
      TransactionStatistics txs = getTransactionStatistic(globalTransaction, local);
      if (txs == null) {
         log.prepareOnUnexistingTransaction(globalTransaction == null ? "null" : globalTransaction.globalId());
         log.error("Trying to invoke onPrepareCommand() but no transaction is associated");
         return;
      }
      txs.onPrepareCommand();
   }
724282
@Override
    public void handle(CommandContext ctx) throws CommandLineException {

        ModelControllerClient client = ctx.getModelControllerClient();
        if(client == null) {
            throw new CommandFormatException("You are disconnected at the moment." +
                    " Type 'connect' to connect to the server" +
                    " or 'help' for the list of supported commands.");
        }
        RequestWithAttachments reqWithAttachments
                = (RequestWithAttachments) ctx.get(Scope.REQUEST, "OP_REQ");
        if (reqWithAttachments == null) {
            throw new CommandLineException("Parsed request isn't available.");
        }
        ModelNode request = reqWithAttachments.getRequest();
        OperationBuilder opBuilder = new OperationBuilder(request, true);
        for (String path : reqWithAttachments.getAttachedFiles()) {
            opBuilder.addFileAsAttachment(new File(path));
        }
        Operation op = opBuilder.build();

        if(ctx.getConfig().isValidateOperationRequests()) {
            ModelNode opDescOutcome = Util.validateRequest(ctx, request);
            if (opDescOutcome != null) { // operation has params that might need to be replaced
                Util.replaceFilePathsWithBytes(request, opDescOutcome);
            }
        }

        try {
            final ModelNode result = ctx.execute(op, "Operation request");
            if (Util.isSuccess(result)) {
                ctx.printDMR(result);
            } else {
                throw new CommandLineException(result.toString());
            }
        } catch(NoSuchElementException e) {
            throw new CommandLineException("ModelNode request is incomplete", e);
        } catch (CancellationException e) {
            throw new CommandLineException("The result couldn't be retrieved (perhaps the task was cancelled", e);
        } catch (IOException e) {
            if (e.getCause() != null && !(e.getCause() instanceof InterruptedException)) {
                ctx.disconnectController();
            }
            throw new CommandLineException("Communication error", e);
        } catch (RuntimeException e) {
            throw new CommandLineException("Failed to execute operation.", e);
        }
    }
964006
private void invokeCommand(CommandRequest request, CompletableFuture<byte[]> future) {
    invoke(new CommandAttempt(sequencer.nextRequest(), request, future));
  }