1. /*
  2. * @(#)JobStateReason.java 1.5 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.print.attribute.standard;
  8. import javax.print.attribute.EnumSyntax;
  9. import javax.print.attribute.Attribute;
  10. /**
  11. * Class JobStateReason is a printing attribute class, an enumeration, that
  12. * provides additional information about the job's current state, i.e.,
  13. * information that augments the value of the job's {@link JobState JobState}
  14. * attribute. Class JobStateReason defines standard job state reason values. A
  15. * Print Service implementation only needs to report those job state
  16. * reasons which are appropriate for the particular implementation; it does not
  17. * have to report every defined job state reason.
  18. * <P>
  19. * Instances of JobStateReason do not appear in a Print Job's attribute set
  20. * directly. Rather, a {@link JobStateReasons JobStateReasons} attribute appears
  21. * in the Print Job's attribute set. The {@link JobStateReasons JobStateReasons}
  22. * attribute contains zero, one, or more than one JobStateReason objects which
  23. * pertain to the Print Job's status. The printer adds a JobStateReason object
  24. * to the Print Job's {@link JobStateReasons JobStateReasons} attribute when the
  25. * corresponding condition becomes true of the Print Job, and the printer
  26. * removes the JobStateReason object again when the corresponding condition
  27. * becomes false, regardless of whether the Print Job's overall {@link JobState
  28. * JobState} also changed.
  29. * <P>
  30. * <B>IPP Compatibility:</B> The category name returned by
  31. * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
  32. * integer value is the IPP enum value. The <code>toString()</code> method
  33. * returns the IPP string representation of the attribute value.
  34. * <P>
  35. *
  36. * @author Alan Kaminsky
  37. */
  38. public class JobStateReason extends EnumSyntax implements Attribute {
  39. /**
  40. * The printer has created the Print Job, but the printer has not finished
  41. * accessing or accepting all the print data yet.
  42. */
  43. public static final JobStateReason
  44. JOB_INCOMING = new JobStateReason(0);
  45. /**
  46. * The printer has created the Print Job, but the printer is expecting
  47. * additional print data before it can move the job into the PROCESSING
  48. * state. If a printer starts processing before it has received all data,
  49. * the printer removes the JOB_DATA_INSUFFICIENT reason, but the
  50. * JOB_INCOMING reason remains. If a printer starts processing after it
  51. * has received all data, the printer removes the JOB_DATA_INSUFFICIENT
  52. * and JOB_INCOMING reasons at the same time.
  53. */
  54. public static final JobStateReason
  55. JOB_DATA_INSUFFICIENT = new JobStateReason(1);
  56. /**
  57. * The Printer could not access one or more documents passed by reference
  58. * (i.e., the print data representation object is a URL). This reason is
  59. * intended to cover any file access problem,including file does not exist
  60. * and access denied because of an access control problem. Whether the
  61. * printer aborts the job and moves the job to the ABORTED job state or
  62. * prints all documents that are accessible and moves the job to the
  63. * COMPLETED job state and adds the COMPLETED_WITH_ERRORS reason to the
  64. * job's {@link JobStateReasons JobStateReasons} attribute depends on
  65. * implementation and/or site policy. This value should be supported if
  66. * the printer supports doc flavors with URL print data representation
  67. * objects.
  68. */
  69. public static final JobStateReason
  70. DOCUMENT_ACCESS_ERROR = new JobStateReason(2);
  71. /**
  72. * The job was not completely submitted for some unforeseen reason.
  73. * Possibilities include (1) the printer has crashed before the job was
  74. * fully submitted by the client, (2) the printer or the document transfer
  75. * method has crashed in some non-recoverable way before the document data
  76. * was entirely transferred to the printer, (3) the client crashed before
  77. * the job was fully submitted.
  78. */
  79. public static final JobStateReason
  80. SUBMISSION_INTERRUPTED = new JobStateReason(3);
  81. /**
  82. * The printer is transmitting the job to the output device.
  83. */
  84. public static final JobStateReason
  85. JOB_OUTGOING = new JobStateReason(4);
  86. /**
  87. * The value of the job's {@link JobHoldUntil JobHoldUntil} attribute was
  88. * specified with a date-time that is still in the future. The job must
  89. * not be a candidate for processing until this reason is removed and
  90. * there are
  91. * no other reasons to hold the job. This value should be supported if the
  92. * {@link JobHoldUntil JobHoldUntil} job template attribute is supported.
  93. */
  94. public static final JobStateReason
  95. JOB_HOLD_UNTIL_SPECIFIED = new JobStateReason(5);
  96. /**
  97. * At least one of the resources needed by the job, such as media, fonts,
  98. * resource objects, etc., is not ready on any of the physical printers
  99. * for which the job is a candidate. This condition may be detected
  100. * when the job is accepted, or subsequently while the job is pending
  101. * or processing, depending on implementation.
  102. * The job may remain in its current state or
  103. * be moved to the PENDING_HELD state, depending on implementation and/or
  104. * job scheduling policy.
  105. */
  106. public static final JobStateReason
  107. RESOURCES_ARE_NOT_READY = new JobStateReason(6);
  108. /**
  109. * The value of the printer's {@link PrinterStateReasons
  110. * PrinterStateReasons} attribute contains a {@link PrinterStateReason
  111. * PrinterStateReason} value of STOPPED_PARTLY.
  112. */
  113. public static final JobStateReason
  114. PRINTER_STOPPED_PARTLY = new JobStateReason(7);
  115. /**
  116. * The value of the printer's {@link PrinterState PrinterState} attribute
  117. * ia STOPPED.
  118. */
  119. public static final JobStateReason
  120. PRINTER_STOPPED = new JobStateReason(8);
  121. /**
  122. * The job is in the PROCESSING state, but more specifically, the printer
  123. * ia interpreting the document data.
  124. */
  125. public static final JobStateReason
  126. JOB_INTERPRETING = new JobStateReason(9);
  127. /**
  128. * The job is in the PROCESSING state, but more specifically, the printer
  129. * has queued the document data.
  130. */
  131. public static final JobStateReason JOB_QUEUED = new JobStateReason(10);
  132. /**
  133. * The job is in the PROCESSING state, but more specifically, the printer
  134. * is interpreting document data and producing another electronic
  135. * representation.
  136. */
  137. public static final JobStateReason
  138. JOB_TRANSFORMING = new JobStateReason(11);
  139. /**
  140. * The job is in the PENDING_HELD, PENDING, or PROCESSING state, but more
  141. * specifically, the printer has completed enough processing of the document
  142. * to be able to start marking and the job is waiting for the marker.
  143. * Systems that require human intervention to release jobs put the job into
  144. * the PENDING_HELD job state. Systems that automatically select a job to
  145. * use the marker put the job into the PENDING job state or keep the job
  146. * in the PROCESSING job state while waiting for the marker, depending on
  147. * implementation. All implementations put the job into (or back into) the
  148. * PROCESSING state when marking does begin.
  149. */
  150. public static final JobStateReason
  151. JOB_QUEUED_FOR_MARKER = new JobStateReason(12);
  152. /**
  153. * The output device is marking media. This value is useful for printers
  154. * which spend a great deal of time processing (1) when no marking is
  155. * happening and then want to show that marking is now happening or (2) when
  156. * the job is in the process of being canceled or aborted while the job
  157. * remains in the PROCESSING state, but the marking has not yet stopped so
  158. * that impression or sheet counts are still increasing for the job.
  159. */
  160. public static final JobStateReason
  161. JOB_PRINTING = new JobStateReason(13);
  162. /**
  163. * The job was canceled by the owner of the job, i.e., by a user whose
  164. * authenticated identity is the same as the value of the originating user
  165. * that created the Print Job, or by some other authorized end-user, such as
  166. * a member of the job owner's security group. This value should be
  167. * supported.
  168. */
  169. public static final JobStateReason
  170. JOB_CANCELED_BY_USER = new JobStateReason(14);
  171. /**
  172. * The job was canceled by the operator, i.e., by a user who has been
  173. * authenticated as having operator privileges (whether local or remote). If
  174. * the security policy is to allow anyone to cancel anyone's job, then this
  175. * value may be used when the job is canceled by someone other than the
  176. * owner of the job. For such a security policy, in effect, everyone is an
  177. * operator as far as canceling jobs is concerned. This value should be
  178. * supported if the implementation permits canceling by someone other than
  179. * the owner of the job.
  180. */
  181. public static final JobStateReason
  182. JOB_CANCELED_BY_OPERATOR = new JobStateReason(15);
  183. /**
  184. * The job was canceled by an unidentified local user, i.e., a user at a
  185. * console at the device. This value should be supported if the
  186. * implementation supports canceling jobs at the console.
  187. */
  188. public static final JobStateReason
  189. JOB_CANCELED_AT_DEVICE = new JobStateReason(16);
  190. /**
  191. * The job was aborted by the system. Either the job (1) is in the process
  192. * of being aborted, (2) has been aborted by the system and placed in the
  193. * ABORTED state, or (3) has been aborted by the system and placed in the
  194. * PENDING_HELD state, so that a user or operator can manually try the job
  195. * again. This value should be supported.
  196. */
  197. public static final JobStateReason
  198. ABORTED_BY_SYSTEM = new JobStateReason(17);
  199. /**
  200. * The job was aborted by the system because the printer determined while
  201. * attempting to decompress the document's data that the compression is
  202. * actually not among those supported by the printer. This value must be
  203. * supported, since {@link Compression Compression} is a required doc
  204. * description attribute.
  205. */
  206. public static final JobStateReason
  207. UNSUPPORTED_COMPRESSION = new JobStateReason(18);
  208. /**
  209. * The job was aborted by the system because the printer encountered an
  210. * error in the document data while decompressing it. If the printer posts
  211. * this reason, the document data has already passed any tests that would
  212. * have led to the UNSUPPORTED_COMPRESSION job state reason.
  213. */
  214. public static final JobStateReason
  215. COMPRESSION_ERROR = new JobStateReason(19);
  216. /**
  217. * The job was aborted by the system because the document data's document
  218. * format (doc flavor) is not among those supported by the printer. If the
  219. * client specifies a doc flavor with a MIME type of
  220. * <CODE>"application/octet-stream"</CODE>, the printer may abort the job if
  221. * the printer cannot determine the document data's actual format through
  222. * auto-sensing (even if the printer supports the document format if
  223. * specified explicitly). This value must be supported, since a doc flavor
  224. * is required to be specified for each doc.
  225. */
  226. public static final JobStateReason
  227. UNSUPPORTED_DOCUMENT_FORMAT = new JobStateReason(20);
  228. /**
  229. * The job was aborted by the system because the printer encountered an
  230. * error in the document data while processing it. If the printer posts this
  231. * reason, the document data has already passed any tests that would have
  232. * led to the UNSUPPORTED_DOCUMENT_FORMAT job state reason.
  233. */
  234. public static final JobStateReason
  235. DOCUMENT_FORMAT_ERROR = new JobStateReason(21);
  236. /**
  237. * The requester has canceled the job or the printer has aborted the job,
  238. * but the printer is still performing some actions on the job until a
  239. * specified stop point occurs or job termination/cleanup is completed.
  240. * <P>
  241. * If the implementation requires some measurable time to cancel the job in
  242. * the PROCESSING or PROCESSING_STOPPED job states, the printer must use
  243. * this reason to indicate that the printer is still performing some actions
  244. * on the job while the job remains in the PROCESSING or PROCESSING_STOPPED
  245. * state. After all the job's job description attributes have stopped
  246. * incrementing, the printer moves the job from the PROCESSING state to the
  247. * CANCELED or ABORTED job states.
  248. */
  249. public static final JobStateReason
  250. PROCESSING_TO_STOP_POINT = new JobStateReason(22);
  251. /**
  252. * The printer is off-line and accepting no jobs. All PENDING jobs are put
  253. * into the PENDING_HELD state. This situation could be true if the
  254. * service's or document transform's input is impaired or broken.
  255. */
  256. public static final JobStateReason
  257. SERVICE_OFF_LINE = new JobStateReason(23);
  258. /**
  259. * The job completed successfully. This value should be supported.
  260. */
  261. public static final JobStateReason
  262. JOB_COMPLETED_SUCCESSFULLY = new JobStateReason(24);
  263. /**
  264. * The job completed with warnings. This value should be supported if the
  265. * implementation detects warnings.
  266. */
  267. public static final JobStateReason
  268. JOB_COMPLETED_WITH_WARNINGS = new JobStateReason(25);
  269. /**
  270. * The job completed with errors (and possibly warnings too). This value
  271. * should be supported if the implementation detects errors.
  272. */
  273. public static final JobStateReason
  274. JOB_COMPLETED_WITH_ERRORS = new JobStateReason(26);
  275. /**
  276. * This job is retained and is currently able to be restarted. If
  277. * JOB_RESTARTABLE is contained in the job's {@link JobStateReasons
  278. * JobStateReasons} attribute, then the printer must accept a request to
  279. * restart that job. This value should be supported if restarting jobs is
  280. * supported. <I>[The capability for restarting jobs is not in the Java
  281. * Print Service API at present.]</I>
  282. */
  283. public static final JobStateReason
  284. JOB_RESTARTABLE = new JobStateReason(27);
  285. /**
  286. * The job has been forwarded to a device or print system that is unable to
  287. * send back status. The printer sets the job's {@link JobState JobState}
  288. * attribute to COMPLETED and adds the QUEUED_IN_DEVICE reason to the job's
  289. * {@link JobStateReasons JobStateReasons} attribute to indicate that the
  290. * printer has no additional information about the job and never will have
  291. * any better information.
  292. */
  293. public static final JobStateReason
  294. QUEUED_IN_DEVICE = new JobStateReason(28);
  295. /**
  296. * Construct a new job state reason enumeration value with the given
  297. * integer value.
  298. *
  299. * @param value Integer value.
  300. */
  301. protected JobStateReason(int value) {
  302. super (value);
  303. }
  304. private static final String[] myStringTable = {
  305. "job-incoming",
  306. "job-data-insufficient",
  307. "document-access-error",
  308. "submission-interrupted",
  309. "job-outgoing",
  310. "job-hold-until-specified",
  311. "resources-are-not-ready",
  312. "printer-stopped-partly",
  313. "printer-stopped",
  314. "job-interpreting",
  315. "job-queued",
  316. "job-transforming",
  317. "job-queued-for-marker",
  318. "job-printing",
  319. "job-canceled-by-user",
  320. "job-canceled-by-operator",
  321. "job-canceled-at-device",
  322. "aborted-by-system",
  323. "unsupported-compression",
  324. "compression-error",
  325. "unsupported-document-format",
  326. "document-format-error",
  327. "processing-to-stop-point",
  328. "service-off-line",
  329. "job-completed-successfully",
  330. "job-completed-with-warnings",
  331. "job-completed-with-errors",
  332. "job-restartable",
  333. "queued-in-device"};
  334. private static final JobStateReason[] myEnumValueTable = {
  335. JOB_INCOMING,
  336. JOB_DATA_INSUFFICIENT,
  337. DOCUMENT_ACCESS_ERROR,
  338. SUBMISSION_INTERRUPTED,
  339. JOB_OUTGOING,
  340. JOB_HOLD_UNTIL_SPECIFIED,
  341. RESOURCES_ARE_NOT_READY,
  342. PRINTER_STOPPED_PARTLY,
  343. PRINTER_STOPPED,
  344. JOB_INTERPRETING,
  345. JOB_QUEUED,
  346. JOB_TRANSFORMING,
  347. JOB_QUEUED_FOR_MARKER,
  348. JOB_PRINTING,
  349. JOB_CANCELED_BY_USER,
  350. JOB_CANCELED_BY_OPERATOR,
  351. JOB_CANCELED_AT_DEVICE,
  352. ABORTED_BY_SYSTEM,
  353. UNSUPPORTED_COMPRESSION,
  354. COMPRESSION_ERROR,
  355. UNSUPPORTED_DOCUMENT_FORMAT,
  356. DOCUMENT_FORMAT_ERROR,
  357. PROCESSING_TO_STOP_POINT,
  358. SERVICE_OFF_LINE,
  359. JOB_COMPLETED_SUCCESSFULLY,
  360. JOB_COMPLETED_WITH_WARNINGS,
  361. JOB_COMPLETED_WITH_ERRORS,
  362. JOB_RESTARTABLE,
  363. QUEUED_IN_DEVICE};
  364. /**
  365. * Returns the string table for class JobStateReason.
  366. */
  367. protected String[] getStringTable() {
  368. return (String[])myStringTable.clone();
  369. }
  370. /**
  371. * Returns the enumeration value table for class JobStateReason.
  372. */
  373. protected EnumSyntax[] getEnumValueTable() {
  374. return (EnumSyntax[])myEnumValueTable.clone();
  375. }
  376. /**
  377. * Get the printing attribute class which is to be used as the "category"
  378. * for this printing attribute value.
  379. * <P>
  380. * For class JobStateReason and any vendor-defined subclasses, the
  381. * category is class JobStateReason itself.
  382. *
  383. * @return Printing attribute class (category), an instance of class
  384. * {@link java.lang.Class java.lang.Class}.
  385. */
  386. public final Class getCategory() {
  387. return JobStateReason.class;
  388. }
  389. /**
  390. * Get the name of the category of which this attribute value is an
  391. * instance.
  392. * <P>
  393. * For class JobStateReason and any vendor-defined subclasses, the
  394. * category name is <CODE>"job-state-reason"</CODE>.
  395. *
  396. * @return Attribute category name.
  397. */
  398. public final String getName() {
  399. return "job-state-reason";
  400. }
  401. }