org.umber.catalan.queues
Interface ICommandQueue

All Known Subinterfaces:
IBulkCommandQueue
All Known Implementing Classes:
DatabaseQueue, DirectoryPollQueue, EmailQueue, ReaderQueue, SingleFileQueue, SocketQueue, StreamQueue

public interface ICommandQueue

Common interface for Catalan input queues. Might represent a queue of files in the filesystem, a series of rows in a database, or even a queue of emails in an SMTP mailbox. The queue is only a command retrieval interface; it does not invoke the commands.

Author:
jsheets

Method Summary
 boolean canQuit()
          Determines if the queue can safely shut down without losing its current status.
 void connect()
          Establishes a connection to the queue.
 void disconnect()
          Closes down the queue.
 IForgeCommand getNextCommand()
          Retrieves the next command in the queue, or null if queue is empty.
 boolean isConnected()
          Determines if the queue is currently connected to a live command feed.
 void sendResult(CommandResult result)
           
 

Method Detail

isConnected

public boolean isConnected()
Determines if the queue is currently connected to a live command feed.

Returns:
true if connected

connect

public void connect()
             throws CatalanQueueException
Establishes a connection to the queue.

Throws:
CatalanQueueException - if unable to connect to queue

disconnect

public void disconnect()
                throws CatalanQueueException
Closes down the queue.

Throws:
CatalanQueueException - if fatal error occurs

canQuit

public boolean canQuit()
Determines if the queue can safely shut down without losing its current status. This should only be called between commands.

Returns:
true if the queue can safely disconnect now

getNextCommand

public IForgeCommand getNextCommand()
                             throws CatalanQueueException,
                                    CatalanCommandException
Retrieves the next command in the queue, or null if queue is empty.

Returns:
processing command
Throws:
CatalanQueueException - if fatal queue error occurs
CatalanCommandException - if unable to process the command data

sendResult

public void sendResult(CommandResult result)
                throws CatalanQueueException
Throws:
CatalanQueueException