Source for gnu.javax.print.ipp.attribute.supported.OperationsSupported

   1: /* OperationsSupported.java --
   2:    Copyright (C) 2006 Free Software Foundation, Inc.
   3: 
   4: This file is part of GNU Classpath.
   5: 
   6: GNU Classpath is free software; you can redistribute it and/or modify
   7: it under the terms of the GNU General Public License as published by
   8: the Free Software Foundation; either version 2, or (at your option)
   9: any later version.
  10: 
  11: GNU Classpath is distributed in the hope that it will be useful, but
  12: WITHOUT ANY WARRANTY; without even the implied warranty of
  13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14: General Public License for more details.
  15: 
  16: You should have received a copy of the GNU General Public License
  17: along with GNU Classpath; see the file COPYING.  If not, write to the
  18: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  19: 02110-1301 USA.
  20: 
  21: Linking this library statically or dynamically with other modules is
  22: making a combined work based on this library.  Thus, the terms and
  23: conditions of the GNU General Public License cover the whole
  24: combination.
  25: 
  26: As a special exception, the copyright holders of this library give you
  27: permission to link this library with independent modules to produce an
  28: executable, regardless of the license terms of these independent
  29: modules, and to copy and distribute the resulting executable under
  30: terms of your choice, provided that you also meet, for each linked
  31: independent module, the terms and conditions of the license of that
  32: module.  An independent module is a module which is not derived from
  33: or based on this library.  If you modify this library, you may extend
  34: this exception to your version of the library, but you are not
  35: obligated to do so.  If you do not wish to do so, delete this
  36: exception statement from your version. */
  37: 
  38: 
  39: package gnu.javax.print.ipp.attribute.supported;
  40: 
  41: import javax.print.attribute.Attribute;
  42: import javax.print.attribute.EnumSyntax;
  43: import javax.print.attribute.SupportedValuesAttribute;
  44: 
  45: /**
  46:  * <code>OperationsSupported</code> specifies the enums of the operations
  47:  * supported by a given printer or job object. The attribute is further
  48:  * specified in RFC 2911 section 4.4.15.
  49:  *
  50:  * @author Wolfgang Baer (WBaer@gmx.de)
  51:  */
  52: public final class OperationsSupported extends EnumSyntax
  53:   implements SupportedValuesAttribute
  54: {
  55:   /*
  56:    * Value               Operation Name
  57:      -----------------   -------------------------------------
  58:      0x0000              reserved, not used
  59:      0x0001              reserved, not used
  60:      0x0002              Print-Job
  61:      0x0003              Print-URI
  62:      0x0004              Validate-Job
  63:      0x0005              Create-Job
  64:      0x0006              Send-Document
  65:      0x0007              Send-URI
  66:      0x0008              Cancel-Job
  67:      0x0009              Get-Job-Attributes
  68:      0x000A              Get-Jobs
  69:      0x000B              Get-Printer-Attributes
  70:      0x000C              Hold-Job
  71:      0x000D              Release-Job
  72:      0x000E              Restart-Job
  73:      0x000F              reserved for a future operation
  74:      0x0010              Pause-Printer
  75:      0x0011              Resume-Printer
  76:      0x0012              Purge-Jobs
  77:      0x0013-0x3FFF       reserved for future IETF standards track operations
  78:      0x4000-0x8FFF       reserved for vendor extensions
  79:    */
  80: 
  81:   // standard ipp 1.1 operations
  82: 
  83:   /**
  84:    * Operation to print a job in one request/response. */
  85:   public static final OperationsSupported PRINT_JOB =
  86:     new OperationsSupported(0x02);
  87: 
  88:   /** Operation to print a document from an URI */
  89:   public static final OperationsSupported PRINT_URI =
  90:     new OperationsSupported(0x03);
  91: 
  92:   /** Operation to validate a job before submission. */
  93:   public static final OperationsSupported VALIDATE_JOB =
  94:     new OperationsSupported(0x04);
  95: 
  96:   /**
  97:    * Operation to create an initial job for use with multiple document per job.
  98:    */
  99:   public static final OperationsSupported CREATE_JOB =
 100:     new OperationsSupported(0x05);
 101: 
 102:   /**
 103:    * Operation to send a document to a multidoc job created via CREATE_JOB
 104:    */
 105:   public static final OperationsSupported SEND_DOCUMENT =
 106:     new OperationsSupported(0x06);
 107: 
 108:   /**
 109:    * Operation to send a document uri to a multidoc job created
 110:    * via CREATE_JOB. The document accessible from this URI will be printed.
 111:    */
 112:   public static final OperationsSupported SEND_URI =
 113:     new OperationsSupported(0x07);
 114: 
 115:   /** Operation to cancel a job by its ID or name.  */
 116:   public static final OperationsSupported CANCEL_JOB =
 117:     new OperationsSupported(0x08);
 118: 
 119:   /** Operation to get job attributes of a current job. */
 120:   public static final OperationsSupported GET_JOB_ATTRIBUTES =
 121:     new OperationsSupported(0x09);
 122: 
 123:   /** Operation to pause a printer. */
 124:   public static final OperationsSupported PAUSE_PRINTER =
 125:     new OperationsSupported(0x10);
 126: 
 127:   /** Operation to get all currently queued or processed jobs. */
 128:   public static final OperationsSupported GET_JOBS =
 129:     new OperationsSupported(0x0A);
 130: 
 131:   /** Operation to get the attributes of a printer. */
 132:   public static final OperationsSupported GET_PRINTER_ATTRIBUTES =
 133:     new OperationsSupported(0x0B);
 134: 
 135:   /** Operation to put a job on hold by its ID or name. */
 136:   public static final OperationsSupported HOLD_JOB =
 137:     new OperationsSupported(0x0C);
 138: 
 139:   /** Operation to release a job by its ID or name. */
 140:   public static final OperationsSupported RELEASE_JOB =
 141:     new OperationsSupported(0x0D);
 142: 
 143:   /** Operation to restart a job by its ID or name. */
 144:   public static final OperationsSupported RESTART_JOB =
 145:     new OperationsSupported(0x0E);
 146: 
 147:   /** Not yet an operation - reserved for futher use. */
 148:   public static final OperationsSupported RESERVED =
 149:     new OperationsSupported(0x0F);
 150: 
 151:   /** Operation to resume a printer. */
 152:   public static final OperationsSupported RESUME_PRINTER =
 153:     new OperationsSupported(0x11);
 154: 
 155:   /** Operation to remove all jobs from a printer regardless of state. */
 156:   public static final OperationsSupported PURGE_JOBS =
 157:     new OperationsSupported(0x12);
 158: 
 159: 
 160:   private static final String[] stringTable = { "print-job", "print-uri",
 161:                                                 "validate-job", "create-job",
 162:                                                 "send-document", "send-uri",
 163:                                                 "cancel-job", "get-job-attributes",
 164:                                                 "pause-printer", "get-jobs",
 165:                                                 "get-printer-attributes", "hold-job",
 166:                                                 "release-job", "restart-job", "reserved",
 167:                                                 "resume-printer", "purge-job"};
 168: 
 169:   private static final OperationsSupported[] enumValueTable =
 170:     { PRINT_JOB, PRINT_URI, VALIDATE_JOB, CREATE_JOB, SEND_DOCUMENT, SEND_URI,
 171:       CANCEL_JOB, GET_JOB_ATTRIBUTES, PAUSE_PRINTER, GET_JOBS, GET_PRINTER_ATTRIBUTES,
 172:       HOLD_JOB, RELEASE_JOB, RESTART_JOB, RESERVED, RESUME_PRINTER, PURGE_JOBS};
 173: 
 174: 
 175:   /**
 176:    * Constructs a <code>OperationsSupported</code> object.
 177:    *
 178:    * @param value the enum value
 179:    */
 180:   protected OperationsSupported(int value)
 181:   {
 182:     super(value);
 183:   }
 184: 
 185:   /**
 186:    * Returns category of this class.
 187:    *
 188:    * @return The class <code>OperationsSupported</code> itself.
 189:    */
 190:   public Class<? extends Attribute> getCategory()
 191:   {
 192:     return OperationsSupported.class;
 193:   }
 194: 
 195:   /**
 196:    * Returns the name of this attribute.
 197:    *
 198:    * @return The name "operations-supported".
 199:    */
 200:   public String getName()
 201:   {
 202:     return "operations-supported";
 203:   }
 204: 
 205:   /**
 206:    * Returns a table with the enumeration values represented as strings
 207:    * for this object.
 208:    *
 209:    * @return The enumeration values as strings.
 210:    */
 211:   protected String[] getStringTable()
 212:   {
 213:     return stringTable;
 214:   }
 215: 
 216:   /**
 217:    * Returns a table with the enumeration values for this object.
 218:    *
 219:    * @return The enumeration values.
 220:    */
 221:   protected EnumSyntax[] getEnumValueTable()
 222:   {
 223:     return enumValueTable;
 224:   }
 225: 
 226:   // we start with 2
 227:   protected int getOffset()
 228:   {
 229:     return 2;
 230:   }
 231: }