org.simoes.lpd.util
Class PrintQueue

java.lang.Object
  extended byorg.simoes.lpd.util.PrintQueue
Direct Known Subclasses:
PrintQueueWithTableModel

public class PrintQueue
extends java.lang.Object

The PrintQueue is just a queue that only accepts print jobs still need to figure out how the events get sent

Author:
Jason Crowe

Field Summary
protected  Lock lock
           
protected  Queue queue
           
 
Constructor Summary
PrintQueue(java.lang.String name)
          constructor.
 
Method Summary
 long add(PrintJob printJob)
          add print job to queue.
 void closeQueue()
           
 Lock getLock()
           
 QueuedPrintJob getNextPrintJob()
          Gets the next PrintJob without removing it.
 java.util.List list()
          list items in queue.
 PrintJob remove(long id)
          remove print job from queue.
 int removeAll()
          remove all print jobs from queue.
 int size()
          size of the print queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lock

protected final Lock lock

queue

protected Queue queue
Constructor Detail

PrintQueue

public PrintQueue(java.lang.String name)
constructor.

Parameters:
name - - name of the print queue.
Method Detail

getLock

public Lock getLock()

add

public long add(PrintJob printJob)
add print job to queue.

Returns:
the unique identifier of the print job in the queue.

remove

public PrintJob remove(long id)
                throws ObjectNotFoundException
remove print job from queue.

Returns:
PrintJob from the queue or null if it was not found
Throws:
ObjectNotFoundException

getNextPrintJob

public QueuedPrintJob getNextPrintJob()
                               throws ObjectNotFoundException
Gets the next PrintJob without removing it.

Returns:
PrintJob the next printJob in the queue or null if theres an error
Throws:
ObjectNotFoundException

removeAll

public int removeAll()
remove all print jobs from queue.

Returns:
number of jobs removed, or -1 if this failed

size

public int size()
size of the print queue.

Returns:
size of the print queue.

list

public java.util.List list()
list items in queue.

Throws:
java.lang.ClassCastException - if queue contains non print jobs.

closeQueue

public void closeQueue()