org.crsh.shell.impl
Class InvocationContextImpl<C,P>

java.lang.Object
  extended by org.crsh.shell.impl.CommandContextImpl
      extended by org.crsh.shell.impl.InvocationContextImpl<C,P>
All Implemented Interfaces:
CommandContext, InvocationContext<C,P>

 class InvocationContextImpl<C,P>
extends CommandContextImpl
implements InvocationContext<C,P>

Version:
$Revision$
Author:
Julien Viet

Field Summary
private  StringWriter buffer
          .
private  Iterable<C> consumedItems
          .
private  ShellProcessContext processContext
          .
private  List<P> products
          .
private  ShellPrinter writer
          .
 
Constructor Summary
InvocationContextImpl(ShellProcessContext processContext, Iterable<C> consumedItems, Map<String,Object> attributes)
           
 
Method Summary
 Iterable<C> consume()
          Returns an iterator over the stream of consumed items.
 StringWriter getBuffer()
           
 List<P> getProducedItems()
           
 int getWidth()
          Returns the term width in chars.
 ShellPrinter getWriter()
           
 boolean isPiped()
          Returns true if the command is involved in a pipe operation and receives a stream.
 void produce(P product)
           
 String readLine(String msg, boolean echo)
           
 
Methods inherited from class org.crsh.shell.impl.CommandContextImpl
getAttributes
 
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
 

Field Detail

processContext

private final ShellProcessContext processContext
.


writer

private ShellPrinter writer
.


buffer

private StringWriter buffer
.


products

private List<P> products
.


consumedItems

private Iterable<C> consumedItems
.

Constructor Detail

InvocationContextImpl

InvocationContextImpl(ShellProcessContext processContext,
                      Iterable<C> consumedItems,
                      Map<String,Object> attributes)
Method Detail

getWidth

public int getWidth()
Description copied from interface: InvocationContext
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 InvocationContext<C,P>
Returns:
the term width

getProducedItems

public List<P> getProducedItems()

getBuffer

public StringWriter getBuffer()

isPiped

public boolean isPiped()
Description copied from interface: InvocationContext
Returns true if the command is involved in a pipe operation and receives a stream.

Specified by:
isPiped in interface InvocationContext<C,P>
Returns:
true if the command is involved in a pipe

consume

public Iterable<C> consume()
Description copied from interface: InvocationContext
Returns an iterator over the stream of consumed items.

Specified by:
consume in interface InvocationContext<C,P>
Returns:
the consumed items

produce

public void produce(P product)
Specified by:
produce in interface InvocationContext<C,P>

getWriter

public ShellPrinter getWriter()
Specified by:
getWriter in interface InvocationContext<C,P>

readLine

public String readLine(String msg,
                       boolean echo)
Specified by:
readLine in interface InvocationContext<C,P>


Copyright © 2011 eXo Platform SAS. All Rights Reserved.