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