org.crsh.shell.impl.command.spi
Class CommandInvoker<C,P>

java.lang.Object
  extended by org.crsh.shell.impl.command.spi.CommandInvoker<C,P>
Type Parameters:
C - the consumed element generic type
P - the produced element generic type
All Implemented Interfaces:
Consumer<C>, Filter<C,P,CommandContext<? super P>>, Producer<P,CommandContext<? super P>>
Direct Known Subclasses:
BaseCommandMatch.BaseInvoker, ClosureInvoker, PipeLine

public abstract class CommandInvoker<C,P>
extends Object
implements Filter<C,P,CommandContext<? super P>>

A command invoker is a filter for a CommandContext kind of consumer.


Constructor Summary
CommandInvoker()
           
 
Method Summary
abstract  void close()
          Close the producer.
abstract  void flush()
          Flush the stream.
 KeyHandler getKeyHandler()
          Return the key handler or null if the invoker cannot handler key events.
 ScreenContext getScreenContext()
          Provide an opportunity for the command to implement screen context.
 void invoke(CommandContext<? super P> consumer)
          Invoke the command.
abstract  void open(CommandContext<? super P> consumer)
          Open the producer with the specified consumer.
abstract  void provide(C element)
          Provide an element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.crsh.stream.Consumer
getConsumedType
 
Methods inherited from interface org.crsh.stream.Producer
getProducedType
 

Constructor Detail

CommandInvoker

public CommandInvoker()
Method Detail

invoke

public final void invoke(CommandContext<? super P> consumer)
                  throws IOException,
                         CommandException
Invoke the command.

Parameters:
consumer - the consumer for this invocation
Throws:
IOException - any io exception
CommandException - anything command exception

flush

public abstract void flush()
                    throws IOException
Description copied from interface: Consumer
Flush the stream.

Specified by:
flush in interface Consumer<C>
Throws:
IOException - any io exception

provide

public abstract void provide(C element)
                      throws IOException,
                             CommandException
Description copied from interface: Consumer
Provide an element.

Specified by:
provide in interface Consumer<C>
Parameters:
element - the provided element
Throws:
IOException
CommandException

open

public abstract void open(CommandContext<? super P> consumer)
                   throws IOException,
                          CommandException
Description copied from interface: Producer
Open the producer with the specified consumer.

Specified by:
open in interface Producer<P,CommandContext<? super P>>
Parameters:
consumer - the consumer
Throws:
IOException
CommandException

close

public abstract void close()
                    throws IOException,
                           CommandException
Description copied from interface: Producer
Close the producer.

Specified by:
close in interface Producer<P,CommandContext<? super P>>
Throws:
IOException
CommandException

getScreenContext

public ScreenContext getScreenContext()
Provide an opportunity for the command to implement screen context.

Returns:
the screen context

getKeyHandler

public KeyHandler getKeyHandler()
Return the key handler or null if the invoker cannot handler key events.

Returns:
the key handler


Copyright © 2015 eXo Platform SAS. All Rights Reserved.