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
026 package javax.print.attribute.standard;
027
028 import javax.print.attribute.Attribute;
029 import javax.print.attribute.EnumSyntax;
030 import javax.print.attribute.PrintJobAttribute;
031
032 /**
033 * JobState is a printing attribute class, an enumeration, that identifies
034 * the current state of a print job. Class JobState defines standard job state
035 * values. A Print Service implementation only needs to report those job
036 * states which are appropriate for the particular implementation; it does not
037 * have to report every defined job state. The {@link JobStateReasons
038 * JobStateReasons} attribute augments the JobState attribute to give more
039 * detailed information about the job in the given job state.
040 * <P>
041 * <B>IPP Compatibility:</B> The category name returned by
042 * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
043 * integer value is the IPP enum value. The <code>toString()</code> method
044 * returns the IPP string representation of the attribute value.
045 * <P>
046 *
047 * @author Alan Kaminsky
048 */
049
050 public class JobState extends EnumSyntax implements PrintJobAttribute {
051
052 private static final long serialVersionUID = 400465010094018920L;
053
054 /**
055 * The job state is unknown.
056 */
057 public static final JobState UNKNOWN = new JobState(0);
058
059 /**
060 * The job is a candidate to start processing, but is not yet processing.
061 */
062 public static final JobState PENDING = new JobState(3);
063
064 /**
065 * The job is not a candidate for processing for any number of reasons but
066 * will return to the PENDING state as soon as the reasons are no longer
067 * present. The job's {@link JobStateReasons JobStateReasons} attribute must
068 * indicate why the job is no longer a candidate for processing.
069 */
070 public static final JobState PENDING_HELD = new JobState(4);
071
072 /**
073 * The job is processing. One or more of the following activities is
074 * occurring:
075 * <OL TYPE=1>
076 * <LI>
077 * The job is using, or is attempting to use, one or more purely software
078 * processes that are analyzing, creating, or interpreting a PDL, etc.
079 * <P>
080 * <LI>
081 * The job is using, or is attempting to use, one or more hardware
082 * devices that are interpreting a PDL, making marks on a medium, and/or
083 * performing finishing, such as stapling, etc.
084 * <P>
085 * <LI>
086 * The printer has made the job ready for printing, but the output
087 * device is not yet printing it, either because the job hasn't reached the
088 * output device or because the job is queued in the output device or some
089 * other spooler, awaiting the output device to print it.
090 * </OL>
091 * <P>
092 * When the job is in the PROCESSING state, the entire job state includes
093 * the detailed status represented in the printer's {@link PrinterState
094 * PrinterState} and {@link PrinterStateReasons PrinterStateReasons}
095 * attributes.
096 * <P>
097 * Implementations may, though they need not, include additional values in
098 * the job's {@link JobStateReasons JobStateReasons} attribute to indicate
099 * the progress of the job, such as adding the JOB_PRINTING value to
100 * indicate when the output device is actually making marks on paper and/or
101 * the PROCESSING_TO_STOP_POINT value to indicate that the printer is in the
102 * process of canceling or aborting the job.
103 */
104 public static final JobState PROCESSING = new JobState(5);
105
106 /**
107 * The job has stopped while processing for any number of reasons and will
108 * return to the PROCESSING state as soon as the reasons are no longer
109 * present.
110 * <P>
111 * The job's {@link JobStateReasons JobStateReasons} attribute may indicate
112 * why the job has stopped processing. For example, if the output device is
113 * stopped, the PRINTER_STOPPED value may be included in the job's {@link
114 * JobStateReasons JobStateReasons} attribute.
115 * <P>
116 * <I>Note:</I> When an output device is stopped, the device usually
117 * indicates its condition in human readable form locally at the device. A
118 * client can obtain more complete device status remotely by querying the
119 * printer's {@link PrinterState PrinterState} and {@link
120 * PrinterStateReasons PrinterStateReasons} attributes.
121 */
122 public static final JobState PROCESSING_STOPPED = new JobState(6);
123
124 /**
125 * The job has been canceled by some human agency, the printer has completed
126 * canceling the job, and all job status attributes have reached their final
127 * values for the job. While the printer is canceling the job, the job
128 * remains in its current state, but the job's {@link JobStateReasons
129 * JobStateReasons} attribute should contain the PROCESSING_TO_STOP_POINT
130 * value and one of the CANCELED_BY_USER, CANCELED_BY_OPERATOR, or
131 * CANCELED_AT_DEVICE values. When the job moves to the CANCELED state, the
132 * PROCESSING_TO_STOP_POINT value, if present, must be removed, but the
133 * CANCELED_BY_<I>xxx</I> value, if present, must remain.
134 */
135 public static final JobState CANCELED = new JobState(7);
136
137 /**
138 * The job has been aborted by the system (usually while the job was in the
139 * PROCESSING or PROCESSING_STOPPED state), the printer has completed
140 * aborting the job, and all job status attributes have reached their final
141 * values for the job. While the printer is aborting the job, the job
142 * remains in its current state, but the job's {@link JobStateReasons
143 * JobStateReasons} attribute should contain the PROCESSING_TO_STOP_POINT
144 * and ABORTED_BY_SYSTEM values. When the job moves to the ABORTED state,
145 * the PROCESSING_TO_STOP_POINT value, if present, must be removed, but the
146 * ABORTED_BY_SYSTEM value, if present, must remain.
147 */
148 public static final JobState ABORTED = new JobState(8);
149
150 /**
151 * The job has completed successfully or with warnings or errors after
152 * processing, all of the job media sheets have been successfully stacked in
153 * the appropriate output bin(s), and all job status attributes have reached
154 * their final values for the job. The job's {@link JobStateReasons
155 * JobStateReasons} attribute should contain one of these values:
156 * COMPLETED_SUCCESSFULLY, COMPLETED_WITH_WARNINGS, or
157 * COMPLETED_WITH_ERRORS.
158 */
159 public static final JobState COMPLETED = new JobState(9);
160
161 // Hidden constructors.
162
163 /**
164 * Construct a new job state enumeration value with the given integer value.
165 *
166 * @param value Integer value.
167 */
168 protected JobState(int value) {
169 super (value);
170 }
171
172 private static final String[] myStringTable = { "unknown", null,
173 null, "pending", "pending-held", "processing",
174 "processing-stopped", "canceled", "aborted", "completed" };
175
176 private static final JobState[] myEnumValueTable = { UNKNOWN, null,
177 null, PENDING, PENDING_HELD, PROCESSING,
178 PROCESSING_STOPPED, CANCELED, ABORTED, COMPLETED };
179
180 /**
181 * Returns the string table for class JobState.
182 */
183 protected String[] getStringTable() {
184 return myStringTable;
185 }
186
187 /**
188 * Returns the enumeration value table for class JobState.
189 */
190 protected EnumSyntax[] getEnumValueTable() {
191 return myEnumValueTable;
192 }
193
194 /**
195 * Get the printing attribute class which is to be used as the "category"
196 * for this printing attribute value.
197 * <P>
198 * For class JobState and any vendor-defined subclasses, the category is
199 * class JobState itself.
200 *
201 * @return Printing attribute class (category), an instance of class
202 * {@link java.lang.Class java.lang.Class}.
203 */
204 public final Class<? extends Attribute> getCategory() {
205 return JobState.class;
206 }
207
208 /**
209 * Get the name of the category of which this attribute value is an
210 * instance.
211 * <P>
212 * For class JobState and any vendor-defined subclasses, the category
213 * name is <CODE>"job-state"</CODE>.
214 *
215 * @return Attribute category name.
216 */
217 public final String getName() {
218 return "job-state";
219 }
220
221 }
|