org.crsh.shell.impl.command
Class SinkPipeFilter<P>

java.lang.Object
  extended by org.crsh.shell.impl.command.SinkPipeFilter<P>
All Implemented Interfaces:
Closeable, Flushable, InteractionContext, Consumer<Object>, Filter<Object,P>, IOContext<Object>, Pipe<Object>, Producer<P>, ProducerContext<Object>, SessionContext

 class SinkPipeFilter<P>
extends Object
implements Filter<Object,P>


Field Summary
private  Filter<P,?> context
          .
private  Class<P> producedType
          .
 
Constructor Summary
SinkPipeFilter(Class<P> producedType)
           
 
Method Summary
 void close()
          Close the producer.
 void flush()
           
 Map<String,Object> getAttributes()
          Returns the current shell attributes.
 Class<Object> getConsumedType()
          Returns the class of the consumed type.
 int getHeight()
          Returns the term height in chars.
 Class<P> getProducedType()
          Returns the class of the produced type.
 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.
 void open(ProducerContext<P> context)
          Open the producer with the specified context.
 void provide(Object element)
          Provide an element.
 String readLine(String msg, boolean echo)
          Display a message and read a line on the console.
 void setPiped(boolean piped)
          Set the pipe status.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

private Filter<P,?> context
.


producedType

private final Class<P> producedType
.

Constructor Detail

SinkPipeFilter

SinkPipeFilter(Class<P> producedType)
Method Detail

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

getProducedType

public Class<P> getProducedType()
Description copied from interface: Producer
Returns the class of the produced type.

Specified by:
getProducedType in interface Producer<P>
Returns:
the produced type

setPiped

public void setPiped(boolean piped)
Description copied from interface: Producer
Set the pipe status.

Specified by:
setPiped in interface Producer<P>
Parameters:
piped - the piped status

open

public void open(ProducerContext<P> context)
Description copied from interface: Producer
Open the producer with the specified context.

Specified by:
open in interface Producer<P>
Parameters:
context - the context

close

public void close()
Description copied from interface: Producer
Close the producer.

Specified by:
close in interface Closeable
Specified by:
close in interface Producer<P>

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<Object>
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<Object>
Returns:
the term height

provide

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

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

getConsumedType

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

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

flush

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


Copyright © 2012 eXo Platform SAS. All Rights Reserved.