org.crsh.command
Interface InvocationContext<C,P>

All Superinterfaces:
CommandContext
All Known Implementing Classes:
BaseInvocationContext, InnerInvocationContext, InvocationContextImpl

public interface InvocationContext<C,P>
extends CommandContext

The invocation context provided to a command during the invocation phase. The invocation context provides the various interactions that a command can perform with its context during its invocation.

Version:
$Revision$
Author:
Julien Viet

Method Summary
 Iterable<C> consume()
          Returns an iterator over the stream of consumed items.
 String getProperty(String propertyName)
          Returns a generic property.
 int getWidth()
          Returns the term width in chars.
 PrintWriter 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.
 String readLine(String msg, boolean echo)
          Display a message and read a line on the console.
 
Methods inherited from interface org.crsh.command.CommandContext
getAttributes
 

Method Detail

getWidth

int getWidth()
Returns the term width in chars. When the value is not positive it means the value could not be determined.

Returns:
the term width

getProperty

String getProperty(String propertyName)
Returns a generic property.

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

readLine

String readLine(String msg,
                boolean echo)
Display a message and read a line on the console.

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

getWriter

PrintWriter getWriter()
Returns the writer for the output.

Returns:
the writer

isPiped

boolean isPiped()
Returns true if the command is involved in a pipe operation and receives a stream.

Returns:
true if the command is involved in a pipe

consume

Iterable<C> consume()
                    throws IllegalStateException
Returns an iterator over the stream of consumed items.

Returns:
the consumed items
Throws:
IllegalStateException - if the command is not involved in a pipe operation

produce

void produce(P product)
Produce an item.

Parameters:
product - the item product


Copyright © 2012 eXo Platform SAS. All Rights Reserved.