class ProcessHandler extends Plugin implements ShellProcessContext
Modifier and Type | Class and Description |
---|---|
(package private) class |
ProcessHandler.Reader
A thread reading a line.
|
Modifier and Type | Field and Description |
---|---|
(package private) Console |
console
.
|
(package private) AtomicReference<ProcessHandler.Reader> |
editor
Weather or not a thread is reading a line callback.
|
(package private) ShellProcess |
process
.
|
Constructor and Description |
---|
ProcessHandler(Console console,
ShellProcess process) |
Modifier and Type | Method and Description |
---|---|
Screenable |
append(char c) |
Screenable |
append(CharSequence s) |
Screenable |
append(CharSequence csq,
int start,
int end) |
Screenable |
append(Style style) |
Screenable |
cls() |
void |
end(ShellResponse response)
This method is invoked when the process ends.
|
void |
flush()
Flush the stream.
|
int |
getHeight()
Returns the screen height in chars.
|
String |
getProperty(String propertyName)
Returns a generic property, usually this property is resolved by the
shell client.
|
int |
getWidth()
Returns the screen width in chars.
|
String |
readLine(String msg,
boolean echo)
Display a message and read a line on the console, this method call can be blocking until the user provides
a value.
|
boolean |
releaseAlternateBuffer()
Release control of the alternate buffer.
|
boolean |
takeAlternateBuffer()
Take control of the alternate buffer.
|
final ShellProcess process
final AtomicReference<ProcessHandler.Reader> editor
ProcessHandler(Console console, ShellProcess process)
public boolean takeAlternateBuffer() throws IOException
InteractionContext
ScreenContext.flush()
method
is invoked.takeAlternateBuffer
in interface InteractionContext
IOException
public boolean releaseAlternateBuffer() throws IOException
InteractionContext
ScreenContext.flush()
method
is invoked.releaseAlternateBuffer
in interface InteractionContext
IOException
public String getProperty(String propertyName)
InteractionContext
getProperty
in interface InteractionContext
propertyName
- the property namepublic String readLine(String msg, boolean echo) throws IOException, InterruptedException
InteractionContext
readLine
in interface InteractionContext
msg
- the message to display before reading a lineecho
- wether or not the line read should be echoed when typingIOException
- any io exceptionInterruptedException
- the thread was interrupted while waiting for the user valuepublic int getWidth()
ScreenContext
getWidth
in interface ScreenContext
public int getHeight()
ScreenContext
getHeight
in interface ScreenContext
public Screenable append(CharSequence s) throws IOException
append
in interface Appendable
IOException
public Screenable append(char c) throws IOException
append
in interface Appendable
IOException
public Screenable append(CharSequence csq, int start, int end) throws IOException
append
in interface Appendable
IOException
public Screenable append(Style style) throws IOException
append
in interface Screenable
IOException
public Screenable cls() throws IOException
cls
in interface Screenable
IOException
public void flush() throws IOException
ScreenContext
flush
in interface ScreenContext
IOException
- any io exceptionpublic void end(ShellResponse response)
ShellProcessContext
end
in interface ShellProcessContext
response
- the shell responseCopyright © 2015 eXo Platform SAS. All Rights Reserved.