org.crsh.shell.impl.command
Class CRaSHInvocationContext<P>

java.lang.Object
  extended by org.crsh.command.BaseCommandContext
      extended by org.crsh.shell.impl.command.CRaSHInvocationContext<P>
All Implemented Interfaces:
Flushable, CommandContext, InvocationContext<P>, InteractionContext<P>, Pipe<P>

public class CRaSHInvocationContext<P>
extends BaseCommandContext
implements InvocationContext<P>


Field Summary
private  ShellProcessContext processContext
          .
protected  Pipe<Object> producer
          .
private  RenderPrintWriter writer
          .
 
Constructor Summary
protected CRaSHInvocationContext(ShellProcessContext processContext, Map<String,Object> session, Map<String,Object> attributes, Pipe<Object> producer)
           
 
Method Summary
 void flush()
           
 int getHeight()
          Returns the term height in chars.
 String getProperty(String propertyName)
          Returns a generic property, usually this property is resolved by the shell client.
 int getWidth()
          Returns the term width in chars.
 RenderPrintWriter getWriter()
          Returns the writer for the output.
 void provide(P element)
          Provide an element.
 String readLine(String msg, boolean echo)
          Display a message and read a line on the console.
 
Methods inherited from class org.crsh.command.BaseCommandContext
getAttributes, getSession
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.crsh.command.CommandContext
getAttributes, getSession
 

Field Detail

processContext

private final ShellProcessContext processContext
.


writer

private RenderPrintWriter writer
.


producer

protected Pipe<Object> producer
.

Constructor Detail

CRaSHInvocationContext

protected CRaSHInvocationContext(ShellProcessContext processContext,
                                 Map<String,Object> session,
                                 Map<String,Object> attributes,
                                 Pipe<Object> producer)
Method Detail

getWidth

public int getWidth()
Description copied from interface: InteractionContext
Returns the term width in chars. When the value is not positive it means the value could not be determined.

Specified by:
getWidth in interface InteractionContext<P>
Returns:
the term width

getHeight

public int getHeight()
Description copied from interface: InteractionContext
Returns the term height in chars. When the value is not positive it means the value could not be determined.

Specified by:
getHeight in interface InteractionContext<P>
Returns:
the term height

getProperty

public String getProperty(String propertyName)
Description copied from interface: InteractionContext
Returns a generic property, usually this property is resolved by the shell client.

Specified by:
getProperty in interface InteractionContext<P>
Parameters:
propertyName - the property name
Returns:
the property value

readLine

public String readLine(String msg,
                       boolean echo)
Description copied from interface: InteractionContext
Display a message and read a line on the console. If no line can be read then null is returned.

Specified by:
readLine in interface InteractionContext<P>
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

provide

public void provide(P element)
             throws IOException
Description copied from interface: Pipe
Provide an element.

Specified by:
provide in interface Pipe<P>
Parameters:
element - the provided element
Throws:
IOException

flush

public void flush()
           throws IOException
Specified by:
flush in interface Flushable
Throws:
IOException

getWriter

public RenderPrintWriter getWriter()
Description copied from interface: InvocationContext
Returns the writer for the output.

Specified by:
getWriter in interface InvocationContext<P>
Returns:
the writer


Copyright © 2012 eXo Platform SAS. All Rights Reserved.