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