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  Iterable<C> consumedItems
          .
protected  List<P> producedItems
          .
protected  CharReader reader
          .
protected  ShellPrinter writer
          .
 
Constructor Summary
protected BaseInvocationContext(Iterable<C> consumedItems, Map<String,Object> session, Map<String,Object> attributes)
           
 
Method Summary
 Iterable<C> consume()
          Returns an iterator over the stream of consumed items.
 List<P> getProducedItems()
           
 CharReader getReader()
           
 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, 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.InvocationContext
getProperty, getWidth, readLine
 
Methods inherited from interface org.crsh.command.CommandContext
getAttributes, getSession
 

Field Detail

writer

protected ShellPrinter writer
.


reader

protected CharReader reader
.


producedItems

protected List<P> producedItems
.


consumedItems

protected Iterable<C> consumedItems
.

Constructor Detail

BaseInvocationContext

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

getProducedItems

public List<P> getProducedItems()

getReader

public CharReader getReader()

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.