class PipeLineElement<C,P> extends Object implements Filter<C,P,CommandContext<P>>, CommandContext<C>
| Modifier and Type | Field and Description |
|---|---|
(package private) Filter<C,P,CommandContext<P>> |
command
.
|
(package private) Class<C> |
consumedType
.
|
protected CommandContext<P> |
context
.
|
| Constructor and Description |
|---|
PipeLineElement(Filter<C,P,CommandContext<P>> command) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the producer.
|
void |
flush() |
Map<String,Object> |
getAttributes()
Returns the current attributes.
|
Class<C> |
getConsumedType()
Returns the class of the element generic type.
|
int |
getHeight()
Returns the screen 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 session.
|
int |
getWidth()
Returns the screen width in chars.
|
boolean |
isPiped() |
void |
open(CommandContext<P> consumer)
Open the producer with the specified consumer.
|
void |
provide(C element)
Provide an element.
|
String |
readLine(String msg,
boolean echo)
Display a message and read a line on the console, this method call can be blocking until the user provides
a value.
|
boolean |
releaseAlternateBuffer()
Release control of the alternate buffer.
|
boolean |
takeAlternateBuffer()
Take control of the alternate buffer.
|
void |
write(Chunk chunk)
Write a chunk to the screen.
|
protected CommandContext<P> context
final Class<C> consumedType
PipeLineElement(Filter<C,P,CommandContext<P>> command)
public final boolean takeAlternateBuffer() throws IOException
InteractionContextFlushable.flush() method
is invoked.takeAlternateBuffer in interface InteractionContextIOExceptionpublic final boolean releaseAlternateBuffer() throws IOException
InteractionContextFlushable.flush() method
is invoked.releaseAlternateBuffer in interface InteractionContextIOExceptionpublic final String getProperty(String propertyName)
InteractionContextgetProperty in interface InteractionContextpropertyName - the property namepublic final String readLine(String msg, boolean echo) throws IOException, InterruptedException
InteractionContextreadLine in interface InteractionContextmsg - the message to display before reading a lineecho - wether or not the line read should be echoed when typingIOException - any io exceptionInterruptedException - the thread was interrupted while waiting for the user valuepublic final int getWidth()
ScreenContextgetWidth in interface ScreenContextpublic final int getHeight()
ScreenContextgetHeight in interface ScreenContextpublic Map<String,Object> getSession()
RuntimeContextgetSession in interface RuntimeContextpublic Map<String,Object> getAttributes()
RuntimeContextgetAttributes in interface RuntimeContextpublic boolean isPiped()
isPiped in interface CommandContext<C>public Class<P> getProducedType()
ProducergetProducedType in interface Producer<P,CommandContext<P>>public Class<C> getConsumedType()
ConsumergetConsumedType in interface Consumer<C>public void open(CommandContext<P> consumer)
Produceropen in interface Producer<P,CommandContext<P>>consumer - the consumerpublic void write(Chunk chunk) throws IOException
ScreenContextwrite in interface ScreenContextchunk - the chunkIOException - any io exceptionpublic void provide(C element) throws IOException
Consumerprovide in interface Consumer<C>element - the provided elementIOExceptionpublic void flush() throws IOException
flush in interface FlushableIOExceptionpublic void close() throws ScriptException, IOException
Producerclose in interface Closeableclose in interface AutoCloseableclose in interface Producer<P,CommandContext<P>>IOException - any io exceptionScriptExceptionCopyright © 2014 eXo Platform SAS. All Rights Reserved.