org.crsh.shell
Interface InteractionContext

All Superinterfaces:
Appendable, Screenable, ScreenContext
All Known Subinterfaces:
CommandContext<P>, InvocationContext<P>, ShellProcessContext
All Known Implementing Classes:
AbstractInvocationContext, ClientProcessContext, CommandInvokerAdapter, CRaSHProcessContext, InvocationContextImpl, PipeLineInvocationContext, ProcessContext, ProcessHandler, SSHInlineShellProcessContext

public interface InteractionContext
extends ScreenContext

The interaction context extends the screen context and provides interaction with the client.


Method Summary
 String getProperty(String propertyName)
          Returns a generic property, usually this property is resolved by the shell client.
 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.
 
Methods inherited from interface org.crsh.text.ScreenContext
flush, getHeight, getWidth
 
Methods inherited from interface org.crsh.text.Screenable
append, cls
 
Methods inherited from interface java.lang.Appendable
append, append, append
 

Method Detail

takeAlternateBuffer

boolean takeAlternateBuffer()
                            throws IOException
Take control of the alternate buffer. When the alternate buffer is already used nothing happens. The buffer switch should occur when then ScreenContext.flush() method is invoked.

Returns:
true if the alternate buffer is shown
Throws:
IOException

releaseAlternateBuffer

boolean releaseAlternateBuffer()
                               throws IOException
Release control of the alternate buffer. When the normal buffer is already used nothing happens. The buffer switch should occur when then ScreenContext.flush() method is invoked.

Returns:
true if the usual buffer is shown
Throws:
IOException

getProperty

String getProperty(String propertyName)
Returns a generic property, usually this property is resolved by the shell client.

Parameters:
propertyName - the property name
Returns:
the property value

readLine

String readLine(String msg,
                boolean echo)
                throws IOException,
                       InterruptedException,
                       IllegalStateException
Display a message and read a line on the console, this method call can be blocking until the user provides a value. If no line can be read then null is returned.

Parameters:
msg - the message to display before reading a line
echo - wether or not the line read should be echoed when typing
Returns:
the line read
Throws:
IOException - any io exception
InterruptedException - the thread was interrupted while waiting for the user value
IllegalStateException - if reading a line is not at the appropriate time


Copyright © 2015 eXo Platform SAS. All Rights Reserved.