|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.umber.catalan.queues.StreamQueue
Queue which loads commands from a single InputStream and writes the processed results to a single OutputStream.
Constructor Summary | |
StreamQueue(java.io.InputStream input,
java.io.OutputStream output)
Creates a new instance of DirectoryPollQueue. |
Method Summary | |
protected abstract IForgeCommand |
buildCommand(java.io.InputStream input)
Loads a IForgeCommand object from the InputStream. |
boolean |
canQuit()
Determines if the queue can safely disconnect without losing its current status. |
void |
connect()
Establishes a connection to the queue. |
void |
disconnect()
Closes down the queue. |
protected java.io.InputStream |
getInput()
Retrieves the input stream. |
IForgeCommand |
getNextCommand()
Retrieves the next command in the queue, or null if queue is empty. |
protected java.io.OutputStream |
getOutput()
Retrieves the output stream. |
boolean |
isConnected()
Determines if the queue is currently connected to a live command feed. |
void |
sendResult(CommandResult result)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public StreamQueue(java.io.InputStream input, java.io.OutputStream output)
input
- stream to pull command files fromoutput
- stream to write completed command files toMethod Detail |
protected abstract IForgeCommand buildCommand(java.io.InputStream input) throws CatalanCommandException
input
- raw data stream of command data
CatalanCommandException
- if unable to load or convert the command dataprotected java.io.InputStream getInput()
protected java.io.OutputStream getOutput()
public boolean isConnected()
isConnected
in interface ICommandQueue
public void connect() throws CatalanQueueException
This implementation checks for valid input and output streams.
connect
in interface ICommandQueue
CatalanQueueException
- if unable to fully access input and
output streamspublic void disconnect() throws CatalanQueueException
This implementation closes the input and output streams.
disconnect
in interface ICommandQueue
CatalanQueueException
- if unable to close streams.public boolean canQuit()
This implementation always returns true.
canQuit
in interface ICommandQueue
public IForgeCommand getNextCommand() throws CatalanQueueException, CatalanCommandException
This implementation reads the next command from the InputStream.
getNextCommand
in interface ICommandQueue
CatalanQueueException
- if the input stream is not readable
CatalanCommandException
- if unable to process the command datapublic void sendResult(CommandResult result) throws CatalanQueueException
sendResult
in interface ICommandQueue
CatalanQueueException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |