diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2010-04-27 21:24:01 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2010-04-27 21:24:01 +0000 |
commit | 2414dc7d8f6bfb6e8cb9797f0de258f0eb2a4c26 (patch) | |
tree | 4869f8e662d9ffa94cee7f4d82cb88399035c6cd /gnu | |
parent | 626673dcfb30b74dde141f1bfa3487881c711897 (diff) | |
download | classpath-2414dc7d8f6bfb6e8cb9797f0de258f0eb2a4c26.tar.gz |
Fix getCategory and getAssociatedAttributeArray warnings. Whitespace cleanup.
2010-04-27 Andrew John Hughes <ahughes@redhat.com>
* gnu/javax/print/ipp/IppPrintService.java:
Fix whitespace. Use correct generic type for printerAttr
map.
(getPrinterAttributeSet(Class<? extends Attribute>)): Add
appropriate generic type.
* gnu/javax/print/ipp/attribute/supported/CharsetSupported.java:
Fix whitespace.
(getCategory()): Fix return type.
* gnu/javax/print/ipp/attribute/supported/CompressionSupported.java:
Fix whitespace.
(getCategory()): Fix return type.
(getAssociatedAttributeArray(Set<CompressionSupported>)): Add generic
type to set and use for-each loop.
* gnu/javax/print/ipp/attribute/supported/DocumentFormatSupported.java:
Fix whitespace.
(getCategory()): Fix return type.
* gnu/javax/print/ipp/attribute/supported/FinishingsSupported.java:
Fix whitespace.
(getCategory()): Fix return type.
(getAssociatedAttributeArray(Set<FinishingsSupported>)): Add generic
type to set and use for-each loop.
* gnu/javax/print/ipp/attribute/supported/GeneratedNaturalLanguageSupported.java:
Fix whitespace.
(getCategory()): Fix return type.
* gnu/javax/print/ipp/attribute/supported/IppVersionsSupported.java:
Fix whitespace.
(getCategory()): Fix return type.
* gnu/javax/print/ipp/attribute/supported/JobHoldUntilSupported.java:
Fix whitespace.
(getCategory()): Fix return type.
* gnu/javax/print/ipp/attribute/supported/JobSheetsSupported.java:
Fix whitespace.
(getCategory()): Fix return type.
(getAssociatedAttributeArray(Set<JobSheetsSupported>)): Add generic
type to set and use for-each loop.
* gnu/javax/print/ipp/attribute/supported/MediaSupported.java:
Fix whitespace.
(getCategory()): Fix return type.
(getAssociatedAttributeArray(Set<MediaSupported>)): Add generic
type to set and use for-each loop.
* gnu/javax/print/ipp/attribute/supported/MultipleDocumentHandlingSupported.java:
Fix whitespace.
(getCategory()): Fix return type.
(getAssociatedAttributeArray(Set<MultipleDocumentHandlingSupported>)): Add generic
type to set and use for-each loop.
* gnu/javax/print/ipp/attribute/supported/MultipleDocumentJobsSupported.java,
Fix whitespace.
(getCategory()): Fix return type.
* gnu/javax/print/ipp/attribute/supported/OperationsSupported.java,
Fix whitespace.
(getCategory()): Fix return type.
* gnu/javax/print/ipp/attribute/supported/OrientationRequestedSupported.java,
Fix whitespace.
(getCategory()): Fix return type.
(getAssociatedAttributeArray(Set<OrientationRequestedSupported>)): Add generic
type to set and use for-each loop.
* gnu/javax/print/ipp/attribute/supported/PageRangesSupported.java,
Fix whitespace.
(getCategory()): Fix return type.
* gnu/javax/print/ipp/attribute/supported/PrintQualitySupported.java,
Fix whitespace.
(getCategory()): Fix return type.
(getAssociatedAttributeArray(Set<PrintQualitySupported>)): Add generic
type to set and use for-each loop.
* gnu/javax/print/ipp/attribute/supported/PrinterResolutionSupported.java,
Fix whitespace.
(getCategory()): Fix return type.
(getAssociatedAttributeArray(Set<PrinterResolutionSupported>)): Add generic
type to set and use for-each loop.
* gnu/javax/print/ipp/attribute/supported/PrinterUriSupported.java,
Fix whitespace.
(getCategory()): Fix return type.
* gnu/javax/print/ipp/attribute/supported/SidesSupported.java,
Fix whitespace.
(getCategory()): Fix return type.
* gnu/javax/print/ipp/attribute/supported/UriAuthenticationSupported.java,
Fix whitespace.
(getCategory()): Fix return type.
* gnu/javax/print/ipp/attribute/supported/UriSecuritySupported.java,
Fix whitespace.
(getCategory()): Fix return type.
Diffstat (limited to 'gnu')
21 files changed, 613 insertions, 613 deletions
diff --git a/gnu/javax/print/ipp/IppPrintService.java b/gnu/javax/print/ipp/IppPrintService.java index 56a41381f..219bd6e03 100644 --- a/gnu/javax/print/ipp/IppPrintService.java +++ b/gnu/javax/print/ipp/IppPrintService.java @@ -1,4 +1,4 @@ -/* IppPrintService.java -- +/* IppPrintService.java -- Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -130,137 +130,137 @@ import javax.print.event.PrintServiceAttributeListener; /** * Implementation of the PrintService interface * for IPP based printers. - * + * * @author Wolfgang Baer (WBaer@gmx.de) */ public class IppPrintService implements PrintService { - /** + /** * A Map with sets of attributes. * key: A attribute category * value: A set with values - * + * * IPP may return sets of attributes e.g. for supported * compression methods so we need to map to sets here. */ - private Map printerAttr; - + private Map<Class<? extends Attribute>, Set<? extends Attribute>> printerAttr; + /** The set of listeners.*/ private HashSet printServiceAttributeListener; - + /** The username. */ private transient String user; - + /** The password of the user. */ private transient String passwd; - + /** The name of this print service. */ private String name; - + /** The list of supported document flavors. */ private List flavors; - + /** The standard printer URI. */ private PrinterURI printerUri; - + /** The list of all supported printer URIs. */ private ArrayList printerUris; - + /** * Logger for tracing - enable by passing * -Dgnu.classpath.debug.components=ipp to the vm. */ static final Logger logger = SystemLogger.SYSTEM; - - /** + + /** * requesting-user-name defaults to the executing user. */ public static final RequestingUserName REQUESTING_USER_NAME; - - /** + + /** * job-name defaults to "Java Printing". */ public static final JobName JOB_NAME; - + static { JOB_NAME = new JobName("Java Printing", null); REQUESTING_USER_NAME = new RequestingUserName( - SystemProperties.getProperty("user.name", ""), null); + SystemProperties.getProperty("user.name", ""), null); } - + // TODO Implement service listener notification and change detection. - + /** * Creates a <code>IppPrintService</code> object. - * + * * @param uri the URI of the IPP printer. * @param username the user of this print service. * @param password the password of the user. - * + * * @throws IppException if an error during connection occurs. */ - public IppPrintService(URI uri, String username, String password) + public IppPrintService(URI uri, String username, String password) throws IppException { printerUri = new PrinterURI(uri); user = username; passwd = password; - + printServiceAttributeListener = new HashSet(); - + printerAttr = getPrinterAttributes(); processResponse(); } - + /** * Fetches all printer attributes from the IPP printer. - * + * * @return The Map with the printer attributes. * @throws IppException if an error occurs. */ private Map getPrinterAttributes() throws IppException { IppResponse response = null; - + try { - IppRequest request = new IppRequest(printerUri.getURI(), user, passwd); - + IppRequest request = new IppRequest(printerUri.getURI(), user, passwd); + int operation = OperationsSupported.GET_PRINTER_ATTRIBUTES.getValue(); - request.setOperationID((short) operation); - request.setOperationAttributeDefaults(); + request.setOperationID((short) operation); + request.setOperationAttributeDefaults(); request.addOperationAttribute(printerUri); - + response = request.send(); - } + } catch (IOException e) { throw new IppException("IOException in IPP request/response.", e); - } - - return (Map) response.getPrinterAttributes().get(0); + } + + return (Map) response.getPrinterAttributes().get(0); } - + /** - * Extracts the set of attribute values for a given + * Extracts the set of attribute values for a given * attribute category from the printer attributes map. - * + * * @param attributeClass the category * @return The set of attributes of the category. */ - private Set getPrinterAttributeSet(Class attributeClass) + private Set getPrinterAttributeSet(Class<? extends Attribute> attributeClass) { return (Set) printerAttr.get(attributeClass); } - + /** - * Extracts the default attribute value for the given + * Extracts the default attribute value for the given * default attribute category from the printer attributes map. - * + * * @param attributeClass the category * @return The default attribute. - * + * * @throws ClassCastException if attributClass is not an * instance of <code>DefaultValueAttribute</code>. */ @@ -269,7 +269,7 @@ public class IppPrintService implements PrintService Set set = (Set) printerAttr.get(attributeClass); return ((DefaultValueAttribute) set.toArray()[0]).getAssociatedAttribute(); } - + /** * Processes the response, sorts and splits the attributes. */ @@ -279,11 +279,11 @@ public class IppPrintService implements PrintService PrinterName[] tmp = (PrinterName[]) getPrinterAttributeSet( PrinterName.class).toArray(new PrinterName[1]); name = tmp[0].getValue(); - + // supported flavors // TODO Check if charsets-supported are charsets that are actually supported // for text doc flavors as cups doesn't send charset parameters - + // utf-8 is supported at least - so we go with this only for now flavors = new ArrayList(); Set flavorAttributes = getPrinterAttributeSet(DocumentFormatSupported.class); @@ -292,13 +292,13 @@ public class IppPrintService implements PrintService for (Iterator it = flavorAttributes.iterator(); it.hasNext();) { String mimeType = ((DocumentFormatSupported) it.next()).getValue(); - + if (mimeType.equals("text/plain")) { flavors.add(DocFlavor.CHAR_ARRAY.TEXT_PLAIN); flavors.add(DocFlavor.READER.TEXT_PLAIN); flavors.add(DocFlavor.STRING.TEXT_PLAIN); - + // add utf-8 mimeType = mimeType + "; charset=utf-8"; } @@ -307,11 +307,11 @@ public class IppPrintService implements PrintService flavors.add(DocFlavor.CHAR_ARRAY.TEXT_HTML); flavors.add(DocFlavor.READER.TEXT_HTML); flavors.add(DocFlavor.STRING.TEXT_HTML); - + // add utf-8 mimeType = mimeType + "; charset=utf-8"; } - + // Process the predefined DocFlavors and if mimetype is // equal put them into the flavors array - otherwise // just build them as binarie class representation. @@ -320,8 +320,8 @@ public class IppPrintService implements PrintService { Class[] clazzes = new Class[] { DocFlavor.BYTE_ARRAY.class, DocFlavor.INPUT_STREAM.class, - DocFlavor.URL.class }; - + DocFlavor.URL.class }; + for (int j = 0; j < clazzes.length; j++) { Field[] fields = clazzes[j].getDeclaredFields(); @@ -336,7 +336,7 @@ public class IppPrintService implements PrintService } } if (!changed) // not in predefined constants of DocFlavor - { + { // everything should be supported as binary stuff flavors.add(new DocFlavor(mimeType, "[B")); flavors.add(new DocFlavor(mimeType, "java.io.InputStream")); @@ -357,14 +357,14 @@ public class IppPrintService implements PrintService } } - if (this.getClass() - .isAssignableFrom(gnu.javax.print.CupsPrintService.class)) - { -// CUPS always provides filters to convert from Postscript. -// This logic looks odd, but it's what OpenJDK does. - flavors.add(DocFlavor.SERVICE_FORMATTED.PAGEABLE); - flavors.add(DocFlavor.SERVICE_FORMATTED.PRINTABLE); - } + if (this.getClass() + .isAssignableFrom(gnu.javax.print.CupsPrintService.class)) + { +// CUPS always provides filters to convert from Postscript. +// This logic looks odd, but it's what OpenJDK does. + flavors.add(DocFlavor.SERVICE_FORMATTED.PAGEABLE); + flavors.add(DocFlavor.SERVICE_FORMATTED.PRINTABLE); + } } // printer uris @@ -380,14 +380,14 @@ public class IppPrintService implements PrintService /** * We always return a implementation implementing CancelablePrintJob. - * + * * @see javax.print.PrintService#createPrintJob() */ public DocPrintJob createPrintJob() { return new DocPrintJobImpl(this, user, passwd); } - + /** * @see javax.print.PrintService#getAttribute(java.lang.Class) @@ -396,15 +396,15 @@ public class IppPrintService implements PrintService { if (category == null) throw new NullPointerException("category may not be null"); - + if (! PrintServiceAttribute.class.isAssignableFrom(category)) throw new IllegalArgumentException( "category must be of type PrintServiceAttribute"); - + Set set = getPrinterAttributeSet(category); - if (set != null && set.size() > 0) + if (set != null && set.size() > 0) return (PrintServiceAttribute) set.toArray()[0]; - + return null; } @@ -414,10 +414,10 @@ public class IppPrintService implements PrintService public PrintServiceAttributeSet getAttributes() { PrintServiceAttributeSet set = new HashPrintServiceAttributeSet(); - + Iterator it = printerAttr.values().iterator(); while (it.hasNext()) - { + { Iterator it2 = ((Set) it.next()).iterator(); while (it2.hasNext()) { @@ -426,7 +426,7 @@ public class IppPrintService implements PrintService set.add(attr); } } - + return AttributeSetUtilities.unmodifiableView(set); } @@ -434,61 +434,61 @@ public class IppPrintService implements PrintService * @see javax.print.PrintService#getDefaultAttributeValue(java.lang.Class) */ public Object getDefaultAttributeValue(Class category) - { + { // required attributes if (category.equals(Fidelity.class)) - return Fidelity.FIDELITY_FALSE; + return Fidelity.FIDELITY_FALSE; if (category.equals(JobName.class)) return JOB_NAME; if (category.equals(RequestingUserName.class)) return REQUESTING_USER_NAME; - + // optional attributes - if (category.equals(JobPriority.class) + if (category.equals(JobPriority.class) && printerAttr.containsKey(JobPriorityDefault.class)) return getPrinterDefaultAttribute(JobPriorityDefault.class); - if (category.equals(JobHoldUntil.class) + if (category.equals(JobHoldUntil.class) && printerAttr.containsKey(JobHoldUntilDefault.class)) return getPrinterDefaultAttribute(JobHoldUntilDefault.class); - if (category.equals(JobSheets.class) + if (category.equals(JobSheets.class) && printerAttr.containsKey(JobSheetsDefault.class)) return getPrinterDefaultAttribute(JobSheetsDefault .class); - if (category.equals(MultipleDocumentHandling.class) + if (category.equals(MultipleDocumentHandling.class) && printerAttr.containsKey(MultipleDocumentHandlingDefault.class)) return getPrinterDefaultAttribute(MultipleDocumentHandlingDefault.class); - if (category.equals(Copies.class) + if (category.equals(Copies.class) && printerAttr.containsKey(CopiesDefault.class)) return getPrinterDefaultAttribute(CopiesDefault.class); - if (category.equals(Finishings.class) + if (category.equals(Finishings.class) && printerAttr.containsKey(FinishingsDefault.class)) return getPrinterDefaultAttribute(FinishingsDefault.class); - if (category.equals(Sides.class) + if (category.equals(Sides.class) && printerAttr.containsKey(SidesDefault.class)) return getPrinterDefaultAttribute(SidesDefault.class); - if (category.equals(NumberUp.class) + if (category.equals(NumberUp.class) && printerAttr.containsKey(NumberUpDefault.class)) return getPrinterDefaultAttribute(NumberUpDefault.class); - if (category.equals(OrientationRequested.class) + if (category.equals(OrientationRequested.class) && printerAttr.containsKey(OrientationRequestedDefault.class)) return getPrinterDefaultAttribute(OrientationRequestedDefault.class); - if (category.equals(Media.class) + if (category.equals(Media.class) && printerAttr.containsKey(MediaDefault.class)) return getPrinterDefaultAttribute(MediaDefault.class); - if (category.equals(PrinterResolution.class) + if (category.equals(PrinterResolution.class) && printerAttr.containsKey(PrinterResolutionDefault.class)) return getPrinterDefaultAttribute(PrinterResolutionDefault.class); - if (category.equals(PrintQuality.class) + if (category.equals(PrintQuality.class) && printerAttr.containsKey(PrintQualityDefault.class)) return getPrinterDefaultAttribute(PrintQualityDefault.class); - if (category.equals(Compression.class) + if (category.equals(Compression.class) && printerAttr.containsKey(CompressionSupported.class)) return Compression.NONE; if (category.equals(PageRanges.class)) return new PageRanges(1, Integer.MAX_VALUE); - return null; + return null; } - + /** * We return the value of <code>PrinterName</code> here. * @see javax.print.PrintService#getName() @@ -506,7 +506,7 @@ public class IppPrintService implements PrintService { // SUN does not provide any service factory for // print services (tested on linux/windows) - + // for the moment we do the same - just return null // later on we could provide at least the about UI dialog return null; @@ -518,8 +518,8 @@ public class IppPrintService implements PrintService public Class[] getSupportedAttributeCategories() { Set categories = new HashSet(); - - // Should only be job template attributes as of section 4.2 + + // Should only be job template attributes as of section 4.2 if (printerAttr.containsKey(JobPrioritySupported.class)) categories.add(JobPriority.class); if (printerAttr.containsKey(JobHoldUntilSupported.class)) @@ -527,14 +527,14 @@ public class IppPrintService implements PrintService if (printerAttr.containsKey(JobSheetsSupported.class)) categories.add(JobSheets.class); if (printerAttr.containsKey(MultipleDocumentHandlingSupported.class)) - categories.add(MultipleDocumentHandling.class); + categories.add(MultipleDocumentHandling.class); if (printerAttr.containsKey(CopiesSupported.class)) categories.add(Copies.class); if (printerAttr.containsKey(FinishingsSupported.class)) { // if only none finishing is supported - it does not count as supported - Set set = getPrinterAttributeSet(FinishingsSupported.class); - if (! (set.size() == 1 && set.contains(FinishingsSupported.NONE))) + Set set = getPrinterAttributeSet(FinishingsSupported.class); + if (! (set.size() == 1 && set.contains(FinishingsSupported.NONE))) categories.add(Finishings.class); } if (printerAttr.containsKey(PageRangesSupported.class)) @@ -551,11 +551,11 @@ public class IppPrintService implements PrintService categories.add(PrinterResolution.class); if (printerAttr.containsKey(PrintQualitySupported.class)) categories.add(PrintQuality.class); - - // Chromaticity, Destination, MediaPrintableArea, + + // Chromaticity, Destination, MediaPrintableArea, // SheetCollate, PresentationDirection - not IPP attributes - - // attributes outside section 4.2 + + // attributes outside section 4.2 if (printerAttr.containsKey(CompressionSupported.class)) categories.add(Compression.class); if (printerAttr.containsKey(JobImpressionsSupported.class)) @@ -564,7 +564,7 @@ public class IppPrintService implements PrintService categories.add(JobKOctets.class); if (printerAttr.containsKey(JobMediaSheetsSupported.class)) categories.add(JobMediaSheets.class); - + // always supported as required by IPP specification categories.add(Fidelity.class); categories.add(JobName.class); @@ -578,7 +578,7 @@ public class IppPrintService implements PrintService * attribute values totally different may override this methods. Subclass only in * need of handling the response differently may override the method * <code>handleSupportedAttributeValuesResponse(IppResponse, Class)</code> only. - * + * * @see PrintService#getSupportedAttributeValues(Class, DocFlavor, AttributeSet) * @see #handleSupportedAttributeValuesResponse(IppResponse, Class) */ @@ -620,7 +620,7 @@ public class IppPrintService implements PrintService request.setOperationAttributeDefaults(); request.addOperationAttribute(new RequestedAttributes(categoryName)); request.addOperationAttribute(printerUri); - + if (flavor != null) { DocumentFormat f = DocumentFormat.createDocumentFormat(flavor); @@ -628,7 +628,7 @@ public class IppPrintService implements PrintService } response = request.send(); - + int status = response.getStatusCode(); if (! (status == IppStatusCode.SUCCESSFUL_OK || status == IppStatusCode.SUCCESSFUL_OK_IGNORED_OR_SUBSTITUED_ATTRIBUTES @@ -647,38 +647,38 @@ public class IppPrintService implements PrintService // method cannot throw exception - just log logger.log(Component.IPP, "IPPException", e); } - + return handleSupportedAttributeValuesResponse(response, category); } - + /** * Called to handle the supported attribute values response for the given * category. This might be overridden by subclasses with different requirements * for parsing/handling the response from the GetPrinterAttributes. - * + * * @param response the response of the GetPrinterAttributes IPP request * @param category the category for which the supported values are requested - * @return A object indicating the supported values for the given attribute - * category, or <code>null</code> if this print service doesn't support the + * @return A object indicating the supported values for the given attribute + * category, or <code>null</code> if this print service doesn't support the * given attribute category at all. - * + * * @see #getSupportedAttributeValues(Class, DocFlavor, AttributeSet) */ - protected Object handleSupportedAttributeValuesResponse(IppResponse response, + protected Object handleSupportedAttributeValuesResponse(IppResponse response, Class category) { List printerAtts = response.getPrinterAttributes(); - + // only one will be returned Map printerAttribute = (Map) printerAtts.get(0); Class suppCategory = IppUtilities.getSupportedCategory(category); Set attr = (Set) printerAttribute.get(suppCategory); - - // We sometime assume its a single instance with arbritrary value just indicating + + // We sometime assume its a single instance with arbritrary value just indicating // support or an array which is returned. This is because I sometimes just choosed - // what sounds right to me - as I have yet to find a printer which supports every + // what sounds right to me - as I have yet to find a printer which supports every // special category in the SUN implementation to see what they return :-) - + // Map whats in the JSP API if (suppCategory.equals(JobPrioritySupported.class)) return (JobPrioritySupported) attr.toArray(new JobPrioritySupported[1])[0]; @@ -693,7 +693,7 @@ public class IppPrintService implements PrintService if (suppCategory.equals(FinishingsSupported.class)) return FinishingsSupported.getAssociatedAttributeArray(attr); if (suppCategory.equals(PageRangesSupported.class)) - return new PageRanges[] { new PageRanges(1, Integer.MAX_VALUE) }; + return new PageRanges[] { new PageRanges(1, Integer.MAX_VALUE) }; if (suppCategory.equals(OrientationRequestedSupported.class)) return OrientationRequestedSupported.getAssociatedAttributeArray(attr); if (suppCategory.equals(MediaSupported.class)) @@ -707,7 +707,7 @@ public class IppPrintService implements PrintService // Special handling as it might also be in range of integers if (suppCategory.equals(NumberUpSupported.class)) { - NumberUpSupported[] tmp = (NumberUpSupported[]) + NumberUpSupported[] tmp = (NumberUpSupported[]) attr.toArray(new NumberUpSupported[attr.size()]); if (attr.size() == 1) // number-up maybe in rangeofintegers @@ -723,10 +723,10 @@ public class IppPrintService implements PrintService NumberUpSupported supported = new NumberUpSupported(members); return supported; } - + return null; - } - + } + /** * @see javax.print.PrintService#getSupportedDocFlavors() */ @@ -736,7 +736,7 @@ public class IppPrintService implements PrintService } /** - * This is done by a validate-job operation and actually implemented in + * This is done by a validate-job operation and actually implemented in * this generic IPP reference implementation. Subclasses which does * not correctly support Validate-Job operation might want to override this. * @@ -744,7 +744,7 @@ public class IppPrintService implements PrintService */ public AttributeSet getUnsupportedAttributes(DocFlavor flavor, AttributeSet attributes) - { + { if (flavor != null && !isDocFlavorSupported(flavor)) throw new IllegalArgumentException("flavor is not supported"); @@ -757,21 +757,21 @@ public class IppPrintService implements PrintService request.setOperationAttributeDefaults(); request.addOperationAttribute(printerUri); request.addOperationAttribute(Fidelity.FIDELITY_TRUE); - + if (attributes != null && attributes.size() > 0) { request.addAndFilterJobOperationAttributes(attributes); request.addAndFilterJobTemplateAttributes(attributes); } - + if (flavor != null) { DocumentFormat f = DocumentFormat.createDocumentFormat(flavor); request.addOperationAttribute(f); } - + response = request.send(); - + int status = response.getStatusCode(); if (! (status == IppStatusCode.SUCCESSFUL_OK || status == IppStatusCode.SUCCESSFUL_OK_IGNORED_OR_SUBSTITUED_ATTRIBUTES @@ -791,16 +791,16 @@ public class IppPrintService implements PrintService logger.log(Component.IPP, "IPPException", e); } - // Validate Jobs returns only Unsupported and Operation - List unsupportedMaps = response.getUnsupportedAttributes(); + // Validate Jobs returns only Unsupported and Operation + List unsupportedMaps = response.getUnsupportedAttributes(); if (unsupportedMaps.size() == 0) return null; - + Map unsupportedAttr = (Map) unsupportedMaps.get(0); if (unsupportedAttr.size() == 0) return null; - - // Convert the return map with unsupported attributes + + // Convert the return map with unsupported attributes // into an AttribueSet instance HashAttributeSet set = new HashAttributeSet(); Iterator it = unsupportedAttr.values().iterator(); @@ -809,9 +809,9 @@ public class IppPrintService implements PrintService Set unsupported = (Set) it.next(); Iterator it2 = unsupported.iterator(); while (it2.hasNext()) - set.add((Attribute) it2.next()); + set.add((Attribute) it2.next()); } - + return set; } @@ -822,10 +822,10 @@ public class IppPrintService implements PrintService { if (category == null) throw new NullPointerException("category may not be null"); - + if (! Attribute.class.isAssignableFrom(category)) throw new IllegalArgumentException("category must be of type Attribute"); - + return Arrays.asList(getSupportedAttributeCategories()).contains(category); } @@ -835,28 +835,28 @@ public class IppPrintService implements PrintService public boolean isAttributeValueSupported(Attribute attrval, DocFlavor flavor, AttributeSet attributes) { - // just redirect to getSupportedAttributeValues - Object values = getSupportedAttributeValues(attrval.getCategory(), - flavor, attributes); + // just redirect to getSupportedAttributeValues + Object values = getSupportedAttributeValues(attrval.getCategory(), + flavor, attributes); // null means none supported if (values == null) return false; - + // object may be an array if (values.getClass().isArray()) return Arrays.asList((Object[]) values).contains(attrval); - + // may be a single instance of the category (value is irrelevant) if (values.getClass().equals(attrval.getCategory())) return true; - - // a single instance of another class to give the bounds + + // a single instance of another class to give the bounds // copies if (values.getClass().equals(CopiesSupported.class)) - return ((CopiesSupported) values).contains((IntegerSyntax) attrval); + return ((CopiesSupported) values).contains((IntegerSyntax) attrval); // number up if (values.getClass().equals(NumberUpSupported.class)) - return ((NumberUpSupported) values).contains((IntegerSyntax) attrval); + return ((NumberUpSupported) values).contains((IntegerSyntax) attrval); // job priority if (values.getClass().equals(JobPrioritySupported.class)) { @@ -865,15 +865,15 @@ public class IppPrintService implements PrintService if (priority.getValue() < maxSupported.getValue()) return true; } - - // I am unsure if these might also show up - not yet found a printer where - // Suns implementation supports them: + + // I am unsure if these might also show up - not yet found a printer where + // Suns implementation supports them: // JobImpressionsSupported, JobKOctetsSupported, JobMediaSheetsSupported - + return false; } - + /** * @see javax.print.PrintService#isDocFlavorSupported(DocFlavor) */ @@ -881,11 +881,11 @@ public class IppPrintService implements PrintService { if (flavor == null) throw new NullPointerException("DocFlavor may not be null."); - + return flavors.contains(flavor); } - + /** * @see PrintService#addPrintServiceAttributeListener(PrintServiceAttributeListener) */ @@ -894,7 +894,7 @@ public class IppPrintService implements PrintService { printServiceAttributeListener.add(listener); } - + /** * @see PrintService#removePrintServiceAttributeListener(PrintServiceAttributeListener) */ @@ -903,7 +903,7 @@ public class IppPrintService implements PrintService { printServiceAttributeListener.remove(listener); } - + /** * Returns "IppPrinter: " + <code>getName()</code> * @return The string representation. @@ -911,15 +911,15 @@ public class IppPrintService implements PrintService public String toString() { return "IppPrinter: " + getName(); - } - + } + /** * Returns the printer-uri of this print service. - * + * * @return The printer-uri attribute. */ public PrinterURI getPrinterURI() { return printerUri; - } + } } diff --git a/gnu/javax/print/ipp/attribute/supported/CharsetSupported.java b/gnu/javax/print/ipp/attribute/supported/CharsetSupported.java index 75804b5a4..22b484ef8 100644 --- a/gnu/javax/print/ipp/attribute/supported/CharsetSupported.java +++ b/gnu/javax/print/ipp/attribute/supported/CharsetSupported.java @@ -1,4 +1,4 @@ -/* CharsetSupported.java -- +/* CharsetSupported.java -- Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -40,23 +40,24 @@ package gnu.javax.print.ipp.attribute.supported; import gnu.javax.print.ipp.attribute.CharsetSyntax; +import javax.print.attribute.Attribute; import javax.print.attribute.SupportedValuesAttribute; /** * CharsetSupported attribute as described in RFC 2911 section * 4.4.18 provides the charset which are supported by the - * IPP implementation to be used in the name and text syntax + * IPP implementation to be used in the name and text syntax * attribute types. - * + * * @author Wolfgang Baer (WBaer@gmx.de) */ -public final class CharsetSupported extends CharsetSyntax +public final class CharsetSupported extends CharsetSyntax implements SupportedValuesAttribute { /** * Creates a <code>CharsetSupported</code> object. - * + * * @param value the charset string value. */ public CharsetSupported(String value) @@ -69,7 +70,7 @@ public final class CharsetSupported extends CharsetSyntax * * @return The class <code>CharsetSupported</code> itself. */ - public Class getCategory() + public Class<? extends Attribute> getCategory() { return CharsetSupported.class; } diff --git a/gnu/javax/print/ipp/attribute/supported/CompressionSupported.java b/gnu/javax/print/ipp/attribute/supported/CompressionSupported.java index 648167a93..56020748f 100644 --- a/gnu/javax/print/ipp/attribute/supported/CompressionSupported.java +++ b/gnu/javax/print/ipp/attribute/supported/CompressionSupported.java @@ -42,6 +42,7 @@ import gnu.javax.print.ipp.IppUtilities; import java.util.Iterator; import java.util.Set; +import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.SupportedValuesAttribute; import javax.print.attribute.standard.Compression; @@ -50,34 +51,34 @@ import javax.print.attribute.standard.Compression; /** * <code>CompressionSupported</code> provides the values which are * supported for the compression attribute. - * + * * @author Wolfgang Baer (WBaer@gmx.de) */ public final class CompressionSupported extends EnumSyntax implements SupportedValuesAttribute { - + /** The print data is not compressed. */ public static final CompressionSupported NONE = new CompressionSupported(0); - + /** The print data is ZIP compressed. */ public static final CompressionSupported DEFLATE = new CompressionSupported(1); - + /** The print data is GNU Zip compressed. */ public static final CompressionSupported GZIP = new CompressionSupported(2); - + /** The print data is UNIX compressed. */ public static final CompressionSupported COMPRESS = new CompressionSupported(3); - - private static final String[] stringTable = { "none", "deflate", + + private static final String[] stringTable = { "none", "deflate", "gzip", "compress" }; - - private static final CompressionSupported[] enumValueTable = { NONE, DEFLATE, + + private static final CompressionSupported[] enumValueTable = { NONE, DEFLATE, GZIP, COMPRESS }; /** * Constructs a <code>CompressionSupported</code> object. - * + * * @param value the enum value */ protected CompressionSupported(int value) @@ -90,7 +91,7 @@ public final class CompressionSupported extends EnumSyntax * * @return The class <code>CompressionSupported</code> itself. */ - public Class getCategory() + public Class<? extends Attribute> getCategory() { return CompressionSupported.class; } @@ -104,7 +105,7 @@ public final class CompressionSupported extends EnumSyntax { return "compression-supported"; } - + /** * Returns a table with the enumeration values represented as strings * for this object. @@ -125,38 +126,36 @@ public final class CompressionSupported extends EnumSyntax { return enumValueTable; } - + /** * Returns the equally enum of the standard attribute class * of this SupportedValuesAttribute enum. - * + * * @return The enum of the standard attribute class. */ - public Compression getAssociatedAttribute() + public Compression getAssociatedAttribute() { return (Compression) IppUtilities.getEnumAttribute( "compression", new Integer(getValue())); } - + /** * Constructs an array from a set of -supported attributes. * @param set set to process * @return The constructed array. - * + * * @see #getAssociatedAttribute() */ - public static Compression[] getAssociatedAttributeArray(Set set) + public static Compression[] + getAssociatedAttributeArray(Set<CompressionSupported> set) { - CompressionSupported tmp; - Compression[] result = new Compression[set.size()]; - Iterator it = set.iterator(); + Compression[] result = new Compression[set.size()]; int j = 0; - while (it.hasNext()) + for (CompressionSupported tmp : set) { - tmp = (CompressionSupported) it.next(); result[j] = tmp.getAssociatedAttribute(); j++; - } + } return result; } } diff --git a/gnu/javax/print/ipp/attribute/supported/DocumentFormatSupported.java b/gnu/javax/print/ipp/attribute/supported/DocumentFormatSupported.java index 6bd63dcfc..03449fa4f 100644 --- a/gnu/javax/print/ipp/attribute/supported/DocumentFormatSupported.java +++ b/gnu/javax/print/ipp/attribute/supported/DocumentFormatSupported.java @@ -1,4 +1,4 @@ -/* DocumentFormatSupported.java -- +/* DocumentFormatSupported.java -- Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -40,21 +40,22 @@ package gnu.javax.print.ipp.attribute.supported; import java.util.Locale; +import javax.print.attribute.Attribute; import javax.print.attribute.SupportedValuesAttribute; import javax.print.attribute.TextSyntax; /** * <code>DocumentFormatSupported</code> specifies the supported document * formats of a printer. Printer are supplying a set of this attribute. - * + * * @author Wolfgang Baer (WBaer@gmx.de) */ -public final class DocumentFormatSupported extends TextSyntax +public final class DocumentFormatSupported extends TextSyntax implements SupportedValuesAttribute { /** - * Creates a <code>DocumentFormatSupported</code> object with the + * Creates a <code>DocumentFormatSupported</code> object with the * given value and locale. * * @param value the value for this syntax @@ -73,7 +74,7 @@ public final class DocumentFormatSupported extends TextSyntax * * @return The class <code>DocumentFormatSupported</code> itself. */ - public Class getCategory() + public Class<? extends Attribute> getCategory() { return DocumentFormatSupported.class; } diff --git a/gnu/javax/print/ipp/attribute/supported/FinishingsSupported.java b/gnu/javax/print/ipp/attribute/supported/FinishingsSupported.java index 9f9c635d3..26e74522a 100644 --- a/gnu/javax/print/ipp/attribute/supported/FinishingsSupported.java +++ b/gnu/javax/print/ipp/attribute/supported/FinishingsSupported.java @@ -43,6 +43,7 @@ import gnu.javax.print.ipp.IppUtilities; import java.util.Iterator; import java.util.Set; +import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.SupportedValuesAttribute; import javax.print.attribute.standard.Finishings; @@ -51,7 +52,7 @@ import javax.print.attribute.standard.Finishings; /** * The <code>FinishingsSupported</code> attribute provides the supported * values for finishings of a job. - * + * * @author Wolfgang Baer (WBaer@gmx.de) */ public final class FinishingsSupported extends EnumSyntax @@ -60,122 +61,122 @@ public final class FinishingsSupported extends EnumSyntax /** No finishing. */ public static final FinishingsSupported NONE = new FinishingsSupported(3); - + /** Staple the document(s) */ public static final FinishingsSupported STAPLE = new FinishingsSupported(4); - + /** Cover a document */ public static final FinishingsSupported COVER = new FinishingsSupported(6); - + /** * This value indicates that a binding is to be applied to the document. * The type and placement of the binding is site-defined. */ public static final FinishingsSupported BIND = new FinishingsSupported(7); - + /** - * Bind the document(s) with one or more staples (wire stitches) - * along the middle fold. + * Bind the document(s) with one or more staples (wire stitches) + * along the middle fold. */ - public static final FinishingsSupported SADDLE_STITCH = + public static final FinishingsSupported SADDLE_STITCH = new FinishingsSupported(8); - + /** - * Bind the document(s) with one or more staples (wire stitches) - * along one edge. + * Bind the document(s) with one or more staples (wire stitches) + * along one edge. */ - public static final FinishingsSupported EDGE_STITCH = + public static final FinishingsSupported EDGE_STITCH = new FinishingsSupported(9); - - /** - * Bind the document(s) with one or more staples in the top left - * corner. + + /** + * Bind the document(s) with one or more staples in the top left + * corner. */ - public static final FinishingsSupported STAPLE_TOP_LEFT = + public static final FinishingsSupported STAPLE_TOP_LEFT = new FinishingsSupported(20); - - /** - * Bind the document(s) with one or more staples in the bottom - * left corner. + + /** + * Bind the document(s) with one or more staples in the bottom + * left corner. */ - public static final FinishingsSupported STAPLE_BOTTOM_LEFT = + public static final FinishingsSupported STAPLE_BOTTOM_LEFT = new FinishingsSupported(21); - + /** * Bind the document(s) with one or more staples in the top right corner. */ - public static final FinishingsSupported STAPLE_TOP_RIGHT = + public static final FinishingsSupported STAPLE_TOP_RIGHT = new FinishingsSupported(22); - + /** * Bind the document(s) with one or more staples in the bottom right corner. */ - public static final FinishingsSupported STAPLE_BOTTOM_RIGHT = + public static final FinishingsSupported STAPLE_BOTTOM_RIGHT = new FinishingsSupported(23); - + /** - * Bind the document(s) with one or more staples (wire stitches) + * Bind the document(s) with one or more staples (wire stitches) * along the left edge. */ - public static final FinishingsSupported EDGE_STITCH_LEFT = + public static final FinishingsSupported EDGE_STITCH_LEFT = new FinishingsSupported(24); - + /** - * Bind the document(s) with one or more staples (wire stitches) along + * Bind the document(s) with one or more staples (wire stitches) along * the top edge. */ - public static final FinishingsSupported EDGE_STITCH_TOP = + public static final FinishingsSupported EDGE_STITCH_TOP = new FinishingsSupported(25); - + /** - * Bind the document(s) with one or more staples (wire stitches) along + * Bind the document(s) with one or more staples (wire stitches) along * the right edge. */ - public static final FinishingsSupported EDGE_STITCH_RIGHT = + public static final FinishingsSupported EDGE_STITCH_RIGHT = new FinishingsSupported(26); - + /** * Bind the document(s) with one or more staples (wire stitches) along - * the bottom edge. + * the bottom edge. */ - public static final FinishingsSupported EDGE_STITCH_BOTTOM = + public static final FinishingsSupported EDGE_STITCH_BOTTOM = new FinishingsSupported(27); - + /** - * Bind the document(s) with two staples (wire stitches) along the + * Bind the document(s) with two staples (wire stitches) along the * left edge assuming a portrait document. */ - public static final FinishingsSupported STAPLE_DUAL_LEFT = + public static final FinishingsSupported STAPLE_DUAL_LEFT = new FinishingsSupported(28); - + /** - * Bind the document(s) with two staples (wire stitches) along the + * Bind the document(s) with two staples (wire stitches) along the * top edge assuming a portrait document. */ - public static final FinishingsSupported STAPLE_DUAL_TOP = + public static final FinishingsSupported STAPLE_DUAL_TOP = new FinishingsSupported(29); - + /** - * Bind the document(s) with two staples (wire stitches) along the + * Bind the document(s) with two staples (wire stitches) along the * right edge assuming a portrait document. */ - public static final FinishingsSupported STAPLE_DUAL_RIGHT = + public static final FinishingsSupported STAPLE_DUAL_RIGHT = new FinishingsSupported(30); - + /** - * Bind the document(s) with two staples (wire stitches) along the + * Bind the document(s) with two staples (wire stitches) along the * bottom edge assuming a portrait document. */ - public static final FinishingsSupported STAPLE_DUAL_BOTTOM = + public static final FinishingsSupported STAPLE_DUAL_BOTTOM = new FinishingsSupported(31); - private static final String[] stringTable = { "none", "staple", null, + private static final String[] stringTable = { "none", "staple", null, "cover", "bind", "saddle-stitch", "edge-stitch", null, null, null, null, null, null, null, null, null, null, "staple-top-left", - "staple-bottom-left", - "staple-top-right", + "staple-bottom-left", + "staple-top-right", "staple-bottom-right", "edge-stitch-left", "edge-stitch-top", @@ -185,14 +186,14 @@ public final class FinishingsSupported extends EnumSyntax "staple-dual-top", "staple-dual-right", "staple-dual-bottom" }; - - private static final FinishingsSupported[] enumValueTable = { NONE, STAPLE, - null, COVER, BIND, + + private static final FinishingsSupported[] enumValueTable = { NONE, STAPLE, + null, COVER, BIND, SADDLE_STITCH, - EDGE_STITCH, null, - null, null, null, - null, null, null, - null, null, null, + EDGE_STITCH, null, + null, null, null, + null, null, null, + null, null, null, STAPLE_TOP_LEFT, STAPLE_BOTTOM_LEFT, STAPLE_TOP_RIGHT, @@ -205,10 +206,10 @@ public final class FinishingsSupported extends EnumSyntax STAPLE_DUAL_TOP, STAPLE_DUAL_RIGHT, STAPLE_DUAL_BOTTOM }; - + /** * Constructs a <code>FinishingsSupported</code> object. - * + * * @param value the value */ protected FinishingsSupported(int value) @@ -221,7 +222,7 @@ public final class FinishingsSupported extends EnumSyntax * * @return the class <code>FinishingsSupported</code> itself */ - public Class getCategory() + public Class<? extends Attribute> getCategory() { return FinishingsSupported.class; } @@ -235,7 +236,7 @@ public final class FinishingsSupported extends EnumSyntax { return "finishings-supported"; } - + /** * Returns a table with the enumeration values represented as strings * for this object. @@ -266,38 +267,36 @@ public final class FinishingsSupported extends EnumSyntax { return 3; } - + /** * Returns the equally enum of the standard attribute class * of this SupportedValuesAttribute enum. - * + * * @return The enum of the standard attribute class. */ - public Finishings getAssociatedAttribute() + public Finishings getAssociatedAttribute() { return (Finishings) IppUtilities.getEnumAttribute( "finishings", new Integer(getValue())); } - + /** * Constructs an array from a set of -supported attributes. * @param set set to process * @return The constructed array. - * + * * @see #getAssociatedAttribute() */ - public static Finishings[] getAssociatedAttributeArray(Set set) + public static Finishings[] + getAssociatedAttributeArray(Set<FinishingsSupported> set) { - FinishingsSupported tmp; - Finishings[] result = new Finishings[set.size()]; - Iterator it = set.iterator(); + Finishings[] result = new Finishings[set.size()]; int j = 0; - while (it.hasNext()) + for (FinishingsSupported tmp : set) { - tmp = (FinishingsSupported) it.next(); result[j] = tmp.getAssociatedAttribute(); j++; - } + } return result; } } diff --git a/gnu/javax/print/ipp/attribute/supported/GeneratedNaturalLanguageSupported.java b/gnu/javax/print/ipp/attribute/supported/GeneratedNaturalLanguageSupported.java index 1dbb2939f..df1d33007 100644 --- a/gnu/javax/print/ipp/attribute/supported/GeneratedNaturalLanguageSupported.java +++ b/gnu/javax/print/ipp/attribute/supported/GeneratedNaturalLanguageSupported.java @@ -1,4 +1,4 @@ -/* GeneratedNaturalLanguageSupported.java -- +/* GeneratedNaturalLanguageSupported.java -- Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -40,24 +40,25 @@ package gnu.javax.print.ipp.attribute.supported; import gnu.javax.print.ipp.attribute.NaturalLanguageSyntax; +import javax.print.attribute.Attribute; import javax.print.attribute.SupportedValuesAttribute; /** - * GeneratedNaturalLanguageSupported attribute as described + * GeneratedNaturalLanguageSupported attribute as described * in RFC 2911 section 4.4.20 provides the natural languages - * which are supported by the IPP implementation to be used + * which are supported by the IPP implementation to be used * in the name and text syntax attribute types. - * + * * @author Wolfgang Baer (WBaer@gmx.de) */ -public final class GeneratedNaturalLanguageSupported - extends NaturalLanguageSyntax +public final class GeneratedNaturalLanguageSupported + extends NaturalLanguageSyntax implements SupportedValuesAttribute { /** * Creates a <code>GeneratedNaturalLanguageSupported</code> object. - * + * * @param value the charset string value. */ public GeneratedNaturalLanguageSupported(String value) @@ -70,7 +71,7 @@ public final class GeneratedNaturalLanguageSupported * * @return The class <code>GeneratedNaturalLanguageSupported</code> itself. */ - public Class getCategory() + public Class<? extends Attribute> getCategory() { return GeneratedNaturalLanguageSupported.class; } diff --git a/gnu/javax/print/ipp/attribute/supported/IppVersionsSupported.java b/gnu/javax/print/ipp/attribute/supported/IppVersionsSupported.java index 06365e6d1..072d7499a 100644 --- a/gnu/javax/print/ipp/attribute/supported/IppVersionsSupported.java +++ b/gnu/javax/print/ipp/attribute/supported/IppVersionsSupported.java @@ -1,4 +1,4 @@ -/* IppVersionsSupported.java -- +/* IppVersionsSupported.java -- Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -38,6 +38,7 @@ exception statement from your version. */ package gnu.javax.print.ipp.attribute.supported; +import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.SupportedValuesAttribute; @@ -45,31 +46,31 @@ import javax.print.attribute.SupportedValuesAttribute; * IppVersionsSupported attribute as described in RFC 2911 section * 4.4.14 provides the value(s) (implemented as EnumSyntax) * of the supported IPP versions. - * + * * @author Wolfgang Baer (WBaer@gmx.de) */ -public final class IppVersionsSupported extends EnumSyntax +public final class IppVersionsSupported extends EnumSyntax implements SupportedValuesAttribute { - + // a keyword based attribute in IPP - int values just starting at 0 - + /** IPP version 1.0 */ - public static final IppVersionsSupported V_1_0 = + public static final IppVersionsSupported V_1_0 = new IppVersionsSupported(0); - + /** IPP version 1.1 */ - public static final IppVersionsSupported V_1_1 = + public static final IppVersionsSupported V_1_1 = new IppVersionsSupported(1); - + private static final String[] stringTable = { "1.0", "1.1" }; - - private static final IppVersionsSupported[] enumValueTable = { V_1_0, + + private static final IppVersionsSupported[] enumValueTable = { V_1_0, V_1_1 }; /** * Constructs a <code>IppVersionsSupported</code> object. - * + * * @param value the enum value */ public IppVersionsSupported(int value) @@ -78,11 +79,11 @@ public final class IppVersionsSupported extends EnumSyntax } /** - * Returns category of this class. + * Returns the category of this class. * * @return The class <code>IppVersionsSupported</code> itself. */ - public Class getCategory() + public Class<? extends Attribute> getCategory() { return IppVersionsSupported.class; } @@ -96,7 +97,7 @@ public final class IppVersionsSupported extends EnumSyntax { return "ipp-versions-supported"; } - + /** * Returns a table with the enumeration values represented as strings * for this object. diff --git a/gnu/javax/print/ipp/attribute/supported/JobHoldUntilSupported.java b/gnu/javax/print/ipp/attribute/supported/JobHoldUntilSupported.java index a15d0095f..2add4a0cd 100644 --- a/gnu/javax/print/ipp/attribute/supported/JobHoldUntilSupported.java +++ b/gnu/javax/print/ipp/attribute/supported/JobHoldUntilSupported.java @@ -1,4 +1,4 @@ -/* JobHoldUntilSupported.java -- +/* JobHoldUntilSupported.java -- Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -40,63 +40,64 @@ package gnu.javax.print.ipp.attribute.supported; import java.util.Locale; +import javax.print.attribute.Attribute; import javax.print.attribute.SupportedValuesAttribute; import javax.print.attribute.TextSyntax; /** * JobHoldUntilSupported attribute provides the supported * values for the attribute type job-hold-until. - * + * * @author Wolfgang Baer (WBaer@gmx.de) */ -public final class JobHoldUntilSupported extends TextSyntax +public final class JobHoldUntilSupported extends TextSyntax implements SupportedValuesAttribute { - - // a keyword/name based attribute in IPP + + // a keyword/name based attribute in IPP // can be extended by administrators // standard values are predefined - + /** Job should be printed immediately. */ - public static final JobHoldUntilSupported NO_HOLD = + public static final JobHoldUntilSupported NO_HOLD = new JobHoldUntilSupported("no-hold", null); - + /** Job should be hold indefinitely. */ - public static final JobHoldUntilSupported INDEFINITE = + public static final JobHoldUntilSupported INDEFINITE = new JobHoldUntilSupported("indefinite", null); - + /** Job should be processed during the day. */ - public static final JobHoldUntilSupported DAY_TIME = + public static final JobHoldUntilSupported DAY_TIME = new JobHoldUntilSupported("day-time", null); - + /** Job should be processed in the evening. */ - public static final JobHoldUntilSupported EVENING = + public static final JobHoldUntilSupported EVENING = new JobHoldUntilSupported("evening", null); - + /** Job should be processed during night. */ - public static final JobHoldUntilSupported NIGHT = + public static final JobHoldUntilSupported NIGHT = new JobHoldUntilSupported("night", null); - + /** Job should be processed during the weekend. */ - public static final JobHoldUntilSupported WEEKEND = + public static final JobHoldUntilSupported WEEKEND = new JobHoldUntilSupported("weekend", null); - - /** - * Job should be processed as second-shift - * (after close of business). + + /** + * Job should be processed as second-shift + * (after close of business). */ - public static final JobHoldUntilSupported SECOND_SHIFT = + public static final JobHoldUntilSupported SECOND_SHIFT = new JobHoldUntilSupported("second-shift", null); - - /** - * Job should be processed as third-shift - * (after midnight). + + /** + * Job should be processed as third-shift + * (after midnight). */ - public static final JobHoldUntilSupported THIRD_SHIFT = - new JobHoldUntilSupported("third-shift", null); + public static final JobHoldUntilSupported THIRD_SHIFT = + new JobHoldUntilSupported("third-shift", null); /** - * Creates a <code>JobHoldUntilSupported</code> object with the + * Creates a <code>JobHoldUntilSupported</code> object with the * given value and locale. * * @param value the value for this syntax @@ -115,7 +116,7 @@ public final class JobHoldUntilSupported extends TextSyntax * * @return The class <code>JobHoldUntilSupported</code> itself. */ - public Class getCategory() + public Class<? extends Attribute> getCategory() { return JobHoldUntilSupported.class; } diff --git a/gnu/javax/print/ipp/attribute/supported/JobSheetsSupported.java b/gnu/javax/print/ipp/attribute/supported/JobSheetsSupported.java index 4051e2420..8f6f21c58 100644 --- a/gnu/javax/print/ipp/attribute/supported/JobSheetsSupported.java +++ b/gnu/javax/print/ipp/attribute/supported/JobSheetsSupported.java @@ -1,4 +1,4 @@ -/* JobSheetsSupported.java -- +/* JobSheetsSupported.java -- Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -53,26 +53,26 @@ import javax.print.attribute.standard.JobSheets; /** * JobSheetsSupported attribute provides the supported values * of the job-sheets attribute. - * + * * @author Wolfgang Baer (WBaer@gmx.de) */ -public final class JobSheetsSupported extends TextSyntax +public final class JobSheetsSupported extends TextSyntax implements SupportedValuesAttribute { - //a keyword/name based attribute in IPP + //a keyword/name based attribute in IPP // can be extended by administrators // standard values are predefined - + /** No job sheet is the default */ - public static final JobSheetsDefault NONE = + public static final JobSheetsDefault NONE = new JobSheetsDefault("none", Locale.getDefault()); - + /** A job sheet is the default */ - public static final JobSheetsDefault STANDARD = + public static final JobSheetsDefault STANDARD = new JobSheetsDefault("standard", Locale.getDefault()); - + /** - * Creates a <code>JobSheetsSupported</code> object with the + * Creates a <code>JobSheetsSupported</code> object with the * given value and locale. * * @param value the value for this syntax @@ -85,13 +85,13 @@ public final class JobSheetsSupported extends TextSyntax { super(value, locale); } - + /** * Returns category of this class. * * @return The class <code>JobSheetsSupported</code> itself. */ - public Class getCategory() + public Class<? extends Attribute> getCategory() { return JobSheetsSupported.class; } @@ -105,46 +105,44 @@ public final class JobSheetsSupported extends TextSyntax { return "job-sheets-supported"; } - + /** * Returns the equally enum of the standard attribute class * of this SupportedValuesAttribute enum. * <p>May return null if no value exists in JPS API.</p> - * + * * @return The enum of the standard attribute class. */ - public JobSheets getAssociatedAttribute() + public JobSheets getAssociatedAttribute() { if (this.equals(JobSheetsDefault.NONE)) return JobSheets.NONE; if (this.equals(JobSheetsDefault.STANDARD)) return JobSheets.STANDARD; - + return null; } - + /** * Constructs an array from a set of -supported attributes. * @param set set to process * @return The constructed array. - * + * * @see #getAssociatedAttribute() */ - public static JobSheets[] getAssociatedAttributeArray(Set set) + public static JobSheets[] + getAssociatedAttributeArray(Set<JobSheetsSupported> set) { - JobSheetsSupported tmp; - ArrayList result = new ArrayList(); - Iterator it = set.iterator(); + ArrayList<JobSheets> result = new ArrayList<JobSheets>(); int j = 0; - while (it.hasNext()) + for (JobSheetsSupported tmp : set) { - tmp = (JobSheetsSupported) it.next(); - Attribute att = tmp.getAssociatedAttribute(); + JobSheets att = tmp.getAssociatedAttribute(); if (att != null) result.add(att); j++; - } - return (JobSheets[]) result.toArray(new JobSheets[result.size()]); + } + return result.toArray(new JobSheets[result.size()]); } - + } diff --git a/gnu/javax/print/ipp/attribute/supported/MediaSupported.java b/gnu/javax/print/ipp/attribute/supported/MediaSupported.java index 3f10c06b5..f0b02d3bc 100644 --- a/gnu/javax/print/ipp/attribute/supported/MediaSupported.java +++ b/gnu/javax/print/ipp/attribute/supported/MediaSupported.java @@ -1,4 +1,4 @@ -/* MediaSupported.java -- +/* MediaSupported.java -- Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -45,6 +45,7 @@ import java.util.Iterator; import java.util.Locale; import java.util.Set; +import javax.print.attribute.Attribute; import javax.print.attribute.SupportedValuesAttribute; import javax.print.attribute.TextSyntax; import javax.print.attribute.standard.Media; @@ -52,15 +53,15 @@ import javax.print.attribute.standard.Media; /** * MediaSupported attribute provides the keyword values * of the media types supported by the printer object. - * + * * @author Wolfgang Baer (WBaer@gmx.de) */ -public final class MediaSupported extends TextSyntax +public final class MediaSupported extends TextSyntax implements SupportedValuesAttribute { /** - * Creates a <code>MediaSupported</code> object with the + * Creates a <code>MediaSupported</code> object with the * given value and locale. * * @param value the value for this syntax @@ -79,7 +80,7 @@ public final class MediaSupported extends TextSyntax * * @return The class <code>MediaSupported</code> itself. */ - public Class getCategory() + public Class<? extends Attribute> getCategory() { return MediaSupported.class; } @@ -93,26 +94,23 @@ public final class MediaSupported extends TextSyntax { return "media-supported"; } - + /** * Constructs an array from a set of -supported attributes. * @param set set to process * @return The constructed array. */ - public static Media[] getAssociatedAttributeArray(Set set) + public static Media[] getAssociatedAttributeArray(Set<MediaSupported> set) { - MediaSupported tmp; Media tmp2; - ArrayList result = new ArrayList(); - Iterator it = set.iterator(); - while (it.hasNext()) + ArrayList<Media> result = new ArrayList<Media>(); + for (MediaSupported tmp : set) { - tmp = (MediaSupported) it.next(); tmp2 = (Media) IppUtilities.getEnumAttribute("media", tmp.toString()); if (tmp2 != null) result.add(tmp2); - } - return (Media[]) result.toArray(new Media[result.size()]); + } + return result.toArray(new Media[result.size()]); } } diff --git a/gnu/javax/print/ipp/attribute/supported/MultipleDocumentHandlingSupported.java b/gnu/javax/print/ipp/attribute/supported/MultipleDocumentHandlingSupported.java index 891a99fae..e4c6a1a62 100644 --- a/gnu/javax/print/ipp/attribute/supported/MultipleDocumentHandlingSupported.java +++ b/gnu/javax/print/ipp/attribute/supported/MultipleDocumentHandlingSupported.java @@ -42,6 +42,7 @@ import gnu.javax.print.ipp.IppUtilities; import java.util.Iterator; import java.util.Set; +import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.SupportedValuesAttribute; import javax.print.attribute.standard.MultipleDocumentHandling; @@ -50,49 +51,49 @@ import javax.print.attribute.standard.MultipleDocumentHandling; /** * <code>MultipleDocumentHandlingSupported</code> provides the * supported values for the MultipleDocumentHandling attribute. - * + * * @author Wolfgang Baer (WBaer@gmx.de) */ public final class MultipleDocumentHandlingSupported extends EnumSyntax implements SupportedValuesAttribute { - + //a keyword based attribute in IPP - int values just starting at 0 - - /** - * Supports only multiple documents treated as a single document. This + + /** + * Supports only multiple documents treated as a single document. This * applies to attributes which specify treatment of multiple document jobs. */ public static final MultipleDocumentHandlingSupported SINGLE_DOCUMENT = new MultipleDocumentHandlingSupported(0); - + /** Supports multiple documents as uncollated copies */ public static final MultipleDocumentHandlingSupported SEPARATE_DOCUMENTS_UNCOLLATED_COPIES = new MultipleDocumentHandlingSupported(1); - + /** Supports multiple documents as collated copies */ public static final MultipleDocumentHandlingSupported SEPARATE_DOCUMENTS_COLLATED_COPIES = new MultipleDocumentHandlingSupported(2); - - /** + + /** * Supports multiple documents where every single document starts - * with a new sheet. + * with a new sheet. */ public static final MultipleDocumentHandlingSupported SINGLE_DOCUMENT_NEW_SHEET = new MultipleDocumentHandlingSupported(3); - private static final String[] stringTable = { "single-document", + private static final String[] stringTable = { "single-document", "separate-documents-uncollated-copies", "separate-documents-collated-copies", "single-document-new-sheet" }; - - private static final MultipleDocumentHandlingSupported[] enumValueTable = + + private static final MultipleDocumentHandlingSupported[] enumValueTable = { SINGLE_DOCUMENT, SEPARATE_DOCUMENTS_UNCOLLATED_COPIES, SEPARATE_DOCUMENTS_COLLATED_COPIES, SINGLE_DOCUMENT_NEW_SHEET}; - + /** * Constructs a <code>MultipleDocumentHandlingSupported</code> object. - * + * * @param value the enum value */ protected MultipleDocumentHandlingSupported(int value) @@ -105,7 +106,7 @@ public final class MultipleDocumentHandlingSupported extends EnumSyntax * * @return The class <code>MultipleDocumentHandlingSupported</code> itself. */ - public Class getCategory() + public Class<? extends Attribute> getCategory() { return MultipleDocumentHandlingSupported.class; } @@ -119,7 +120,7 @@ public final class MultipleDocumentHandlingSupported extends EnumSyntax { return "multiple-document-handling-supported"; } - + /** * Returns a table with the enumeration values represented as strings * for this object. @@ -140,38 +141,36 @@ public final class MultipleDocumentHandlingSupported extends EnumSyntax { return enumValueTable; } - + /** * Returns the equally enum of the standard attribute class * of this SupportedValuesAttribute enum. - * + * * @return The enum of the standard attribute class. */ - public MultipleDocumentHandling getAssociatedAttribute() + public MultipleDocumentHandling getAssociatedAttribute() { return (MultipleDocumentHandling) IppUtilities.getEnumAttribute( "multiple-document-handling", new Integer(getValue())); } - + /** * Constructs an array from a set of -supported attributes. * @param set set to process * @return The constructed array. - * + * * @see #getAssociatedAttribute() */ - public static MultipleDocumentHandling[] getAssociatedAttributeArray(Set set) + public static MultipleDocumentHandling[] + getAssociatedAttributeArray(Set<MultipleDocumentHandlingSupported> set) { - MultipleDocumentHandlingSupported tmp; - MultipleDocumentHandling[] result = new MultipleDocumentHandling[set.size()]; - Iterator it = set.iterator(); + MultipleDocumentHandling[] result = new MultipleDocumentHandling[set.size()]; int j = 0; - while (it.hasNext()) + for (MultipleDocumentHandlingSupported tmp : set) { - tmp = (MultipleDocumentHandlingSupported) it.next(); result[j] = tmp.getAssociatedAttribute(); j++; - } + } return result; } } diff --git a/gnu/javax/print/ipp/attribute/supported/MultipleDocumentJobsSupported.java b/gnu/javax/print/ipp/attribute/supported/MultipleDocumentJobsSupported.java index 387e6b513..1b2998456 100644 --- a/gnu/javax/print/ipp/attribute/supported/MultipleDocumentJobsSupported.java +++ b/gnu/javax/print/ipp/attribute/supported/MultipleDocumentJobsSupported.java @@ -1,4 +1,4 @@ -/* MultipleDocumentJobsSupported.java -- +/* MultipleDocumentJobsSupported.java -- Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -38,35 +38,36 @@ exception statement from your version. */ package gnu.javax.print.ipp.attribute.supported; +import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.SupportedValuesAttribute; /** * <code>MultipleDocumentJobsSupported</code> specifies if a printer * supported multiple documents in one job. - * + * * @author Wolfgang Baer (WBaer@gmx.de) */ -public class MultipleDocumentJobsSupported extends EnumSyntax +public class MultipleDocumentJobsSupported extends EnumSyntax implements SupportedValuesAttribute { - + /** Multiple documents per job are not supported. */ - public static final MultipleDocumentJobsSupported NOT_SUPPORTED = + public static final MultipleDocumentJobsSupported NOT_SUPPORTED = new MultipleDocumentJobsSupported(0); - + /** Multiple documents per job are supported. */ - public static final MultipleDocumentJobsSupported SUPPORTED = + public static final MultipleDocumentJobsSupported SUPPORTED = new MultipleDocumentJobsSupported(1); private static final String[] stringTable = { "not-supported", "supported" }; - - private static final MultipleDocumentJobsSupported[] enumValueTable = + + private static final MultipleDocumentJobsSupported[] enumValueTable = { NOT_SUPPORTED, SUPPORTED }; - + /** * Constructs a <code>MultipleDocumentJobsSupported</code> object. - * + * * @param value the enum value */ protected MultipleDocumentJobsSupported(int value) @@ -79,7 +80,7 @@ public class MultipleDocumentJobsSupported extends EnumSyntax * * @return The class <code>MultipleDocumentJobsSupported</code> itself. */ - public Class getCategory() + public Class<? extends Attribute> getCategory() { return MultipleDocumentJobsSupported.class; } @@ -93,7 +94,7 @@ public class MultipleDocumentJobsSupported extends EnumSyntax { return "multiple-document-jobs-supported"; } - + /** * Returns a table with the enumeration values represented as strings * for this object. diff --git a/gnu/javax/print/ipp/attribute/supported/OperationsSupported.java b/gnu/javax/print/ipp/attribute/supported/OperationsSupported.java index 81e2e34cd..a059c89a5 100644 --- a/gnu/javax/print/ipp/attribute/supported/OperationsSupported.java +++ b/gnu/javax/print/ipp/attribute/supported/OperationsSupported.java @@ -1,4 +1,4 @@ -/* OperationsSupported.java -- +/* OperationsSupported.java -- Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -38,6 +38,7 @@ exception statement from your version. */ package gnu.javax.print.ipp.attribute.supported; +import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.SupportedValuesAttribute; @@ -45,12 +46,12 @@ import javax.print.attribute.SupportedValuesAttribute; * <code>OperationsSupported</code> specifies the enums of the operations * supported by a given printer or job object. The attribute is further * specified in RFC 2911 section 4.4.15. - * + * * @author Wolfgang Baer (WBaer@gmx.de) */ -public final class OperationsSupported extends EnumSyntax +public final class OperationsSupported extends EnumSyntax implements SupportedValuesAttribute -{ +{ /* * Value Operation Name ----------------- ------------------------------------- @@ -76,104 +77,104 @@ public final class OperationsSupported extends EnumSyntax 0x0013-0x3FFF reserved for future IETF standards track operations 0x4000-0x8FFF reserved for vendor extensions */ - + // standard ipp 1.1 operations - /** + /** * Operation to print a job in one request/response. */ - public static final OperationsSupported PRINT_JOB = + public static final OperationsSupported PRINT_JOB = new OperationsSupported(0x02); - + /** Operation to print a document from an URI */ - public static final OperationsSupported PRINT_URI = + public static final OperationsSupported PRINT_URI = new OperationsSupported(0x03); - + /** Operation to validate a job before submission. */ - public static final OperationsSupported VALIDATE_JOB = + public static final OperationsSupported VALIDATE_JOB = new OperationsSupported(0x04); - - /** - * Operation to create an initial job for use with multiple document per job. + + /** + * Operation to create an initial job for use with multiple document per job. */ - public static final OperationsSupported CREATE_JOB = + public static final OperationsSupported CREATE_JOB = new OperationsSupported(0x05); - - /** - * Operation to send a document to a multidoc job created via CREATE_JOB + + /** + * Operation to send a document to a multidoc job created via CREATE_JOB */ - public static final OperationsSupported SEND_DOCUMENT = + public static final OperationsSupported SEND_DOCUMENT = new OperationsSupported(0x06); - - /** - * Operation to send a document uri to a multidoc job created - * via CREATE_JOB. The document accessible from this URI will be printed. + + /** + * Operation to send a document uri to a multidoc job created + * via CREATE_JOB. The document accessible from this URI will be printed. */ - public static final OperationsSupported SEND_URI = + public static final OperationsSupported SEND_URI = new OperationsSupported(0x07); - + /** Operation to cancel a job by its ID or name. */ - public static final OperationsSupported CANCEL_JOB = + public static final OperationsSupported CANCEL_JOB = new OperationsSupported(0x08); - + /** Operation to get job attributes of a current job. */ - public static final OperationsSupported GET_JOB_ATTRIBUTES = + public static final OperationsSupported GET_JOB_ATTRIBUTES = new OperationsSupported(0x09); - + /** Operation to pause a printer. */ - public static final OperationsSupported PAUSE_PRINTER = + public static final OperationsSupported PAUSE_PRINTER = new OperationsSupported(0x10); - + /** Operation to get all currently queued or processed jobs. */ - public static final OperationsSupported GET_JOBS = + public static final OperationsSupported GET_JOBS = new OperationsSupported(0x0A); - + /** Operation to get the attributes of a printer. */ - public static final OperationsSupported GET_PRINTER_ATTRIBUTES = + public static final OperationsSupported GET_PRINTER_ATTRIBUTES = new OperationsSupported(0x0B); - + /** Operation to put a job on hold by its ID or name. */ - public static final OperationsSupported HOLD_JOB = + public static final OperationsSupported HOLD_JOB = new OperationsSupported(0x0C); - + /** Operation to release a job by its ID or name. */ - public static final OperationsSupported RELEASE_JOB = + public static final OperationsSupported RELEASE_JOB = new OperationsSupported(0x0D); - + /** Operation to restart a job by its ID or name. */ - public static final OperationsSupported RESTART_JOB = + public static final OperationsSupported RESTART_JOB = new OperationsSupported(0x0E); - + /** Not yet an operation - reserved for futher use. */ - public static final OperationsSupported RESERVED = + public static final OperationsSupported RESERVED = new OperationsSupported(0x0F); - + /** Operation to resume a printer. */ - public static final OperationsSupported RESUME_PRINTER = + public static final OperationsSupported RESUME_PRINTER = new OperationsSupported(0x11); - + /** Operation to remove all jobs from a printer regardless of state. */ - public static final OperationsSupported PURGE_JOBS = + public static final OperationsSupported PURGE_JOBS = new OperationsSupported(0x12); - private static final String[] stringTable = { "print-job", "print-uri", + private static final String[] stringTable = { "print-job", "print-uri", "validate-job", "create-job", - "send-document", "send-uri", + "send-document", "send-uri", "cancel-job", "get-job-attributes", - "pause-printer", "get-jobs", + "pause-printer", "get-jobs", "get-printer-attributes", "hold-job", "release-job", "restart-job", "reserved", "resume-printer", "purge-job"}; - - private static final OperationsSupported[] enumValueTable = + + private static final OperationsSupported[] enumValueTable = { PRINT_JOB, PRINT_URI, VALIDATE_JOB, CREATE_JOB, SEND_DOCUMENT, SEND_URI, CANCEL_JOB, GET_JOB_ATTRIBUTES, PAUSE_PRINTER, GET_JOBS, GET_PRINTER_ATTRIBUTES, HOLD_JOB, RELEASE_JOB, RESTART_JOB, RESERVED, RESUME_PRINTER, PURGE_JOBS}; - - + + /** * Constructs a <code>OperationsSupported</code> object. - * + * * @param value the enum value */ protected OperationsSupported(int value) @@ -186,7 +187,7 @@ public final class OperationsSupported extends EnumSyntax * * @return The class <code>OperationsSupported</code> itself. */ - public Class getCategory() + public Class<? extends Attribute> getCategory() { return OperationsSupported.class; } @@ -200,7 +201,7 @@ public final class OperationsSupported extends EnumSyntax { return "operations-supported"; } - + /** * Returns a table with the enumeration values represented as strings * for this object. @@ -226,5 +227,5 @@ public final class OperationsSupported extends EnumSyntax protected int getOffset() { return 2; - } + } } diff --git a/gnu/javax/print/ipp/attribute/supported/OrientationRequestedSupported.java b/gnu/javax/print/ipp/attribute/supported/OrientationRequestedSupported.java index 528c758ac..4e5da3182 100644 --- a/gnu/javax/print/ipp/attribute/supported/OrientationRequestedSupported.java +++ b/gnu/javax/print/ipp/attribute/supported/OrientationRequestedSupported.java @@ -42,33 +42,34 @@ import gnu.javax.print.ipp.IppUtilities; import java.util.Iterator; import java.util.Set; +import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.SupportedValuesAttribute; import javax.print.attribute.standard.OrientationRequested; /** - * The <code>OrientationRequestedSupported</code> attribute provides + * The <code>OrientationRequestedSupported</code> attribute provides * the supported values for the job attribute orientation-requested. - * + * * @author Wolfgang Baer (WBaer@gmx.de) */ public final class OrientationRequestedSupported extends EnumSyntax implements SupportedValuesAttribute { - + /** Orientation as portrait. */ public static final OrientationRequestedSupported PORTRAIT = new OrientationRequestedSupported(3); - + /** Orientation as landscape. */ public static final OrientationRequestedSupported LANDSCAPE = new OrientationRequestedSupported(4); - + /** Orientation as reversed landscape. */ public static final OrientationRequestedSupported REVERSE_LANDSCAPE = new OrientationRequestedSupported(5); - + /** Orientation as reversed portrait. */ public static final OrientationRequestedSupported REVERSE_PORTRAIT = new OrientationRequestedSupported(6); @@ -77,14 +78,14 @@ public final class OrientationRequestedSupported extends EnumSyntax private static final String[] stringTable = { "portrait", "landscape", "reverse-landscape", "reverse-portrait" }; - - private static final OrientationRequestedSupported[] - enumValueTable = { PORTRAIT, LANDSCAPE, + + private static final OrientationRequestedSupported[] + enumValueTable = { PORTRAIT, LANDSCAPE, REVERSE_LANDSCAPE, REVERSE_PORTRAIT }; - + /** * Constructs a <code>OrientationRequestedSupported</code> object. - * + * * @param value the value */ protected OrientationRequestedSupported(int value) @@ -97,7 +98,7 @@ public final class OrientationRequestedSupported extends EnumSyntax * * @return The class <code>OrientationRequestedSupported</code> itself. */ - public Class getCategory() + public Class<? extends Attribute> getCategory() { return OrientationRequestedSupported.class; } @@ -111,7 +112,7 @@ public final class OrientationRequestedSupported extends EnumSyntax { return "orientation-requested-supported"; } - + /** * Returns a table with the enumeration values represented as strings * for this object. @@ -132,7 +133,7 @@ public final class OrientationRequestedSupported extends EnumSyntax { return enumValueTable; } - + /** * Returns the lowest used value by the enumerations of this class. * . @@ -142,38 +143,36 @@ public final class OrientationRequestedSupported extends EnumSyntax { return 3; } - + /** * Returns the equally enum of the standard attribute class * of this SupportedValuesAttribute enum. - * + * * @return The enum of the standard attribute class. */ - public OrientationRequested getAssociatedAttribute() + public OrientationRequested getAssociatedAttribute() { return (OrientationRequested) IppUtilities.getEnumAttribute( "orientation-requested", new Integer(getValue())); } - + /** * Constructs an array from a set of -supported attributes. * @param set set to process * @return The constructed array. - * + * * @see #getAssociatedAttribute() */ - public static OrientationRequested[] getAssociatedAttributeArray(Set set) + public static OrientationRequested[] + getAssociatedAttributeArray(Set<OrientationRequestedSupported> set) { - OrientationRequestedSupported tmp; - OrientationRequested[] result = new OrientationRequested[set.size()]; - Iterator it = set.iterator(); + OrientationRequested[] result = new OrientationRequested[set.size()]; int j = 0; - while (it.hasNext()) + for (OrientationRequestedSupported tmp : set) { - tmp = (OrientationRequestedSupported) it.next(); result[j] = tmp.getAssociatedAttribute(); j++; - } + } return result; } } diff --git a/gnu/javax/print/ipp/attribute/supported/PageRangesSupported.java b/gnu/javax/print/ipp/attribute/supported/PageRangesSupported.java index d39a37fd7..c58f76748 100644 --- a/gnu/javax/print/ipp/attribute/supported/PageRangesSupported.java +++ b/gnu/javax/print/ipp/attribute/supported/PageRangesSupported.java @@ -37,36 +37,36 @@ exception statement from your version. */ package gnu.javax.print.ipp.attribute.supported; +import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.SupportedValuesAttribute; - /** * <code>PageRangesSupported</code> is a boolean typed * attribute indicating (as EnumSyntax) if page ranges * are supported. - * + * * @author Wolfgang Baer (WBaer@gmx.de) */ public final class PageRangesSupported extends EnumSyntax implements SupportedValuesAttribute { /** Page ranges are not supported. */ - public static final PageRangesSupported NOT_SUPPORTED = + public static final PageRangesSupported NOT_SUPPORTED = new PageRangesSupported(0); - + /** Page ranges are supported. */ - public static final PageRangesSupported SUPPORTED = + public static final PageRangesSupported SUPPORTED = new PageRangesSupported(1); private static final String[] stringTable = { "not-supported", "supported" }; - + private static final PageRangesSupported[] enumValueTable = { NOT_SUPPORTED, SUPPORTED }; - + /** * Constructs a <code>PageRangesSupported</code> object. - * + * * @param value the enum value */ protected PageRangesSupported(int value) @@ -79,7 +79,7 @@ public final class PageRangesSupported extends EnumSyntax * * @return The class <code>PageRangesSupported</code> itself. */ - public Class getCategory() + public Class<? extends Attribute> getCategory() { return PageRangesSupported.class; } @@ -93,7 +93,7 @@ public final class PageRangesSupported extends EnumSyntax { return "page-ranges-supported"; } - + /** * Returns a table with the enumeration values represented as strings * for this object. diff --git a/gnu/javax/print/ipp/attribute/supported/PrintQualitySupported.java b/gnu/javax/print/ipp/attribute/supported/PrintQualitySupported.java index b0f7e8673..470a869ac 100644 --- a/gnu/javax/print/ipp/attribute/supported/PrintQualitySupported.java +++ b/gnu/javax/print/ipp/attribute/supported/PrintQualitySupported.java @@ -42,6 +42,7 @@ import gnu.javax.print.ipp.IppUtilities; import java.util.Iterator; import java.util.Set; +import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.SupportedValuesAttribute; import javax.print.attribute.standard.PrintQuality; @@ -50,33 +51,33 @@ import javax.print.attribute.standard.PrintQuality; /** * <code>PrintQualitySupported</code> provides the * supported values for the print-quality attribute. - * + * * @author Wolfgang Baer (WBaer@gmx.de) */ public final class PrintQualitySupported extends EnumSyntax implements SupportedValuesAttribute { /** Draft quality of the printer. */ - public static final PrintQualitySupported DRAFT = + public static final PrintQualitySupported DRAFT = new PrintQualitySupported(3); - + /** Normal quality of the printer. */ - public static final PrintQualitySupported NORMAL = + public static final PrintQualitySupported NORMAL = new PrintQualitySupported(4); - + /** High quality of the printer. */ - public static final PrintQualitySupported HIGH = + public static final PrintQualitySupported HIGH = new PrintQualitySupported(5); private static final String[] stringTable = { "draft", "normal", "high" }; - - private static final PrintQualitySupported[] enumValueTable = { DRAFT, - NORMAL, + + private static final PrintQualitySupported[] enumValueTable = { DRAFT, + NORMAL, HIGH }; - + /** * Constructs a <code>PrintQualitySupported</code> object. - * + * * @param value the value of the enum */ protected PrintQualitySupported(int value) @@ -89,7 +90,7 @@ public final class PrintQualitySupported extends EnumSyntax * * @return The class <code>PrintQualitySupported</code> itself. */ - public Class getCategory() + public Class<? extends Attribute> getCategory() { return PrintQualitySupported.class; } @@ -103,7 +104,7 @@ public final class PrintQualitySupported extends EnumSyntax { return "print-quality-supported"; } - + /** * Returns a table with the enumeration values represented as strings * for this object. @@ -124,7 +125,7 @@ public final class PrintQualitySupported extends EnumSyntax { return enumValueTable; } - + /** * Returns the lowest used value by the enumerations of this class. * . @@ -134,38 +135,35 @@ public final class PrintQualitySupported extends EnumSyntax { return 3; } - + /** * Returns the equally enum of the standard attribute class * of this SupportedValuesAttribute enum. - * + * * @return The enum of the standard attribute class. */ - public PrintQuality getAssociatedAttribute() + public PrintQuality getAssociatedAttribute() { return (PrintQuality) IppUtilities.getEnumAttribute( "print-quality", new Integer(getValue())); } - + /** * Constructs an array from a set of -supported attributes. * @param set set to process * @return The constructed array. - * + * * @see #getAssociatedAttribute() */ - public static PrintQuality[] getAssociatedAttributeArray(Set set) + public static PrintQuality[] getAssociatedAttributeArray(Set<PrintQualitySupported> set) { - PrintQualitySupported tmp; - PrintQuality[] result = new PrintQuality[set.size()]; - Iterator it = set.iterator(); + PrintQuality[] result = new PrintQuality[set.size()]; int j = 0; - while (it.hasNext()) + for (PrintQualitySupported tmp : set) { - tmp = (PrintQualitySupported) it.next(); result[j] = tmp.getAssociatedAttribute(); j++; - } + } return result; } } diff --git a/gnu/javax/print/ipp/attribute/supported/PrinterResolutionSupported.java b/gnu/javax/print/ipp/attribute/supported/PrinterResolutionSupported.java index e3266c422..0c1210d64 100644 --- a/gnu/javax/print/ipp/attribute/supported/PrinterResolutionSupported.java +++ b/gnu/javax/print/ipp/attribute/supported/PrinterResolutionSupported.java @@ -40,23 +40,24 @@ package gnu.javax.print.ipp.attribute.supported; import java.util.Iterator; import java.util.Set; +import javax.print.attribute.Attribute; import javax.print.attribute.ResolutionSyntax; import javax.print.attribute.SupportedValuesAttribute; import javax.print.attribute.standard.PrinterResolution; /** - * The <code>PrinterResolutionSupported</code> attribute provides + * The <code>PrinterResolutionSupported</code> attribute provides * the supported values for the job attribute printer-resolution. - * + * * @author Wolfgang Baer (WBaer@gmx.de) */ public final class PrinterResolutionSupported extends ResolutionSyntax implements SupportedValuesAttribute { - + /** - * Creates a <code>PrinterResolutionSupported</code> object with the + * Creates a <code>PrinterResolutionSupported</code> object with the * given arguments. * * @param crossFeedResolution the cross feed resolution @@ -65,25 +66,25 @@ public final class PrinterResolutionSupported extends ResolutionSyntax * * @exception IllegalArgumentException if preconditions fail */ - public PrinterResolutionSupported(int crossFeedResolution, + public PrinterResolutionSupported(int crossFeedResolution, int feedResolution, int units) { super(crossFeedResolution, feedResolution, units); } - + /** * Tests if the given object is equal to this object. * * @param obj the object to test * - * @return <code>true</code> if both objects are equal, + * @return <code>true</code> if both objects are equal, * <code>false</code> otherwise. */ public boolean equals(Object obj) { if(! (obj instanceof PrinterResolutionSupported)) return false; - + return super.equals(obj); } @@ -92,7 +93,7 @@ public final class PrinterResolutionSupported extends ResolutionSyntax * * @return The class <code>PrinterResolutionSupported</code> itself. */ - public Class getCategory() + public Class<? extends Attribute> getCategory() { return PrinterResolutionSupported.class; } @@ -106,38 +107,36 @@ public final class PrinterResolutionSupported extends ResolutionSyntax { return "printer-resolution-supported"; } - + /** * Returns the equally enum of the standard attribute class * of this SupportedValuesAttribute enum. - * + * * @return The enum of the standard attribute class. */ - public PrinterResolution getAssociatedAttribute() + public PrinterResolution getAssociatedAttribute() { - return new PrinterResolution(getCrossFeedResolutionDphi(), + return new PrinterResolution(getCrossFeedResolutionDphi(), getFeedResolutionDphi(), 1); } - + /** * Constructs an array from a set of -supported attributes. * @param set set to process * @return The constructed array. - * + * * @see #getAssociatedAttribute() */ - public static PrinterResolution[] getAssociatedAttributeArray(Set set) + public static PrinterResolution[] + getAssociatedAttributeArray(Set<PrinterResolutionSupported> set) { - PrinterResolutionSupported tmp; - PrinterResolution[] result = new PrinterResolution[set.size()]; - Iterator it = set.iterator(); + PrinterResolution[] result = new PrinterResolution[set.size()]; int j = 0; - while (it.hasNext()) + for (PrinterResolutionSupported tmp : set) { - tmp = (PrinterResolutionSupported) it.next(); result[j] = tmp.getAssociatedAttribute(); j++; - } + } return result; } } diff --git a/gnu/javax/print/ipp/attribute/supported/PrinterUriSupported.java b/gnu/javax/print/ipp/attribute/supported/PrinterUriSupported.java index ce3e2a7d6..0eed39c6c 100644 --- a/gnu/javax/print/ipp/attribute/supported/PrinterUriSupported.java +++ b/gnu/javax/print/ipp/attribute/supported/PrinterUriSupported.java @@ -1,4 +1,4 @@ -/* PrinterUriSupported.java -- +/* PrinterUriSupported.java -- Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -40,6 +40,7 @@ package gnu.javax.print.ipp.attribute.supported; import java.net.URI; +import javax.print.attribute.Attribute; import javax.print.attribute.SupportedValuesAttribute; import javax.print.attribute.URISyntax; @@ -47,10 +48,10 @@ import javax.print.attribute.URISyntax; * PrinterUriSupported attribute as described in RFC 2911 section * 4.4.1 contains one of the URIs the printer supported for * job processing (e.g. one with authentication). - * + * * @author Wolfgang Baer (WBaer@gmx.de) */ -public final class PrinterUriSupported extends URISyntax +public final class PrinterUriSupported extends URISyntax implements SupportedValuesAttribute { @@ -70,7 +71,7 @@ public final class PrinterUriSupported extends URISyntax * * @return The class <code>PrinterUriSupported</code> itself. */ - public Class getCategory() + public Class<? extends Attribute> getCategory() { return PrinterUriSupported.class; } diff --git a/gnu/javax/print/ipp/attribute/supported/SidesSupported.java b/gnu/javax/print/ipp/attribute/supported/SidesSupported.java index 5110e9593..eff82c143 100644 --- a/gnu/javax/print/ipp/attribute/supported/SidesSupported.java +++ b/gnu/javax/print/ipp/attribute/supported/SidesSupported.java @@ -37,6 +37,7 @@ exception statement from your version. */ package gnu.javax.print.ipp.attribute.supported; +import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.SupportedValuesAttribute; @@ -44,45 +45,45 @@ import javax.print.attribute.SupportedValuesAttribute; /** * <code>SidesSupported</code> provides the * supported values for the sides attribute. - * + * * @author Wolfgang Baer (WBaer@gmx.de) */ public final class SidesSupported extends EnumSyntax implements SupportedValuesAttribute { - + /** Specifies that each page should be printed on one sheet. */ public static final SidesSupported ONE_SIDED = new SidesSupported(0); - - /** - * Specifies that two following pages should be printed on the + + /** + * Specifies that two following pages should be printed on the * front and back of one sheet for binding on the long edge. */ - public static final SidesSupported TWO_SIDED_LONG_EDGE = + public static final SidesSupported TWO_SIDED_LONG_EDGE = new SidesSupported(1); - - /** - * Specifies that two following pages should be printed on the + + /** + * Specifies that two following pages should be printed on the * front and back of one sheet for binding on the short edge. */ - public static final SidesSupported TWO_SIDED_SHORT_EDGE = + public static final SidesSupported TWO_SIDED_SHORT_EDGE = new SidesSupported(2); - + /** An alias constant for "two sided long edge". */ public static final SidesSupported DUPLEX = new SidesSupported(1); - + /** An alias constant for "two sided short edge". */ public static final SidesSupported TUMBLE = new SidesSupported(2); - private static final String[] stringTable = { "one-sided", + private static final String[] stringTable = { "one-sided", "two-sided-long-edge", "two-sided-short-edge" }; - - private static final SidesSupported[] - enumValueTable = { ONE_SIDED, TWO_SIDED_LONG_EDGE, + + private static final SidesSupported[] + enumValueTable = { ONE_SIDED, TWO_SIDED_LONG_EDGE, TWO_SIDED_SHORT_EDGE }; - - + + /** * Creates a <code>SidesSupported</code> object. * @@ -98,7 +99,7 @@ public final class SidesSupported extends EnumSyntax * * @return The class <code>SidesSupported</code> itself. */ - public Class getCategory() + public Class<? extends Attribute> getCategory() { return SidesSupported.class; } @@ -112,7 +113,7 @@ public final class SidesSupported extends EnumSyntax { return "sides-supported"; } - + /** * Returns a table with the enumeration values represented as strings * for this object. diff --git a/gnu/javax/print/ipp/attribute/supported/UriAuthenticationSupported.java b/gnu/javax/print/ipp/attribute/supported/UriAuthenticationSupported.java index 8deac7a2f..dc1a29f5c 100644 --- a/gnu/javax/print/ipp/attribute/supported/UriAuthenticationSupported.java +++ b/gnu/javax/print/ipp/attribute/supported/UriAuthenticationSupported.java @@ -1,4 +1,4 @@ -/* UriAuthenticationSupported.java -- +/* UriAuthenticationSupported.java -- Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -38,58 +38,59 @@ exception statement from your version. */ package gnu.javax.print.ipp.attribute.supported; +import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.SupportedValuesAttribute; /** * UriAuthenticationSupported attribute as described in RFC 2911 section - * 4.4.2 provides the keywords (implemented as EnumSyntax) which + * 4.4.2 provides the keywords (implemented as EnumSyntax) which * authentication methods are supported by the printer object. This * includes a value of none. - * + * * @author Wolfgang Baer (WBaer@gmx.de) */ -public final class UriAuthenticationSupported extends EnumSyntax +public final class UriAuthenticationSupported extends EnumSyntax implements SupportedValuesAttribute { - + // a keyword based attribute in IPP - int values just starting at 0 - + /** Supports no authentication - assumes anonymous process */ - public static final UriAuthenticationSupported NONE = + public static final UriAuthenticationSupported NONE = new UriAuthenticationSupported(0); - - /** + + /** * The authenticated user assumed is the value of the * "requesting-user-name" operation attribute supplied * with the operation. */ - public static final UriAuthenticationSupported REQUESTING_USER_NAME = + public static final UriAuthenticationSupported REQUESTING_USER_NAME = new UriAuthenticationSupported(1); - + /** Supports HTTP basic authentication (RFC 2617) */ - public static final UriAuthenticationSupported BASIC = + public static final UriAuthenticationSupported BASIC = new UriAuthenticationSupported(2); - + /** Supports HTTP digest authentication (RFC 2617) */ - public static final UriAuthenticationSupported DIGEST = + public static final UriAuthenticationSupported DIGEST = new UriAuthenticationSupported(3); - + /** Supports authentication through a client provided certificate */ - public static final UriAuthenticationSupported CERTIFICATE = + public static final UriAuthenticationSupported CERTIFICATE = new UriAuthenticationSupported(4); - - private static final String[] stringTable = { "none", - "requesting-user-name", - "basic", "digest", + + private static final String[] stringTable = { "none", + "requesting-user-name", + "basic", "digest", "certificate" }; - - private static final UriAuthenticationSupported[] enumValueTable = + + private static final UriAuthenticationSupported[] enumValueTable = { NONE, REQUESTING_USER_NAME, BASIC, DIGEST, CERTIFICATE }; /** * Constructs a <code>UriAuthenticationSupported</code> object. - * + * * @param value the enum value */ public UriAuthenticationSupported(int value) @@ -102,7 +103,7 @@ public final class UriAuthenticationSupported extends EnumSyntax * * @return The class <code>UriAuthenticationSupported</code> itself. */ - public Class getCategory() + public Class<? extends Attribute> getCategory() { return UriAuthenticationSupported.class; } @@ -116,7 +117,7 @@ public final class UriAuthenticationSupported extends EnumSyntax { return "uri-authentication-supported"; } - + /** * Returns a table with the enumeration values represented as strings * for this object. diff --git a/gnu/javax/print/ipp/attribute/supported/UriSecuritySupported.java b/gnu/javax/print/ipp/attribute/supported/UriSecuritySupported.java index 1d995184d..03396978f 100644 --- a/gnu/javax/print/ipp/attribute/supported/UriSecuritySupported.java +++ b/gnu/javax/print/ipp/attribute/supported/UriSecuritySupported.java @@ -1,4 +1,4 @@ -/* UriSecuritySupported.java -- +/* UriSecuritySupported.java -- Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -38,6 +38,7 @@ exception statement from your version. */ package gnu.javax.print.ipp.attribute.supported; +import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; import javax.print.attribute.SupportedValuesAttribute; @@ -46,35 +47,35 @@ import javax.print.attribute.SupportedValuesAttribute; * 4.4.3 provides the keywords (implemented as EnumSyntax) for * the security mechanisms supported by the corresponding uri's * supported (same place in setOf). - * + * * @author Wolfgang Baer (WBaer@gmx.de) */ -public final class UriSecuritySupported extends EnumSyntax +public final class UriSecuritySupported extends EnumSyntax implements SupportedValuesAttribute { - + // a keyword based attribute in IPP - int values just starting at 0 - + /** The URI has no secure communication */ - public static final UriSecuritySupported NONE = + public static final UriSecuritySupported NONE = new UriSecuritySupported(0); - + /** The URI has SSL3 communication */ - public static final UriSecuritySupported SSL3 = + public static final UriSecuritySupported SSL3 = new UriSecuritySupported(1); - + /** The URI has TLS (RFC 2246) communication */ - public static final UriSecuritySupported TLS = + public static final UriSecuritySupported TLS = new UriSecuritySupported(2); - + private static final String[] stringTable = { "none", "ssl3", "tls" }; - - private static final UriSecuritySupported[] enumValueTable = { NONE, + + private static final UriSecuritySupported[] enumValueTable = { NONE, SSL3, TLS }; /** * Constructs a <code>UriSecuritySupported</code> object. - * + * * @param value the enum value */ public UriSecuritySupported(int value) @@ -87,7 +88,7 @@ public final class UriSecuritySupported extends EnumSyntax * * @return The class <code>UriSecuritySupported</code> itself. */ - public Class getCategory() + public Class<? extends Attribute> getCategory() { return UriSecuritySupported.class; } @@ -101,7 +102,7 @@ public final class UriSecuritySupported extends EnumSyntax { return "uri-security-supported"; } - + /** * Returns a table with the enumeration values represented as strings * for this object. |