org.crsh.command
Class InvocationContextImpl<P>

java.lang.Object
  extended by org.crsh.command.InvocationContextImpl<P>
All Implemented Interfaces:
Flushable, InvocationContext<P>, InteractionContext, Consumer<P>, IOContext<P>, Pipe<P>, ProducerContext<P>, SessionContext

 class InvocationContextImpl<P>
extends Object
implements InvocationContext<P>


Field Summary
private  ProducerContext<P> producerContext
          .
private  RenderPrintWriter writer
          .
 
Constructor Summary
InvocationContextImpl(ProducerContext<P> producerContext)
           
 
Method Summary
 void flush()
           
 Map<String,Object> getAttributes()
          Returns the current shell attributes.
 Class<P> getConsumedType()
          Returns the class of the consumed type.
 int getHeight()
          Returns the term height in chars.
 String getProperty(String propertyName)
          Returns a generic property, usually this property is resolved by the shell client.
 Map<String,Object> getSession()
          Returns the current shell session.
 int getWidth()
          Returns the term width in chars.
 RenderPrintWriter getWriter()
          Returns the writer for the output.
 void provide(P element)
          Provide an element.
 String readLine(String msg, boolean echo)
          Display a message and read a line on the console.
 CommandInvoker<?,?> resolve(String s)
          Resolve a command invoker for the specified command line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

producerContext

private final ProducerContext<P> producerContext
.


writer

private RenderPrintWriter writer
.

Constructor Detail

InvocationContextImpl

InvocationContextImpl(ProducerContext<P> producerContext)
Method Detail

getWriter

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

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

resolve

public CommandInvoker<?,?> resolve(String s)
                            throws ScriptException,
                                   IOException
Description copied from interface: InvocationContext
Resolve a command invoker for the specified command line.

Specified by:
resolve in interface InvocationContext<P>
Parameters:
s - the command line
Returns:
the command invoker
Throws:
ScriptException - any script exception
IOException - any io exception

getConsumedType

public Class<P> getConsumedType()
Description copied from interface: Consumer
Returns the class of the consumed type.

Specified by:
getConsumedType in interface Consumer<P>
Returns:
the consumed type

getProperty

public String getProperty(String propertyName)
Description copied from interface: InteractionContext
Returns a generic property, usually this property is resolved by the shell client.

Specified by:
getProperty in interface InteractionContext
Parameters:
propertyName - the property name
Returns:
the property value

readLine

public String readLine(String msg,
                       boolean echo)
Description copied from interface: InteractionContext
Display a message and read a line on the console. If no line can be read then null is returned.

Specified by:
readLine in interface InteractionContext
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

getWidth

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

getHeight

public int getHeight()
Description copied from interface: IOContext
Returns the term height in chars. When the value is not positive it means the value could not be determined.

Specified by:
getHeight in interface IOContext<P>
Returns:
the term height

provide

public void provide(P element)
             throws IOException
Description copied from interface: Pipe
Provide an element.

Specified by:
provide in interface Pipe<P>
Parameters:
element - the provided element
Throws:
IOException

flush

public void flush()
           throws IOException
Specified by:
flush in interface Flushable
Throws:
IOException

getSession

public Map<String,Object> getSession()
Description copied from interface: SessionContext
Returns the current shell session.

Specified by:
getSession in interface SessionContext
Returns:
the session map

getAttributes

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

Specified by:
getAttributes in interface SessionContext
Returns:
the attributes map


Copyright © 2012 eXo Platform SAS. All Rights Reserved.