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.EnumSyntax;
  42: import javax.print.attribute.SupportedValuesAttribute;
  43: 
  44: /**
  45:  * <code>OperationsSupported</code> specifies the enums of the operations
  46:  * supported by a given printer or job object. The attribute is further
  47:  * specified in RFC 2911 section 4.4.15.
  48:  *  
  49:  * @author Wolfgang Baer (WBaer@gmx.de)
  50:  */
  51: public final class OperationsSupported extends EnumSyntax 
  52:   implements SupportedValuesAttribute
  53: {  
  54:   /*
  55:    * Value               Operation Name
  56:      -----------------   -------------------------------------
  57:      0x0000              reserved, not used
  58:      0x0001              reserved, not used
  59:      0x0002              Print-Job
  60:      0x0003              Print-URI
  61:      0x0004              Validate-Job
  62:      0x0005              Create-Job
  63:      0x0006              Send-Document
  64:      0x0007              Send-URI
  65:      0x0008              Cancel-Job
  66:      0x0009              Get-Job-Attributes
  67:      0x000A              Get-Jobs
  68:      0x000B              Get-Printer-Attributes
  69:      0x000C              Hold-Job
  70:      0x000D              Release-Job
  71:      0x000E              Restart-Job
  72:      0x000F              reserved for a future operation
  73:      0x0010              Pause-Printer
  74:      0x0011              Resume-Printer
  75:      0x0012              Purge-Jobs
  76:      0x0013-0x3FFF       reserved for future IETF standards track operations
  77:      0x4000-0x8FFF       reserved for vendor extensions
  78:    */
  79:   
  80:   // standard ipp 1.1 operations
  81: 
  82:   /** 
  83:    * Operation to print a job in one request/response. */
  84:   public static final OperationsSupported PRINT_JOB = 
  85:     new OperationsSupported(0x02);
  86:   
  87:   /** Operation to print a document from an URI */
  88:   public static final OperationsSupported PRINT_URI = 
  89:     new OperationsSupported(0x03);
  90:   
  91:   /** Operation to validate a job before submission. */
  92:   public static final OperationsSupported VALIDATE_JOB = 
  93:     new OperationsSupported(0x04);
  94:   
  95:   /** 
  96:    * Operation to create an initial job for use with multiple document per job. 
  97:    */
  98:   public static final OperationsSupported CREATE_JOB = 
  99:     new OperationsSupported(0x05);
 100:   
 101:   /** 
 102:    * Operation to send a document to a multidoc job created via CREATE_JOB 
 103:    */
 104:   public static final OperationsSupported SEND_DOCUMENT = 
 105:     new OperationsSupported(0x06);
 106:   
 107:   /** 
 108:    * Operation to send a document uri to a multidoc job created 
 109:    * via CREATE_JOB. The document accessible from this URI will be printed. 
 110:    */
 111:   public static final OperationsSupported SEND_URI = 
 112:     new OperationsSupported(0x07);
 113:   
 114:   /** Operation to cancel a job by its ID or name.  */
 115:   public static final OperationsSupported CANCEL_JOB = 
 116:     new OperationsSupported(0x08);
 117:   
 118:   /** Operation to get job attributes of a current job. */
 119:   public static final OperationsSupported GET_JOB_ATTRIBUTES = 
 120:     new OperationsSupported(0x09);
 121:   
 122:   /** Operation to pause a printer. */
 123:   public static final OperationsSupported PAUSE_PRINTER = 
 124:     new OperationsSupported(0x10);
 125:   
 126:   /** Operation to get all currently queued or processed jobs. */
 127:   public static final OperationsSupported GET_JOBS = 
 128:     new OperationsSupported(0x0A);
 129:   
 130:   /** Operation to get the attributes of a printer. */
 131:   public static final OperationsSupported GET_PRINTER_ATTRIBUTES = 
 132:     new OperationsSupported(0x0B);
 133:   
 134:   /** Operation to put a job on hold by its ID or name. */
 135:   public static final OperationsSupported HOLD_JOB = 
 136:     new OperationsSupported(0x0C);
 137:   
 138:   /** Operation to release a job by its ID or name. */
 139:   public static final OperationsSupported RELEASE_JOB = 
 140:     new OperationsSupported(0x0D);
 141:   
 142:   /** Operation to restart a job by its ID or name. */
 143:   public static final OperationsSupported RESTART_JOB = 
 144:     new OperationsSupported(0x0E);
 145:   
 146:   /** Not yet an operation - reserved for futher use. */
 147:   public static final OperationsSupported RESERVED = 
 148:     new OperationsSupported(0x0F);
 149:   
 150:   /** Operation to resume a printer. */
 151:   public static final OperationsSupported RESUME_PRINTER = 
 152:     new OperationsSupported(0x11);
 153:   
 154:   /** Operation to remove all jobs from a printer regardless of state. */
 155:   public static final OperationsSupported PURGE_JOBS = 
 156:     new OperationsSupported(0x12);
 157: 
 158: 
 159:   private static final String[] stringTable = { "print-job", "print-uri", 
 160:                                                 "validate-job", "create-job",
 161:                                                 "send-document", "send-uri", 
 162:                                                 "cancel-job", "get-job-attributes",
 163:                                                 "pause-printer", "get-jobs", 
 164:                                                 "get-printer-attributes", "hold-job",
 165:                                                 "release-job", "restart-job", "reserved",
 166:                                                 "resume-printer", "purge-job"};
 167:   
 168:   private static final OperationsSupported[] enumValueTable = 
 169:     { PRINT_JOB, PRINT_URI, VALIDATE_JOB, CREATE_JOB, SEND_DOCUMENT, SEND_URI,
 170:       CANCEL_JOB, GET_JOB_ATTRIBUTES, PAUSE_PRINTER, GET_JOBS, GET_PRINTER_ATTRIBUTES,
 171:       HOLD_JOB, RELEASE_JOB, RESTART_JOB, RESERVED, RESUME_PRINTER, PURGE_JOBS};
 172:   
 173:   
 174:   /**
 175:    * Constructs a <code>OperationsSupported</code> object.
 176:    * 
 177:    * @param value the enum value
 178:    */
 179:   protected OperationsSupported(int value)
 180:   {
 181:     super(value);
 182:   }
 183: 
 184:   /**
 185:    * Returns category of this class.
 186:    *
 187:    * @return The class <code>OperationsSupported</code> itself.
 188:    */
 189:   public Class getCategory()
 190:   {
 191:     return OperationsSupported.class;
 192:   }
 193: 
 194:   /**
 195:    * Returns the name of this attribute.
 196:    *
 197:    * @return The name "operations-supported".
 198:    */
 199:   public String getName()
 200:   {
 201:     return "operations-supported";
 202:   }
 203:   
 204:   /**
 205:    * Returns a table with the enumeration values represented as strings
 206:    * for this object.
 207:    *
 208:    * @return The enumeration values as strings.
 209:    */
 210:   protected String[] getStringTable()
 211:   {
 212:     return stringTable;
 213:   }
 214: 
 215:   /**
 216:    * Returns a table with the enumeration values for this object.
 217:    *
 218:    * @return The enumeration values.
 219:    */
 220:   protected EnumSyntax[] getEnumValueTable()
 221:   {
 222:     return enumValueTable;
 223:   }
 224: 
 225:   // we start with 2
 226:   protected int getOffset()
 227:   {
 228:     return 2;
 229:   } 
 230: }