static void install(final Env env, final Config conf) { String path = conf.getString("crash.httpshell.path"); Router router = env.router(); router.get(path + "/{cmd:.*}", router.promise("direct", (req, deferred) -> { MediaType type = req.accepts(MediaType.json) .map(it -> MediaType.json) .orElse(MediaType.html); PluginContext ctx = req.require(PluginContext.class); ShellFactory shellFactory = ctx.getPlugin(ShellFactory.class); Shell shell = shellFactory.create(null); String cmd = req.param("cmd").value().replaceAll("/", " "); ShellProcess process = shell.createProcess(cmd); ShellProcessContext spc = new SimpleProcessContext( result -> deferred.resolve(result.type(type))); process.execute(spc); })); }
Integer width = (Integer) event.get("width"); Integer height = (Integer) event.get("height"); process.set(shell.createProcess(command)); SimpleProcessContext context = new SimpleProcessContext(r -> { Try.run(() -> {
private BaseProcessContext(Shell shell, String line) { this(shell.createProcess(line)); }
void run() { Shell sh = task.factory.create(null); ShellProcess sp = sh.createProcess(task.def.getLine()); task.plugin.processes.add(this); task.plugin.history.add(this); while (task.plugin.history.size() > 100) { task.plugin.history.remove(); } active = true; log.log(Level.FINE, "Started task with id=" + task.def.hashCode() + " pattern=" + task.def.getSchedullingPattern() + " : " + task.def.getLine()); sp.execute(context); }
callee = shell.shell.createProcess(request); caller = processContext;
int width = event.get("width").getAsInt(); int height = event.get("height").getAsInt(); ShellProcess process = session.shell.createProcess(command); WSProcessContext context = new WSProcessContext(session, process, command, width, height); if (session.current.getAndSet(context) == null) {
ShellProcess shellProcess = shell.createProcess(command);
height = execute.height; last = System.currentTimeMillis(); current = new ClientProcessContext(this, shell.createProcess(execute.line)); current.execute(); } else if (msg instanceof ClientMessage.Cancel) {
term.addToHistory(command); ShellProcess process = shell.createProcess(command); current = new ProcessContext(this, process); status = Status.PROCESSING;
String line = editor.append(action, key.sequence); if (line != null) { ShellProcess process = shell.createProcess(line); ProcessHandler context = new ProcessHandler(this, process); handler.set(context);
public void testFoo() throws Exception { URL xml = SpringTestCase.class.getResource("spring.xml"); Assert.assertNotNull(xml); // GenericXmlApplicationContext context = new GenericXmlApplicationContext(new UrlResource(xml)); context.start(); // SpringBootstrap bootstrap = context.getBean(SpringBootstrap.class); // Test a bit ShellFactory factory = bootstrap.getContext().getPlugin(ShellFactory.class); Shell shell = factory.create(null); assertNotNull(shell); ShellProcess process = shell.createProcess("foo_cmd"); assertNotNull(process); BaseProcessContext pc = BaseProcessContext.create(process).execute(); assertTrue(pc.getResponse() instanceof ShellResponse.Ok); String r = pc.getOutput(); assertEquals("bar", r); } }
ShellProcess process = shell.createProcess(line); JLineProcessContext context = new JLineProcessContext(this); current.set(process);
term.addToHistory(command); ShellProcess process = shell.createProcess(command); current = new ProcessContext(this, process); status = Status.PROCESSING;
ShellProcess shellProcess = shell.createProcess(command);
height = execute.height; last = System.currentTimeMillis(); current = new ClientProcessContext(this, shell.createProcess(execute.line)); current.execute(); } else if (msg instanceof ClientMessage.Cancel) {
height = execute.height; last = System.currentTimeMillis(); current = new ClientProcessContext(this, shell.createProcess(execute.line)); current.execute(); } else if (msg instanceof ClientMessage.Cancel) {
ShellProcess shellProcess = shell.createProcess(command);
term.addToHistory(command); ShellProcess process = shell.createProcess(command); current = new ProcessContext(this, process); status = Status.PROCESSING;
ShellProcess shellProcess = shell.createProcess(command);
String line = editor.append(action, key.sequence); if (line != null) { ShellProcess process = shell.createProcess(line); ProcessHandler context = new ProcessHandler(this, process); handler.set(context);