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
          .
(package private)  ProcessContext current
          .
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
          .
private  boolean reading
           
(package private)  Shell shell
          .
(package private)  Status status
          .
(package private)  Term term
          .
private  Object termLock
          .
(package private)  boolean waitingEvent
          A flag useful for unit testing to know when the thread is reading.
(package private)  Runnable WRITE_PROMPT
          .
 
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

NOOP

static final Runnable NOOP
.


WRITE_PROMPT

final Runnable WRITE_PROMPT
.


CLOSE

final Runnable CLOSE
.


READ_TERM

private final Runnable READ_TERM
.


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
.


termLock

private final Object termLock
.


reading

private boolean reading
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 © 2013 eXo Platform SAS. All Rights Reserved.