org.crsh.command
Class InnerInvocationContext<P>

java.lang.Object
  extended by org.crsh.command.InnerInvocationContext<P>
All Implemented Interfaces:
CommandContext, InvocationContext<Void,P>

 class InnerInvocationContext<P>
extends Object
implements InvocationContext<Void,P>

Author:
Julien Viet

Field Summary
(package private)  InvocationContext<?,?> outter
          .
(package private)  boolean piped
          .
(package private)  Class<? extends P> producedType
          .
(package private)  List<P> products
          .
 
Constructor Summary
InnerInvocationContext(InvocationContext<?,?> outter, Class<? extends P> producedType, boolean piped)
           
 
Method Summary
 Iterable<Void> consume()
          Returns an iterator over the stream of consumed items.
 Map<String,Object> getAttributes()
          Returns the attributes related to current shell session.
 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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outter

final InvocationContext<?,?> outter
.


producedType

final Class<? extends P> producedType
.


products

List<P> products
.


piped

final boolean piped
.

Constructor Detail

InnerInvocationContext

InnerInvocationContext(InvocationContext<?,?> outter,
                       Class<? extends P> producedType,
                       boolean piped)
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<Void,P>
Returns:
the term width

getProperty

public String getProperty(String propertyName)
Description copied from interface: InvocationContext
Returns a generic property.

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

readLine

public String readLine(String msg,
                       boolean echo)
Description copied from interface: InvocationContext
Display a message and read a line on the console.

Specified by:
readLine in interface InvocationContext<Void,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

getWriter

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

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

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<Void,P>
Returns:
true if the command is involved in a pipe

consume

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

Specified by:
consume in interface InvocationContext<Void,P>
Returns:
the consumed items
Throws:
IllegalStateException - if the command is not involved in a pipe operation

produce

public void produce(P product)
Description copied from interface: InvocationContext
Produce an item.

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

getAttributes

public Map<String,Object> getAttributes()
Description copied from interface: CommandContext
Returns the attributes related to current shell session.

Specified by:
getAttributes in interface CommandContext
Returns:
the session attributes


Copyright © 2012 eXo Platform SAS. All Rights Reserved.