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