+/**\r
+ * Copyright (C) 2003 <a href="http://www.lohndirekt.de/">lohndirekt.de</a>\r
+ *\r
+ * This library is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU Lesser General Public\r
+ * License as published by the Free Software Foundation; either\r
+ * version 2.1 of the License, or (at your option) any later version.\r
+ * \r
+ * This library is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+ * Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+ * \r
+ */\r
+package de.lohndirekt.print.attribute;\r
+\r
+import java.net.URI;\r
+import java.net.URISyntaxException;\r
+import java.util.Date;\r
+import java.util.HashMap;\r
+import java.util.Locale;\r
+import java.util.Map;\r
+import java.util.logging.Logger;\r
+\r
+import javax.print.attribute.Attribute;\r
+import javax.print.attribute.standard.ColorSupported;\r
+import javax.print.attribute.standard.Compression;\r
+import javax.print.attribute.standard.Copies;\r
+import javax.print.attribute.standard.CopiesSupported;\r
+import javax.print.attribute.standard.DateTimeAtCompleted;\r
+import javax.print.attribute.standard.DateTimeAtCreation;\r
+import javax.print.attribute.standard.DateTimeAtProcessing;\r
+import javax.print.attribute.standard.DocumentName;\r
+import javax.print.attribute.standard.Fidelity;\r
+import javax.print.attribute.standard.Finishings;\r
+import javax.print.attribute.standard.JobImpressions;\r
+import javax.print.attribute.standard.JobImpressionsCompleted;\r
+import javax.print.attribute.standard.JobImpressionsSupported;\r
+import javax.print.attribute.standard.JobKOctets;\r
+import javax.print.attribute.standard.JobKOctetsProcessed;\r
+import javax.print.attribute.standard.JobKOctetsSupported;\r
+import javax.print.attribute.standard.JobMediaSheets;\r
+import javax.print.attribute.standard.JobMediaSheetsCompleted;\r
+import javax.print.attribute.standard.JobMediaSheetsSupported;\r
+import javax.print.attribute.standard.JobMessageFromOperator;\r
+import javax.print.attribute.standard.JobName;\r
+import javax.print.attribute.standard.JobOriginatingUserName;\r
+import javax.print.attribute.standard.JobPriority;\r
+import javax.print.attribute.standard.JobPrioritySupported;\r
+import javax.print.attribute.standard.JobSheets;\r
+import javax.print.attribute.standard.JobState;\r
+import javax.print.attribute.standard.JobStateReason;\r
+import javax.print.attribute.standard.JobStateReasons;\r
+import javax.print.attribute.standard.MediaSizeName;\r
+import javax.print.attribute.standard.MultipleDocumentHandling;\r
+import javax.print.attribute.standard.NumberOfDocuments;\r
+import javax.print.attribute.standard.NumberOfInterveningJobs;\r
+import javax.print.attribute.standard.NumberUp;\r
+import javax.print.attribute.standard.NumberUpSupported;\r
+import javax.print.attribute.standard.OrientationRequested;\r
+import javax.print.attribute.standard.OutputDeviceAssigned;\r
+import javax.print.attribute.standard.PDLOverrideSupported;\r
+import javax.print.attribute.standard.PageRanges;\r
+import javax.print.attribute.standard.PagesPerMinute;\r
+import javax.print.attribute.standard.PagesPerMinuteColor;\r
+import javax.print.attribute.standard.PresentationDirection;\r
+import javax.print.attribute.standard.PrintQuality;\r
+import javax.print.attribute.standard.PrinterInfo;\r
+import javax.print.attribute.standard.PrinterIsAcceptingJobs;\r
+import javax.print.attribute.standard.PrinterLocation;\r
+import javax.print.attribute.standard.PrinterMakeAndModel;\r
+import javax.print.attribute.standard.PrinterMessageFromOperator;\r
+import javax.print.attribute.standard.PrinterMoreInfo;\r
+import javax.print.attribute.standard.PrinterMoreInfoManufacturer;\r
+import javax.print.attribute.standard.PrinterName;\r
+import javax.print.attribute.standard.PrinterResolution;\r
+import javax.print.attribute.standard.PrinterState;\r
+import javax.print.attribute.standard.PrinterStateReason;\r
+import javax.print.attribute.standard.PrinterStateReasons;\r
+import javax.print.attribute.standard.PrinterURI;\r
+import javax.print.attribute.standard.QueuedJobCount;\r
+import javax.print.attribute.standard.ReferenceUriSchemesSupported;\r
+import javax.print.attribute.standard.RequestingUserName;\r
+import javax.print.attribute.standard.Severity;\r
+import javax.print.attribute.standard.SheetCollate;\r
+import javax.print.attribute.standard.Sides;\r
+\r
+import de.lohndirekt.print.attribute.auth.RequestingUserPassword;\r
+import de.lohndirekt.print.attribute.cups.DeviceClass;\r
+import de.lohndirekt.print.attribute.cups.DeviceUri;\r
+import de.lohndirekt.print.attribute.cups.JobKLimit;\r
+import de.lohndirekt.print.attribute.cups.JobPageLimit;\r
+import de.lohndirekt.print.attribute.cups.JobQuotaPeriod;\r
+import de.lohndirekt.print.attribute.cups.MemberNames;\r
+import de.lohndirekt.print.attribute.cups.MemberUris;\r
+import de.lohndirekt.print.attribute.cups.PrinterType;\r
+import de.lohndirekt.print.attribute.ipp.Charset;\r
+import de.lohndirekt.print.attribute.ipp.DetailedStatusMessage;\r
+import de.lohndirekt.print.attribute.ipp.DocumentFormat;\r
+import de.lohndirekt.print.attribute.ipp.NaturalLanguage;\r
+import de.lohndirekt.print.attribute.ipp.StatusMessage;\r
+import de.lohndirekt.print.attribute.ipp.UnknownAttribute;\r
+import de.lohndirekt.print.attribute.ipp.jobdesc.JobId;\r
+import de.lohndirekt.print.attribute.ipp.jobdesc.JobMoreInfo;\r
+import de.lohndirekt.print.attribute.ipp.jobdesc.JobOriginatingHostName;\r
+import de.lohndirekt.print.attribute.ipp.jobdesc.JobPrinterUpTime;\r
+import de.lohndirekt.print.attribute.ipp.jobdesc.JobPrinterUri;\r
+import de.lohndirekt.print.attribute.ipp.jobdesc.JobUri;\r
+import de.lohndirekt.print.attribute.ipp.jobdesc.TimeAtCompleted;\r
+import de.lohndirekt.print.attribute.ipp.jobdesc.TimeAtCreation;\r
+import de.lohndirekt.print.attribute.ipp.jobdesc.TimeAtProcessing;\r
+import de.lohndirekt.print.attribute.ipp.jobtempl.LdJobHoldUntil;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.MultipleOperationTimeout;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.NaturalLanguageConfigured;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.PrinterCurrentTime;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.PrinterDriverInstaller;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.PrinterStateMessage;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.PrinterUpTime;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.defaults.CharsetConfigured;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.defaults.CopiesDefault;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.defaults.DocumentFormatDefault;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.defaults.FinishingsDefault;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.defaults.JobHoldUntilDefault;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.defaults.JobPriorityDefault;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.defaults.JobSheetsDefault;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.defaults.MediaDefault;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.defaults.MultipleDocumentHandlingDefault;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.defaults.NumberUpDefault;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.defaults.OrientationRequestedDefault;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.defaults.SidesDefault;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.supported.CharsetSupported;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.supported.CompressionSupported;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.supported.DocumentFormatSupported;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.supported.FinishingsSupported;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.supported.GeneratedNaturalLanguageSupported;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.supported.IppVersionsSupported;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.supported.JobHoldUntilSupported;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.supported.JobSheetsSupported;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.supported.MediaSupported;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.supported.MultipleDocumentHandlingSupported;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.supported.MultipleDocumentJobsSupported;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.supported.OperationsSupported;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.supported.OrientationRequestedSupported;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.supported.OutputBinSupported;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.supported.PageRangesSupported;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.supported.PrinterUriSupported;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.supported.SidesSupported;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.supported.UriAuthenticationSupported;\r
+import de.lohndirekt.print.attribute.ipp.printerdesc.supported.UriSecuritySupported;\r
+import de.lohndirekt.print.attribute.undocumented.PrinterStateTime;\r
+\r
+/**\r
+ * @author bpusch\r
+ *\r
+ */\r
+public final class IppAttributeName {\r
+ private final static Logger log = Logger.getLogger(AttributeParser.class.getName());\r
+ \r
+ /*\r
+ * Attributes defined in javax.print.attribute.standard\r
+ */\r
+ public static final IppAttributeName COLOR_SUPPORTED = new IppAttributeName(ColorSupported.SUPPORTED);\r
+ public static final IppAttributeName COMPRESSION = new IppAttributeName(Compression.NONE);\r
+ public static final IppAttributeName COPIES = new IppAttributeName(new Copies(1));\r
+ public static final IppAttributeName COPIES_SUPPORTED = new IppAttributeName(new CopiesSupported(1));\r
+ public static final IppAttributeName DATE_TIME_AT_COMPLETION = new IppAttributeName(new DateTimeAtCompleted(new Date()));\r
+ public static final IppAttributeName DATE_TIME_AT_CREATION = new IppAttributeName(new DateTimeAtCreation(new Date()));\r
+ public static final IppAttributeName DATE_TIME_AT_PROCESSING = new IppAttributeName(new DateTimeAtProcessing(new Date()));\r
+ public static final IppAttributeName DOCUMENT_NAME = new IppAttributeName(new DocumentName("", Locale.CANADA));\r
+ public static final IppAttributeName FIDELITY = new IppAttributeName(Fidelity.FIDELITY_TRUE);\r
+ public static final IppAttributeName FINISHINGS = new IppAttributeName(Finishings.BIND);\r
+ public static final IppAttributeName JOB_IMPRESSIONS = new IppAttributeName(new JobImpressions(1));\r
+ public static final IppAttributeName JOB_IMPRESSIONS_COMPLETED = new IppAttributeName(new JobImpressionsCompleted(1));\r
+ public static final IppAttributeName JOB_IMPRESSIONS_SUPPORTED = new IppAttributeName(new JobImpressionsSupported(1, 1));\r
+ public static final IppAttributeName JOB_K_OCTETS = new IppAttributeName(new JobKOctets(1));\r
+ public static final IppAttributeName JOB_K_OCTETS_PROCESSED = new IppAttributeName(new JobKOctetsProcessed(1));\r
+ public static final IppAttributeName JOB_K_OCTETS_SUPPORTED = new IppAttributeName(new JobKOctetsSupported(1, 1));\r
+ public static final IppAttributeName JOB_MEDIA_SHEETS = new IppAttributeName(new JobMediaSheets(1));\r
+ public static final IppAttributeName JOB_MEDIA_SHEETS_COMPLETED = new IppAttributeName(new JobMediaSheetsCompleted(1));\r
+ public static final IppAttributeName JOB_MEDIA_SHEETS_SUPPORTED = new IppAttributeName(new JobMediaSheetsSupported(1, 1));\r
+ public static final IppAttributeName JOB_MESSAGE_FROM_OPERATOR =\r
+ new IppAttributeName(new JobMessageFromOperator("", Locale.CANADA));\r
+ public static final IppAttributeName JOB_NAME = new IppAttributeName(new JobName("", Locale.CANADA));\r
+ public static final IppAttributeName JOB_ORIGINATING_USER_NAME =\r
+ new IppAttributeName(new JobOriginatingUserName("", Locale.CANADA));\r
+ public static final IppAttributeName JOB_PRIORIY = new IppAttributeName(new JobPriority(1));\r
+ public static final IppAttributeName JOB_PRIORIY_SUPPORTED = new IppAttributeName(new JobPrioritySupported(1));\r
+ public static final IppAttributeName JOB_SHEETS = new IppAttributeName(JobSheets.NONE);\r
+ public static final IppAttributeName JOB_STATE = new IppAttributeName(JobState.ABORTED);\r
+ public static final IppAttributeName JOB_STATE_REASON = new IppAttributeName(JobStateReason.ABORTED_BY_SYSTEM);\r
+ public static final IppAttributeName JOB_STATE_REASONS = new IppAttributeName(new JobStateReasons());\r
+ //Could be MediaName,MediaSizeName or MediaTray\r
+ public static final IppAttributeName MEDIA = new IppAttributeName(MediaSizeName.A);\r
+ public static final IppAttributeName MULTIPLE_DOCUMENT_HANDLING =\r
+ new IppAttributeName(MultipleDocumentHandling.SEPARATE_DOCUMENTS_COLLATED_COPIES);\r
+ public static final IppAttributeName NUMBER_OF_DOCUMENTS = new IppAttributeName(new NumberOfDocuments(1));\r
+ public static final IppAttributeName NUMBER_OF_INTERVENING_JOBS = new IppAttributeName(new NumberOfInterveningJobs(1));\r
+ public static final IppAttributeName NUMBER_UP = new IppAttributeName(new NumberUp(1));\r
+ public static final IppAttributeName NUMBER_UP_SUPPORTED = new IppAttributeName(new NumberUpSupported(1));\r
+ public static final IppAttributeName ORIENTATION_REQUESTED = new IppAttributeName(OrientationRequested.LANDSCAPE);\r
+ public static final IppAttributeName OUTPUT_DEVICE_ASSIGNED =\r
+ new IppAttributeName(new OutputDeviceAssigned("", Locale.CANADA));\r
+ public static final IppAttributeName PAGE_RANGES = new IppAttributeName(new PageRanges(1));\r
+ public static final IppAttributeName PAGES_PER_MINUTE = new IppAttributeName(new PagesPerMinute(1));\r
+ public static final IppAttributeName PAGES_PER_MINUTE_COLOR = new IppAttributeName(new PagesPerMinuteColor(1));\r
+ public static final IppAttributeName PDL_OVERRIDE_SUPPORTED = new IppAttributeName(PDLOverrideSupported.ATTEMPTED);\r
+ public static final IppAttributeName PRESENTATION_DIRECTION = new IppAttributeName(PresentationDirection.TOBOTTOM_TOLEFT);\r
+ public static final IppAttributeName PRINTER_INFO = new IppAttributeName(new PrinterInfo("", Locale.CANADA));\r
+ public static final IppAttributeName PRINTER_IS_ACCEPTING_JOBS = new IppAttributeName(PrinterIsAcceptingJobs.ACCEPTING_JOBS);\r
+ public static final IppAttributeName PRINTER_LOCATION = new IppAttributeName(new PrinterLocation("", Locale.CANADA));\r
+ public static final IppAttributeName PRINTER_MAKE_AND_MODEL =\r
+ new IppAttributeName(new PrinterMakeAndModel("", Locale.CANADA));\r
+ public static final IppAttributeName PRINTER_MESSAGE_FROM_OPERATOR =\r
+ new IppAttributeName(new PrinterMessageFromOperator("", Locale.CANADA));\r
+ public static final IppAttributeName PRINTER_MORE_INFO = new IppAttributeName(new PrinterMoreInfo(IppAttributeName.getURI()));\r
+ public static final IppAttributeName PRINTER_MORE_INFO_MANUFACTURER =\r
+ new IppAttributeName(new PrinterMoreInfoManufacturer(IppAttributeName.getURI()));\r
+ public static final IppAttributeName PRINTER_NAME = new IppAttributeName(new PrinterName("", Locale.CANADA));\r
+ public static final IppAttributeName PRINTER_RESOLUTION = new IppAttributeName(new PrinterResolution(1, 1, 1));\r
+ public static final IppAttributeName PRINTER_STATE = new IppAttributeName(PrinterState.IDLE);\r
+ public static final IppAttributeName PRINTER_STATE_REASON = new IppAttributeName(PrinterStateReason.CONNECTING_TO_DEVICE);\r
+ public static final IppAttributeName PRINTER_STATE_REASONS = new IppAttributeName(new PrinterStateReasons());\r
+ public static final IppAttributeName PRINTER_URI = new IppAttributeName(new PrinterURI(IppAttributeName.getURI()));\r
+ public static final IppAttributeName PRINT_QUALITY = new IppAttributeName(PrintQuality.DRAFT);\r
+ public static final IppAttributeName QUEUED_JOB_COUNT = new IppAttributeName(new QueuedJobCount(1));\r
+ public static final IppAttributeName REFERENCE_URI_SCHEMES_SUPPORTED =\r
+ new IppAttributeName(ReferenceUriSchemesSupported.FILE);\r
+ public static final IppAttributeName REQUESTING_USER_NAME = new IppAttributeName(new RequestingUserName("", Locale.CANADA));\r
+ public static final IppAttributeName REQUESTING_USER_PASSWD = new IppAttributeName(new RequestingUserPassword("", Locale.CANADA));\r
+ public static final IppAttributeName SEVERITY = new IppAttributeName(Severity.ERROR);\r
+ public static final IppAttributeName SHEET_COLLATE = new IppAttributeName(SheetCollate.COLLATED);\r
+ public static final IppAttributeName SIDES = new IppAttributeName(Sides.DUPLEX);\r
+\r
+ /*\r
+ * IPP standard attributes defined in de.lohndirekt.attribute.ipp\r
+ */\r
+ public static final IppAttributeName CHARSET = new IppAttributeName(new Charset("x", Locale.getDefault()));\r
+ public static final IppAttributeName CHARSET_CONFIGURED =\r
+ new IppAttributeName(new CharsetConfigured("x", Locale.getDefault()));\r
+ public static final IppAttributeName CHARSET_SUPORTED = new IppAttributeName(new CharsetSupported("x", Locale.getDefault()));\r
+ public static final IppAttributeName COMPRESSION_SUPORTED =\r
+ new IppAttributeName(new CompressionSupported("x", Locale.getDefault()));\r
+ public static final IppAttributeName COPIES_DEFAULT = new IppAttributeName(new CopiesDefault(1));\r
+ public static final IppAttributeName DETAILED_STATUS_MESSAGE = new IppAttributeName(new DetailedStatusMessage("x", Locale.getDefault()));\r
+ public static final IppAttributeName DOCUMENT_FORMAT =\r
+ new IppAttributeName(new DocumentFormat("x", Locale.getDefault()));\r
+ public static final IppAttributeName DOCUMENT_FORMAT_SUPORTED =\r
+ new IppAttributeName(new DocumentFormatSupported("x", Locale.getDefault()));\r
+ public static final IppAttributeName DOCUMENT_FORMAT_DEFAULT =\r
+ new IppAttributeName(new DocumentFormatDefault("x", Locale.getDefault()));\r
+ public static final IppAttributeName FINISHINGS_DEFAULT = new IppAttributeName(new FinishingsDefault(1));\r
+ public static final IppAttributeName FINISHINGS_SUPPORTED = new IppAttributeName(new FinishingsSupported(1));\r
+ public static final IppAttributeName IPP_VERSIONS_SUPPORTED =\r
+ new IppAttributeName(new IppVersionsSupported("x", Locale.getDefault()));\r
+ public static final IppAttributeName JOB_HOLD_UNTIL = new IppAttributeName(new LdJobHoldUntil("x", Locale.getDefault())); \r
+ public static final IppAttributeName JOB_HOLD_UNTIL_DEFAULT = new IppAttributeName(new JobHoldUntilDefault("x", Locale.getDefault()));\r
+ public static final IppAttributeName JOB_HOLD_UNTIL_SUPPORTED = new IppAttributeName(new JobHoldUntilSupported("x", Locale.getDefault()));\r
+ public static final IppAttributeName JOB_ID = new IppAttributeName(new JobId(1));\r
+ public static final IppAttributeName JOB_MORE_INFO = new IppAttributeName(new JobMoreInfo(IppAttributeName.getURI()));\r
+ public static final IppAttributeName JOB_ORIGINATING_HOST_NAME =\r
+ new IppAttributeName(new JobOriginatingHostName("x", Locale.getDefault()));\r
+ public static final IppAttributeName JOB_PRINTER_UP_TIME = new IppAttributeName(new JobPrinterUpTime(1));\r
+ public static final IppAttributeName JOB_PRINTER_URI = new IppAttributeName(new JobPrinterUri(getURI()));\r
+ public static final IppAttributeName JOB_PRIORITY_DEFAULT = new IppAttributeName(new JobPriorityDefault(1));\r
+ public static final IppAttributeName JOB_SHEETS_DEFAULT =\r
+ new IppAttributeName(new JobSheetsDefault("x", Locale.getDefault()));\r
+ public static final IppAttributeName JOB_SHEETS_SUPORTED =\r
+ new IppAttributeName(new JobSheetsSupported("x", Locale.getDefault()));\r
+ public static final IppAttributeName JOB_URI =\r
+ new IppAttributeName(new JobUri(IppAttributeName.getURI()));\r
+ public static final IppAttributeName GENERATED_NATURAL_LANGUAGE_SUPPORTED =\r
+ new IppAttributeName(new GeneratedNaturalLanguageSupported("x", Locale.getDefault()));\r
+ public static final IppAttributeName MEDIA_DEFAULT = new IppAttributeName(new MediaDefault("x", Locale.getDefault()));\r
+ public static final IppAttributeName MEDIA_SUPPORTED = new IppAttributeName(new MediaSupported("x", Locale.getDefault()));\r
+ public static final IppAttributeName MULTIPLE_DOCUMENT_HANDLING_DEFAULT =\r
+ new IppAttributeName(new MultipleDocumentHandlingDefault("x", Locale.getDefault()));\r
+ public static final IppAttributeName MULTIPLE_DOCUMENT_HANDLING_SUPPORTED =\r
+ new IppAttributeName(new MultipleDocumentHandlingSupported("x", Locale.getDefault()));\r
+ public static final IppAttributeName MULTIPLE_DOCUMENT_JOBS_SUPPORTED =\r
+ new IppAttributeName(new MultipleDocumentJobsSupported(1));\r
+ public static final IppAttributeName MULTIPLE_OPERATION_TIMEOUT = new IppAttributeName(new MultipleOperationTimeout(1));\r
+ public static final IppAttributeName NATURAL_LANGUAGE = new IppAttributeName(new NaturalLanguage("x", Locale.getDefault()));\r
+ public static final IppAttributeName NATURAL_LANGUAGE_CONFIGURED =\r
+ new IppAttributeName(new NaturalLanguageConfigured("x", Locale.getDefault()));\r
+ public static final IppAttributeName NUMBER_UP_DEFAULT = new IppAttributeName(new NumberUpDefault(1));\r
+ public static final IppAttributeName OPERATIONS_SUPPORTED = new IppAttributeName(new OperationsSupported(1));\r
+ public static final IppAttributeName ORIENTATION_REQUESTED_DEFAULT = new IppAttributeName(new OrientationRequestedDefault(1));\r
+ public static final IppAttributeName ORIENTATION_REQUESTED_SUPPORTED =\r
+ new IppAttributeName(new OrientationRequestedSupported(1));\r
+ public static final IppAttributeName PAGE_RANGES_SUPPORTED = new IppAttributeName(new PageRangesSupported(1));\r
+ public static final IppAttributeName PRINTER_CURRENT_TIME = new IppAttributeName(new PrinterCurrentTime(new Date()));\r
+ public static final IppAttributeName PRINTER_DRIVER_INSTALLER =\r
+ new IppAttributeName(new PrinterDriverInstaller(IppAttributeName.getURI()));\r
+ public static final IppAttributeName PRINTER_STATE_MESSAGE =\r
+ new IppAttributeName(new PrinterStateMessage("x", Locale.getDefault()));\r
+ public static final IppAttributeName PRINTER_TYPE = new IppAttributeName(new PrinterType(1));\r
+ public static final IppAttributeName PRINTER_UP_TIME = new IppAttributeName(new PrinterUpTime(1));\r
+ public static final IppAttributeName PRINTER_URI_SUPPORTED =\r
+ new IppAttributeName(new PrinterUriSupported(IppAttributeName.getURI()));\r
+ public static final IppAttributeName SIDES_DEFAULT = new IppAttributeName(new SidesDefault("x", Locale.getDefault()));\r
+ public static final IppAttributeName SIDES_SUPPORTED = new IppAttributeName(new SidesSupported("x", Locale.getDefault()));\r
+ public static final IppAttributeName STATUS_MESSAGE = new IppAttributeName(new StatusMessage("x", Locale.getDefault()));\r
+ public static final IppAttributeName TIME_AT_COMPLETED = new IppAttributeName(new TimeAtCompleted(1));\r
+ public static final IppAttributeName TIME_AT_CREATION = new IppAttributeName(new TimeAtCreation(1));\r
+ public static final IppAttributeName TIME_AT_PROCESSING = new IppAttributeName(new TimeAtProcessing(1));\r
+ public static final IppAttributeName URI_AUTHENTICATION_SUPPORTED =\r
+ new IppAttributeName(new UriAuthenticationSupported("x", Locale.getDefault()));\r
+ public static final IppAttributeName URI_SECURITY_SUPPORTED =\r
+ new IppAttributeName(new UriSecuritySupported("x", Locale.getDefault()));\r
+ \r
+ \r
+ /*\r
+ * CUPS IPP extension attributes defined in de.lohndirekt.attribute.cups\r
+ */\r
+ public static final IppAttributeName DEVICE_CLASS = new IppAttributeName(new DeviceClass("x", Locale.getDefault()));\r
+ public static final IppAttributeName DEVICE_URI = new IppAttributeName(new DeviceUri(IppAttributeName.getURI()));\r
+ public static final IppAttributeName Job_K_LIMIT = new IppAttributeName(new JobKLimit(1));\r
+ public static final IppAttributeName JOB_PAGE_LIMIT = new IppAttributeName(new JobPageLimit(1));\r
+ public static final IppAttributeName JOB_QUOTA_PERIOD = new IppAttributeName(new JobQuotaPeriod(1));\r
+ public static final IppAttributeName MEMBER_NAMES = new IppAttributeName(new MemberNames("x", Locale.getDefault()));\r
+ public static final IppAttributeName MEMBER_URIS = new IppAttributeName(new MemberUris(IppAttributeName.getURI()));\r
+ public static final IppAttributeName PRINTER_STATE_TIME = new IppAttributeName(new PrinterStateTime(1));\r
+ \r
+ /*\r
+ * undocumented IPP attributes used by CUPS\r
+ */\r
+ public static final IppAttributeName OUTPUT_BIN_SUPPORTED =\r
+ new IppAttributeName(new OutputBinSupported("x", Locale.getDefault()));\r
+ \r
+ \r
+ private static Map attributesByName = new HashMap();;\r
+ private static Map attributesByCategory = new HashMap();;\r
+\r
+ /**\r
+ * \r
+ */\r
+ private static URI getURI() {\r
+ try {\r
+ return new URI("http://www.lohndirekt.de");\r
+ } catch (URISyntaxException e) {\r
+ throw new RuntimeException(e);\r
+ }\r
+\r
+ }\r
+\r
+ private static void put(IppAttributeName attr) {\r
+ attributesByName.put(attr.getName(), attr);\r
+ attributesByCategory.put(attr.getCategory(), attr);\r
+ }\r
+\r
+ /**\r
+ * \r
+ */\r
+ static {\r
+ put(IppAttributeName.CHARSET);\r
+ put(IppAttributeName.CHARSET_CONFIGURED);\r
+ put(IppAttributeName.CHARSET_SUPORTED);\r
+ put(IppAttributeName.COLOR_SUPPORTED);\r
+ put(IppAttributeName.COMPRESSION);\r
+ put(IppAttributeName.COMPRESSION_SUPORTED);\r
+ put(IppAttributeName.COPIES);\r
+ put(IppAttributeName.COPIES_DEFAULT);\r
+ put(IppAttributeName.COPIES_SUPPORTED);\r
+ put(IppAttributeName.DATE_TIME_AT_COMPLETION);\r
+ put(IppAttributeName.DATE_TIME_AT_CREATION);\r
+ put(IppAttributeName.DATE_TIME_AT_PROCESSING);\r
+ put(IppAttributeName.DEVICE_CLASS);\r
+ put(IppAttributeName.DEVICE_URI);\r
+ put(IppAttributeName.DETAILED_STATUS_MESSAGE);\r
+ put(IppAttributeName.DOCUMENT_NAME);\r
+ put(IppAttributeName.DOCUMENT_FORMAT);\r
+ put(IppAttributeName.DOCUMENT_FORMAT_DEFAULT);\r
+ put(IppAttributeName.DOCUMENT_FORMAT_SUPORTED);\r
+ put(IppAttributeName.FIDELITY);\r
+ put(IppAttributeName.FINISHINGS);\r
+ put(IppAttributeName.FINISHINGS_DEFAULT);\r
+ put(IppAttributeName.FINISHINGS_SUPPORTED);\r
+ put(IppAttributeName.GENERATED_NATURAL_LANGUAGE_SUPPORTED);\r
+ put(IppAttributeName.IPP_VERSIONS_SUPPORTED);\r
+ put(IppAttributeName.JOB_HOLD_UNTIL);\r
+ put(IppAttributeName.JOB_HOLD_UNTIL_DEFAULT);\r
+ put(IppAttributeName.JOB_HOLD_UNTIL_SUPPORTED);\r
+ put(IppAttributeName.JOB_ID);\r
+ put(IppAttributeName.JOB_IMPRESSIONS);\r
+ put(IppAttributeName.JOB_IMPRESSIONS_COMPLETED);\r
+ put(IppAttributeName.JOB_IMPRESSIONS_SUPPORTED);\r
+ put(IppAttributeName.Job_K_LIMIT);\r
+ put(IppAttributeName.JOB_K_OCTETS);\r
+ put(IppAttributeName.JOB_K_OCTETS_PROCESSED);\r
+ put(IppAttributeName.JOB_K_OCTETS_SUPPORTED);\r
+ put(IppAttributeName.JOB_MEDIA_SHEETS);\r
+ put(IppAttributeName.JOB_MEDIA_SHEETS_COMPLETED);\r
+ put(IppAttributeName.JOB_MEDIA_SHEETS_SUPPORTED);\r
+ put(IppAttributeName.JOB_MESSAGE_FROM_OPERATOR);\r
+ put(IppAttributeName.JOB_MORE_INFO);\r
+ put(IppAttributeName.JOB_NAME);\r
+ put(IppAttributeName.JOB_ORIGINATING_HOST_NAME);\r
+ put(IppAttributeName.JOB_ORIGINATING_USER_NAME);\r
+ put(IppAttributeName.JOB_PAGE_LIMIT);\r
+ put(IppAttributeName.JOB_PRINTER_UP_TIME);\r
+ put(IppAttributeName.JOB_PRINTER_URI);\r
+ put(IppAttributeName.JOB_PRIORIY);\r
+ put(IppAttributeName.JOB_PRIORITY_DEFAULT);\r
+ put(IppAttributeName.JOB_PRIORIY_SUPPORTED);\r
+ put(IppAttributeName.JOB_QUOTA_PERIOD);\r
+ put(IppAttributeName.JOB_SHEETS);\r
+ put(IppAttributeName.JOB_SHEETS_DEFAULT);\r
+ put(IppAttributeName.JOB_SHEETS_SUPORTED);\r
+ put(IppAttributeName.JOB_STATE);\r
+ put(IppAttributeName.JOB_STATE_REASON);\r
+ put(IppAttributeName.JOB_STATE_REASONS);\r
+ put(IppAttributeName.JOB_URI);\r
+ put(IppAttributeName.MEDIA);\r
+ put(IppAttributeName.MEDIA_DEFAULT);\r
+ put(IppAttributeName.MEDIA_SUPPORTED);\r
+ put(IppAttributeName.MEMBER_NAMES);\r
+ put(IppAttributeName.MEMBER_URIS);\r
+ put(IppAttributeName.MULTIPLE_DOCUMENT_HANDLING);\r
+ put(IppAttributeName.MULTIPLE_DOCUMENT_HANDLING_DEFAULT);\r
+ put(IppAttributeName.MULTIPLE_DOCUMENT_HANDLING_SUPPORTED);\r
+ put(IppAttributeName.MULTIPLE_DOCUMENT_JOBS_SUPPORTED);\r
+ put(IppAttributeName.MULTIPLE_OPERATION_TIMEOUT);\r
+ put(IppAttributeName.NATURAL_LANGUAGE);\r
+ put(IppAttributeName.NATURAL_LANGUAGE_CONFIGURED);\r
+ put(IppAttributeName.NUMBER_OF_DOCUMENTS);\r
+ put(IppAttributeName.NUMBER_OF_INTERVENING_JOBS);\r
+ put(IppAttributeName.NUMBER_UP);\r
+ put(IppAttributeName.NUMBER_UP_DEFAULT);\r
+ put(IppAttributeName.NUMBER_UP_SUPPORTED);\r
+ put(IppAttributeName.OPERATIONS_SUPPORTED);\r
+ put(IppAttributeName.ORIENTATION_REQUESTED);\r
+ put(IppAttributeName.ORIENTATION_REQUESTED_DEFAULT);\r
+ put(IppAttributeName.ORIENTATION_REQUESTED_SUPPORTED);\r
+ put(IppAttributeName.OUTPUT_BIN_SUPPORTED);\r
+ put(IppAttributeName.OUTPUT_DEVICE_ASSIGNED);\r
+ put(IppAttributeName.PAGE_RANGES);\r
+ put(IppAttributeName.PAGE_RANGES_SUPPORTED);\r
+ put(IppAttributeName.PAGES_PER_MINUTE);\r
+ put(IppAttributeName.PAGES_PER_MINUTE_COLOR);\r
+ put(IppAttributeName.PDL_OVERRIDE_SUPPORTED);\r
+ put(IppAttributeName.PRESENTATION_DIRECTION);\r
+ put(IppAttributeName.PRINT_QUALITY);\r
+ put(IppAttributeName.PRINTER_CURRENT_TIME);\r
+ put(IppAttributeName.PRINTER_DRIVER_INSTALLER);\r
+ put(IppAttributeName.PRINTER_INFO);\r
+ put(IppAttributeName.PRINTER_IS_ACCEPTING_JOBS);\r
+ put(IppAttributeName.PRINTER_LOCATION);\r
+ put(IppAttributeName.PRINTER_MAKE_AND_MODEL);\r
+ put(IppAttributeName.PRINTER_MESSAGE_FROM_OPERATOR);\r
+ put(IppAttributeName.PRINTER_MORE_INFO);\r
+ put(IppAttributeName.PRINTER_MORE_INFO_MANUFACTURER);\r
+ put(IppAttributeName.PRINTER_NAME);\r
+ put(IppAttributeName.PRINTER_RESOLUTION);\r
+ put(IppAttributeName.PRINTER_STATE);\r
+ put(IppAttributeName.PRINTER_STATE_MESSAGE);\r
+ put(IppAttributeName.PRINTER_STATE_REASON);\r
+ put(IppAttributeName.PRINTER_STATE_REASONS);\r
+ put(IppAttributeName.PRINTER_STATE_TIME);\r
+ put(IppAttributeName.PRINTER_TYPE);\r
+ put(IppAttributeName.PRINTER_UP_TIME);\r
+ put(IppAttributeName.PRINTER_URI);\r
+ put(IppAttributeName.PRINTER_URI_SUPPORTED);\r
+ put(IppAttributeName.QUEUED_JOB_COUNT);\r
+ put(IppAttributeName.REFERENCE_URI_SCHEMES_SUPPORTED);\r
+ put(IppAttributeName.REQUESTING_USER_NAME);\r
+ put(IppAttributeName.REQUESTING_USER_PASSWD);\r
+ put(IppAttributeName.SEVERITY);\r
+ put(IppAttributeName.SHEET_COLLATE);\r
+ put(IppAttributeName.SIDES);\r
+ put(IppAttributeName.SIDES_DEFAULT);\r
+ put(IppAttributeName.SIDES_SUPPORTED);\r
+ put(IppAttributeName.STATUS_MESSAGE);\r
+ put(IppAttributeName.TIME_AT_COMPLETED);\r
+ put(IppAttributeName.TIME_AT_CREATION);\r
+ put(IppAttributeName.TIME_AT_PROCESSING);\r
+ put(IppAttributeName.URI_AUTHENTICATION_SUPPORTED);\r
+ put(IppAttributeName.URI_SECURITY_SUPPORTED);\r
+ }\r
+\r
+ public static IppAttributeName get(String attributeName) {\r
+ IppAttributeName attrib =(IppAttributeName)attributesByName.get(attributeName);\r
+ if (attrib == null) {\r
+ log.warning("Unknown Attribute " + attributeName + ".");\r
+ attrib = new IppAttributeName(new UnknownAttribute(attributeName, Locale.getDefault()));\r
+ }\r
+ return attrib;\r
+ }\r
+\r
+ public static IppAttributeName get(Class category) {\r
+ IppAttributeName attrib =(IppAttributeName)attributesByCategory.get(category);\r
+ if (attrib == null) {\r
+ log.warning("Unknown Category " + category + ".");\r
+ attrib = new IppAttributeName(new UnknownAttribute(category.getName(), Locale.getDefault()));\r
+ }\r
+ return attrib;\r
+ }\r
+ // End of static part\r
+\r
+ private String methodName;\r
+ private Class attributeClass;\r
+ private Class category;\r
+\r
+ private IppAttributeName(Attribute attribute) {\r
+ this.methodName = attribute.getName();\r
+ this.attributeClass = attribute.getClass();\r
+ this.category = attribute.getCategory();\r
+ }\r
+\r
+ /**\r
+ * @return\r
+ */\r
+ public Class getAttributeClass() {\r
+ return attributeClass;\r
+ }\r
+\r
+ public String getName() {\r
+ return this.methodName;\r
+ }\r
+\r
+ /**\r
+ * \r
+ */\r
+ public Class getCategory() {\r
+ return this.category;\r
+ }\r
+\r
+}\r