org.crsh.command.impl
Class BaseInvocationContext<C,P>

java.lang.Object
  extended by org.crsh.command.impl.BaseCommandContext
      extended by org.crsh.command.impl.BaseInvocationContext<C,P>
All Implemented Interfaces:
CommandContext, InvocationContext<C,P>
Direct Known Subclasses:
InvocationContextImpl

public abstract class BaseInvocationContext<C,P>
extends BaseCommandContext
implements InvocationContext<C,P>

Version:
$Revision$
Author:
Julien Viet

Field Summary
protected  StringWriter buffer
          .
protected  Iterable<C> consumedItems
          .
protected  List<P> producedItems
          .
protected  ShellPrinter writer
          .
 
Constructor Summary
protected BaseInvocationContext(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()
           
 ShellPrinter getWriter()
          Returns the writer for the output.
 boolean isPiped()
          Returns true if the command is involved in a pipe operation and receives a stream.
 void produce(P product)
          Produce an item.
 
Methods inherited from class org.crsh.command.impl.BaseCommandContext
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.InvocationContext
getProperty, getWidth, readLine
 
Methods inherited from interface org.crsh.command.CommandContext
getAttributes
 

Field Detail

writer

protected ShellPrinter writer
.


buffer

protected StringWriter buffer
.


producedItems

protected List<P> producedItems
.


consumedItems

protected Iterable<C> consumedItems
.

Constructor Detail

BaseInvocationContext

protected BaseInvocationContext(Iterable<C> consumedItems,
                                Map<String,Object> attributes)
Method Detail

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)
Description copied from interface: InvocationContext
Produce an item.

Specified by:
produce in interface InvocationContext<C,P>
Parameters:
product - the item product

getWriter

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

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


Copyright © 2012 eXo Platform SAS. All Rights Reserved.