001 /*
002 * Copyright 2000-2004 Sun Microsystems, Inc. All Rights Reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation. Sun designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Sun in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022 * CA 95054 USA or visit www.sun.com if you need additional information or
023 * have any questions.
024 */
025 package javax.print.attribute.standard;
026
027 import javax.print.attribute.EnumSyntax;
028 import javax.print.attribute.Attribute;
029
030 /**
031 * Class JobStateReason is a printing attribute class, an enumeration, that
032 * provides additional information about the job's current state, i.e.,
033 * information that augments the value of the job's {@link JobState JobState}
034 * attribute. Class JobStateReason defines standard job state reason values. A
035 * Print Service implementation only needs to report those job state
036 * reasons which are appropriate for the particular implementation; it does not
037 * have to report every defined job state reason.
038 * <P>
039 * Instances of JobStateReason do not appear in a Print Job's attribute set
040 * directly. Rather, a {@link JobStateReasons JobStateReasons} attribute appears
041 * in the Print Job's attribute set. The {@link JobStateReasons JobStateReasons}
042 * attribute contains zero, one, or more than one JobStateReason objects which
043 * pertain to the Print Job's status. The printer adds a JobStateReason object
044 * to the Print Job's {@link JobStateReasons JobStateReasons} attribute when the
045 * corresponding condition becomes true of the Print Job, and the printer
046 * removes the JobStateReason object again when the corresponding condition
047 * becomes false, regardless of whether the Print Job's overall {@link JobState
048 * JobState} also changed.
049 * <P>
050 * <B>IPP Compatibility:</B> The category name returned by
051 * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
052 * integer value is the IPP enum value. The <code>toString()</code> method
053 * returns the IPP string representation of the attribute value.
054 * <P>
055 *
056 * @author Alan Kaminsky
057 */
058 public class JobStateReason extends EnumSyntax implements Attribute {
059
060 private static final long serialVersionUID = -8765894420449009168L;
061
062 /**
063 * The printer has created the Print Job, but the printer has not finished
064 * accessing or accepting all the print data yet.
065 */
066 public static final JobStateReason JOB_INCOMING = new JobStateReason(
067 0);
068
069 /**
070 * The printer has created the Print Job, but the printer is expecting
071 * additional print data before it can move the job into the PROCESSING
072 * state. If a printer starts processing before it has received all data,
073 * the printer removes the JOB_DATA_INSUFFICIENT reason, but the
074 * JOB_INCOMING reason remains. If a printer starts processing after it
075 * has received all data, the printer removes the JOB_DATA_INSUFFICIENT
076 * and JOB_INCOMING reasons at the same time.
077 */
078 public static final JobStateReason JOB_DATA_INSUFFICIENT = new JobStateReason(
079 1);
080
081 /**
082 * The Printer could not access one or more documents passed by reference
083 * (i.e., the print data representation object is a URL). This reason is
084 * intended to cover any file access problem,including file does not exist
085 * and access denied because of an access control problem. Whether the
086 * printer aborts the job and moves the job to the ABORTED job state or
087 * prints all documents that are accessible and moves the job to the
088 * COMPLETED job state and adds the COMPLETED_WITH_ERRORS reason to the
089 * job's {@link JobStateReasons JobStateReasons} attribute depends on
090 * implementation and/or site policy. This value should be supported if
091 * the printer supports doc flavors with URL print data representation
092 * objects.
093 */
094 public static final JobStateReason DOCUMENT_ACCESS_ERROR = new JobStateReason(
095 2);
096
097 /**
098 * The job was not completely submitted for some unforeseen reason.
099 * Possibilities include (1) the printer has crashed before the job was
100 * fully submitted by the client, (2) the printer or the document transfer
101 * method has crashed in some non-recoverable way before the document data
102 * was entirely transferred to the printer, (3) the client crashed before
103 * the job was fully submitted.
104 */
105 public static final JobStateReason SUBMISSION_INTERRUPTED = new JobStateReason(
106 3);
107
108 /**
109 * The printer is transmitting the job to the output device.
110 */
111 public static final JobStateReason JOB_OUTGOING = new JobStateReason(
112 4);
113
114 /**
115 * The value of the job's {@link JobHoldUntil JobHoldUntil} attribute was
116 * specified with a date-time that is still in the future. The job must
117 * not be a candidate for processing until this reason is removed and
118 * there are
119 * no other reasons to hold the job. This value should be supported if the
120 * {@link JobHoldUntil JobHoldUntil} job template attribute is supported.
121 */
122 public static final JobStateReason JOB_HOLD_UNTIL_SPECIFIED = new JobStateReason(
123 5);
124
125 /**
126 * At least one of the resources needed by the job, such as media, fonts,
127 * resource objects, etc., is not ready on any of the physical printers
128 * for which the job is a candidate. This condition may be detected
129 * when the job is accepted, or subsequently while the job is pending
130 * or processing, depending on implementation.
131 * The job may remain in its current state or
132 * be moved to the PENDING_HELD state, depending on implementation and/or
133 * job scheduling policy.
134 */
135 public static final JobStateReason RESOURCES_ARE_NOT_READY = new JobStateReason(
136 6);
137
138 /**
139 * The value of the printer's {@link PrinterStateReasons
140 * PrinterStateReasons} attribute contains a {@link PrinterStateReason
141 * PrinterStateReason} value of STOPPED_PARTLY.
142 */
143 public static final JobStateReason PRINTER_STOPPED_PARTLY = new JobStateReason(
144 7);
145
146 /**
147 * The value of the printer's {@link PrinterState PrinterState} attribute
148 * ia STOPPED.
149 */
150 public static final JobStateReason PRINTER_STOPPED = new JobStateReason(
151 8);
152
153 /**
154 * The job is in the PROCESSING state, but more specifically, the printer
155 * ia interpreting the document data.
156 */
157 public static final JobStateReason JOB_INTERPRETING = new JobStateReason(
158 9);
159
160 /**
161 * The job is in the PROCESSING state, but more specifically, the printer
162 * has queued the document data.
163 */
164 public static final JobStateReason JOB_QUEUED = new JobStateReason(
165 10);
166
167 /**
168 * The job is in the PROCESSING state, but more specifically, the printer
169 * is interpreting document data and producing another electronic
170 * representation.
171 */
172 public static final JobStateReason JOB_TRANSFORMING = new JobStateReason(
173 11);
174
175 /**
176 * The job is in the PENDING_HELD, PENDING, or PROCESSING state, but more
177 * specifically, the printer has completed enough processing of the document
178 * to be able to start marking and the job is waiting for the marker.
179 * Systems that require human intervention to release jobs put the job into
180 * the PENDING_HELD job state. Systems that automatically select a job to
181 * use the marker put the job into the PENDING job state or keep the job
182 * in the PROCESSING job state while waiting for the marker, depending on
183 * implementation. All implementations put the job into (or back into) the
184 * PROCESSING state when marking does begin.
185 */
186 public static final JobStateReason JOB_QUEUED_FOR_MARKER = new JobStateReason(
187 12);
188
189 /**
190 * The output device is marking media. This value is useful for printers
191 * which spend a great deal of time processing (1) when no marking is
192 * happening and then want to show that marking is now happening or (2) when
193 * the job is in the process of being canceled or aborted while the job
194 * remains in the PROCESSING state, but the marking has not yet stopped so
195 * that impression or sheet counts are still increasing for the job.
196 */
197 public static final JobStateReason JOB_PRINTING = new JobStateReason(
198 13);
199
200 /**
201 * The job was canceled by the owner of the job, i.e., by a user whose
202 * authenticated identity is the same as the value of the originating user
203 * that created the Print Job, or by some other authorized end-user, such as
204 * a member of the job owner's security group. This value should be
205 * supported.
206 */
207 public static final JobStateReason JOB_CANCELED_BY_USER = new JobStateReason(
208 14);
209
210 /**
211 * The job was canceled by the operator, i.e., by a user who has been
212 * authenticated as having operator privileges (whether local or remote). If
213 * the security policy is to allow anyone to cancel anyone's job, then this
214 * value may be used when the job is canceled by someone other than the
215 * owner of the job. For such a security policy, in effect, everyone is an
216 * operator as far as canceling jobs is concerned. This value should be
217 * supported if the implementation permits canceling by someone other than
218 * the owner of the job.
219 */
220 public static final JobStateReason JOB_CANCELED_BY_OPERATOR = new JobStateReason(
221 15);
222
223 /**
224 * The job was canceled by an unidentified local user, i.e., a user at a
225 * console at the device. This value should be supported if the
226 * implementation supports canceling jobs at the console.
227 */
228 public static final JobStateReason JOB_CANCELED_AT_DEVICE = new JobStateReason(
229 16);
230
231 /**
232 * The job was aborted by the system. Either the job (1) is in the process
233 * of being aborted, (2) has been aborted by the system and placed in the
234 * ABORTED state, or (3) has been aborted by the system and placed in the
235 * PENDING_HELD state, so that a user or operator can manually try the job
236 * again. This value should be supported.
237 */
238 public static final JobStateReason ABORTED_BY_SYSTEM = new JobStateReason(
239 17);
240
241 /**
242 * The job was aborted by the system because the printer determined while
243 * attempting to decompress the document's data that the compression is
244 * actually not among those supported by the printer. This value must be
245 * supported, since {@link Compression Compression} is a required doc
246 * description attribute.
247 */
248 public static final JobStateReason UNSUPPORTED_COMPRESSION = new JobStateReason(
249 18);
250
251 /**
252 * The job was aborted by the system because the printer encountered an
253 * error in the document data while decompressing it. If the printer posts
254 * this reason, the document data has already passed any tests that would
255 * have led to the UNSUPPORTED_COMPRESSION job state reason.
256 */
257 public static final JobStateReason COMPRESSION_ERROR = new JobStateReason(
258 19);
259
260 /**
261 * The job was aborted by the system because the document data's document
262 * format (doc flavor) is not among those supported by the printer. If the
263 * client specifies a doc flavor with a MIME type of
264 * <CODE>"application/octet-stream"</CODE>, the printer may abort the job if
265 * the printer cannot determine the document data's actual format through
266 * auto-sensing (even if the printer supports the document format if
267 * specified explicitly). This value must be supported, since a doc flavor
268 * is required to be specified for each doc.
269 */
270 public static final JobStateReason UNSUPPORTED_DOCUMENT_FORMAT = new JobStateReason(
271 20);
272
273 /**
274 * The job was aborted by the system because the printer encountered an
275 * error in the document data while processing it. If the printer posts this
276 * reason, the document data has already passed any tests that would have
277 * led to the UNSUPPORTED_DOCUMENT_FORMAT job state reason.
278 */
279 public static final JobStateReason DOCUMENT_FORMAT_ERROR = new JobStateReason(
280 21);
281
282 /**
283 * The requester has canceled the job or the printer has aborted the job,
284 * but the printer is still performing some actions on the job until a
285 * specified stop point occurs or job termination/cleanup is completed.
286 * <P>
287 * If the implementation requires some measurable time to cancel the job in
288 * the PROCESSING or PROCESSING_STOPPED job states, the printer must use
289 * this reason to indicate that the printer is still performing some actions
290 * on the job while the job remains in the PROCESSING or PROCESSING_STOPPED
291 * state. After all the job's job description attributes have stopped
292 * incrementing, the printer moves the job from the PROCESSING state to the
293 * CANCELED or ABORTED job states.
294 */
295 public static final JobStateReason PROCESSING_TO_STOP_POINT = new JobStateReason(
296 22);
297
298 /**
299 * The printer is off-line and accepting no jobs. All PENDING jobs are put
300 * into the PENDING_HELD state. This situation could be true if the
301 * service's or document transform's input is impaired or broken.
302 */
303 public static final JobStateReason SERVICE_OFF_LINE = new JobStateReason(
304 23);
305
306 /**
307 * The job completed successfully. This value should be supported.
308 */
309 public static final JobStateReason JOB_COMPLETED_SUCCESSFULLY = new JobStateReason(
310 24);
311
312 /**
313 * The job completed with warnings. This value should be supported if the
314 * implementation detects warnings.
315 */
316 public static final JobStateReason JOB_COMPLETED_WITH_WARNINGS = new JobStateReason(
317 25);
318
319 /**
320 * The job completed with errors (and possibly warnings too). This value
321 * should be supported if the implementation detects errors.
322 */
323 public static final JobStateReason JOB_COMPLETED_WITH_ERRORS = new JobStateReason(
324 26);
325
326 /**
327 * This job is retained and is currently able to be restarted. If
328 * JOB_RESTARTABLE is contained in the job's {@link JobStateReasons
329 * JobStateReasons} attribute, then the printer must accept a request to
330 * restart that job. This value should be supported if restarting jobs is
331 * supported. <I>[The capability for restarting jobs is not in the Java
332 * Print Service API at present.]</I>
333 */
334 public static final JobStateReason JOB_RESTARTABLE = new JobStateReason(
335 27);
336
337 /**
338 * The job has been forwarded to a device or print system that is unable to
339 * send back status. The printer sets the job's {@link JobState JobState}
340 * attribute to COMPLETED and adds the QUEUED_IN_DEVICE reason to the job's
341 * {@link JobStateReasons JobStateReasons} attribute to indicate that the
342 * printer has no additional information about the job and never will have
343 * any better information.
344 */
345 public static final JobStateReason QUEUED_IN_DEVICE = new JobStateReason(
346 28);
347
348 /**
349 * Construct a new job state reason enumeration value with the given
350 * integer value.
351 *
352 * @param value Integer value.
353 */
354 protected JobStateReason(int value) {
355 super (value);
356 }
357
358 private static final String[] myStringTable = { "job-incoming",
359 "job-data-insufficient", "document-access-error",
360 "submission-interrupted", "job-outgoing",
361 "job-hold-until-specified", "resources-are-not-ready",
362 "printer-stopped-partly", "printer-stopped",
363 "job-interpreting", "job-queued", "job-transforming",
364 "job-queued-for-marker", "job-printing",
365 "job-canceled-by-user", "job-canceled-by-operator",
366 "job-canceled-at-device", "aborted-by-system",
367 "unsupported-compression", "compression-error",
368 "unsupported-document-format", "document-format-error",
369 "processing-to-stop-point", "service-off-line",
370 "job-completed-successfully",
371 "job-completed-with-warnings", "job-completed-with-errors",
372 "job-restartable", "queued-in-device" };
373
374 private static final JobStateReason[] myEnumValueTable = {
375 JOB_INCOMING, JOB_DATA_INSUFFICIENT, DOCUMENT_ACCESS_ERROR,
376 SUBMISSION_INTERRUPTED, JOB_OUTGOING,
377 JOB_HOLD_UNTIL_SPECIFIED, RESOURCES_ARE_NOT_READY,
378 PRINTER_STOPPED_PARTLY, PRINTER_STOPPED, JOB_INTERPRETING,
379 JOB_QUEUED, JOB_TRANSFORMING, JOB_QUEUED_FOR_MARKER,
380 JOB_PRINTING, JOB_CANCELED_BY_USER,
381 JOB_CANCELED_BY_OPERATOR, JOB_CANCELED_AT_DEVICE,
382 ABORTED_BY_SYSTEM, UNSUPPORTED_COMPRESSION,
383 COMPRESSION_ERROR, UNSUPPORTED_DOCUMENT_FORMAT,
384 DOCUMENT_FORMAT_ERROR, PROCESSING_TO_STOP_POINT,
385 SERVICE_OFF_LINE, JOB_COMPLETED_SUCCESSFULLY,
386 JOB_COMPLETED_WITH_WARNINGS, JOB_COMPLETED_WITH_ERRORS,
387 JOB_RESTARTABLE, QUEUED_IN_DEVICE };
388
389 /**
390 * Returns the string table for class JobStateReason.
391 */
392 protected String[] getStringTable() {
393 return (String[]) myStringTable.clone();
394 }
395
396 /**
397 * Returns the enumeration value table for class JobStateReason.
398 */
399 protected EnumSyntax[] getEnumValueTable() {
400 return (EnumSyntax[]) myEnumValueTable.clone();
401 }
402
403 /**
404 * Get the printing attribute class which is to be used as the "category"
405 * for this printing attribute value.
406 * <P>
407 * For class JobStateReason and any vendor-defined subclasses, the
408 * category is class JobStateReason itself.
409 *
410 * @return Printing attribute class (category), an instance of class
411 * {@link java.lang.Class java.lang.Class}.
412 */
413 public final Class<? extends Attribute> getCategory() {
414 return JobStateReason.class;
415 }
416
417 /**
418 * Get the name of the category of which this attribute value is an
419 * instance.
420 * <P>
421 * For class JobStateReason and any vendor-defined subclasses, the
422 * category name is <CODE>"job-state-reason"</CODE>.
423 *
424 * @return Attribute category name.
425 */
426 public final String getName() {
427 return "job-state-reason";
428 }
429
430 }
|