class CRaSHProcessContext extends Object implements CommandContext<Object>, Closeable
Modifier and Type | Field and Description |
---|---|
private ScreenContextConsumer |
adapter
.
|
private ScreenBuffer |
buffer
.
|
private ShellProcessContext |
processContext
.
|
private CRaSHSession |
session
.
|
private boolean |
useAlternateBuffer
.
|
Constructor and Description |
---|
CRaSHProcessContext(CRaSHSession session,
ShellProcessContext processContext) |
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) |
void |
close() |
Screenable |
cls() |
void |
flush()
Flush the stream.
|
Map<String,Object> |
getAttributes()
Returns the current attributes.
|
Class<Object> |
getConsumedType()
Returns the class of the element generic type.
|
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.
|
Map<String,Object> |
getSession()
Returns the current session.
|
int |
getWidth()
Returns the screen width in chars.
|
void |
provide(Object element)
Provide an element.
|
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.
|
private final CRaSHSession session
private final ShellProcessContext processContext
private final ScreenContextConsumer adapter
private final ScreenBuffer buffer
private boolean useAlternateBuffer
CRaSHProcessContext(CRaSHSession session, ShellProcessContext processContext)
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 Class<Object> getConsumedType()
Consumer
getConsumedType
in interface Consumer<Object>
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 provide(Object element) throws IOException
Consumer
provide
in interface Consumer<Object>
element
- the provided elementIOException
public void flush() throws IOException
Consumer
flush
in interface Consumer<Object>
flush
in interface ScreenContext
IOException
- any io exceptionpublic Map<String,Object> getSession()
RuntimeContext
getSession
in interface RuntimeContext
public Map<String,Object> getAttributes()
RuntimeContext
getAttributes
in interface RuntimeContext
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in interface CommandContext<Object>
IOException
Copyright © 2015 eXo Platform SAS. All Rights Reserved.