out.writeObject(new ClientMessage.Execute(processContext.getWidth(), processContext.getHeight(), process.line)); out.flush(); ServerMessage msg = (ServerMessage)in.readObject(); if (msg instanceof ServerMessage.GetSize) { out.writeObject(new ClientMessage.SetSize(processContext.getWidth(), processContext.getHeight())); out.flush(); } else if (msg instanceof ServerMessage.ReadLine) { processContext.takeAlternateBuffer(); } else if (msg instanceof ServerMessage.UseMainBuffer) { processContext.releaseAlternateBuffer(); } else if (msg instanceof ServerMessage.End) { response = ((ServerMessage.End)msg).response; processContext.append(((ServerMessage.Chunk.Text)chunk).payload); } else if (chunk instanceof ServerMessage.Chunk.Cls) { processContext.cls(); } else { processContext.append(((ServerMessage.Chunk.Style)chunk).payload); processContext.flush(); } else { response = ShellResponse.internalError("Unexpected"); processContext.end(response); } else { processContext.end(ShellResponse.internalError(""));
public String readLine(String msg, boolean echo) throws IOException, InterruptedException { return caller.readLine(msg, echo); }
public String getProperty(String propertyName) { return processContext.getProperty(propertyName); }
public void run(String request, ShellProcessContext context) throws Exception { try { syncA.await(); } catch (Exception e) { e.printStackTrace(); } String s = context.readLine("hello", true); if (s == null) { s = "cancelled"; } line.set(s); try { syncB.await(); } catch (Exception e) { e.printStackTrace(); } context.append("foo"); context.end(ShellResponse.ok()); } });
out.writeObject(new ClientMessage.Execute(processContext.getWidth(), processContext.getHeight(), process.line)); out.flush(); ServerMessage msg = (ServerMessage)in.readObject(); if (msg instanceof ServerMessage.GetSize) { out.writeObject(new ClientMessage.SetSize(processContext.getWidth(), processContext.getHeight())); out.flush(); } else if (msg instanceof ServerMessage.ReadLine) { processContext.takeAlternateBuffer(); } else if (msg instanceof ServerMessage.UseMainBuffer) { processContext.releaseAlternateBuffer(); } else if (msg instanceof ServerMessage.End) { response = ((ServerMessage.End)msg).response; } else if (msg instanceof ServerMessage.Chunk) { processContext.provide(((ServerMessage.Chunk)msg).payload); } else if (msg instanceof ServerMessage.Flush) { processContext.flush(); } else { response = ShellResponse.internalError("Unexpected"); processContext.end(response); } else { processContext.end(ShellResponse.internalError(""));
@Override public void run(String request, ShellProcessContext context) throws Exception { context.end(ShellResponse.ok()); } });
public void run(String request, ShellProcessContext context) throws Exception { try { syncA.await(); syncB.await(); } catch (Exception e) { e.printStackTrace(); } String s = context.readLine("hello", true); line.set(s); try { syncC.await(); } catch (Exception e) { e.printStackTrace(); } context.end(ShellResponse.close()); } });
@Override public Screenable append(char c) throws IOException { caller.append(c); return this; }
public int getWidth() { return processContext.getWidth(); }
public int getHeight() { return processContext.getHeight(); }
public boolean takeAlternateBuffer() throws IOException { return useAlternateBuffer = processContext.takeAlternateBuffer(); }
public boolean releaseAlternateBuffer() throws IOException { return caller.releaseAlternateBuffer(); }
public void flush() throws IOException { caller.flush(); }
public void run(String request, ShellProcessContext context) throws Exception { try { syncA.await(); } catch (Exception e) { e.printStackTrace(); } String s = context.readLine("hello", true); if (s == null) { s = "cancelled"; } line.set(s); try { syncB.await(); } catch (Exception e) { e.printStackTrace(); } context.append("foo"); context.end(ShellResponse.ok()); } });
@Override public void run(String request, ShellProcessContext context) throws Exception { context.end(ShellResponse.ok()); } });
@Override public Screenable append(CharSequence csq, int start, int end) throws IOException { caller.append(csq, start, end); return this; }
public int getWidth() { return processContext.getWidth(); }
public int getHeight() { return processContext.getHeight(); }