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