org.crsh.processor.term
Class Processor

java.lang.Object
  extended by org.crsh.processor.term.Processor
All Implemented Interfaces:
Flushable, Runnable, Consumer<Chunk>

public final class Processor
extends Object
implements Runnable, Consumer<Chunk>


Field Summary
(package private)  Runnable CLOSE_TASK
          .
private static Text CONTINUE_PROMPT
          .
(package private)  ProcessContext current
          .
private  StringBuffer lineBuffer
          .
private  CloseableList listeners
          .
(package private)  Object lock
          .
(package private)  Logger log
          .
(package private) static Runnable NOOP
          .
(package private)  LinkedList<TermEvent> queue
          .
private  Runnable READ_TERM_TASK
          .
(package private)  Shell shell
          .
(package private)  Status status
          .
(package private)  Term term
          .
private  Object termLock
          .
private  boolean termReading
          .
(package private)  boolean waitingEvent
          A flag useful for unit testing to know when the thread is reading.
(package private)  Runnable WRITE_PROMPT_TASK
          .
 
Constructor Summary
Processor(Term term, Shell shell)
           
 
Method Summary
 void addListener(Closeable listener)
           
(package private)  void close()
           
private  void complete(CharSequence prefix)
           
 void flush()
           
 Class<Chunk> getConsumedType()
          Returns the class of the element generic type.
 boolean isWaitingEvent()
           
(package private)  boolean iterate()
           
(package private)  ProcessContext peekProcess()
           
 void provide(Chunk element)
          Provide an element.
(package private)  void readTerm()
           
 void run()
           
(package private)  void writePromptFlush()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTINUE_PROMPT

private static final Text CONTINUE_PROMPT
.


NOOP

static final Runnable NOOP
.


WRITE_PROMPT_TASK

final Runnable WRITE_PROMPT_TASK
.


CLOSE_TASK

final Runnable CLOSE_TASK
.


READ_TERM_TASK

private final Runnable READ_TERM_TASK
.


log

final Logger log
.


term

final Term term
.


shell

final Shell shell
.


queue

final LinkedList<TermEvent> queue
.


lock

final Object lock
.


current

ProcessContext current
.


status

Status status
.


waitingEvent

volatile boolean waitingEvent
A flag useful for unit testing to know when the thread is reading.


listeners

private final CloseableList listeners
.


lineBuffer

private final StringBuffer lineBuffer
.


termLock

private final Object termLock
.


termReading

private boolean termReading
.

Constructor Detail

Processor

public Processor(Term term,
                 Shell shell)
Method Detail

isWaitingEvent

public boolean isWaitingEvent()

run

public void run()
Specified by:
run in interface Runnable

iterate

boolean iterate()
          throws InterruptedException,
                 IOException
Throws:
InterruptedException
IOException

peekProcess

ProcessContext peekProcess()

readTerm

void readTerm()

close

void close()

addListener

public void addListener(Closeable listener)

getConsumedType

public Class<Chunk> getConsumedType()
Description copied from interface: Consumer
Returns the class of the element generic type.

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

provide

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

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

flush

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

writePromptFlush

void writePromptFlush()

complete

private void complete(CharSequence prefix)


Copyright © 2014 eXo Platform SAS. All Rights Reserved.