org.simoes.lpd.util
Class Queues

java.lang.Object
  extended byorg.simoes.lpd.util.Queues

public class Queues
extends java.lang.Object

This class maintains all of the Print queues and contains all of the logic for performing operations on them.

Author:
Chris Simoes

Method Summary
 void addPrintJob(java.lang.String queueName, PrintJob printJob)
          Adds a printJob to the queue specified by queueName.
 void createQueue(java.lang.String queueName)
          Creates a Print Queue with the name passed in
 PrintQueue createQueueWithTableModel(java.lang.String queueName, PrintJobTableModel tableModel)
          Creates a Print Queue with the name passed in and creates a TableModel for the GUI.
static Queues getInstance()
          This class is a singleton.
 QueuedPrintJob getNextPrintJob(java.lang.String queueName)
           
 Lock getQueueLock(java.lang.String queueName)
           
 int getQueueSize(java.lang.String queueName)
           
 java.util.List listAllPrintJobs(java.lang.String queueName)
          Returns a List of all print jobs in the Queue.
 void removeAllPrintJobs(java.lang.String queueName)
          Deletes all printJobs for this queue.
 void removePrintJob(java.lang.String queueName, java.lang.String user, java.lang.String jobNumber)
          Removes a printJob based on queueName and the jobNumber.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Queues getInstance()
This class is a singleton.

Returns:
the only instance of Queues.

createQueue

public void createQueue(java.lang.String queueName)
                 throws QueueException
Creates a Print Queue with the name passed in

Parameters:
queueName - - the name of the print queue
Throws:
QueueException

createQueueWithTableModel

public PrintQueue createQueueWithTableModel(java.lang.String queueName,
                                            PrintJobTableModel tableModel)
                                     throws QueueException
Creates a Print Queue with the name passed in and creates a TableModel for the GUI.

Parameters:
queueName - - the name of the print queue
tableModel - - the TableModel passed to the View
Returns:
a PrintQueue object that was just created.
Throws:
QueueException

addPrintJob

public void addPrintJob(java.lang.String queueName,
                        PrintJob printJob)
                 throws QueueException
Adds a printJob to the queue specified by queueName.

Parameters:
queueName - - the name of the print queue
printJob - - the printJob added to the print queue
Throws:
QueueException

removePrintJob

public void removePrintJob(java.lang.String queueName,
                           java.lang.String user,
                           java.lang.String jobNumber)
                    throws QueueException
Removes a printJob based on queueName and the jobNumber.

Parameters:
queueName - - the name of the print queue
user - - the user trying to delete the print job
jobNumber - - the print job number assigned by the Queue
Throws:
QueueException

removeAllPrintJobs

public void removeAllPrintJobs(java.lang.String queueName)
                        throws QueueException
Deletes all printJobs for this queue.

Parameters:
queueName - - the name of the print queue
Throws:
QueueException

listAllPrintJobs

public java.util.List listAllPrintJobs(java.lang.String queueName)
                                throws QueueException
Returns a List of all print jobs in the Queue.

Parameters:
queueName - the name of the queue we are wanting to list
Returns:
a List of all print jobs in the Queue
Throws:
QueueException - thrown if we have problems getting the queue list

getQueueSize

public int getQueueSize(java.lang.String queueName)
                 throws QueueException
Throws:
QueueException

getQueueLock

public Lock getQueueLock(java.lang.String queueName)
                  throws QueueException
Throws:
QueueException

getNextPrintJob

public QueuedPrintJob getNextPrintJob(java.lang.String queueName)
                               throws QueueException
Throws:
QueueException