J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2000-2004 Sun Microsystems, Inc. All Rights Reserved. |
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | * |
| 5 | * This code is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License version 2 only, as |
| 7 | * published by the Free Software Foundation. Sun designates this |
| 8 | * particular file as subject to the "Classpath" exception as provided |
| 9 | * by Sun in the LICENSE file that accompanied this code. |
| 10 | * |
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 | * version 2 for more details (a copy is included in the LICENSE file that |
| 15 | * accompanied this code). |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License version |
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | * |
| 21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 22 | * CA 95054 USA or visit www.sun.com if you need additional information or |
| 23 | * have any questions. |
| 24 | */ |
| 25 | package javax.print.attribute.standard; |
| 26 | |
| 27 | import javax.print.attribute.EnumSyntax; |
| 28 | import javax.print.attribute.Attribute; |
| 29 | |
| 30 | /** |
| 31 | * Class ReferenceUriSchemesSupported is a printing attribute class |
| 32 | * an enumeration, that indicates a "URI scheme," such as "http:" or "ftp:", |
| 33 | * that a printer can use to retrieve print data stored at a URI location. |
| 34 | * If a printer supports doc flavors with a print data representation class of |
| 35 | * <CODE>"java.net.URL"</CODE>, the printer uses instances of class |
| 36 | * ReferenceUriSchemesSupported to advertise the URI schemes it can accept. |
| 37 | * The acceptable URI schemes are included as service attributes in the |
| 38 | * lookup service; this lets clients search the |
| 39 | * for printers that can get print data using a certain URI scheme. The |
| 40 | * acceptable URI schemes can also be queried using the capability methods in |
| 41 | * interface <code>PrintService</code>. However, |
| 42 | * ReferenceUriSchemesSupported attributes are used solely for determining |
| 43 | * acceptable URI schemes, they are never included in a doc's, |
| 44 | * print request's, print job's, or print service's attribute set. |
| 45 | * <P> |
| 46 | * The Internet Assigned Numbers Authority maintains the |
| 47 | * <A HREF="http://www.isi.edu/in-notes/iana/assignments/url-schemes">official |
| 48 | * list of URI schemes</A>. |
| 49 | * <p> |
| 50 | * Class ReferenceUriSchemesSupported defines enumeration values for widely |
| 51 | * used URI schemes. A printer that supports additional URI schemes |
| 52 | * can define them in a subclass of class ReferenceUriSchemesSupported. |
| 53 | * <P> |
| 54 | * <B>IPP Compatibility:</B> The category name returned by |
| 55 | * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's |
| 56 | * integer value is the IPP enum value. The <code>toString()</code> method |
| 57 | * returns the IPP string representation of the attribute value. |
| 58 | * <P> |
| 59 | * |
| 60 | * @author Alan Kaminsky |
| 61 | */ |
| 62 | public class ReferenceUriSchemesSupported |
| 63 | extends EnumSyntax implements Attribute { |
| 64 | |
| 65 | private static final long serialVersionUID = -8989076942813442805L; |
| 66 | |
| 67 | /** |
| 68 | * File Transfer Protocol (FTP). |
| 69 | */ |
| 70 | public static final ReferenceUriSchemesSupported FTP = |
| 71 | new ReferenceUriSchemesSupported(0); |
| 72 | |
| 73 | /** |
| 74 | * HyperText Transfer Protocol (HTTP). |
| 75 | */ |
| 76 | public static final ReferenceUriSchemesSupported HTTP = new ReferenceUriSchemesSupported(1); |
| 77 | |
| 78 | /** |
| 79 | * Secure HyperText Transfer Protocol (HTTPS). |
| 80 | */ |
| 81 | public static final ReferenceUriSchemesSupported HTTPS = new ReferenceUriSchemesSupported(2); |
| 82 | |
| 83 | /** |
| 84 | * Gopher Protocol. |
| 85 | */ |
| 86 | public static final ReferenceUriSchemesSupported GOPHER = new ReferenceUriSchemesSupported(3); |
| 87 | |
| 88 | /** |
| 89 | * USENET news. |
| 90 | */ |
| 91 | public static final ReferenceUriSchemesSupported NEWS = new ReferenceUriSchemesSupported(4); |
| 92 | |
| 93 | /** |
| 94 | * USENET news using Network News Transfer Protocol (NNTP). |
| 95 | */ |
| 96 | public static final ReferenceUriSchemesSupported NNTP = new ReferenceUriSchemesSupported(5); |
| 97 | |
| 98 | /** |
| 99 | * Wide Area Information Server (WAIS) protocol. |
| 100 | */ |
| 101 | public static final ReferenceUriSchemesSupported WAIS = new ReferenceUriSchemesSupported(6); |
| 102 | |
| 103 | /** |
| 104 | * Host-specific file names. |
| 105 | */ |
| 106 | public static final ReferenceUriSchemesSupported FILE = new ReferenceUriSchemesSupported(7); |
| 107 | |
| 108 | /** |
| 109 | * Construct a new reference URI scheme enumeration value with the given |
| 110 | * integer value. |
| 111 | * |
| 112 | * @param value Integer value. |
| 113 | */ |
| 114 | protected ReferenceUriSchemesSupported(int value) { |
| 115 | super (value); |
| 116 | } |
| 117 | |
| 118 | private static final String[] myStringTable = { |
| 119 | "ftp", |
| 120 | "http", |
| 121 | "https", |
| 122 | "gopher", |
| 123 | "news", |
| 124 | "nntp", |
| 125 | "wais", |
| 126 | "file", |
| 127 | }; |
| 128 | |
| 129 | private static final ReferenceUriSchemesSupported[] myEnumValueTable = { |
| 130 | FTP, |
| 131 | HTTP, |
| 132 | HTTPS, |
| 133 | GOPHER, |
| 134 | NEWS, |
| 135 | NNTP, |
| 136 | WAIS, |
| 137 | FILE, |
| 138 | }; |
| 139 | |
| 140 | /** |
| 141 | * Returns the string table for class ReferenceUriSchemesSupported. |
| 142 | */ |
| 143 | protected String[] getStringTable() { |
| 144 | return (String[])myStringTable.clone(); |
| 145 | } |
| 146 | |
| 147 | /** |
| 148 | * Returns the enumeration value table for class |
| 149 | * ReferenceUriSchemesSupported. |
| 150 | */ |
| 151 | protected EnumSyntax[] getEnumValueTable() { |
| 152 | return (EnumSyntax[])myEnumValueTable.clone(); |
| 153 | } |
| 154 | |
| 155 | /** |
| 156 | * Get the printing attribute class which is to be used as the "category" |
| 157 | * for this printing attribute value. |
| 158 | * <P> |
| 159 | * For class ReferenceUriSchemesSupported and any vendor-defined |
| 160 | * subclasses, the category is class ReferenceUriSchemesSupported itself. |
| 161 | * |
| 162 | * @return Printing attribute class (category), an instance of class |
| 163 | * {@link java.lang.Class java.lang.Class}. |
| 164 | */ |
| 165 | public final Class<? extends Attribute> getCategory() { |
| 166 | return ReferenceUriSchemesSupported.class; |
| 167 | } |
| 168 | |
| 169 | /** |
| 170 | * Get the name of the category of which this attribute value is an |
| 171 | * instance. |
| 172 | * <P> |
| 173 | * For class ReferenceUriSchemesSupported and any vendor-defined |
| 174 | * subclasses, the category name is |
| 175 | * <CODE>"reference-uri-schemes-supported"</CODE>. |
| 176 | * |
| 177 | * @return Attribute category name. |
| 178 | */ |
| 179 | public final String getName() { |
| 180 | return "reference-uri-schemes-supported"; |
| 181 | } |
| 182 | |
| 183 | } |