Initial import.
[clinton/mirror/jspi/.git] / jspi / src / main / java / de / lohndirekt / print / attribute / IppAttributeName.java
1 /**
2 * Copyright (C) 2003 <a href="http://www.lohndirekt.de/">lohndirekt.de</a>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 */
19 package de.lohndirekt.print.attribute;
20
21 import java.net.URI;
22 import java.net.URISyntaxException;
23 import java.util.Date;
24 import java.util.HashMap;
25 import java.util.Locale;
26 import java.util.Map;
27 import java.util.logging.Logger;
28
29 import javax.print.attribute.Attribute;
30 import javax.print.attribute.standard.ColorSupported;
31 import javax.print.attribute.standard.Compression;
32 import javax.print.attribute.standard.Copies;
33 import javax.print.attribute.standard.CopiesSupported;
34 import javax.print.attribute.standard.DateTimeAtCompleted;
35 import javax.print.attribute.standard.DateTimeAtCreation;
36 import javax.print.attribute.standard.DateTimeAtProcessing;
37 import javax.print.attribute.standard.DocumentName;
38 import javax.print.attribute.standard.Fidelity;
39 import javax.print.attribute.standard.Finishings;
40 import javax.print.attribute.standard.JobImpressions;
41 import javax.print.attribute.standard.JobImpressionsCompleted;
42 import javax.print.attribute.standard.JobImpressionsSupported;
43 import javax.print.attribute.standard.JobKOctets;
44 import javax.print.attribute.standard.JobKOctetsProcessed;
45 import javax.print.attribute.standard.JobKOctetsSupported;
46 import javax.print.attribute.standard.JobMediaSheets;
47 import javax.print.attribute.standard.JobMediaSheetsCompleted;
48 import javax.print.attribute.standard.JobMediaSheetsSupported;
49 import javax.print.attribute.standard.JobMessageFromOperator;
50 import javax.print.attribute.standard.JobName;
51 import javax.print.attribute.standard.JobOriginatingUserName;
52 import javax.print.attribute.standard.JobPriority;
53 import javax.print.attribute.standard.JobPrioritySupported;
54 import javax.print.attribute.standard.JobSheets;
55 import javax.print.attribute.standard.JobState;
56 import javax.print.attribute.standard.JobStateReason;
57 import javax.print.attribute.standard.JobStateReasons;
58 import javax.print.attribute.standard.MediaSizeName;
59 import javax.print.attribute.standard.MultipleDocumentHandling;
60 import javax.print.attribute.standard.NumberOfDocuments;
61 import javax.print.attribute.standard.NumberOfInterveningJobs;
62 import javax.print.attribute.standard.NumberUp;
63 import javax.print.attribute.standard.NumberUpSupported;
64 import javax.print.attribute.standard.OrientationRequested;
65 import javax.print.attribute.standard.OutputDeviceAssigned;
66 import javax.print.attribute.standard.PDLOverrideSupported;
67 import javax.print.attribute.standard.PageRanges;
68 import javax.print.attribute.standard.PagesPerMinute;
69 import javax.print.attribute.standard.PagesPerMinuteColor;
70 import javax.print.attribute.standard.PresentationDirection;
71 import javax.print.attribute.standard.PrintQuality;
72 import javax.print.attribute.standard.PrinterInfo;
73 import javax.print.attribute.standard.PrinterIsAcceptingJobs;
74 import javax.print.attribute.standard.PrinterLocation;
75 import javax.print.attribute.standard.PrinterMakeAndModel;
76 import javax.print.attribute.standard.PrinterMessageFromOperator;
77 import javax.print.attribute.standard.PrinterMoreInfo;
78 import javax.print.attribute.standard.PrinterMoreInfoManufacturer;
79 import javax.print.attribute.standard.PrinterName;
80 import javax.print.attribute.standard.PrinterResolution;
81 import javax.print.attribute.standard.PrinterState;
82 import javax.print.attribute.standard.PrinterStateReason;
83 import javax.print.attribute.standard.PrinterStateReasons;
84 import javax.print.attribute.standard.PrinterURI;
85 import javax.print.attribute.standard.QueuedJobCount;
86 import javax.print.attribute.standard.ReferenceUriSchemesSupported;
87 import javax.print.attribute.standard.RequestingUserName;
88 import javax.print.attribute.standard.Severity;
89 import javax.print.attribute.standard.SheetCollate;
90 import javax.print.attribute.standard.Sides;
91
92 import de.lohndirekt.print.attribute.auth.RequestingUserPassword;
93 import de.lohndirekt.print.attribute.cups.DeviceClass;
94 import de.lohndirekt.print.attribute.cups.DeviceUri;
95 import de.lohndirekt.print.attribute.cups.JobKLimit;
96 import de.lohndirekt.print.attribute.cups.JobPageLimit;
97 import de.lohndirekt.print.attribute.cups.JobQuotaPeriod;
98 import de.lohndirekt.print.attribute.cups.MemberNames;
99 import de.lohndirekt.print.attribute.cups.MemberUris;
100 import de.lohndirekt.print.attribute.cups.PrinterType;
101 import de.lohndirekt.print.attribute.ipp.Charset;
102 import de.lohndirekt.print.attribute.ipp.DetailedStatusMessage;
103 import de.lohndirekt.print.attribute.ipp.DocumentFormat;
104 import de.lohndirekt.print.attribute.ipp.NaturalLanguage;
105 import de.lohndirekt.print.attribute.ipp.StatusMessage;
106 import de.lohndirekt.print.attribute.ipp.UnknownAttribute;
107 import de.lohndirekt.print.attribute.ipp.jobdesc.JobId;
108 import de.lohndirekt.print.attribute.ipp.jobdesc.JobMoreInfo;
109 import de.lohndirekt.print.attribute.ipp.jobdesc.JobOriginatingHostName;
110 import de.lohndirekt.print.attribute.ipp.jobdesc.JobPrinterUpTime;
111 import de.lohndirekt.print.attribute.ipp.jobdesc.JobPrinterUri;
112 import de.lohndirekt.print.attribute.ipp.jobdesc.JobUri;
113 import de.lohndirekt.print.attribute.ipp.jobdesc.TimeAtCompleted;
114 import de.lohndirekt.print.attribute.ipp.jobdesc.TimeAtCreation;
115 import de.lohndirekt.print.attribute.ipp.jobdesc.TimeAtProcessing;
116 import de.lohndirekt.print.attribute.ipp.jobtempl.LdJobHoldUntil;
117 import de.lohndirekt.print.attribute.ipp.printerdesc.MultipleOperationTimeout;
118 import de.lohndirekt.print.attribute.ipp.printerdesc.NaturalLanguageConfigured;
119 import de.lohndirekt.print.attribute.ipp.printerdesc.PrinterCurrentTime;
120 import de.lohndirekt.print.attribute.ipp.printerdesc.PrinterDriverInstaller;
121 import de.lohndirekt.print.attribute.ipp.printerdesc.PrinterStateMessage;
122 import de.lohndirekt.print.attribute.ipp.printerdesc.PrinterUpTime;
123 import de.lohndirekt.print.attribute.ipp.printerdesc.defaults.CharsetConfigured;
124 import de.lohndirekt.print.attribute.ipp.printerdesc.defaults.CopiesDefault;
125 import de.lohndirekt.print.attribute.ipp.printerdesc.defaults.DocumentFormatDefault;
126 import de.lohndirekt.print.attribute.ipp.printerdesc.defaults.FinishingsDefault;
127 import de.lohndirekt.print.attribute.ipp.printerdesc.defaults.JobHoldUntilDefault;
128 import de.lohndirekt.print.attribute.ipp.printerdesc.defaults.JobPriorityDefault;
129 import de.lohndirekt.print.attribute.ipp.printerdesc.defaults.JobSheetsDefault;
130 import de.lohndirekt.print.attribute.ipp.printerdesc.defaults.MediaDefault;
131 import de.lohndirekt.print.attribute.ipp.printerdesc.defaults.MultipleDocumentHandlingDefault;
132 import de.lohndirekt.print.attribute.ipp.printerdesc.defaults.NumberUpDefault;
133 import de.lohndirekt.print.attribute.ipp.printerdesc.defaults.OrientationRequestedDefault;
134 import de.lohndirekt.print.attribute.ipp.printerdesc.defaults.SidesDefault;
135 import de.lohndirekt.print.attribute.ipp.printerdesc.supported.CharsetSupported;
136 import de.lohndirekt.print.attribute.ipp.printerdesc.supported.CompressionSupported;
137 import de.lohndirekt.print.attribute.ipp.printerdesc.supported.DocumentFormatSupported;
138 import de.lohndirekt.print.attribute.ipp.printerdesc.supported.FinishingsSupported;
139 import de.lohndirekt.print.attribute.ipp.printerdesc.supported.GeneratedNaturalLanguageSupported;
140 import de.lohndirekt.print.attribute.ipp.printerdesc.supported.IppVersionsSupported;
141 import de.lohndirekt.print.attribute.ipp.printerdesc.supported.JobHoldUntilSupported;
142 import de.lohndirekt.print.attribute.ipp.printerdesc.supported.JobSheetsSupported;
143 import de.lohndirekt.print.attribute.ipp.printerdesc.supported.MediaSupported;
144 import de.lohndirekt.print.attribute.ipp.printerdesc.supported.MultipleDocumentHandlingSupported;
145 import de.lohndirekt.print.attribute.ipp.printerdesc.supported.MultipleDocumentJobsSupported;
146 import de.lohndirekt.print.attribute.ipp.printerdesc.supported.OperationsSupported;
147 import de.lohndirekt.print.attribute.ipp.printerdesc.supported.OrientationRequestedSupported;
148 import de.lohndirekt.print.attribute.ipp.printerdesc.supported.OutputBinSupported;
149 import de.lohndirekt.print.attribute.ipp.printerdesc.supported.PageRangesSupported;
150 import de.lohndirekt.print.attribute.ipp.printerdesc.supported.PrinterUriSupported;
151 import de.lohndirekt.print.attribute.ipp.printerdesc.supported.SidesSupported;
152 import de.lohndirekt.print.attribute.ipp.printerdesc.supported.UriAuthenticationSupported;
153 import de.lohndirekt.print.attribute.ipp.printerdesc.supported.UriSecuritySupported;
154 import de.lohndirekt.print.attribute.undocumented.PrinterStateTime;
155
156 /**
157 * @author bpusch
158 *
159 */
160 public final class IppAttributeName {
161 private final static Logger log = Logger.getLogger(AttributeParser.class.getName());
162
163 /*
164 * Attributes defined in javax.print.attribute.standard
165 */
166 public static final IppAttributeName COLOR_SUPPORTED = new IppAttributeName(ColorSupported.SUPPORTED);
167 public static final IppAttributeName COMPRESSION = new IppAttributeName(Compression.NONE);
168 public static final IppAttributeName COPIES = new IppAttributeName(new Copies(1));
169 public static final IppAttributeName COPIES_SUPPORTED = new IppAttributeName(new CopiesSupported(1));
170 public static final IppAttributeName DATE_TIME_AT_COMPLETION = new IppAttributeName(new DateTimeAtCompleted(new Date()));
171 public static final IppAttributeName DATE_TIME_AT_CREATION = new IppAttributeName(new DateTimeAtCreation(new Date()));
172 public static final IppAttributeName DATE_TIME_AT_PROCESSING = new IppAttributeName(new DateTimeAtProcessing(new Date()));
173 public static final IppAttributeName DOCUMENT_NAME = new IppAttributeName(new DocumentName("", Locale.CANADA));
174 public static final IppAttributeName FIDELITY = new IppAttributeName(Fidelity.FIDELITY_TRUE);
175 public static final IppAttributeName FINISHINGS = new IppAttributeName(Finishings.BIND);
176 public static final IppAttributeName JOB_IMPRESSIONS = new IppAttributeName(new JobImpressions(1));
177 public static final IppAttributeName JOB_IMPRESSIONS_COMPLETED = new IppAttributeName(new JobImpressionsCompleted(1));
178 public static final IppAttributeName JOB_IMPRESSIONS_SUPPORTED = new IppAttributeName(new JobImpressionsSupported(1, 1));
179 public static final IppAttributeName JOB_K_OCTETS = new IppAttributeName(new JobKOctets(1));
180 public static final IppAttributeName JOB_K_OCTETS_PROCESSED = new IppAttributeName(new JobKOctetsProcessed(1));
181 public static final IppAttributeName JOB_K_OCTETS_SUPPORTED = new IppAttributeName(new JobKOctetsSupported(1, 1));
182 public static final IppAttributeName JOB_MEDIA_SHEETS = new IppAttributeName(new JobMediaSheets(1));
183 public static final IppAttributeName JOB_MEDIA_SHEETS_COMPLETED = new IppAttributeName(new JobMediaSheetsCompleted(1));
184 public static final IppAttributeName JOB_MEDIA_SHEETS_SUPPORTED = new IppAttributeName(new JobMediaSheetsSupported(1, 1));
185 public static final IppAttributeName JOB_MESSAGE_FROM_OPERATOR =
186 new IppAttributeName(new JobMessageFromOperator("", Locale.CANADA));
187 public static final IppAttributeName JOB_NAME = new IppAttributeName(new JobName("", Locale.CANADA));
188 public static final IppAttributeName JOB_ORIGINATING_USER_NAME =
189 new IppAttributeName(new JobOriginatingUserName("", Locale.CANADA));
190 public static final IppAttributeName JOB_PRIORIY = new IppAttributeName(new JobPriority(1));
191 public static final IppAttributeName JOB_PRIORIY_SUPPORTED = new IppAttributeName(new JobPrioritySupported(1));
192 public static final IppAttributeName JOB_SHEETS = new IppAttributeName(JobSheets.NONE);
193 public static final IppAttributeName JOB_STATE = new IppAttributeName(JobState.ABORTED);
194 public static final IppAttributeName JOB_STATE_REASON = new IppAttributeName(JobStateReason.ABORTED_BY_SYSTEM);
195 public static final IppAttributeName JOB_STATE_REASONS = new IppAttributeName(new JobStateReasons());
196 //Could be MediaName,MediaSizeName or MediaTray
197 public static final IppAttributeName MEDIA = new IppAttributeName(MediaSizeName.A);
198 public static final IppAttributeName MULTIPLE_DOCUMENT_HANDLING =
199 new IppAttributeName(MultipleDocumentHandling.SEPARATE_DOCUMENTS_COLLATED_COPIES);
200 public static final IppAttributeName NUMBER_OF_DOCUMENTS = new IppAttributeName(new NumberOfDocuments(1));
201 public static final IppAttributeName NUMBER_OF_INTERVENING_JOBS = new IppAttributeName(new NumberOfInterveningJobs(1));
202 public static final IppAttributeName NUMBER_UP = new IppAttributeName(new NumberUp(1));
203 public static final IppAttributeName NUMBER_UP_SUPPORTED = new IppAttributeName(new NumberUpSupported(1));
204 public static final IppAttributeName ORIENTATION_REQUESTED = new IppAttributeName(OrientationRequested.LANDSCAPE);
205 public static final IppAttributeName OUTPUT_DEVICE_ASSIGNED =
206 new IppAttributeName(new OutputDeviceAssigned("", Locale.CANADA));
207 public static final IppAttributeName PAGE_RANGES = new IppAttributeName(new PageRanges(1));
208 public static final IppAttributeName PAGES_PER_MINUTE = new IppAttributeName(new PagesPerMinute(1));
209 public static final IppAttributeName PAGES_PER_MINUTE_COLOR = new IppAttributeName(new PagesPerMinuteColor(1));
210 public static final IppAttributeName PDL_OVERRIDE_SUPPORTED = new IppAttributeName(PDLOverrideSupported.ATTEMPTED);
211 public static final IppAttributeName PRESENTATION_DIRECTION = new IppAttributeName(PresentationDirection.TOBOTTOM_TOLEFT);
212 public static final IppAttributeName PRINTER_INFO = new IppAttributeName(new PrinterInfo("", Locale.CANADA));
213 public static final IppAttributeName PRINTER_IS_ACCEPTING_JOBS = new IppAttributeName(PrinterIsAcceptingJobs.ACCEPTING_JOBS);
214 public static final IppAttributeName PRINTER_LOCATION = new IppAttributeName(new PrinterLocation("", Locale.CANADA));
215 public static final IppAttributeName PRINTER_MAKE_AND_MODEL =
216 new IppAttributeName(new PrinterMakeAndModel("", Locale.CANADA));
217 public static final IppAttributeName PRINTER_MESSAGE_FROM_OPERATOR =
218 new IppAttributeName(new PrinterMessageFromOperator("", Locale.CANADA));
219 public static final IppAttributeName PRINTER_MORE_INFO = new IppAttributeName(new PrinterMoreInfo(IppAttributeName.getURI()));
220 public static final IppAttributeName PRINTER_MORE_INFO_MANUFACTURER =
221 new IppAttributeName(new PrinterMoreInfoManufacturer(IppAttributeName.getURI()));
222 public static final IppAttributeName PRINTER_NAME = new IppAttributeName(new PrinterName("", Locale.CANADA));
223 public static final IppAttributeName PRINTER_RESOLUTION = new IppAttributeName(new PrinterResolution(1, 1, 1));
224 public static final IppAttributeName PRINTER_STATE = new IppAttributeName(PrinterState.IDLE);
225 public static final IppAttributeName PRINTER_STATE_REASON = new IppAttributeName(PrinterStateReason.CONNECTING_TO_DEVICE);
226 public static final IppAttributeName PRINTER_STATE_REASONS = new IppAttributeName(new PrinterStateReasons());
227 public static final IppAttributeName PRINTER_URI = new IppAttributeName(new PrinterURI(IppAttributeName.getURI()));
228 public static final IppAttributeName PRINT_QUALITY = new IppAttributeName(PrintQuality.DRAFT);
229 public static final IppAttributeName QUEUED_JOB_COUNT = new IppAttributeName(new QueuedJobCount(1));
230 public static final IppAttributeName REFERENCE_URI_SCHEMES_SUPPORTED =
231 new IppAttributeName(ReferenceUriSchemesSupported.FILE);
232 public static final IppAttributeName REQUESTING_USER_NAME = new IppAttributeName(new RequestingUserName("", Locale.CANADA));
233 public static final IppAttributeName REQUESTING_USER_PASSWD = new IppAttributeName(new RequestingUserPassword("", Locale.CANADA));
234 public static final IppAttributeName SEVERITY = new IppAttributeName(Severity.ERROR);
235 public static final IppAttributeName SHEET_COLLATE = new IppAttributeName(SheetCollate.COLLATED);
236 public static final IppAttributeName SIDES = new IppAttributeName(Sides.DUPLEX);
237
238 /*
239 * IPP standard attributes defined in de.lohndirekt.attribute.ipp
240 */
241 public static final IppAttributeName CHARSET = new IppAttributeName(new Charset("x", Locale.getDefault()));
242 public static final IppAttributeName CHARSET_CONFIGURED =
243 new IppAttributeName(new CharsetConfigured("x", Locale.getDefault()));
244 public static final IppAttributeName CHARSET_SUPORTED = new IppAttributeName(new CharsetSupported("x", Locale.getDefault()));
245 public static final IppAttributeName COMPRESSION_SUPORTED =
246 new IppAttributeName(new CompressionSupported("x", Locale.getDefault()));
247 public static final IppAttributeName COPIES_DEFAULT = new IppAttributeName(new CopiesDefault(1));
248 public static final IppAttributeName DETAILED_STATUS_MESSAGE = new IppAttributeName(new DetailedStatusMessage("x", Locale.getDefault()));
249 public static final IppAttributeName DOCUMENT_FORMAT =
250 new IppAttributeName(new DocumentFormat("x", Locale.getDefault()));
251 public static final IppAttributeName DOCUMENT_FORMAT_SUPORTED =
252 new IppAttributeName(new DocumentFormatSupported("x", Locale.getDefault()));
253 public static final IppAttributeName DOCUMENT_FORMAT_DEFAULT =
254 new IppAttributeName(new DocumentFormatDefault("x", Locale.getDefault()));
255 public static final IppAttributeName FINISHINGS_DEFAULT = new IppAttributeName(new FinishingsDefault(1));
256 public static final IppAttributeName FINISHINGS_SUPPORTED = new IppAttributeName(new FinishingsSupported(1));
257 public static final IppAttributeName IPP_VERSIONS_SUPPORTED =
258 new IppAttributeName(new IppVersionsSupported("x", Locale.getDefault()));
259 public static final IppAttributeName JOB_HOLD_UNTIL = new IppAttributeName(new LdJobHoldUntil("x", Locale.getDefault()));
260 public static final IppAttributeName JOB_HOLD_UNTIL_DEFAULT = new IppAttributeName(new JobHoldUntilDefault("x", Locale.getDefault()));
261 public static final IppAttributeName JOB_HOLD_UNTIL_SUPPORTED = new IppAttributeName(new JobHoldUntilSupported("x", Locale.getDefault()));
262 public static final IppAttributeName JOB_ID = new IppAttributeName(new JobId(1));
263 public static final IppAttributeName JOB_MORE_INFO = new IppAttributeName(new JobMoreInfo(IppAttributeName.getURI()));
264 public static final IppAttributeName JOB_ORIGINATING_HOST_NAME =
265 new IppAttributeName(new JobOriginatingHostName("x", Locale.getDefault()));
266 public static final IppAttributeName JOB_PRINTER_UP_TIME = new IppAttributeName(new JobPrinterUpTime(1));
267 public static final IppAttributeName JOB_PRINTER_URI = new IppAttributeName(new JobPrinterUri(getURI()));
268 public static final IppAttributeName JOB_PRIORITY_DEFAULT = new IppAttributeName(new JobPriorityDefault(1));
269 public static final IppAttributeName JOB_SHEETS_DEFAULT =
270 new IppAttributeName(new JobSheetsDefault("x", Locale.getDefault()));
271 public static final IppAttributeName JOB_SHEETS_SUPORTED =
272 new IppAttributeName(new JobSheetsSupported("x", Locale.getDefault()));
273 public static final IppAttributeName JOB_URI =
274 new IppAttributeName(new JobUri(IppAttributeName.getURI()));
275 public static final IppAttributeName GENERATED_NATURAL_LANGUAGE_SUPPORTED =
276 new IppAttributeName(new GeneratedNaturalLanguageSupported("x", Locale.getDefault()));
277 public static final IppAttributeName MEDIA_DEFAULT = new IppAttributeName(new MediaDefault("x", Locale.getDefault()));
278 public static final IppAttributeName MEDIA_SUPPORTED = new IppAttributeName(new MediaSupported("x", Locale.getDefault()));
279 public static final IppAttributeName MULTIPLE_DOCUMENT_HANDLING_DEFAULT =
280 new IppAttributeName(new MultipleDocumentHandlingDefault("x", Locale.getDefault()));
281 public static final IppAttributeName MULTIPLE_DOCUMENT_HANDLING_SUPPORTED =
282 new IppAttributeName(new MultipleDocumentHandlingSupported("x", Locale.getDefault()));
283 public static final IppAttributeName MULTIPLE_DOCUMENT_JOBS_SUPPORTED =
284 new IppAttributeName(new MultipleDocumentJobsSupported(1));
285 public static final IppAttributeName MULTIPLE_OPERATION_TIMEOUT = new IppAttributeName(new MultipleOperationTimeout(1));
286 public static final IppAttributeName NATURAL_LANGUAGE = new IppAttributeName(new NaturalLanguage("x", Locale.getDefault()));
287 public static final IppAttributeName NATURAL_LANGUAGE_CONFIGURED =
288 new IppAttributeName(new NaturalLanguageConfigured("x", Locale.getDefault()));
289 public static final IppAttributeName NUMBER_UP_DEFAULT = new IppAttributeName(new NumberUpDefault(1));
290 public static final IppAttributeName OPERATIONS_SUPPORTED = new IppAttributeName(new OperationsSupported(1));
291 public static final IppAttributeName ORIENTATION_REQUESTED_DEFAULT = new IppAttributeName(new OrientationRequestedDefault(1));
292 public static final IppAttributeName ORIENTATION_REQUESTED_SUPPORTED =
293 new IppAttributeName(new OrientationRequestedSupported(1));
294 public static final IppAttributeName PAGE_RANGES_SUPPORTED = new IppAttributeName(new PageRangesSupported(1));
295 public static final IppAttributeName PRINTER_CURRENT_TIME = new IppAttributeName(new PrinterCurrentTime(new Date()));
296 public static final IppAttributeName PRINTER_DRIVER_INSTALLER =
297 new IppAttributeName(new PrinterDriverInstaller(IppAttributeName.getURI()));
298 public static final IppAttributeName PRINTER_STATE_MESSAGE =
299 new IppAttributeName(new PrinterStateMessage("x", Locale.getDefault()));
300 public static final IppAttributeName PRINTER_TYPE = new IppAttributeName(new PrinterType(1));
301 public static final IppAttributeName PRINTER_UP_TIME = new IppAttributeName(new PrinterUpTime(1));
302 public static final IppAttributeName PRINTER_URI_SUPPORTED =
303 new IppAttributeName(new PrinterUriSupported(IppAttributeName.getURI()));
304 public static final IppAttributeName SIDES_DEFAULT = new IppAttributeName(new SidesDefault("x", Locale.getDefault()));
305 public static final IppAttributeName SIDES_SUPPORTED = new IppAttributeName(new SidesSupported("x", Locale.getDefault()));
306 public static final IppAttributeName STATUS_MESSAGE = new IppAttributeName(new StatusMessage("x", Locale.getDefault()));
307 public static final IppAttributeName TIME_AT_COMPLETED = new IppAttributeName(new TimeAtCompleted(1));
308 public static final IppAttributeName TIME_AT_CREATION = new IppAttributeName(new TimeAtCreation(1));
309 public static final IppAttributeName TIME_AT_PROCESSING = new IppAttributeName(new TimeAtProcessing(1));
310 public static final IppAttributeName URI_AUTHENTICATION_SUPPORTED =
311 new IppAttributeName(new UriAuthenticationSupported("x", Locale.getDefault()));
312 public static final IppAttributeName URI_SECURITY_SUPPORTED =
313 new IppAttributeName(new UriSecuritySupported("x", Locale.getDefault()));
314
315
316 /*
317 * CUPS IPP extension attributes defined in de.lohndirekt.attribute.cups
318 */
319 public static final IppAttributeName DEVICE_CLASS = new IppAttributeName(new DeviceClass("x", Locale.getDefault()));
320 public static final IppAttributeName DEVICE_URI = new IppAttributeName(new DeviceUri(IppAttributeName.getURI()));
321 public static final IppAttributeName Job_K_LIMIT = new IppAttributeName(new JobKLimit(1));
322 public static final IppAttributeName JOB_PAGE_LIMIT = new IppAttributeName(new JobPageLimit(1));
323 public static final IppAttributeName JOB_QUOTA_PERIOD = new IppAttributeName(new JobQuotaPeriod(1));
324 public static final IppAttributeName MEMBER_NAMES = new IppAttributeName(new MemberNames("x", Locale.getDefault()));
325 public static final IppAttributeName MEMBER_URIS = new IppAttributeName(new MemberUris(IppAttributeName.getURI()));
326 public static final IppAttributeName PRINTER_STATE_TIME = new IppAttributeName(new PrinterStateTime(1));
327
328 /*
329 * undocumented IPP attributes used by CUPS
330 */
331 public static final IppAttributeName OUTPUT_BIN_SUPPORTED =
332 new IppAttributeName(new OutputBinSupported("x", Locale.getDefault()));
333
334
335 private static Map attributesByName = new HashMap();;
336 private static Map attributesByCategory = new HashMap();;
337
338 /**
339 *
340 */
341 private static URI getURI() {
342 try {
343 return new URI("http://www.lohndirekt.de");
344 } catch (URISyntaxException e) {
345 throw new RuntimeException(e);
346 }
347
348 }
349
350 private static void put(IppAttributeName attr) {
351 attributesByName.put(attr.getName(), attr);
352 attributesByCategory.put(attr.getCategory(), attr);
353 }
354
355 /**
356 *
357 */
358 static {
359 put(IppAttributeName.CHARSET);
360 put(IppAttributeName.CHARSET_CONFIGURED);
361 put(IppAttributeName.CHARSET_SUPORTED);
362 put(IppAttributeName.COLOR_SUPPORTED);
363 put(IppAttributeName.COMPRESSION);
364 put(IppAttributeName.COMPRESSION_SUPORTED);
365 put(IppAttributeName.COPIES);
366 put(IppAttributeName.COPIES_DEFAULT);
367 put(IppAttributeName.COPIES_SUPPORTED);
368 put(IppAttributeName.DATE_TIME_AT_COMPLETION);
369 put(IppAttributeName.DATE_TIME_AT_CREATION);
370 put(IppAttributeName.DATE_TIME_AT_PROCESSING);
371 put(IppAttributeName.DEVICE_CLASS);
372 put(IppAttributeName.DEVICE_URI);
373 put(IppAttributeName.DETAILED_STATUS_MESSAGE);
374 put(IppAttributeName.DOCUMENT_NAME);
375 put(IppAttributeName.DOCUMENT_FORMAT);
376 put(IppAttributeName.DOCUMENT_FORMAT_DEFAULT);
377 put(IppAttributeName.DOCUMENT_FORMAT_SUPORTED);
378 put(IppAttributeName.FIDELITY);
379 put(IppAttributeName.FINISHINGS);
380 put(IppAttributeName.FINISHINGS_DEFAULT);
381 put(IppAttributeName.FINISHINGS_SUPPORTED);
382 put(IppAttributeName.GENERATED_NATURAL_LANGUAGE_SUPPORTED);
383 put(IppAttributeName.IPP_VERSIONS_SUPPORTED);
384 put(IppAttributeName.JOB_HOLD_UNTIL);
385 put(IppAttributeName.JOB_HOLD_UNTIL_DEFAULT);
386 put(IppAttributeName.JOB_HOLD_UNTIL_SUPPORTED);
387 put(IppAttributeName.JOB_ID);
388 put(IppAttributeName.JOB_IMPRESSIONS);
389 put(IppAttributeName.JOB_IMPRESSIONS_COMPLETED);
390 put(IppAttributeName.JOB_IMPRESSIONS_SUPPORTED);
391 put(IppAttributeName.Job_K_LIMIT);
392 put(IppAttributeName.JOB_K_OCTETS);
393 put(IppAttributeName.JOB_K_OCTETS_PROCESSED);
394 put(IppAttributeName.JOB_K_OCTETS_SUPPORTED);
395 put(IppAttributeName.JOB_MEDIA_SHEETS);
396 put(IppAttributeName.JOB_MEDIA_SHEETS_COMPLETED);
397 put(IppAttributeName.JOB_MEDIA_SHEETS_SUPPORTED);
398 put(IppAttributeName.JOB_MESSAGE_FROM_OPERATOR);
399 put(IppAttributeName.JOB_MORE_INFO);
400 put(IppAttributeName.JOB_NAME);
401 put(IppAttributeName.JOB_ORIGINATING_HOST_NAME);
402 put(IppAttributeName.JOB_ORIGINATING_USER_NAME);
403 put(IppAttributeName.JOB_PAGE_LIMIT);
404 put(IppAttributeName.JOB_PRINTER_UP_TIME);
405 put(IppAttributeName.JOB_PRINTER_URI);
406 put(IppAttributeName.JOB_PRIORIY);
407 put(IppAttributeName.JOB_PRIORITY_DEFAULT);
408 put(IppAttributeName.JOB_PRIORIY_SUPPORTED);
409 put(IppAttributeName.JOB_QUOTA_PERIOD);
410 put(IppAttributeName.JOB_SHEETS);
411 put(IppAttributeName.JOB_SHEETS_DEFAULT);
412 put(IppAttributeName.JOB_SHEETS_SUPORTED);
413 put(IppAttributeName.JOB_STATE);
414 put(IppAttributeName.JOB_STATE_REASON);
415 put(IppAttributeName.JOB_STATE_REASONS);
416 put(IppAttributeName.JOB_URI);
417 put(IppAttributeName.MEDIA);
418 put(IppAttributeName.MEDIA_DEFAULT);
419 put(IppAttributeName.MEDIA_SUPPORTED);
420 put(IppAttributeName.MEMBER_NAMES);
421 put(IppAttributeName.MEMBER_URIS);
422 put(IppAttributeName.MULTIPLE_DOCUMENT_HANDLING);
423 put(IppAttributeName.MULTIPLE_DOCUMENT_HANDLING_DEFAULT);
424 put(IppAttributeName.MULTIPLE_DOCUMENT_HANDLING_SUPPORTED);
425 put(IppAttributeName.MULTIPLE_DOCUMENT_JOBS_SUPPORTED);
426 put(IppAttributeName.MULTIPLE_OPERATION_TIMEOUT);
427 put(IppAttributeName.NATURAL_LANGUAGE);
428 put(IppAttributeName.NATURAL_LANGUAGE_CONFIGURED);
429 put(IppAttributeName.NUMBER_OF_DOCUMENTS);
430 put(IppAttributeName.NUMBER_OF_INTERVENING_JOBS);
431 put(IppAttributeName.NUMBER_UP);
432 put(IppAttributeName.NUMBER_UP_DEFAULT);
433 put(IppAttributeName.NUMBER_UP_SUPPORTED);
434 put(IppAttributeName.OPERATIONS_SUPPORTED);
435 put(IppAttributeName.ORIENTATION_REQUESTED);
436 put(IppAttributeName.ORIENTATION_REQUESTED_DEFAULT);
437 put(IppAttributeName.ORIENTATION_REQUESTED_SUPPORTED);
438 put(IppAttributeName.OUTPUT_BIN_SUPPORTED);
439 put(IppAttributeName.OUTPUT_DEVICE_ASSIGNED);
440 put(IppAttributeName.PAGE_RANGES);
441 put(IppAttributeName.PAGE_RANGES_SUPPORTED);
442 put(IppAttributeName.PAGES_PER_MINUTE);
443 put(IppAttributeName.PAGES_PER_MINUTE_COLOR);
444 put(IppAttributeName.PDL_OVERRIDE_SUPPORTED);
445 put(IppAttributeName.PRESENTATION_DIRECTION);
446 put(IppAttributeName.PRINT_QUALITY);
447 put(IppAttributeName.PRINTER_CURRENT_TIME);
448 put(IppAttributeName.PRINTER_DRIVER_INSTALLER);
449 put(IppAttributeName.PRINTER_INFO);
450 put(IppAttributeName.PRINTER_IS_ACCEPTING_JOBS);
451 put(IppAttributeName.PRINTER_LOCATION);
452 put(IppAttributeName.PRINTER_MAKE_AND_MODEL);
453 put(IppAttributeName.PRINTER_MESSAGE_FROM_OPERATOR);
454 put(IppAttributeName.PRINTER_MORE_INFO);
455 put(IppAttributeName.PRINTER_MORE_INFO_MANUFACTURER);
456 put(IppAttributeName.PRINTER_NAME);
457 put(IppAttributeName.PRINTER_RESOLUTION);
458 put(IppAttributeName.PRINTER_STATE);
459 put(IppAttributeName.PRINTER_STATE_MESSAGE);
460 put(IppAttributeName.PRINTER_STATE_REASON);
461 put(IppAttributeName.PRINTER_STATE_REASONS);
462 put(IppAttributeName.PRINTER_STATE_TIME);
463 put(IppAttributeName.PRINTER_TYPE);
464 put(IppAttributeName.PRINTER_UP_TIME);
465 put(IppAttributeName.PRINTER_URI);
466 put(IppAttributeName.PRINTER_URI_SUPPORTED);
467 put(IppAttributeName.QUEUED_JOB_COUNT);
468 put(IppAttributeName.REFERENCE_URI_SCHEMES_SUPPORTED);
469 put(IppAttributeName.REQUESTING_USER_NAME);
470 put(IppAttributeName.REQUESTING_USER_PASSWD);
471 put(IppAttributeName.SEVERITY);
472 put(IppAttributeName.SHEET_COLLATE);
473 put(IppAttributeName.SIDES);
474 put(IppAttributeName.SIDES_DEFAULT);
475 put(IppAttributeName.SIDES_SUPPORTED);
476 put(IppAttributeName.STATUS_MESSAGE);
477 put(IppAttributeName.TIME_AT_COMPLETED);
478 put(IppAttributeName.TIME_AT_CREATION);
479 put(IppAttributeName.TIME_AT_PROCESSING);
480 put(IppAttributeName.URI_AUTHENTICATION_SUPPORTED);
481 put(IppAttributeName.URI_SECURITY_SUPPORTED);
482 }
483
484 public static IppAttributeName get(String attributeName) {
485 IppAttributeName attrib =(IppAttributeName)attributesByName.get(attributeName);
486 if (attrib == null) {
487 log.warning("Unknown Attribute " + attributeName + ".");
488 attrib = new IppAttributeName(new UnknownAttribute(attributeName, Locale.getDefault()));
489 }
490 return attrib;
491 }
492
493 public static IppAttributeName get(Class category) {
494 IppAttributeName attrib =(IppAttributeName)attributesByCategory.get(category);
495 if (attrib == null) {
496 log.warning("Unknown Category " + category + ".");
497 attrib = new IppAttributeName(new UnknownAttribute(category.getName(), Locale.getDefault()));
498 }
499 return attrib;
500 }
501 // End of static part
502
503 private String methodName;
504 private Class attributeClass;
505 private Class category;
506
507 private IppAttributeName(Attribute attribute) {
508 this.methodName = attribute.getName();
509 this.attributeClass = attribute.getClass();
510 this.category = attribute.getCategory();
511 }
512
513 /**
514 * @return
515 */
516 public Class getAttributeClass() {
517 return attributeClass;
518 }
519
520 public String getName() {
521 return this.methodName;
522 }
523
524 /**
525 *
526 */
527 public Class getCategory() {
528 return this.category;
529 }
530
531 }