KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)JobStateReason.java 1.8 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 package javax.print.attribute.standard;
8
9 import javax.print.attribute.EnumSyntax JavaDoc;
10 import javax.print.attribute.Attribute JavaDoc;
11
12 /**
13  * Class JobStateReason is a printing attribute class, an enumeration, that
14  * provides additional information about the job's current state, i.e.,
15  * information that augments the value of the job's {@link JobState JobState}
16  * attribute. Class JobStateReason defines standard job state reason values. A
17  * Print Service implementation only needs to report those job state
18  * reasons which are appropriate for the particular implementation; it does not
19  * have to report every defined job state reason.
20  * <P>
21  * Instances of JobStateReason do not appear in a Print Job's attribute set
22  * directly. Rather, a {@link JobStateReasons JobStateReasons} attribute appears
23  * in the Print Job's attribute set. The {@link JobStateReasons JobStateReasons}
24  * attribute contains zero, one, or more than one JobStateReason objects which
25  * pertain to the Print Job's status. The printer adds a JobStateReason object
26  * to the Print Job's {@link JobStateReasons JobStateReasons} attribute when the
27  * corresponding condition becomes true of the Print Job, and the printer
28  * removes the JobStateReason object again when the corresponding condition
29  * becomes false, regardless of whether the Print Job's overall {@link JobState
30  * JobState} also changed.
31  * <P>
32  * <B>IPP Compatibility:</B> The category name returned by
33  * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
34  * integer value is the IPP enum value. The <code>toString()</code> method
35  * returns the IPP string representation of the attribute value.
36  * <P>
37  *
38  * @author Alan Kaminsky
39  */

40 public class JobStateReason extends EnumSyntax JavaDoc implements Attribute JavaDoc {
41
42     private static final long serialVersionUID = -8765894420449009168L;
43     
44     /**
45      * The printer has created the Print Job, but the printer has not finished
46      * accessing or accepting all the print data yet.
47      */

48     public static final JobStateReason JavaDoc
49     JOB_INCOMING = new JobStateReason JavaDoc(0);
50     
51     /**
52      * The printer has created the Print Job, but the printer is expecting
53      * additional print data before it can move the job into the PROCESSING
54      * state. If a printer starts processing before it has received all data,
55      * the printer removes the JOB_DATA_INSUFFICIENT reason, but the
56      * JOB_INCOMING reason remains. If a printer starts processing after it
57      * has received all data, the printer removes the JOB_DATA_INSUFFICIENT
58      * and JOB_INCOMING reasons at the same time.
59      */

60     public static final JobStateReason JavaDoc
61     JOB_DATA_INSUFFICIENT = new JobStateReason JavaDoc(1);
62
63     /**
64      * The Printer could not access one or more documents passed by reference
65      * (i.e., the print data representation object is a URL). This reason is
66      * intended to cover any file access problem,including file does not exist
67      * and access denied because of an access control problem. Whether the
68      * printer aborts the job and moves the job to the ABORTED job state or
69      * prints all documents that are accessible and moves the job to the
70      * COMPLETED job state and adds the COMPLETED_WITH_ERRORS reason to the
71      * job's {@link JobStateReasons JobStateReasons} attribute depends on
72      * implementation and/or site policy. This value should be supported if
73      * the printer supports doc flavors with URL print data representation
74      * objects.
75      */

76     public static final JobStateReason JavaDoc
77     DOCUMENT_ACCESS_ERROR = new JobStateReason JavaDoc(2);
78     
79     /**
80      * The job was not completely submitted for some unforeseen reason.
81      * Possibilities include (1) the printer has crashed before the job was
82      * fully submitted by the client, (2) the printer or the document transfer
83      * method has crashed in some non-recoverable way before the document data
84      * was entirely transferred to the printer, (3) the client crashed before
85      * the job was fully submitted.
86      */

87     public static final JobStateReason JavaDoc
88     SUBMISSION_INTERRUPTED = new JobStateReason JavaDoc(3);
89     
90     /**
91      * The printer is transmitting the job to the output device.
92      */

93     public static final JobStateReason JavaDoc
94     JOB_OUTGOING = new JobStateReason JavaDoc(4);
95     
96     /**
97      * The value of the job's {@link JobHoldUntil JobHoldUntil} attribute was
98      * specified with a date-time that is still in the future. The job must
99      * not be a candidate for processing until this reason is removed and
100      * there are
101      * no other reasons to hold the job. This value should be supported if the
102      * {@link JobHoldUntil JobHoldUntil} job template attribute is supported.
103      */

104     public static final JobStateReason JavaDoc
105     JOB_HOLD_UNTIL_SPECIFIED = new JobStateReason JavaDoc(5);
106     
107     /**
108      * At least one of the resources needed by the job, such as media, fonts,
109      * resource objects, etc., is not ready on any of the physical printers
110      * for which the job is a candidate. This condition may be detected
111      * when the job is accepted, or subsequently while the job is pending
112      * or processing, depending on implementation.
113      * The job may remain in its current state or
114      * be moved to the PENDING_HELD state, depending on implementation and/or
115      * job scheduling policy.
116      */

117     public static final JobStateReason JavaDoc
118     RESOURCES_ARE_NOT_READY = new JobStateReason JavaDoc(6);
119     
120     /**
121      * The value of the printer's {@link PrinterStateReasons
122      * PrinterStateReasons} attribute contains a {@link PrinterStateReason
123      * PrinterStateReason} value of STOPPED_PARTLY.
124      */

125     public static final JobStateReason JavaDoc
126     PRINTER_STOPPED_PARTLY = new JobStateReason JavaDoc(7);
127     
128     /**
129      * The value of the printer's {@link PrinterState PrinterState} attribute
130      * ia STOPPED.
131      */

132     public static final JobStateReason JavaDoc
133     PRINTER_STOPPED = new JobStateReason JavaDoc(8);
134     
135     /**
136      * The job is in the PROCESSING state, but more specifically, the printer
137      * ia interpreting the document data.
138      */

139     public static final JobStateReason JavaDoc
140     JOB_INTERPRETING = new JobStateReason JavaDoc(9);
141     
142     /**
143      * The job is in the PROCESSING state, but more specifically, the printer
144      * has queued the document data.
145      */

146     public static final JobStateReason JavaDoc JOB_QUEUED = new JobStateReason JavaDoc(10);
147     
148     /**
149      * The job is in the PROCESSING state, but more specifically, the printer
150      * is interpreting document data and producing another electronic
151      * representation.
152      */

153     public static final JobStateReason JavaDoc
154     JOB_TRANSFORMING = new JobStateReason JavaDoc(11);
155     
156     /**
157      * The job is in the PENDING_HELD, PENDING, or PROCESSING state, but more
158      * specifically, the printer has completed enough processing of the document
159      * to be able to start marking and the job is waiting for the marker.
160      * Systems that require human intervention to release jobs put the job into
161      * the PENDING_HELD job state. Systems that automatically select a job to
162      * use the marker put the job into the PENDING job state or keep the job
163      * in the PROCESSING job state while waiting for the marker, depending on
164      * implementation. All implementations put the job into (or back into) the
165      * PROCESSING state when marking does begin.
166      */

167     public static final JobStateReason JavaDoc
168     JOB_QUEUED_FOR_MARKER = new JobStateReason JavaDoc(12);
169     
170     /**
171      * The output device is marking media. This value is useful for printers
172      * which spend a great deal of time processing (1) when no marking is
173      * happening and then want to show that marking is now happening or (2) when
174      * the job is in the process of being canceled or aborted while the job
175      * remains in the PROCESSING state, but the marking has not yet stopped so
176      * that impression or sheet counts are still increasing for the job.
177      */

178     public static final JobStateReason JavaDoc
179     JOB_PRINTING = new JobStateReason JavaDoc(13);
180     
181     /**
182      * The job was canceled by the owner of the job, i.e., by a user whose
183      * authenticated identity is the same as the value of the originating user
184      * that created the Print Job, or by some other authorized end-user, such as
185      * a member of the job owner's security group. This value should be
186      * supported.
187      */

188     public static final JobStateReason JavaDoc
189     JOB_CANCELED_BY_USER = new JobStateReason JavaDoc(14);
190     
191     /**
192      * The job was canceled by the operator, i.e., by a user who has been
193      * authenticated as having operator privileges (whether local or remote). If
194      * the security policy is to allow anyone to cancel anyone's job, then this
195      * value may be used when the job is canceled by someone other than the
196      * owner of the job. For such a security policy, in effect, everyone is an
197      * operator as far as canceling jobs is concerned. This value should be
198      * supported if the implementation permits canceling by someone other than
199      * the owner of the job.
200      */

201     public static final JobStateReason JavaDoc
202     JOB_CANCELED_BY_OPERATOR = new JobStateReason JavaDoc(15);
203     
204     /**
205      * The job was canceled by an unidentified local user, i.e., a user at a
206      * console at the device. This value should be supported if the
207      * implementation supports canceling jobs at the console.
208      */

209     public static final JobStateReason JavaDoc
210     JOB_CANCELED_AT_DEVICE = new JobStateReason JavaDoc(16);
211     
212     /**
213      * The job was aborted by the system. Either the job (1) is in the process
214      * of being aborted, (2) has been aborted by the system and placed in the
215      * ABORTED state, or (3) has been aborted by the system and placed in the
216      * PENDING_HELD state, so that a user or operator can manually try the job
217      * again. This value should be supported.
218      */

219     public static final JobStateReason JavaDoc
220     ABORTED_BY_SYSTEM = new JobStateReason JavaDoc(17);
221     
222     /**
223      * The job was aborted by the system because the printer determined while
224      * attempting to decompress the document's data that the compression is
225      * actually not among those supported by the printer. This value must be
226      * supported, since {@link Compression Compression} is a required doc
227      * description attribute.
228      */

229     public static final JobStateReason JavaDoc
230     UNSUPPORTED_COMPRESSION = new JobStateReason JavaDoc(18);
231     
232     /**
233      * The job was aborted by the system because the printer encountered an
234      * error in the document data while decompressing it. If the printer posts
235      * this reason, the document data has already passed any tests that would
236      * have led to the UNSUPPORTED_COMPRESSION job state reason.
237      */

238     public static final JobStateReason JavaDoc
239     COMPRESSION_ERROR = new JobStateReason JavaDoc(19);
240     
241     /**
242      * The job was aborted by the system because the document data's document
243      * format (doc flavor) is not among those supported by the printer. If the
244      * client specifies a doc flavor with a MIME type of
245      * <CODE>"application/octet-stream"</CODE>, the printer may abort the job if
246      * the printer cannot determine the document data's actual format through
247      * auto-sensing (even if the printer supports the document format if
248      * specified explicitly). This value must be supported, since a doc flavor
249      * is required to be specified for each doc.
250      */

251     public static final JobStateReason JavaDoc
252     UNSUPPORTED_DOCUMENT_FORMAT = new JobStateReason JavaDoc(20);
253     
254     /**
255      * The job was aborted by the system because the printer encountered an
256      * error in the document data while processing it. If the printer posts this
257      * reason, the document data has already passed any tests that would have
258      * led to the UNSUPPORTED_DOCUMENT_FORMAT job state reason.
259      */

260     public static final JobStateReason JavaDoc
261     DOCUMENT_FORMAT_ERROR = new JobStateReason JavaDoc(21);
262     
263     /**
264      * The requester has canceled the job or the printer has aborted the job,
265      * but the printer is still performing some actions on the job until a
266      * specified stop point occurs or job termination/cleanup is completed.
267      * <P>
268      * If the implementation requires some measurable time to cancel the job in
269      * the PROCESSING or PROCESSING_STOPPED job states, the printer must use
270      * this reason to indicate that the printer is still performing some actions
271      * on the job while the job remains in the PROCESSING or PROCESSING_STOPPED
272      * state. After all the job's job description attributes have stopped
273      * incrementing, the printer moves the job from the PROCESSING state to the
274      * CANCELED or ABORTED job states.
275      */

276     public static final JobStateReason JavaDoc
277     PROCESSING_TO_STOP_POINT = new JobStateReason JavaDoc(22);
278     
279     /**
280      * The printer is off-line and accepting no jobs. All PENDING jobs are put
281      * into the PENDING_HELD state. This situation could be true if the
282      * service's or document transform's input is impaired or broken.
283      */

284     public static final JobStateReason JavaDoc
285     SERVICE_OFF_LINE = new JobStateReason JavaDoc(23);
286
287     /**
288      * The job completed successfully. This value should be supported.
289      */

290     public static final JobStateReason JavaDoc
291     JOB_COMPLETED_SUCCESSFULLY = new JobStateReason JavaDoc(24);
292     
293     /**
294      * The job completed with warnings. This value should be supported if the
295      * implementation detects warnings.
296      */

297     public static final JobStateReason JavaDoc
298     JOB_COMPLETED_WITH_WARNINGS = new JobStateReason JavaDoc(25);
299     
300     /**
301      * The job completed with errors (and possibly warnings too). This value
302      * should be supported if the implementation detects errors.
303      */

304     public static final JobStateReason JavaDoc
305     JOB_COMPLETED_WITH_ERRORS = new JobStateReason JavaDoc(26);
306     
307     /**
308      * This job is retained and is currently able to be restarted. If
309      * JOB_RESTARTABLE is contained in the job's {@link JobStateReasons
310      * JobStateReasons} attribute, then the printer must accept a request to
311      * restart that job. This value should be supported if restarting jobs is
312      * supported. <I>[The capability for restarting jobs is not in the Java
313      * Print Service API at present.]</I>
314      */

315     public static final JobStateReason JavaDoc
316     JOB_RESTARTABLE = new JobStateReason JavaDoc(27);
317     
318     /**
319      * The job has been forwarded to a device or print system that is unable to
320      * send back status. The printer sets the job's {@link JobState JobState}
321      * attribute to COMPLETED and adds the QUEUED_IN_DEVICE reason to the job's
322      * {@link JobStateReasons JobStateReasons} attribute to indicate that the
323      * printer has no additional information about the job and never will have
324      * any better information.
325      */

326     public static final JobStateReason JavaDoc
327     QUEUED_IN_DEVICE = new JobStateReason JavaDoc(28);
328         
329     /**
330      * Construct a new job state reason enumeration value with the given
331      * integer value.
332      *
333      * @param value Integer value.
334      */

335     protected JobStateReason(int value) {
336     super (value);
337     }
338         
339     private static final String JavaDoc[] myStringTable = {
340     "job-incoming",
341     "job-data-insufficient",
342     "document-access-error",
343     "submission-interrupted",
344     "job-outgoing",
345     "job-hold-until-specified",
346     "resources-are-not-ready",
347     "printer-stopped-partly",
348     "printer-stopped",
349     "job-interpreting",
350     "job-queued",
351     "job-transforming",
352     "job-queued-for-marker",
353     "job-printing",
354     "job-canceled-by-user",
355     "job-canceled-by-operator",
356     "job-canceled-at-device",
357     "aborted-by-system",
358     "unsupported-compression",
359     "compression-error",
360     "unsupported-document-format",
361     "document-format-error",
362     "processing-to-stop-point",
363     "service-off-line",
364     "job-completed-successfully",
365     "job-completed-with-warnings",
366     "job-completed-with-errors",
367     "job-restartable",
368     "queued-in-device"};
369
370     private static final JobStateReason JavaDoc[] myEnumValueTable = {
371     JOB_INCOMING,
372     JOB_DATA_INSUFFICIENT,
373     DOCUMENT_ACCESS_ERROR,
374     SUBMISSION_INTERRUPTED,
375     JOB_OUTGOING,
376     JOB_HOLD_UNTIL_SPECIFIED,
377     RESOURCES_ARE_NOT_READY,
378     PRINTER_STOPPED_PARTLY,
379     PRINTER_STOPPED,
380     JOB_INTERPRETING,
381     JOB_QUEUED,
382     JOB_TRANSFORMING,
383     JOB_QUEUED_FOR_MARKER,
384     JOB_PRINTING,
385     JOB_CANCELED_BY_USER,
386     JOB_CANCELED_BY_OPERATOR,
387     JOB_CANCELED_AT_DEVICE,
388     ABORTED_BY_SYSTEM,
389     UNSUPPORTED_COMPRESSION,
390     COMPRESSION_ERROR,
391     UNSUPPORTED_DOCUMENT_FORMAT,
392     DOCUMENT_FORMAT_ERROR,
393     PROCESSING_TO_STOP_POINT,
394     SERVICE_OFF_LINE,
395     JOB_COMPLETED_SUCCESSFULLY,
396     JOB_COMPLETED_WITH_WARNINGS,
397     JOB_COMPLETED_WITH_ERRORS,
398     JOB_RESTARTABLE,
399     QUEUED_IN_DEVICE};
400
401     /**
402      * Returns the string table for class JobStateReason.
403      */

404     protected String JavaDoc[] getStringTable() {
405     return (String JavaDoc[])myStringTable.clone();
406     }
407     
408     /**
409      * Returns the enumeration value table for class JobStateReason.
410      */

411     protected EnumSyntax JavaDoc[] getEnumValueTable() {
412     return (EnumSyntax JavaDoc[])myEnumValueTable.clone();
413     }
414     
415          
416     /**
417      * Get the printing attribute class which is to be used as the "category"
418      * for this printing attribute value.
419      * <P>
420      * For class JobStateReason and any vendor-defined subclasses, the
421      * category is class JobStateReason itself.
422      *
423      * @return Printing attribute class (category), an instance of class
424      * {@link java.lang.Class java.lang.Class}.
425      */

426     public final Class JavaDoc<? extends Attribute JavaDoc> getCategory() {
427     return JobStateReason JavaDoc.class;
428     }
429     
430     /**
431      * Get the name of the category of which this attribute value is an
432      * instance.
433      * <P>
434      * For class JobStateReason and any vendor-defined subclasses, the
435      * category name is <CODE>"job-state-reason"</CODE>.
436      *
437      * @return Attribute category name.
438      */

439     public final String JavaDoc getName() {
440     return "job-state-reason";
441     }
442     
443 }
444
Popular Tags