@@ -0,0 +1,1015 @@
+package com.github.aureliano.achmed.resources.exec;%0A%0Aimport java.util.concurrent.ExecutionException;%0Aimport java.util.concurrent.ExecutorService;%0Aimport java.util.concurrent.Executors;%0Aimport java.util.concurrent.Future;%0Aimport java.util.concurrent.TimeUnit;%0Aimport java.util.concurrent.TimeoutException;%0A%0Aimport com.github.aureliano.achmed.exception.ExecResourceException;%0A%0Apublic final class CommandFacade %7B%0A%0A%09private CommandFacade() %7B%0A%09%09super();%0A%09%7D%0A%09%0A%09public static int executeCommand(CommandBuilder command) %7B%0A%09%09boolean verbose = command.getVerbose() != null ? command.getVerbose() : true;%0A%09%09CommandRunner runner = new CommandRunner(command.getCommand(), command.getWorkingDir(), verbose);%0A%09%09%0A%09%09ExecutorService executor = Executors.newSingleThreadExecutor();%0A%09%09Future%3CInteger%3E future = executor.submit(runner);%0A%09%09%0A%09%09try %7B%0A%09%09%09return future.get(command.getTimeout(), TimeUnit.MILLISECONDS);%0A%09%09%7D catch (ExecutionException%7CTimeoutException%7CInterruptedException ex) %7B%0A%09%09%09throw new ExecResourceException(ex);%0A%09%09%7D%0A%09%7D%0A%7D

Create command facade to encapsulate command execution.