Save This Page
Home » openjdk-7 » javax » print » attribute » standard » [javadoc | source]
    1   /*
    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    */
   25   
   26   package javax.print.attribute.standard;
   27   
   28   import javax.print.attribute.Attribute;
   29   import javax.print.attribute.EnumSyntax;
   30   import javax.print.attribute.PrintJobAttribute;
   31   
   32   /**
   33    * JobState is a printing attribute class, an enumeration, that identifies
   34    * the current state of a print job. Class JobState defines standard job state
   35    * values. A  Print Service implementation only needs to report those job
   36    * states which are appropriate for the particular implementation; it does not
   37    * have to report every defined job state. The {@link JobStateReasons
   38    * JobStateReasons} attribute augments the JobState attribute to give more
   39    * detailed information about the job in the given job state.
   40    * <P>
   41    * <B>IPP Compatibility:</B> The category name returned by
   42    * <CODE>getName()</CODE> is the IPP attribute name.  The enumeration's
   43    * integer value is the IPP enum value.  The <code>toString()</code> method
   44    * returns the IPP string representation of the attribute value.
   45    * <P>
   46    *
   47    * @author  Alan Kaminsky
   48    */
   49   
   50   public class JobState extends EnumSyntax implements PrintJobAttribute {
   51   
   52       private static final long serialVersionUID = 400465010094018920L;
   53   
   54       /**
   55        * The job state is unknown.
   56        */
   57       public static final JobState UNKNOWN = new JobState(0);
   58   
   59       /**
   60        * The job is a candidate to start processing, but is not yet processing.
   61        */
   62       public static final JobState PENDING = new JobState(3);
   63   
   64       /**
   65        * The job is not a candidate for processing for any number of reasons but
   66        * will return to the PENDING state as soon as the reasons are no longer
   67        * present. The job's {@link JobStateReasons JobStateReasons} attribute must
   68        * indicate why the job is no longer a candidate for processing.
   69        */
   70       public static final JobState PENDING_HELD = new JobState(4);
   71   
   72       /**
   73        * The job is processing. One or more of the following activities is
   74        * occurring:
   75        * <OL TYPE=1>
   76        * <LI>
   77        * The job is using, or is attempting to use, one or more purely software
   78        * processes that are analyzing, creating, or interpreting a PDL, etc.
   79        * <P>
   80        * <LI>
   81        * The job is using, or is attempting to use, one or more hardware
   82        * devices that are interpreting a PDL, making marks on a medium, and/or
   83        * performing finishing, such as stapling, etc.
   84        * <P>
   85        * <LI>
   86        * The printer has made the job ready for printing, but the output
   87        * device is not yet printing it, either because the job hasn't reached the
   88        * output device or because the job is queued in the output device or some
   89        * other spooler, awaiting the output device to print it.
   90        * </OL>
   91        * <P>
   92        * When the job is in the PROCESSING state, the entire job state includes
   93        * the detailed status represented in the printer's {@link PrinterState
   94        * PrinterState} and {@link PrinterStateReasons PrinterStateReasons}
   95        * attributes.
   96        * <P>
   97        * Implementations may, though they need not, include additional values in
   98        * the job's {@link JobStateReasons JobStateReasons} attribute to indicate
   99        * 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 =
  173       {"unknown",
  174        null,
  175        null,
  176        "pending",
  177        "pending-held",
  178        "processing",
  179        "processing-stopped",
  180        "canceled",
  181        "aborted",
  182        "completed"};
  183   
  184       private static final JobState[] myEnumValueTable =
  185       {UNKNOWN,
  186        null,
  187        null,
  188        PENDING,
  189        PENDING_HELD,
  190        PROCESSING,
  191        PROCESSING_STOPPED,
  192        CANCELED,
  193        ABORTED,
  194        COMPLETED};
  195   
  196       /**
  197        * Returns the string table for class JobState.
  198        */
  199       protected String[] getStringTable() {
  200           return myStringTable;
  201       }
  202   
  203       /**
  204        * Returns the enumeration value table for class JobState.
  205        */
  206       protected EnumSyntax[] getEnumValueTable() {
  207           return myEnumValueTable;
  208       }
  209   
  210       /**
  211        * Get the printing attribute class which is to be used as the "category"
  212        * for this printing attribute value.
  213        * <P>
  214        * For class JobState and any vendor-defined subclasses, the category is
  215        * class JobState itself.
  216        *
  217        * @return  Printing attribute class (category), an instance of class
  218        *          {@link java.lang.Class java.lang.Class}.
  219        */
  220       public final Class<? extends Attribute> getCategory() {
  221           return JobState.class;
  222       }
  223   
  224       /**
  225        * Get the name of the category of which this attribute value is an
  226        * instance.
  227        * <P>
  228        * For class JobState and any vendor-defined subclasses, the category
  229        * name is <CODE>"job-state"</CODE>.
  230        *
  231        * @return  Attribute category name.
  232        */
  233       public final String getName() {
  234           return "job-state";
  235       }
  236   
  237   }

Save This Page
Home » openjdk-7 » javax » print » attribute » standard » [javadoc | source]