001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: /**
018: * @author Igor A. Pyankov
019: * @version $Revision: 1.2 $
020: */package org.apache.harmony.x.print.ipp;
021:
022: /**
023: * This class represents Job and Printer Set Operations
024: * described in RFC 3380 (http://ietf.org/rfc/rfc3380.txt?number=3380)
025: */
026:
027: public class IppDefs {
028: public static final Object[] JOBTEMPLATEATTRIBUTES = {
029: "job-priority",
030: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
031: IppAttribute.TAG_INTEGER },
032: "job-priority-default",
033: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
034: IppAttribute.TAG_INTEGER },
035: "job-priority-supported",
036: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
037: IppAttribute.TAG_INTEGER },
038:
039: "job-hold-until",
040: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
041: IppAttribute.TAG_KEYWORD },
042: "job-hold-until-default",
043: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
044: IppAttribute.TAG_KEYWORD },
045: "job-hold-until-supported",
046: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
047: IppAttribute.TAG_KEYWORD },
048:
049: "job-sheets",
050: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
051: IppAttribute.TAG_KEYWORD },
052: "job-sheets-default",
053: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
054: IppAttribute.TAG_KEYWORD },
055: "job-sheets-supported",
056: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
057: IppAttribute.TAG_KEYWORD },
058:
059: "multiple-document-handling",
060: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
061: IppAttribute.TAG_KEYWORD },
062: "multiple-document-handling-default",
063: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
064: IppAttribute.TAG_KEYWORD },
065: "multiple-document-handling-supported",
066: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
067: IppAttribute.TAG_KEYWORD },
068:
069: "copies",
070: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
071: IppAttribute.TAG_INTEGER },
072: "copies-default",
073: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
074: IppAttribute.TAG_INTEGER },
075: "copies-supported",
076: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
077: IppAttribute.TAG_RANGEOFINTEGER },
078:
079: "finishings",
080: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
081: IppAttribute.TAG_ENUM },
082: "finishings-default",
083: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
084: IppAttribute.TAG_ENUM },
085: "finishings-supported",
086: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
087: IppAttribute.TAG_ENUM },
088:
089: "page-ranges",
090: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
091: IppAttribute.TAG_RANGEOFINTEGER },
092: "page-ranges-supported",
093: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
094: IppAttribute.TAG_BOOLEAN },
095:
096: "sides",
097: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
098: IppAttribute.TAG_KEYWORD },
099: "sides-default",
100: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
101: IppAttribute.TAG_KEYWORD },
102: "sides-supported",
103: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
104: IppAttribute.TAG_KEYWORD },
105:
106: "number-up",
107: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
108: IppAttribute.TAG_INTEGER },
109: "number-up-default",
110: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
111: IppAttribute.TAG_INTEGER },
112: "number-up-supported",
113: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
114: IppAttribute.TAG_INTEGER },
115:
116: "orientation-requested",
117: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
118: IppAttribute.TAG_ENUM },
119: "orientation-requested-default",
120: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
121: IppAttribute.TAG_ENUM },
122: "orientation-requested-supported",
123: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
124: IppAttribute.TAG_ENUM },
125:
126: "media",
127: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
128: IppAttribute.TAG_KEYWORD },
129: "media-default",
130: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
131: IppAttribute.TAG_KEYWORD },
132: "media-supported",
133: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
134: IppAttribute.TAG_KEYWORD },
135: "media-ready",
136: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
137: IppAttribute.TAG_KEYWORD },
138:
139: "printer-resolution",
140: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
141: IppAttribute.TAG_RESOLUTION },
142: "printer-resolution-default",
143: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
144: IppAttribute.TAG_RESOLUTION },
145: "printer-resolution-supported",
146: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
147: IppAttribute.TAG_RESOLUTION },
148:
149: "print-quality",
150: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
151: IppAttribute.TAG_ENUM },
152: "print-quality-default",
153: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
154: IppAttribute.TAG_ENUM },
155: "print-quality-supported",
156: new byte[] { IppAttributeGroup.TAG_JOB_TEMPLATE_ATTRIBUTES,
157: IppAttribute.TAG_ENUM } };
158:
159: public static final Object[] JOBDESCRIPTIONATTRIBUTES = {
160: "job-uri",
161: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
162: IppAttribute.TAG_URI },
163: "job-id",
164: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
165: IppAttribute.TAG_INTEGER },
166: "job-printer-uri",
167: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
168: IppAttribute.TAG_URI },
169: "job-more-info",
170: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
171: IppAttribute.TAG_URI },
172: // "job-name",
173: // new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
174: // IppAttribute.TAG_NAMEWITHOUTLANGUAGE },
175: "job-originating-user-name",
176: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
177: IppAttribute.TAG_NAMEWITHOUTLANGUAGE },
178: "job-state",
179: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
180: IppAttribute.TAG_ENUM },
181: "job-state-reasons",
182: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
183: IppAttribute.TAG_KEYWORD },
184: "job-state-message",
185: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
186: IppAttribute.TAG_TEXTWITHOUTLANGUAGE },
187: "job-detailed-status-messages",
188: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
189: IppAttribute.TAG_TEXTWITHOUTLANGUAGE },
190: "job-document-access-errors",
191: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
192: IppAttribute.TAG_TEXTWITHOUTLANGUAGE },
193: "number-of-documents",
194: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
195: IppAttribute.TAG_INTEGER },
196: "output-device-assigned",
197: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
198: IppAttribute.TAG_NAMEWITHOUTLANGUAGE },
199: "time-at-creation",
200: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
201: IppAttribute.TAG_INTEGER },
202: "time-at-processing",
203: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
204: IppAttribute.TAG_INTEGER },
205: "time-at-completed",
206: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
207: IppAttribute.TAG_INTEGER },
208: "job-printer-up-time",
209: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
210: IppAttribute.TAG_INTEGER },
211: "date-time-at-creation",
212: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
213: IppAttribute.TAG_DATETIME },
214: "date-time-at-processing",
215: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
216: IppAttribute.TAG_DATETIME },
217: "date-time-at-completed",
218: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
219: IppAttribute.TAG_DATETIME },
220: "number-of-intervening-jobs",
221: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
222: IppAttribute.TAG_INTEGER },
223: "job-message-from-operator",
224: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
225: IppAttribute.TAG_TEXTWITHOUTLANGUAGE },
226: "job-k-octets",
227: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
228: IppAttribute.TAG_INTEGER },
229: "job-impressions",
230: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
231: IppAttribute.TAG_INTEGER },
232: "job-media-sheets",
233: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
234: IppAttribute.TAG_INTEGER },
235: "job-k-octets-processed",
236: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
237: IppAttribute.TAG_INTEGER },
238: "job-impressions-completed",
239: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
240: IppAttribute.TAG_INTEGER },
241: "job-media-sheets-completed",
242: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
243: IppAttribute.TAG_INTEGER },
244: "attributes-charset",
245: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
246: IppAttribute.TAG_CHARSET },
247: "attributes-natural-language",
248: new byte[] { IppAttributeGroup.TAG_JOB_ATTRIBUTES,
249: IppAttribute.TAG_NATURAL_LANGUAGE } };
250:
251: public static final Object[] PRINTERDESCRIPTIONATTRIBUTES = {
252: "printer-uri-supported",
253: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
254: IppAttribute.TAG_URI },
255: "uri-security-supported",
256: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
257: IppAttribute.TAG_KEYWORD },
258: "uri-authentication-supported",
259: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
260: IppAttribute.TAG_KEYWORD },
261: "printer-name",
262: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
263: IppAttribute.TAG_NAMEWITHOUTLANGUAGE },
264: "printer-location",
265: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
266: IppAttribute.TAG_TEXTWITHOUTLANGUAGE },
267: "printer-info",
268: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
269: IppAttribute.TAG_TEXTWITHOUTLANGUAGE },
270: "printer-more-info",
271: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
272: IppAttribute.TAG_URI },
273: "printer-driver-installer",
274: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
275: IppAttribute.TAG_URI },
276: "printer-make-and-model",
277: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
278: IppAttribute.TAG_TEXTWITHOUTLANGUAGE },
279: "printer-more-info-manufacturer",
280: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
281: IppAttribute.TAG_URI },
282: "printer-state",
283: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
284: IppAttribute.TAG_ENUM },
285: "printer-state-reasons",
286: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
287: IppAttribute.TAG_KEYWORD },
288: "printer-state-message",
289: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
290: IppAttribute.TAG_TEXTWITHOUTLANGUAGE },
291: "ipp-versions-supported",
292: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
293: IppAttribute.TAG_KEYWORD },
294: "operations-supported",
295: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
296: IppAttribute.TAG_ENUM },
297: "multiple-document-jobs-supported",
298: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
299: IppAttribute.TAG_BOOLEAN },
300: "charset-configured",
301: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
302: IppAttribute.TAG_CHARSET },
303: "charset-supported",
304: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
305: IppAttribute.TAG_CHARSET },
306: "natural-language-configured",
307: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
308: IppAttribute.TAG_NATURAL_LANGUAGE },
309: "generated-natural-language-supported",
310: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
311: IppAttribute.TAG_NATURAL_LANGUAGE },
312: "document-format-default",
313: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
314: IppAttribute.TAG_MIMEMEDIATYPE },
315: "document-format-supported",
316: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
317: IppAttribute.TAG_MIMEMEDIATYPE },
318: "printer-is-accepting-jobs",
319: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
320: IppAttribute.TAG_BOOLEAN },
321: "queued-job-count",
322: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
323: IppAttribute.TAG_INTEGER },
324: "printer-message-from-operator",
325: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
326: IppAttribute.TAG_TEXTWITHOUTLANGUAGE },
327: "color-supported",
328: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
329: IppAttribute.TAG_BOOLEAN },
330: "reference-uri-schemes-supported",
331: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
332: IppAttribute.TAG_URISCHEME },
333: "pdl-override-supported",
334: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
335: IppAttribute.TAG_KEYWORD },
336: "printer-up-time",
337: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
338: IppAttribute.TAG_INTEGER },
339: "printer-current-time",
340: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
341: IppAttribute.TAG_DATETIME },
342: "multiple-operation-time-out",
343: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
344: IppAttribute.TAG_INTEGER },
345: "compression-supported",
346: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
347: IppAttribute.TAG_KEYWORD },
348: "job-k-octets-supported",
349: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
350: IppAttribute.TAG_RANGEOFINTEGER },
351: "job-impressions-supported",
352: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
353: IppAttribute.TAG_RANGEOFINTEGER },
354: "job-media-sheets-supported",
355: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
356: IppAttribute.TAG_RANGEOFINTEGER },
357: "pages-per-minute",
358: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
359: IppAttribute.TAG_INTEGER },
360: "pages-per-minute-color",
361: new byte[] { IppAttributeGroup.TAG_PRINTER_ATTRIBUTES,
362: IppAttribute.TAG_INTEGER } };
363:
364: public static final Object[] PRINTEROPERATIONATTRIBUTES = {
365: "requesting-user-name",
366: new byte[] { IppAttributeGroup.TAG_OPERATION_ATTRIBUTES,
367: IppAttribute.TAG_NAMEWITHOUTLANGUAGE },
368: "job-name",
369: new byte[] { IppAttributeGroup.TAG_OPERATION_ATTRIBUTES,
370: IppAttribute.TAG_NAMEWITHOUTLANGUAGE },
371: "document-name",
372: new byte[] { IppAttributeGroup.TAG_OPERATION_ATTRIBUTES,
373: IppAttribute.TAG_NAMEWITHOUTLANGUAGE } };
374:
375: public static final Object[] ATAGS = { JOBTEMPLATEATTRIBUTES,
376: JOBDESCRIPTIONATTRIBUTES, PRINTERDESCRIPTIONATTRIBUTES,
377: PRINTEROPERATIONATTRIBUTES };
378:
379: // TODO need to tune for performance
380: public static byte getAttributeGtag(String aname) {
381: for (int ii = ATAGS.length, i = 0; i < ii; i += 1) {
382: Object[] atags = (Object[]) ATAGS[i];
383: for (int j = 0, jj = atags.length; j < jj; j += 2) {
384: if (aname.equals(atags[j])) {
385: return ((byte[]) atags[j + 1])[0];
386: }
387: }
388: }
389: return -1;
390: }
391:
392: // TODO need to tune for performance
393: public static byte getAttributeVtag(String aname) {
394: for (int ii = ATAGS.length, i = 0; i < ii; i += 1) {
395: Object[] atags = (Object[]) ATAGS[i];
396: for (int j = 0, jj = atags.length; j < jj; j += 2) {
397: if (aname.equals(atags[j])) {
398: return ((byte[]) atags[j + 1])[1];
399: }
400: }
401: }
402: return -1;
403: }
404:
405: }
|