001 /*
002 * Copyright 2000-2004 Sun Microsystems, Inc. All Rights Reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation. Sun designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Sun in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022 * CA 95054 USA or visit www.sun.com if you need additional information or
023 * have any questions.
024 */
025 package javax.print.attribute.standard;
026
027 import javax.print.attribute.EnumSyntax;
028 import javax.print.attribute.Attribute;
029
030 /**
031 * Class PrinterStateReason is a printing attribute class, an enumeration,
032 * that provides additional information about the printer's current state,
033 * i.e., information that augments the value of the printer's
034 * {@link PrinterState PrinterState} attribute.
035 * Class PrinterStateReason defines standard printer
036 * state reason values. A Print Service implementation only needs to report
037 * those printer state reasons which are appropriate for the particular
038 * implementation; it does not have to report every defined printer state
039 * reason.
040 * <P>
041 * Instances of PrinterStateReason do not appear in a Print Service's
042 * attribute set directly.
043 * Rather, a {@link PrinterStateReasons PrinterStateReasons}
044 * attribute appears in the Print Service's attribute set. The {@link
045 * PrinterStateReasons PrinterStateReasons} attribute contains zero, one, or
046 * more than one PrinterStateReason objects which pertain to the
047 * Print Service's status, and each PrinterStateReason object is
048 * associated with a {@link Severity Severity} level of REPORT (least severe),
049 * WARNING, or ERROR (most severe). The printer adds a PrinterStateReason
050 * object to the Print Service's
051 * {@link PrinterStateReasons PrinterStateReasons} attribute when the
052 * corresponding condition becomes true of the printer, and the printer
053 * removesthe PrinterStateReason object again when the corresponding
054 * condition becomes false, regardless of whether the Print Service's overall
055 * {@link PrinterState PrinterState} also changed.
056 * <P>
057 * <B>IPP Compatibility:</B>
058 * The string values returned by each individual {@link PrinterStateReason} and
059 * associated {@link Severity} object's <CODE>toString()</CODE>
060 * methods, concatenated together with a hyphen (<CODE>"-"</CODE>) in
061 * between, gives the IPP keyword value for a {@link PrinterStateReasons}.
062 * The category name returned by <CODE>getName()</CODE> gives the IPP
063 * attribute name.
064 * <P>
065 *
066 * @author Alan Kaminsky
067 */
068 public class PrinterStateReason extends EnumSyntax implements Attribute {
069
070 private static final long serialVersionUID = -1623720656201472593L;
071
072 /**
073 * The printer has detected an error other than ones listed below.
074 */
075 public static final PrinterStateReason OTHER = new PrinterStateReason(
076 0);
077
078 /**
079 * A tray has run out of media.
080 */
081 public static final PrinterStateReason MEDIA_NEEDED = new PrinterStateReason(
082 1);
083
084 /**
085 * The device has a media jam.
086 */
087 public static final PrinterStateReason MEDIA_JAM = new PrinterStateReason(
088 2);
089
090 /**
091 * Someone has paused the printer, but the device(s) are taking an
092 * appreciable time to stop. Later, when all output has stopped,
093 * the {@link PrinterState PrinterState} becomes STOPPED,
094 * and the PAUSED value replaces
095 * the MOVING_TO_PAUSED value in the {@link PrinterStateReasons
096 * PrinterStateReasons} attribute. This value must be supported if the
097 * printer can be paused and the implementation takes significant time to
098 * pause a device in certain circumstances.
099 */
100 public static final PrinterStateReason MOVING_TO_PAUSED = new PrinterStateReason(
101 3);
102
103 /**
104 * Someone has paused the printer and the printer's {@link PrinterState
105 * PrinterState} is STOPPED. In this state, a printer must not produce
106 * printed output, but it must perform other operations requested by a
107 * client. If a printer had been printing a job when the printer was
108 * paused,
109 * the Printer must resume printing that job when the printer is no longer
110 * paused and leave no evidence in the printed output of such a pause.
111 * This value must be supported if the printer can be paused.
112 */
113 public static final PrinterStateReason PAUSED = new PrinterStateReason(
114 4);
115
116 /**
117 * Someone has removed a printer from service, and the device may be
118 * powered down or physically removed.
119 * In this state, a printer must not produce
120 * printed output, and unless the printer is realized by a print server
121 * that is still active, the printer must perform no other operations
122 * requested by a client.
123 * If a printer had been printing a job when it was shut down,
124 * the printer need not resume printing that job when the printer is no
125 * longer shut down. If the printer resumes printing such a job, it may
126 * leave evidence in the printed output of such a shutdown, e.g. the part
127 * printed before the shutdown may be printed a second time after the
128 * shutdown.
129 */
130 public static final PrinterStateReason SHUTDOWN = new PrinterStateReason(
131 5);
132
133 /**
134 * The printer has scheduled a job on the output device and is in the
135 * process of connecting to a shared network output device (and might not
136 * be able to actually start printing the job for an arbitrarily long time
137 * depending on the usage of the output device by other servers on the
138 * network).
139 */
140 public static final PrinterStateReason CONNECTING_TO_DEVICE = new PrinterStateReason(
141 6);
142
143 /**
144 * The server was able to connect to the output device (or is always
145 * connected), but was unable to get a response from the output device.
146 */
147 public static final PrinterStateReason TIMED_OUT = new PrinterStateReason(
148 7);
149
150 /**
151 * The printer is in the process of stopping the device and will be
152 * stopped in a while.
153 * When the device is stopped, the printer will change the
154 * {@link PrinterState PrinterState} to STOPPED. The STOPPING reason is
155 * never an error, even for a printer with a single output device. When an
156 * output device ceases accepting jobs, the printer's {@link
157 * PrinterStateReasons PrinterStateReasons} will have this reason while
158 * the output device completes printing.
159 */
160 public static final PrinterStateReason STOPPING = new PrinterStateReason(
161 8);
162
163 /**
164 * When a printer controls more than one output device, this reason
165 * indicates that one or more output devices are stopped. If the reason's
166 * severity is a report, fewer than half of the output devices are
167 * stopped.
168 * If the reason's severity is a warning, half or more but fewer than
169 * all of the output devices are stopped.
170 */
171 public static final PrinterStateReason STOPPED_PARTLY = new PrinterStateReason(
172 9);
173
174 /**
175 * The device is low on toner.
176 */
177 public static final PrinterStateReason TONER_LOW = new PrinterStateReason(
178 10);
179
180 /**
181 * The device is out of toner.
182 */
183 public static final PrinterStateReason TONER_EMPTY = new PrinterStateReason(
184 11);
185
186 /**
187 * The limit of persistent storage allocated for spooling has been
188 * reached.
189 * The printer is temporarily unable to accept more jobs. The printer will
190 * remove this reason when it is able to accept more jobs.
191 * This value should be used by a non-spooling printer that only
192 * accepts one or a small number
193 * jobs at a time or a spooling printer that has filled the spool space.
194 */
195 public static final PrinterStateReason SPOOL_AREA_FULL = new PrinterStateReason(
196 12);
197
198 /**
199 * One or more covers on the device are open.
200 */
201 public static final PrinterStateReason COVER_OPEN = new PrinterStateReason(
202 13);
203
204 /**
205 * One or more interlock devices on the printer are unlocked.
206 */
207 public static final PrinterStateReason INTERLOCK_OPEN = new PrinterStateReason(
208 14);
209
210 /**
211 * One or more doors on the device are open.
212 */
213 public static final PrinterStateReason DOOR_OPEN = new PrinterStateReason(
214 15);
215
216 /**
217 * One or more input trays are not in the device.
218 */
219 public static final PrinterStateReason INPUT_TRAY_MISSING = new PrinterStateReason(
220 16);
221
222 /**
223 * At least one input tray is low on media.
224 */
225 public static final PrinterStateReason MEDIA_LOW = new PrinterStateReason(
226 17);
227
228 /**
229 * At least one input tray is empty.
230 */
231 public static final PrinterStateReason MEDIA_EMPTY = new PrinterStateReason(
232 18);
233
234 /**
235 * One or more output trays are not in the device.
236 */
237 public static final PrinterStateReason OUTPUT_TRAY_MISSING = new PrinterStateReason(
238 19);
239
240 /**
241 * One or more output areas are almost full
242 * (e.g. tray, stacker, collator).
243 */
244 public static final PrinterStateReason OUTPUT_AREA_ALMOST_FULL = new PrinterStateReason(
245 20);
246
247 /**
248 * One or more output areas are full (e.g. tray, stacker, collator).
249 */
250 public static final PrinterStateReason OUTPUT_AREA_FULL = new PrinterStateReason(
251 21);
252
253 /**
254 * The device is low on at least one marker supply (e.g. toner, ink,
255 * ribbon).
256 */
257 public static final PrinterStateReason MARKER_SUPPLY_LOW = new PrinterStateReason(
258 22);
259
260 /**
261 * The device is out of at least one marker supply (e.g. toner, ink,
262 * ribbon).
263 */
264 public static final PrinterStateReason MARKER_SUPPLY_EMPTY = new PrinterStateReason(
265 23);
266
267 /**
268 * The device marker supply waste receptacle is almost full.
269 */
270 public static final PrinterStateReason MARKER_WASTE_ALMOST_FULL = new PrinterStateReason(
271 24);
272
273 /**
274 * The device marker supply waste receptacle is full.
275 */
276 public static final PrinterStateReason MARKER_WASTE_FULL = new PrinterStateReason(
277 25);
278
279 /**
280 * The fuser temperature is above normal.
281 */
282 public static final PrinterStateReason FUSER_OVER_TEMP = new PrinterStateReason(
283 26);
284
285 /**
286 * The fuser temperature is below normal.
287 */
288 public static final PrinterStateReason FUSER_UNDER_TEMP = new PrinterStateReason(
289 27);
290
291 /**
292 * The optical photo conductor is near end of life.
293 */
294 public static final PrinterStateReason OPC_NEAR_EOL = new PrinterStateReason(
295 28);
296
297 /**
298 * The optical photo conductor is no longer functioning.
299 */
300 public static final PrinterStateReason OPC_LIFE_OVER = new PrinterStateReason(
301 29);
302
303 /**
304 * The device is low on developer.
305 */
306 public static final PrinterStateReason DEVELOPER_LOW = new PrinterStateReason(
307 30);
308
309 /**
310 * The device is out of developer.
311 */
312 public static final PrinterStateReason DEVELOPER_EMPTY = new PrinterStateReason(
313 31);
314
315 /**
316 * An interpreter resource is unavailable (e.g., font, form).
317 */
318 public static final PrinterStateReason INTERPRETER_RESOURCE_UNAVAILABLE = new PrinterStateReason(
319 32);
320
321 /**
322 * Construct a new printer state reason enumeration value with
323 * the given integer value.
324 *
325 * @param value Integer value.
326 */
327 protected PrinterStateReason(int value) {
328 super (value);
329 }
330
331 private static final String[] myStringTable = { "other",
332 "media-needed", "media-jam", "moving-to-paused", "paused",
333 "shutdown", "connecting-to-device", "timed-out",
334 "stopping", "stopped-partly", "toner-low", "toner-empty",
335 "spool-area-full", "cover-open", "interlock-open",
336 "door-open", "input-tray-missing", "media-low",
337 "media-empty", "output-tray-missing",
338 "output-area-almost-full", "output-area-full",
339 "marker-supply-low", "marker-supply-empty",
340 "marker-waste-almost-full", "marker-waste-full",
341 "fuser-over-temp", "fuser-under-temp", "opc-near-eol",
342 "opc-life-over", "developer-low", "developer-empty",
343 "interpreter-resource-unavailable" };
344
345 private static final PrinterStateReason[] myEnumValueTable = {
346 OTHER, MEDIA_NEEDED, MEDIA_JAM, MOVING_TO_PAUSED, PAUSED,
347 SHUTDOWN, CONNECTING_TO_DEVICE, TIMED_OUT, STOPPING,
348 STOPPED_PARTLY, TONER_LOW, TONER_EMPTY, SPOOL_AREA_FULL,
349 COVER_OPEN, INTERLOCK_OPEN, DOOR_OPEN, INPUT_TRAY_MISSING,
350 MEDIA_LOW, MEDIA_EMPTY, OUTPUT_TRAY_MISSING,
351 OUTPUT_AREA_ALMOST_FULL, OUTPUT_AREA_FULL,
352 MARKER_SUPPLY_LOW, MARKER_SUPPLY_EMPTY,
353 MARKER_WASTE_ALMOST_FULL, MARKER_WASTE_FULL,
354 FUSER_OVER_TEMP, FUSER_UNDER_TEMP, OPC_NEAR_EOL,
355 OPC_LIFE_OVER, DEVELOPER_LOW, DEVELOPER_EMPTY,
356 INTERPRETER_RESOURCE_UNAVAILABLE };
357
358 /**
359 * Returns the string table for class PrinterStateReason.
360 */
361 protected String[] getStringTable() {
362 return (String[]) myStringTable.clone();
363 }
364
365 /**
366 * Returns the enumeration value table for class PrinterStateReason.
367 */
368 protected EnumSyntax[] getEnumValueTable() {
369 return (EnumSyntax[]) myEnumValueTable.clone();
370 }
371
372 /**
373 * Get the printing attribute class which is to be used as the "category"
374 * for this printing attribute value.
375 * <P>
376 * For class PrinterStateReason and any vendor-defined subclasses, the
377 * category is class PrinterStateReason itself.
378 *
379 * @return Printing attribute class (category), an instance of class
380 * {@link java.lang.Class java.lang.Class}.
381 */
382 public final Class<? extends Attribute> getCategory() {
383 return PrinterStateReason.class;
384 }
385
386 /**
387 * Get the name of the category of which this attribute value is an
388 * instance.
389 * <P>
390 * For class PrinterStateReason and any vendor-defined subclasses, the
391 * category name is <CODE>"printer-state-reason"</CODE>.
392 *
393 * @return Attribute category name.
394 */
395 public final String getName() {
396 return "printer-state-reason";
397 }
398
399 }
|