KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > print > attribute > standard > JobState


1 /*
2  * @(#)JobState.java 1.7 04/05/05
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.print.attribute.standard;
9
10 import javax.print.attribute.Attribute JavaDoc;
11 import javax.print.attribute.EnumSyntax JavaDoc;
12 import javax.print.attribute.PrintJobAttribute JavaDoc;
13
14 /**
15  * JobState is a printing attribute class, an enumeration, that identifies
16  * the current state of a print job. Class JobState defines standard job state
17  * values. A Print Service implementation only needs to report those job
18  * states which are appropriate for the particular implementation; it does not
19  * have to report every defined job state. The {@link JobStateReasons
20  * JobStateReasons} attribute augments the JobState attribute to give more
21  * detailed information about the job in the given job state.
22  * <P>
23  * <B>IPP Compatibility:</B> The category name returned by
24  * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
25  * integer value is the IPP enum value. The <code>toString()</code> method
26  * returns the IPP string representation of the attribute value.
27  * <P>
28  *
29  * @author Alan Kaminsky
30  */

31
32 public class JobState extends EnumSyntax JavaDoc implements PrintJobAttribute JavaDoc {
33
34     private static final long serialVersionUID = 400465010094018920L;
35
36     /**
37      * The job state is unknown.
38      */

39     public static final JobState JavaDoc UNKNOWN = new JobState JavaDoc(0);
40     
41     /**
42      * The job is a candidate to start processing, but is not yet processing.
43      */

44     public static final JobState JavaDoc PENDING = new JobState JavaDoc(3);
45     
46     /**
47      * The job is not a candidate for processing for any number of reasons but
48      * will return to the PENDING state as soon as the reasons are no longer
49      * present. The job's {@link JobStateReasons JobStateReasons} attribute must
50      * indicate why the job is no longer a candidate for processing.
51      */

52     public static final JobState JavaDoc PENDING_HELD = new JobState JavaDoc(4);
53     
54     /**
55      * The job is processing. One or more of the following activities is
56      * occurring:
57      * <OL TYPE=1>
58      * <LI>
59      * The job is using, or is attempting to use, one or more purely software
60      * processes that are analyzing, creating, or interpreting a PDL, etc.
61      * <P>
62      * <LI>
63      * The job is using, or is attempting to use, one or more hardware
64      * devices that are interpreting a PDL, making marks on a medium, and/or
65      * performing finishing, such as stapling, etc.
66      * <P>
67      * <LI>
68      * The printer has made the job ready for printing, but the output
69      * device is not yet printing it, either because the job hasn't reached the
70      * output device or because the job is queued in the output device or some
71      * other spooler, awaiting the output device to print it.
72      * </OL>
73      * <P>
74      * When the job is in the PROCESSING state, the entire job state includes
75      * the detailed status represented in the printer's {@link PrinterState
76      * PrinterState} and {@link PrinterStateReasons PrinterStateReasons}
77      * attributes.
78      * <P>
79      * Implementations may, though they need not, include additional values in
80      * the job's {@link JobStateReasons JobStateReasons} attribute to indicate
81      * the progress of the job, such as adding the JOB_PRINTING value to
82      * indicate when the output device is actually making marks on paper and/or
83      * the PROCESSING_TO_STOP_POINT value to indicate that the printer is in the
84      * process of canceling or aborting the job.
85      */

86     public static final JobState JavaDoc PROCESSING = new JobState JavaDoc (5);
87     
88     /**
89      * The job has stopped while processing for any number of reasons and will
90      * return to the PROCESSING state as soon as the reasons are no longer
91      * present.
92      * <P>
93      * The job's {@link JobStateReasons JobStateReasons} attribute may indicate
94      * why the job has stopped processing. For example, if the output device is
95      * stopped, the PRINTER_STOPPED value may be included in the job's {@link
96      * JobStateReasons JobStateReasons} attribute.
97      * <P>
98      * <I>Note:</I> When an output device is stopped, the device usually
99      * indicates its condition in human readable form locally at the device. A
100      * client can obtain more complete device status remotely by querying the
101      * printer's {@link PrinterState PrinterState} and {@link
102      * PrinterStateReasons PrinterStateReasons} attributes.
103      */

104     public static final JobState JavaDoc PROCESSING_STOPPED = new JobState JavaDoc (6);
105     
106     /**
107      * The job has been canceled by some human agency, the printer has completed
108      * canceling the job, and all job status attributes have reached their final
109      * values for the job. While the printer is canceling the job, the job
110      * remains in its current state, but the job's {@link JobStateReasons
111      * JobStateReasons} attribute should contain the PROCESSING_TO_STOP_POINT
112      * value and one of the CANCELED_BY_USER, CANCELED_BY_OPERATOR, or
113      * CANCELED_AT_DEVICE values. When the job moves to the CANCELED state, the
114      * PROCESSING_TO_STOP_POINT value, if present, must be removed, but the
115      * CANCELED_BY_<I>xxx</I> value, if present, must remain.
116      */

117     public static final JobState JavaDoc CANCELED = new JobState JavaDoc (7);
118     
119     /**
120      * The job has been aborted by the system (usually while the job was in the
121      * PROCESSING or PROCESSING_STOPPED state), the printer has completed
122      * aborting the job, and all job status attributes have reached their final
123      * values for the job. While the printer is aborting the job, the job
124      * remains in its current state, but the job's {@link JobStateReasons
125      * JobStateReasons} attribute should contain the PROCESSING_TO_STOP_POINT
126      * and ABORTED_BY_SYSTEM values. When the job moves to the ABORTED state,
127      * the PROCESSING_TO_STOP_POINT value, if present, must be removed, but the
128      * ABORTED_BY_SYSTEM value, if present, must remain.
129      */

130     public static final JobState JavaDoc ABORTED = new JobState JavaDoc (8);
131     
132     /**
133      * The job has completed successfully or with warnings or errors after
134      * processing, all of the job media sheets have been successfully stacked in
135      * the appropriate output bin(s), and all job status attributes have reached
136      * their final values for the job. The job's {@link JobStateReasons
137      * JobStateReasons} attribute should contain one of these values:
138      * COMPLETED_SUCCESSFULLY, COMPLETED_WITH_WARNINGS, or
139      * COMPLETED_WITH_ERRORS.
140      */

141     public static final JobState JavaDoc COMPLETED = new JobState JavaDoc (9);
142     
143     // Hidden constructors.
144

145     /**
146      * Construct a new job state enumeration value with the given integer value.
147      *
148      * @param value Integer value.
149      */

150     protected JobState(int value) {
151     super (value);
152     }
153         
154     private static final String JavaDoc[] myStringTable =
155     {"unknown",
156      null,
157      null,
158      "pending",
159      "pending-held",
160      "processing",
161      "processing-stopped",
162      "canceled",
163      "aborted",
164      "completed"};
165     
166     private static final JobState JavaDoc[] myEnumValueTable =
167     {UNKNOWN,
168      null,
169      null,
170      PENDING,
171      PENDING_HELD,
172      PROCESSING,
173      PROCESSING_STOPPED,
174      CANCELED,
175      ABORTED,
176      COMPLETED};
177     
178     /**
179      * Returns the string table for class JobState.
180      */

181     protected String JavaDoc[] getStringTable() {
182     return myStringTable;
183     }
184     
185     /**
186      * Returns the enumeration value table for class JobState.
187      */

188     protected EnumSyntax JavaDoc[] getEnumValueTable() {
189     return myEnumValueTable;
190     }
191     
192     /**
193      * Get the printing attribute class which is to be used as the "category"
194      * for this printing attribute value.
195      * <P>
196      * For class JobState and any vendor-defined subclasses, the category is
197      * class JobState itself.
198      *
199      * @return Printing attribute class (category), an instance of class
200      * {@link java.lang.Class java.lang.Class}.
201      */

202     public final Class JavaDoc<? extends Attribute JavaDoc> getCategory() {
203     return JobState JavaDoc.class;
204     }
205     
206     /**
207      * Get the name of the category of which this attribute value is an
208      * instance.
209      * <P>
210      * For class JobState and any vendor-defined subclasses, the category
211      * name is <CODE>"job-state"</CODE>.
212      *
213      * @return Attribute category name.
214      */

215     public final String JavaDoc getName() {
216     return "job-state";
217     }
218     
219 }
220
Popular Tags