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