1. /*
  2. * @(#)PrinterStateReason.java 1.10 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 PrinterStateReason is a printing attribute class, an enumeration,
  12. * that provides additional information about the printer's current state,
  13. * i.e., information that augments the value of the printer's
  14. * {@link PrinterState PrinterState} attribute.
  15. * Class PrinterStateReason defines standard printer
  16. * state reason values. A Print Service implementation only needs to report
  17. * those printer state reasons which are appropriate for the particular
  18. * implementation; it does not have to report every defined printer state
  19. * reason.
  20. * <P>
  21. * Instances of PrinterStateReason do not appear in a Print Service's
  22. * attribute set directly.
  23. * Rather, a {@link PrinterStateReasons PrinterStateReasons}
  24. * attribute appears in the Print Service's attribute set. The {@link
  25. * PrinterStateReasons PrinterStateReasons} attribute contains zero, one, or
  26. * more than one PrinterStateReason objects which pertain to the
  27. * Print Service's status, and each PrinterStateReason object is
  28. * associated with a {@link Severity Severity} level of REPORT (least severe),
  29. * WARNING, or ERROR (most severe). The printer adds a PrinterStateReason
  30. * object to the Print Service's
  31. * {@link PrinterStateReasons PrinterStateReasons} attribute when the
  32. * corresponding condition becomes true of the printer, and the printer
  33. * removesthe PrinterStateReason object again when the corresponding
  34. * condition becomes false, regardless of whether the Print Service's overall
  35. * {@link PrinterState PrinterState} also changed.
  36. * <P>
  37. * <B>IPP Compatibility:</B>
  38. * The string values returned by each individual {@link PrinterStateReason} and
  39. * associated {@link Severity} object's <CODE>toString()</CODE>
  40. * methods, concatenated together with a hyphen (<CODE>"-"</CODE>) in
  41. * between, gives the IPP keyword value for a {@link PrinterStateReasons}.
  42. * The category name returned by <CODE>getName()</CODE> gives the IPP
  43. * attribute name.
  44. * <P>
  45. *
  46. * @author Alan Kaminsky
  47. */
  48. public class PrinterStateReason extends EnumSyntax implements Attribute {
  49. private static final long serialVersionUID = -1623720656201472593L;
  50. /**
  51. * The printer has detected an error other than ones listed below.
  52. */
  53. public static final PrinterStateReason OTHER = new PrinterStateReason(0);
  54. /**
  55. * A tray has run out of media.
  56. */
  57. public static final PrinterStateReason
  58. MEDIA_NEEDED = new PrinterStateReason(1);
  59. /**
  60. * The device has a media jam.
  61. */
  62. public static final PrinterStateReason
  63. MEDIA_JAM = new PrinterStateReason(2);
  64. /**
  65. * Someone has paused the printer, but the device(s) are taking an
  66. * appreciable time to stop. Later, when all output has stopped,
  67. * the {@link PrinterState PrinterState} becomes STOPPED,
  68. * and the PAUSED value replaces
  69. * the MOVING_TO_PAUSED value in the {@link PrinterStateReasons
  70. * PrinterStateReasons} attribute. This value must be supported if the
  71. * printer can be paused and the implementation takes significant time to
  72. * pause a device in certain circumstances.
  73. */
  74. public static final PrinterStateReason
  75. MOVING_TO_PAUSED = new PrinterStateReason(3);
  76. /**
  77. * Someone has paused the printer and the printer's {@link PrinterState
  78. * PrinterState} is STOPPED. In this state, a printer must not produce
  79. * printed output, but it must perform other operations requested by a
  80. * client. If a printer had been printing a job when the printer was
  81. * paused,
  82. * the Printer must resume printing that job when the printer is no longer
  83. * paused and leave no evidence in the printed output of such a pause.
  84. * This value must be supported if the printer can be paused.
  85. */
  86. public static final PrinterStateReason
  87. PAUSED = new PrinterStateReason(4);
  88. /**
  89. * Someone has removed a printer from service, and the device may be
  90. * powered down or physically removed.
  91. * In this state, a printer must not produce
  92. * printed output, and unless the printer is realized by a print server
  93. * that is still active, the printer must perform no other operations
  94. * requested by a client.
  95. * If a printer had been printing a job when it was shut down,
  96. * the printer need not resume printing that job when the printer is no
  97. * longer shut down. If the printer resumes printing such a job, it may
  98. * leave evidence in the printed output of such a shutdown, e.g. the part
  99. * printed before the shutdown may be printed a second time after the
  100. * shutdown.
  101. */
  102. public static final PrinterStateReason
  103. SHUTDOWN = new PrinterStateReason(5);
  104. /**
  105. * The printer has scheduled a job on the output device and is in the
  106. * process of connecting to a shared network output device (and might not
  107. * be able to actually start printing the job for an arbitrarily long time
  108. * depending on the usage of the output device by other servers on the
  109. * network).
  110. */
  111. public static final PrinterStateReason
  112. CONNECTING_TO_DEVICE = new PrinterStateReason(6);
  113. /**
  114. * The server was able to connect to the output device (or is always
  115. * connected), but was unable to get a response from the output device.
  116. */
  117. public static final PrinterStateReason
  118. TIMED_OUT = new PrinterStateReason(7);
  119. /**
  120. * The printer is in the process of stopping the device and will be
  121. * stopped in a while.
  122. * When the device is stopped, the printer will change the
  123. * {@link PrinterState PrinterState} to STOPPED. The STOPPING reason is
  124. * never an error, even for a printer with a single output device. When an
  125. * output device ceases accepting jobs, the printer's {@link
  126. * PrinterStateReasons PrinterStateReasons} will have this reason while
  127. * the output device completes printing.
  128. */
  129. public static final PrinterStateReason
  130. STOPPING = new PrinterStateReason(8);
  131. /**
  132. * When a printer controls more than one output device, this reason
  133. * indicates that one or more output devices are stopped. If the reason's
  134. * severity is a report, fewer than half of the output devices are
  135. * stopped.
  136. * If the reason's severity is a warning, half or more but fewer than
  137. * all of the output devices are stopped.
  138. */
  139. public static final PrinterStateReason
  140. STOPPED_PARTLY = new PrinterStateReason(9);
  141. /**
  142. * The device is low on toner.
  143. */
  144. public static final PrinterStateReason
  145. TONER_LOW = new PrinterStateReason(10);
  146. /**
  147. * The device is out of toner.
  148. */
  149. public static final PrinterStateReason
  150. TONER_EMPTY = new PrinterStateReason(11);
  151. /**
  152. * The limit of persistent storage allocated for spooling has been
  153. * reached.
  154. * The printer is temporarily unable to accept more jobs. The printer will
  155. * remove this reason when it is able to accept more jobs.
  156. * This value should be used by a non-spooling printer that only
  157. * accepts one or a small number
  158. * jobs at a time or a spooling printer that has filled the spool space.
  159. */
  160. public static final PrinterStateReason
  161. SPOOL_AREA_FULL = new PrinterStateReason(12);
  162. /**
  163. * One or more covers on the device are open.
  164. */
  165. public static final PrinterStateReason
  166. COVER_OPEN = new PrinterStateReason(13);
  167. /**
  168. * One or more interlock devices on the printer are unlocked.
  169. */
  170. public static final PrinterStateReason
  171. INTERLOCK_OPEN = new PrinterStateReason(14);
  172. /**
  173. * One or more doors on the device are open.
  174. */
  175. public static final PrinterStateReason
  176. DOOR_OPEN = new PrinterStateReason(15);
  177. /**
  178. * One or more input trays are not in the device.
  179. */
  180. public static final PrinterStateReason
  181. INPUT_TRAY_MISSING = new PrinterStateReason(16);
  182. /**
  183. * At least one input tray is low on media.
  184. */
  185. public static final PrinterStateReason
  186. MEDIA_LOW = new PrinterStateReason(17);
  187. /**
  188. * At least one input tray is empty.
  189. */
  190. public static final PrinterStateReason
  191. MEDIA_EMPTY = new PrinterStateReason(18);
  192. /**
  193. * One or more output trays are not in the device.
  194. */
  195. public static final PrinterStateReason
  196. OUTPUT_TRAY_MISSING = new PrinterStateReason(19);
  197. /**
  198. * One or more output areas are almost full
  199. * (e.g. tray, stacker, collator).
  200. */
  201. public static final PrinterStateReason
  202. OUTPUT_AREA_ALMOST_FULL = new PrinterStateReason(20);
  203. /**
  204. * One or more output areas are full (e.g. tray, stacker, collator).
  205. */
  206. public static final PrinterStateReason
  207. OUTPUT_AREA_FULL = new PrinterStateReason(21);
  208. /**
  209. * The device is low on at least one marker supply (e.g. toner, ink,
  210. * ribbon).
  211. */
  212. public static final PrinterStateReason
  213. MARKER_SUPPLY_LOW = new PrinterStateReason(22);
  214. /**
  215. * The device is out of at least one marker supply (e.g. toner, ink,
  216. * ribbon).
  217. */
  218. public static final PrinterStateReason
  219. MARKER_SUPPLY_EMPTY = new PrinterStateReason(23);
  220. /**
  221. * The device marker supply waste receptacle is almost full.
  222. */
  223. public static final PrinterStateReason
  224. MARKER_WASTE_ALMOST_FULL = new PrinterStateReason(24);
  225. /**
  226. * The device marker supply waste receptacle is full.
  227. */
  228. public static final PrinterStateReason
  229. MARKER_WASTE_FULL = new PrinterStateReason(25);
  230. /**
  231. * The fuser temperature is above normal.
  232. */
  233. public static final PrinterStateReason
  234. FUSER_OVER_TEMP = new PrinterStateReason(26);
  235. /**
  236. * The fuser temperature is below normal.
  237. */
  238. public static final PrinterStateReason
  239. FUSER_UNDER_TEMP = new PrinterStateReason(27);
  240. /**
  241. * The optical photo conductor is near end of life.
  242. */
  243. public static final PrinterStateReason
  244. OPC_NEAR_EOL = new PrinterStateReason(28);
  245. /**
  246. * The optical photo conductor is no longer functioning.
  247. */
  248. public static final PrinterStateReason
  249. OPC_LIFE_OVER = new PrinterStateReason(29);
  250. /**
  251. * The device is low on developer.
  252. */
  253. public static final PrinterStateReason
  254. DEVELOPER_LOW = new PrinterStateReason(30);
  255. /**
  256. * The device is out of developer.
  257. */
  258. public static final PrinterStateReason
  259. DEVELOPER_EMPTY = new PrinterStateReason(31);
  260. /**
  261. * An interpreter resource is unavailable (e.g., font, form).
  262. */
  263. public static final PrinterStateReason
  264. INTERPRETER_RESOURCE_UNAVAILABLE = new PrinterStateReason(32);
  265. /**
  266. * Construct a new printer state reason enumeration value with
  267. * the given integer value.
  268. *
  269. * @param value Integer value.
  270. */
  271. protected PrinterStateReason(int value) {
  272. super (value);
  273. }
  274. private static final String[] myStringTable = {
  275. "other",
  276. "media-needed",
  277. "media-jam",
  278. "moving-to-paused",
  279. "paused",
  280. "shutdown",
  281. "connecting-to-device",
  282. "timed-out",
  283. "stopping",
  284. "stopped-partly",
  285. "toner-low",
  286. "toner-empty",
  287. "spool-area-full",
  288. "cover-open",
  289. "interlock-open",
  290. "door-open",
  291. "input-tray-missing",
  292. "media-low",
  293. "media-empty",
  294. "output-tray-missing",
  295. "output-area-almost-full",
  296. "output-area-full",
  297. "marker-supply-low",
  298. "marker-supply-empty",
  299. "marker-waste-almost-full",
  300. "marker-waste-full",
  301. "fuser-over-temp",
  302. "fuser-under-temp",
  303. "opc-near-eol",
  304. "opc-life-over",
  305. "developer-low",
  306. "developer-empty",
  307. "interpreter-resource-unavailable"
  308. };
  309. private static final PrinterStateReason[] myEnumValueTable = {
  310. OTHER,
  311. MEDIA_NEEDED,
  312. MEDIA_JAM,
  313. MOVING_TO_PAUSED,
  314. PAUSED,
  315. SHUTDOWN,
  316. CONNECTING_TO_DEVICE,
  317. TIMED_OUT,
  318. STOPPING,
  319. STOPPED_PARTLY,
  320. TONER_LOW,
  321. TONER_EMPTY,
  322. SPOOL_AREA_FULL,
  323. COVER_OPEN,
  324. INTERLOCK_OPEN,
  325. DOOR_OPEN,
  326. INPUT_TRAY_MISSING,
  327. MEDIA_LOW,
  328. MEDIA_EMPTY,
  329. OUTPUT_TRAY_MISSING,
  330. OUTPUT_AREA_ALMOST_FULL,
  331. OUTPUT_AREA_FULL,
  332. MARKER_SUPPLY_LOW,
  333. MARKER_SUPPLY_EMPTY,
  334. MARKER_WASTE_ALMOST_FULL,
  335. MARKER_WASTE_FULL,
  336. FUSER_OVER_TEMP,
  337. FUSER_UNDER_TEMP,
  338. OPC_NEAR_EOL,
  339. OPC_LIFE_OVER,
  340. DEVELOPER_LOW,
  341. DEVELOPER_EMPTY,
  342. INTERPRETER_RESOURCE_UNAVAILABLE
  343. };
  344. /**
  345. * Returns the string table for class PrinterStateReason.
  346. */
  347. protected String[] getStringTable() {
  348. return (String[])myStringTable.clone();
  349. }
  350. /**
  351. * Returns the enumeration value table for class PrinterStateReason.
  352. */
  353. protected EnumSyntax[] getEnumValueTable() {
  354. return (EnumSyntax[])myEnumValueTable.clone();
  355. }
  356. /**
  357. * Get the printing attribute class which is to be used as the "category"
  358. * for this printing attribute value.
  359. * <P>
  360. * For class PrinterStateReason and any vendor-defined subclasses, the
  361. * category is class PrinterStateReason itself.
  362. *
  363. * @return Printing attribute class (category), an instance of class
  364. * {@link java.lang.Class java.lang.Class}.
  365. */
  366. public final Class<? extends Attribute> getCategory() {
  367. return PrinterStateReason.class;
  368. }
  369. /**
  370. * Get the name of the category of which this attribute value is an
  371. * instance.
  372. * <P>
  373. * For class PrinterStateReason and any vendor-defined subclasses, the
  374. * category name is <CODE>"printer-state-reason"</CODE>.
  375. *
  376. * @return Attribute category name.
  377. */
  378. public final String getName() {
  379. return "printer-state-reason";
  380. }
  381. }