diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /libjava/classpath/gnu/javax/print/ipp/attribute | |
download | cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2 cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'libjava/classpath/gnu/javax/print/ipp/attribute')
58 files changed, 7138 insertions, 0 deletions
diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/CharsetSyntax.java b/libjava/classpath/gnu/javax/print/ipp/attribute/CharsetSyntax.java new file mode 100644 index 000000000..cd112f459 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/CharsetSyntax.java @@ -0,0 +1,115 @@ +/* CharsetSyntax.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute; + +import java.io.Serializable; + +/** + * <code>CharsetSyntax</code> is the abstract base class of all attribute + * classes which provide a charset (US-ASCII) string as value. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public abstract class CharsetSyntax implements Cloneable, Serializable +{ + private final String value; + + /** + * Creates a <code>CharsetSyntax</code> object with the given value + * and locale. + * + * @param value the value for this syntax + * + * @exception NullPointerException if value is null + */ + protected CharsetSyntax(String value) + { + if (value == null) + throw new NullPointerException("value may not be null"); + + this.value = value; + } + + /** + * Returns the value of this syntax object. + * + * @return The value. + */ + public String getValue() + { + return value; + } + + /** + * Returns the hashcode for this object. + * + * @return The hashcode. + */ + public int hashCode() + { + return value.hashCode(); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, false otherwise. + */ + public boolean equals(Object obj) + { + if (! (obj instanceof CharsetSyntax)) + return false; + + CharsetSyntax tmp = (CharsetSyntax) obj; + return value.equals(tmp.getValue()); + } + + /** + * Returns a string representing the object. The returned + * string is the underlying text value of this object. + * + * @return The string representation. + */ + public String toString() + { + return getValue(); + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/DefaultValueAttribute.java b/libjava/classpath/gnu/javax/print/ipp/attribute/DefaultValueAttribute.java new file mode 100644 index 000000000..cc40db22e --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/DefaultValueAttribute.java @@ -0,0 +1,59 @@ +/* DefaultValueAttribute.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute; + +import javax.print.attribute.Attribute; + +/** + * Marker interface for all attribute classes describing attributes + * providing default values. Often there exist a sequence of an + * attribute name like: Name - > Name-default -> Name-supported. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public interface DefaultValueAttribute extends Attribute +{ + /** + * Returns the equally enum of the standard attribute class + * of this SupportedValuesAttribute enum. + * + * @return The enum of the standard attribute class. + */ + public Attribute getAssociatedAttribute(); +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/DetailedStatusMessage.java b/libjava/classpath/gnu/javax/print/ipp/attribute/DetailedStatusMessage.java new file mode 100644 index 000000000..2d005a82e --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/DetailedStatusMessage.java @@ -0,0 +1,93 @@ +/* DetailedStatusMessage.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute; + +import java.util.Locale; + +import javax.print.attribute.Attribute; +import javax.print.attribute.TextSyntax; + +/** + * DetailedStatusMessage attribute as described in RFC 2911 section + * 3.1.6 Operation Response Status Codes and Status Message + * provides a short description of the status of the operation. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class DetailedStatusMessage extends TextSyntax + implements Attribute +{ + + /** + * Creates a <code>DetailedStatusMessage</code> object with the given value + * and locale. + * + * @param value the value for this syntax + * @param locale the locale to use, if <code>null</code> the default + * locale is used. + * + * @exception NullPointerException if value is null + */ + public DetailedStatusMessage(String value, Locale locale) + { + super(value, locale); + } + + /** + * Returns category of this class. + * + * @return The class <code>DetailedStatusMessage</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return DetailedStatusMessage.class; + } + + + /** + * Returns the name of this attribute. + * + * @return The name "detailed-status-message". + */ + public String getName() + { + return "detailed-status-message"; + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/DocumentAccessError.java b/libjava/classpath/gnu/javax/print/ipp/attribute/DocumentAccessError.java new file mode 100644 index 000000000..56b55ba76 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/DocumentAccessError.java @@ -0,0 +1,93 @@ +/* DocumentAccessError.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute; + +import java.util.Locale; + +import javax.print.attribute.Attribute; +import javax.print.attribute.TextSyntax; + +/** + * DocumentAccessError attribute as described in RFC 2911 section + * 3.1.6 Operation Response Status Codes and Status Message + * provides additional information for document access errors. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class DocumentAccessError extends TextSyntax + implements Attribute +{ + + /** + * Creates a <code>DocumentAccessError</code> object with the given value + * and locale. + * + * @param value the value for this syntax + * @param locale the locale to use, if <code>null</code> the default + * locale is used. + * + * @exception NullPointerException if value is null + */ + public DocumentAccessError(String value, Locale locale) + { + super(value, locale); + } + + /** + * Returns category of this class. + * + * @return The class <code>DocumentAccessError</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return DocumentAccessError.class; + } + + + /** + * Returns the name of this attribute. + * + * @return The name "document-access-error". + */ + public String getName() + { + return "document-access-error"; + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/NaturalLanguageSyntax.java b/libjava/classpath/gnu/javax/print/ipp/attribute/NaturalLanguageSyntax.java new file mode 100644 index 000000000..a648c8cec --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/NaturalLanguageSyntax.java @@ -0,0 +1,117 @@ +/* NaturalLanguageSyntax.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute; + +import java.io.Serializable; + +/** + * <code>NaturalLanguageSyntax</code> is the abstract base class of all + * attribute classes which provide a natural language (US-ASCII) + * string as value. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public abstract class NaturalLanguageSyntax + implements Cloneable, Serializable +{ + private final String value; + + /** + * Creates a <code>NaturalLanguageSyntax</code> object with the given value + * and locale. + * + * @param value the value for this syntax + * + * @exception NullPointerException if value is null + */ + protected NaturalLanguageSyntax(String value) + { + if (value == null) + throw new NullPointerException("value may not be null"); + + this.value = value; + } + + /** + * Returns the value of this syntax object. + * + * @return The value. + */ + public String getValue() + { + return value; + } + + /** + * Returns the hashcode for this object. + * + * @return The hashcode. + */ + public int hashCode() + { + return value.hashCode(); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, false otherwise. + */ + public boolean equals(Object obj) + { + if (! (obj instanceof NaturalLanguageSyntax)) + return false; + + NaturalLanguageSyntax tmp = (NaturalLanguageSyntax) obj; + return value.equals(tmp.getValue()); + } + + /** + * Returns a string representing the object. The returned + * string is the underlying text value of this object. + * + * @return The string representation. + */ + public String toString() + { + return getValue(); + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/RequestedAttributes.java b/libjava/classpath/gnu/javax/print/ipp/attribute/RequestedAttributes.java new file mode 100644 index 000000000..4c129f6d5 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/RequestedAttributes.java @@ -0,0 +1,132 @@ +/* RequestedAttributes.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute; + +import gnu.java.lang.CPStringBuilder; + +import java.util.ArrayList; +import java.util.List; + +import javax.print.attribute.Attribute; + +/** + * <code>RequestedAttributes</code> specifies the requested + * attributes in an IPP request operation. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class RequestedAttributes implements Attribute +{ + private ArrayList<String> attributes; + + /** + * Creates a <code>RequestedAttributes</code> object with + * the initial value. + * + * @param value the string for the ipp name + * + * @exception NullPointerException if value is null + */ + public RequestedAttributes(String value) + { + if (value == null) + throw new NullPointerException(); + + attributes = new ArrayList<String>(); + attributes.add(value); + } + + /** + * Adds the IPP name value to the set. + * + * @param value the string for the ipp name + */ + public void addValue(String value) + { + attributes.add(value); + } + + /** + * Returns the values. + * + * @return The values as list. + */ + public String[] getValues() + { + return attributes.toArray(new String[attributes.size()]); + } + + /** + * Returns category of this class. + * + * @return The class <code>DocumentFormat</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return RequestedAttributes.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "requested-attributes". + */ + public String getName() + { + return "requested-attributes"; + } + + /** + * Returns the string representation for this object. + * + * @return The string representation. + */ + public String toString() + { + CPStringBuilder b = new CPStringBuilder(); + + if (attributes.size() > 0) + b.append(attributes.get(0)); + + for (int i=1; i < attributes.size(); i++) + b.append(", " + attributes.get(i)); + + return b.toString(); + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/StatusMessage.java b/libjava/classpath/gnu/javax/print/ipp/attribute/StatusMessage.java new file mode 100644 index 000000000..0701008ef --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/StatusMessage.java @@ -0,0 +1,92 @@ +/* StatusMessage.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute; + +import java.util.Locale; + +import javax.print.attribute.Attribute; +import javax.print.attribute.TextSyntax; + +/** + * StatusMessage attribute as described in RFC 2911 section + * 3.1.6 Operation Response Status Codes and Status Message + * provides a short description of the status of the operation. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class StatusMessage extends TextSyntax implements Attribute +{ + + /** + * Creates a <code>StatusMessage</code> object with the given value + * and locale. + * + * @param value the value for this syntax + * @param locale the locale to use, if <code>null</code> the default + * locale is used. + * + * @exception NullPointerException if value is null + */ + public StatusMessage(String value, Locale locale) + { + super(value, locale); + } + + /** + * Returns category of this class. + * + * @return The class <code>StatusMessage</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return StatusMessage.class; + } + + + /** + * Returns the name of this attribute. + * + * @return The name "status-message". + */ + public String getName() + { + return "status-message"; + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/UnknownAttribute.java b/libjava/classpath/gnu/javax/print/ipp/attribute/UnknownAttribute.java new file mode 100644 index 000000000..a03beccbe --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/UnknownAttribute.java @@ -0,0 +1,190 @@ +/* UnknownAttribute.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute; + +import gnu.javax.print.ipp.IppUtilities; +import gnu.javax.print.ipp.IppValueTag; + +import java.net.URI; +import java.net.URISyntaxException; + +import javax.print.attribute.Attribute; + +/** + * UnknownAttribute holds all the parsed Attribute information. + * It provides methods to get the value-tag, name and value. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class UnknownAttribute implements Attribute +{ + private byte tag; + private String name; + private byte[] value; + + /** + * Creates a <code>UnknownAttribute</code> object with the given values. + * + * @param tag the value tag + * @param name the attribute name + * @param value the byte[] with the value + */ + public UnknownAttribute(byte tag, String name, byte[] value) + { + this.tag = tag; + this.name = name; + this.value = value; + } + + /** + * Returns category of this class. + * + * @return The class <code>UnknownAttribute</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return UnknownAttribute.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name attributes IPP name. + */ + public String getName() + { + return name; + } + + /** + * Returns the value tag + * @return The tag. + * + * @see gnu.javax.print.ipp.IppValueTag + */ + public byte getValueTag() + { + return tag; + } + + /** + * Returns the name of the attribute. + * @return The name. + */ + public String getAttributeName() + { + return name; + } + + /** + * Returns the attribute value origin byte array. + * @return The value. + */ + public byte[] getAttributeValue() + { + return value; + } + + /** + * Returns the attribute value decoded as String. + * @return The value as String. + */ + public String getAttributeValueAsString() + { + return new String(value); + } + + /** + * Returns the attribute value decoded as int. + * @return The value as int. + */ + public int getAttributeValueAsInt() + { + return IppUtilities.convertToInt(value); + } + + /** + * Returns the attribute value decoded as an URI. + * @return The value as URI. + */ + public URI getAttributeValueAsUri() + { + try + { + return new URI(new String(value)); + } + catch (URISyntaxException e) + { + return null; + } + } + + /** + * Provides a string representation for some default + * tag types (e.g. int, rangeofinteger, string, uri). + * For other more complex types "No conversion found." + * is returned. + */ + public String toString() + { + switch (tag) + { + case IppValueTag.INTEGER: + return "" + getAttributeValueAsInt(); + case IppValueTag.RANGEOFINTEGER: + int lower = IppUtilities.convertToInt(value[0], value[1], + value[2], value[3]); + int upper = IppUtilities.convertToInt(value[4], value[5], + value[6], value[7]); + return lower + "-" + upper; + case IppValueTag.URI: + return getAttributeValueAsUri().toString(); + case IppValueTag.KEYWORD: + case IppValueTag.URI_SCHEME: + case IppValueTag.CHARSET: + case IppValueTag.NATURAL_LANGUAGE: + case IppValueTag.MIME_MEDIA_TYPE: + case IppValueTag.NAME_WITHOUT_LANGUAGE: + case IppValueTag.TEXT_WITHOUT_LANGUAGE: + return getAttributeValueAsString(); + default: + return "No conversion found."; + } + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/CopiesDefault.java b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/CopiesDefault.java new file mode 100644 index 000000000..39d8fe1c0 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/CopiesDefault.java @@ -0,0 +1,118 @@ +/* CopiesDefault.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.javax.print.ipp.attribute.defaults; + +import gnu.javax.print.ipp.attribute.DefaultValueAttribute; + +import javax.print.attribute.Attribute; +import javax.print.attribute.IntegerSyntax; +import javax.print.attribute.standard.Copies; + +/** + * <code>CopiesDefault</code> provides the default value + * for the copies attribute. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class CopiesDefault extends IntegerSyntax + implements DefaultValueAttribute +{ + + /** + * Creates a <code>CopiesDefault</code> object. + * + * @param value the number of copies + * + * @exception IllegalArgumentException if value < 1 + */ + public CopiesDefault(int value) + { + super(value); + + if (value < 1) + throw new IllegalArgumentException("value may not be less than 1"); + } + + /** + * 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, + * <code>false</code> otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof CopiesDefault)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class <code>CopiesDefault</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return CopiesDefault.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "copies-default". + */ + public String getName() + { + return "copies-default"; + } + + /** + * Returns the equally enum of the standard attribute class + * of this DefaultValuesAttribute enum. + * <p>May return null if no value exists in JPS API.</p> + * + * @return The enum of the standard attribute class. + */ + public Attribute getAssociatedAttribute() + { + return new Copies(getValue()); + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/DocumentFormatDefault.java b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/DocumentFormatDefault.java new file mode 100644 index 000000000..5eff91498 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/DocumentFormatDefault.java @@ -0,0 +1,106 @@ +/* DocumentFormatDefault.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.defaults; + +import gnu.javax.print.ipp.attribute.DefaultValueAttribute; +import gnu.javax.print.ipp.attribute.printer.DocumentFormat; + +import java.util.Locale; + +import javax.print.attribute.Attribute; +import javax.print.attribute.TextSyntax; + +/** + * <code>DocumentFormatDefault</code> specifies the default document + * format of a printer. + * + * @author Wolfgang Baer (WBaer@gmx.de) + * + */ +public final class DocumentFormatDefault extends TextSyntax + implements DefaultValueAttribute +{ + + /** + * Creates a <code>DocumentFormatDefault</code> object with the + * given value and locale. + * + * @param value the value for this syntax + * @param locale the locale to use, if <code>null</code> the default + * locale is used. + * + * @exception NullPointerException if value is null + */ + public DocumentFormatDefault(String value, Locale locale) + { + super(value, locale); + } + + /** + * Returns category of this class. + * + * @return The class <code>DocumentFormatDefault</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return DocumentFormatDefault.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "document-format-default". + */ + public String getName() + { + return "document-format-default"; + } + + /** + * Returns the equally enum of the standard attribute class + * of this DefaultValuesAttribute enum. + * + * @return The enum of the standard attribute class. + */ + public Attribute getAssociatedAttribute() + { + return new DocumentFormat(getValue(), getLocale()); + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/FinishingsDefault.java b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/FinishingsDefault.java new file mode 100644 index 000000000..9d4a06002 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/FinishingsDefault.java @@ -0,0 +1,263 @@ +/* FinishingsDefault.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.defaults; + +import gnu.javax.print.ipp.IppUtilities; +import gnu.javax.print.ipp.attribute.DefaultValueAttribute; + +import javax.print.attribute.Attribute; +import javax.print.attribute.EnumSyntax; + + +/** + * The <code>FinishingsDefault</code> attribute provides the supported + * values for finishings of a job. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class FinishingsDefault extends EnumSyntax + implements DefaultValueAttribute +{ + + /** No finishing. */ + public static final FinishingsDefault NONE = new FinishingsDefault(3); + + /** Staple the document(s) */ + public static final FinishingsDefault STAPLE = new FinishingsDefault(4); + + /** Cover a document */ + public static final FinishingsDefault COVER = new FinishingsDefault(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 FinishingsDefault BIND = new FinishingsDefault(7); + + /** + * Bind the document(s) with one or more staples (wire stitches) + * along the middle fold. + */ + public static final FinishingsDefault SADDLE_STITCH = new FinishingsDefault(8); + + /** + * Bind the document(s) with one or more staples (wire stitches) + * along one edge. + */ + public static final FinishingsDefault EDGE_STITCH = new FinishingsDefault(9); + + /** + * Bind the document(s) with one or more staples in the top left + * corner. + */ + public static final FinishingsDefault STAPLE_TOP_LEFT = new FinishingsDefault(20); + + /** + * Bind the document(s) with one or more staples in the bottom + * left corner. + */ + public static final FinishingsDefault STAPLE_BOTTOM_LEFT = new FinishingsDefault(21); + + /** + * Bind the document(s) with one or more staples in the top right corner. + */ + public static final FinishingsDefault STAPLE_TOP_RIGHT = new FinishingsDefault(22); + + /** + * Bind the document(s) with one or more staples in the bottom right corner. + */ + public static final FinishingsDefault STAPLE_BOTTOM_RIGHT = new FinishingsDefault(23); + + /** + * Bind the document(s) with one or more staples (wire stitches) + * along the left edge. + */ + public static final FinishingsDefault EDGE_STITCH_LEFT = new FinishingsDefault(24); + + /** + * Bind the document(s) with one or more staples (wire stitches) along + * the top edge. + */ + public static final FinishingsDefault EDGE_STITCH_TOP = new FinishingsDefault(25); + + /** + * Bind the document(s) with one or more staples (wire stitches) along + * the right edge. + */ + public static final FinishingsDefault EDGE_STITCH_RIGHT = new FinishingsDefault(26); + + /** + * Bind the document(s) with one or more staples (wire stitches) along + * the bottom edge. + */ + public static final FinishingsDefault EDGE_STITCH_BOTTOM = new FinishingsDefault(27); + + /** + * Bind the document(s) with two staples (wire stitches) along the + * left edge assuming a portrait document. + */ + public static final FinishingsDefault STAPLE_DUAL_LEFT = new FinishingsDefault(28); + + /** + * Bind the document(s) with two staples (wire stitches) along the + * top edge assuming a portrait document. + */ + public static final FinishingsDefault STAPLE_DUAL_TOP = new FinishingsDefault(29); + + /** + * Bind the document(s) with two staples (wire stitches) along the + * right edge assuming a portrait document. + */ + public static final FinishingsDefault STAPLE_DUAL_RIGHT = new FinishingsDefault(30); + + /** + * Bind the document(s) with two staples (wire stitches) along the + * bottom edge assuming a portrait document. + */ + public static final FinishingsDefault STAPLE_DUAL_BOTTOM = new FinishingsDefault(31); + + 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-right", + "edge-stitch-left", + "edge-stitch-top", + "edge-stitch-right", + "edge-stitch-bottom", + "staple-dual-left", + "staple-dual-top", + "staple-dual-right", + "staple-dual-bottom" }; + + private static final FinishingsDefault[] enumValueTable = { 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_RIGHT, + EDGE_STITCH_LEFT, + EDGE_STITCH_TOP, + EDGE_STITCH_RIGHT, + EDGE_STITCH_BOTTOM, + STAPLE_DUAL_LEFT, + STAPLE_DUAL_TOP, + STAPLE_DUAL_RIGHT, + STAPLE_DUAL_BOTTOM }; + + /** + * Constructs a <code>FinishingsDefault</code> object. + * + * @param value the value + */ + protected FinishingsDefault(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return the class <code>FinishingsDefault</code> itself + */ + public Class<? extends Attribute> getCategory() + { + return FinishingsDefault.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "finishings-default". + */ + public String getName() + { + return "finishings-default"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } + + /** + * Returns the lowest used value by the enumerations of this class. + * . + * @return The lowest value used. + */ + protected int getOffset() + { + return 3; + } + + /** + * Returns the equally enum of the standard attribute class + * of this DefaultValuesAttribute enum. + * + * @return The enum of the standard attribute class. + */ + public Attribute getAssociatedAttribute() + { + return IppUtilities.getEnumAttribute("finishings", new Integer(getValue())); + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/JobHoldUntilDefault.java b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/JobHoldUntilDefault.java new file mode 100644 index 000000000..7c29f231c --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/JobHoldUntilDefault.java @@ -0,0 +1,149 @@ +/* JobHoldUntilDefault.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.defaults; + +import gnu.javax.print.ipp.attribute.DefaultValueAttribute; + +import java.util.Date; +import java.util.Locale; + +import javax.print.attribute.Attribute; +import javax.print.attribute.TextSyntax; +import javax.print.attribute.standard.JobHoldUntil; + +/** + * JobHoldUntilDefault attribute provides the default value + * for the attribute type job-hold-until. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class JobHoldUntilDefault extends TextSyntax + implements DefaultValueAttribute +{ + + // a keyword/name based attribute in IPP + // can be extended by administrators + // standard values are predefined + + /** Job should be printed immediately. */ + public static final JobHoldUntilDefault NO_HOLD = + new JobHoldUntilDefault("no-hold", null); + + /** Job should be hold indefinitely. */ + public static final JobHoldUntilDefault INDEFINITE = + new JobHoldUntilDefault("indefinite", null); + + /** Job should be processed during the day. */ + public static final JobHoldUntilDefault DAY_TIME = + new JobHoldUntilDefault("day-time", null); + + /** Job should be processed in the evening. */ + public static final JobHoldUntilDefault EVENING = + new JobHoldUntilDefault("evening", null); + + /** Job should be processed during night. */ + public static final JobHoldUntilDefault NIGHT = + new JobHoldUntilDefault("night", null); + + /** Job should be processed during the weekend. */ + public static final JobHoldUntilDefault WEEKEND = + new JobHoldUntilDefault("weekend", null); + + /** + * Job should be processed as second-shift + * (after close of business). + */ + public static final JobHoldUntilDefault SECOND_SHIFT = + new JobHoldUntilDefault("second-shift", null); + + /** + * Job should be processed as third-shift + * (after midnight). + */ + public static final JobHoldUntilDefault THIRD_SHIFT = + new JobHoldUntilDefault("third-shift", null); + + /** + * Creates a <code>JobHoldUntilDefault</code> object with the + * given value and locale. + * + * @param value the value for this syntax + * @param locale the locale to use, if <code>null</code> the default + * locale is used. + * + * @throws NullPointerException if value is null + */ + public JobHoldUntilDefault(String value, Locale locale) + { + super(value, locale); + } + + /** + * Returns category of this class. + * + * @return The class <code>JobHoldUntilDefault</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return JobHoldUntilDefault.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-hold-until-default". + */ + public String getName() + { + return "job-hold-until-default"; + } + + /** + * Returns the equally enum of the standard attribute class + * of this DefaultValuesAttribute enum. + * + * @return The enum of the standard attribute class. + */ + public Attribute getAssociatedAttribute() + { + // FIXME Same Mapping problem as in IppPrintService + return new JobHoldUntil(new Date()); + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/JobPriorityDefault.java b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/JobPriorityDefault.java new file mode 100644 index 000000000..9430250ae --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/JobPriorityDefault.java @@ -0,0 +1,118 @@ +/* JobPriorityDefault.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.javax.print.ipp.attribute.defaults; + +import gnu.javax.print.ipp.attribute.DefaultValueAttribute; + +import javax.print.attribute.Attribute; +import javax.print.attribute.IntegerSyntax; +import javax.print.attribute.standard.JobPriority; + + +/** + * JobPriorityDefault attribute provides the default value of + * the printer object for the job-priority attribute. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class JobPriorityDefault extends IntegerSyntax + implements DefaultValueAttribute +{ + + /** + * Creates a <code>JobPriorityDefault</code> object. + * + * @param value the priority + * + * @exception IllegalArgumentException if value < 1 or value > 100 + */ + public JobPriorityDefault(int value) + { + super(value); + + if (value < 1 || value > 100) + throw new IllegalArgumentException("value out of range"); + } + + /** + * 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, + * <code>false</code> otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof JobPriorityDefault)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class <code>JobPriorityDefault</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return JobPriorityDefault.class; + } + + /** + * Returns name of this class. + * + * @return The anme "job-priority-default". + */ + public String getName() + { + return "job-priority-default"; + } + + /** + * Returns the equally enum of the standard attribute class + * of this DefaultValuesAttribute enum. + * + * @return The enum of the standard attribute class. + */ + public Attribute getAssociatedAttribute() + { + return new JobPriority(getValue()); + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/JobSheetsDefault.java b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/JobSheetsDefault.java new file mode 100644 index 000000000..6bf027eda --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/JobSheetsDefault.java @@ -0,0 +1,122 @@ +/* JobSheetsDefault.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.defaults; + +import gnu.javax.print.ipp.attribute.DefaultValueAttribute; + +import java.util.Locale; + +import javax.print.attribute.Attribute; +import javax.print.attribute.TextSyntax; +import javax.print.attribute.standard.JobSheets; + +/** + * JobSheetsDefault attribute provides the default value of + * the printer object for the job-sheets attribute. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class JobSheetsDefault extends TextSyntax + implements DefaultValueAttribute +{ + //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 = + new JobSheetsDefault("none", Locale.getDefault()); + + /** A job sheet is the default */ + public static final JobSheetsDefault STANDARD = + new JobSheetsDefault("standard", Locale.getDefault()); + + /** + * Creates a <code>JobSheetsDefault</code> object with the + * given value and locale. + * + * @param value the value for this syntax + * @param locale the locale to use, if <code>null</code> the default + * locale is used. + * + * @throws NullPointerException if value is null + */ + public JobSheetsDefault(String value, Locale locale) + { + super(value, locale); + } + + /** + * Returns category of this class. + * + * @return The class <code>JobSheetsDefault</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return JobSheetsDefault.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-sheets-default". + */ + public String getName() + { + return "job-sheets-default"; + } + + /** + * Returns the equally enum of the standard attribute class + * of this DefaultValuesAttribute enum. + * <p>May return null if no value exists in JPS API.</p> + * + * @return The enum of the standard attribute class. + */ + public Attribute getAssociatedAttribute() + { + if (this.equals(JobSheetsDefault.NONE)) + return JobSheets.NONE; + if (this.equals(JobSheetsDefault.STANDARD)) + return JobSheets.STANDARD; + + return null; + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/MediaDefault.java b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/MediaDefault.java new file mode 100644 index 000000000..5945d0b9b --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/MediaDefault.java @@ -0,0 +1,105 @@ +/* MediaDefault.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.defaults; + +import gnu.javax.print.ipp.IppUtilities; +import gnu.javax.print.ipp.attribute.DefaultValueAttribute; + +import java.util.Locale; + +import javax.print.attribute.Attribute; +import javax.print.attribute.TextSyntax; + +/** + * MediaDefault attribute provides the default value of + * the printer object for the media attribute. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class MediaDefault extends TextSyntax + implements DefaultValueAttribute +{ + + /** + * Creates a <code>MediaDefault</code> object with the + * given value and locale. + * + * @param value the value for this syntax + * @param locale the locale to use, if <code>null</code> the default + * locale is used. + * + * @throws NullPointerException if value is null + */ + public MediaDefault(String value, Locale locale) + { + super(value, locale); + } + + /** + * Returns category of this class. + * + * @return The class <code>MediaDefault</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return MediaDefault.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "media-default". + */ + public String getName() + { + return "media-default"; + } + + /** + * Returns the equally enum of the standard attribute class + * of this DefaultValuesAttribute enum. + * + * @return The enum of the standard attribute class. + */ + public Attribute getAssociatedAttribute() + { + return IppUtilities.getEnumAttribute("media" , getValue()); + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/MultipleDocumentHandlingDefault.java b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/MultipleDocumentHandlingDefault.java new file mode 100644 index 000000000..1563db82c --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/MultipleDocumentHandlingDefault.java @@ -0,0 +1,152 @@ +/* MultipleDocumentHandlingDefault.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.javax.print.ipp.attribute.defaults; + +import gnu.javax.print.ipp.IppUtilities; +import gnu.javax.print.ipp.attribute.DefaultValueAttribute; + +import javax.print.attribute.Attribute; +import javax.print.attribute.EnumSyntax; + + +/** + * <code>MultipleDocumentHandlingDefault</code> provides the + * default value for the MultipleDocumentHandling attribute. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class MultipleDocumentHandlingDefault extends EnumSyntax + implements DefaultValueAttribute +{ + + //a keyword based attribute in IPP - int values just starting at 0 + + /** + * Supports only multiple documents treated as a single document. This + * applies to attributes which specify treatment of multiple document jobs. + */ + public static final MultipleDocumentHandlingDefault SINGLE_DOCUMENT = + new MultipleDocumentHandlingDefault(0); + + /** Supports multiple documents as uncollated copies */ + public static final MultipleDocumentHandlingDefault SEPARATE_DOCUMENTS_UNCOLLATED_COPIES = + new MultipleDocumentHandlingDefault(1); + + /** Supports multiple documents as collated copies */ + public static final MultipleDocumentHandlingDefault SEPARATE_DOCUMENTS_COLLATED_COPIES = + new MultipleDocumentHandlingDefault(2); + + /** + * Supports multiple documents where every single document starts + * with a new sheet. + */ + public static final MultipleDocumentHandlingDefault SINGLE_DOCUMENT_NEW_SHEET = + new MultipleDocumentHandlingDefault(3); + + private static final String[] stringTable = { "single-document", + "separate-documents-uncollated-copies", + "separate-documents-collated-copies", + "single-document-new-sheet" }; + + private static final MultipleDocumentHandlingDefault[] enumValueTable = + { SINGLE_DOCUMENT, SEPARATE_DOCUMENTS_UNCOLLATED_COPIES, + SEPARATE_DOCUMENTS_COLLATED_COPIES, SINGLE_DOCUMENT_NEW_SHEET}; + + /** + * Constructs a <code>MultipleDocumentHandlingDefault</code> object. + * + * @param value the enum value + */ + protected MultipleDocumentHandlingDefault(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class <code>MultipleDocumentHandlingDefault</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return MultipleDocumentHandlingDefault.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "multiple-document-handling-default". + */ + public String getName() + { + return "multiple-document-handling-default"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } + + /** + * Returns the equally enum of the standard attribute class + * of this DefaultValuesAttribute enum. + * + * @return The enum of the standard attribute class. + */ + public Attribute getAssociatedAttribute() + { + return IppUtilities.getEnumAttribute("multiple-document-handling", + new Integer(getValue())); + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/NumberUpDefault.java b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/NumberUpDefault.java new file mode 100644 index 000000000..8e2d076d5 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/NumberUpDefault.java @@ -0,0 +1,114 @@ +/* NumberUpDefault.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.javax.print.ipp.attribute.defaults; + +import gnu.javax.print.ipp.attribute.DefaultValueAttribute; + +import javax.print.attribute.Attribute; +import javax.print.attribute.IntegerSyntax; +import javax.print.attribute.standard.NumberUp; + +/** + * NumberUpDefault attribute provides the default value of + * the numper up attribute. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class NumberUpDefault extends IntegerSyntax + implements DefaultValueAttribute +{ + + /** + * Creates a <code>NumberUpDefault</code> object. + * + * @param value the value + * @throws IllegalArgumentException if value < 1 + */ + public NumberUpDefault(int value) + { + super(value); + } + + /** + * 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, + * <code>false</code> otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof NumberUpDefault)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class <code>NumberUpDefault</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return NumberUpDefault.class; + } + + /** + * Returns name of this class. + * + * @return The name "number-up-default". + */ + public String getName() + { + return "number-up-default"; + } + + /** + * Returns the equally enum of the standard attribute class + * of this DefaultValuesAttribute enum. + * <p>May return null if no value exists in JPS API.</p> + * + * @return The enum of the standard attribute class. + */ + public Attribute getAssociatedAttribute() + { + return new NumberUp(getValue()); + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/OrientationRequestedDefault.java b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/OrientationRequestedDefault.java new file mode 100644 index 000000000..4563ec525 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/OrientationRequestedDefault.java @@ -0,0 +1,154 @@ +/* OrientationRequestedDefault.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.javax.print.ipp.attribute.defaults; + +import gnu.javax.print.ipp.IppUtilities; +import gnu.javax.print.ipp.attribute.DefaultValueAttribute; + +import javax.print.attribute.Attribute; +import javax.print.attribute.EnumSyntax; + + +/** + * The <code>OrientationRequestedDefault</code> attribute provides + * the default value for the job attribute orientation-requested. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class OrientationRequestedDefault extends EnumSyntax + implements DefaultValueAttribute +{ + + /** Orientation as portrait. */ + public static final OrientationRequestedDefault PORTRAIT = + new OrientationRequestedDefault(3); + + /** Orientation as landscape. */ + public static final OrientationRequestedDefault LANDSCAPE = + new OrientationRequestedDefault(4); + + /** Orientation as reversed landscape. */ + public static final OrientationRequestedDefault REVERSE_LANDSCAPE = + new OrientationRequestedDefault(5); + + /** Orientation as reversed portrait. */ + public static final OrientationRequestedDefault REVERSE_PORTRAIT = + new OrientationRequestedDefault(6); + + + private static final String[] stringTable = { "portrait", "landscape", + "reverse-landscape", + "reverse-portrait" }; + + private static final OrientationRequestedDefault[] + enumValueTable = { PORTRAIT, LANDSCAPE, + REVERSE_LANDSCAPE, REVERSE_PORTRAIT }; + + /** + * Constructs a <code>OrientationRequestedDefault</code> object. + * + * @param value the value + */ + protected OrientationRequestedDefault(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class <code>OrientationRequestedDefault</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return OrientationRequestedDefault.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "orientation-requested-default". + */ + public String getName() + { + return "orientation-requested-default"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } + + /** + * Returns the lowest used value by the enumerations of this class. + * . + * @return The lowest value used. + */ + protected int getOffset() + { + return 3; + } + + /** + * Returns the equally enum of the standard attribute class + * of this DefaultValuesAttribute enum. + * + * @return The enum of the standard attribute class. + */ + public Attribute getAssociatedAttribute() + { + return IppUtilities.getEnumAttribute("orientation-requested", + new Integer(getValue())); + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/PrintQualityDefault.java b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/PrintQualityDefault.java new file mode 100644 index 000000000..7b123eeb4 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/PrintQualityDefault.java @@ -0,0 +1,141 @@ +/* PrintQualityDefault.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.javax.print.ipp.attribute.defaults; + +import gnu.javax.print.ipp.IppUtilities; +import gnu.javax.print.ipp.attribute.DefaultValueAttribute; + +import javax.print.attribute.Attribute; +import javax.print.attribute.EnumSyntax; + + +/** + * <code>PrintQualityDefault</code> provides the + * default value for the print-quality attribute. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class PrintQualityDefault extends EnumSyntax + implements DefaultValueAttribute +{ + /** Draft quality of the printer. */ + public static final PrintQualityDefault DRAFT = new PrintQualityDefault(3); + + /** Normal quality of the printer. */ + public static final PrintQualityDefault NORMAL = new PrintQualityDefault(4); + + /** High quality of the printer. */ + public static final PrintQualityDefault HIGH = new PrintQualityDefault(5); + + private static final String[] stringTable = { "draft", "normal", "high" }; + + private static final PrintQualityDefault[] enumValueTable = { DRAFT, NORMAL, HIGH }; + + /** + * Constructs a <code>PrintQualityDefault</code> object. + * + * @param value the value of the enum + */ + protected PrintQualityDefault(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class <code>PrintQualityDefault</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return PrintQualityDefault.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "print-quality-default". + */ + public String getName() + { + return "print-quality-default"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } + + /** + * Returns the lowest used value by the enumerations of this class. + * . + * @return The lowest value used. + */ + protected int getOffset() + { + return 3; + } + + /** + * Returns the equally enum of the standard attribute class + * of this DefaultValuesAttribute enum. + * + * @return The enum of the standard attribute class. + */ + public Attribute getAssociatedAttribute() + { + return IppUtilities.getEnumAttribute( + "print-quality", new Integer(getValue())); + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/PrinterResolutionDefault.java b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/PrinterResolutionDefault.java new file mode 100644 index 000000000..2c84b99ba --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/PrinterResolutionDefault.java @@ -0,0 +1,119 @@ +/* PrinterResolutionDefault.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.javax.print.ipp.attribute.defaults; + +import gnu.javax.print.ipp.attribute.DefaultValueAttribute; + +import javax.print.attribute.Attribute; +import javax.print.attribute.ResolutionSyntax; +import javax.print.attribute.standard.PrinterResolution; + + +/** + * The <code>PrinterResolutionDefault</code> attribute provides + * the default value for the job attribute printer-resolution. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class PrinterResolutionDefault extends ResolutionSyntax + implements DefaultValueAttribute +{ + + /** + * Creates a <code>ResolutionSyntax</code> object with the given arguments. + * + * @param crossFeedResolution the cross feed resolution + * @param feedResolution the feed resolution + * @param units the unit to use (e.g. {@link #DPCM} or {@link #DPI}) + * + * @exception IllegalArgumentException if preconditions fail + */ + public PrinterResolutionDefault(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, + * <code>false</code> otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof PrinterResolutionDefault)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class <code>PrinterResolutionDefault</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return PrinterResolutionDefault.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "printer-resolution-default". + */ + public String getName() + { + return "printer-resolution-default"; + } + + /** + * Returns the equally enum of the standard attribute class + * of this DefaultValuesAttribute enum. + * + * @return The enum of the standard attribute class. + */ + public Attribute getAssociatedAttribute() + { + return new PrinterResolution(getCrossFeedResolutionDphi(), + getFeedResolutionDphi(), 1); + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/SidesDefault.java b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/SidesDefault.java new file mode 100644 index 000000000..a50560ae9 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/defaults/SidesDefault.java @@ -0,0 +1,150 @@ +/* SidesDefault.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.javax.print.ipp.attribute.defaults; + +import gnu.javax.print.ipp.IppUtilities; +import gnu.javax.print.ipp.attribute.DefaultValueAttribute; + +import javax.print.attribute.Attribute; +import javax.print.attribute.EnumSyntax; + + +/** + * <code>SidesDefault</code> provides the + * default for the sides attribute. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class SidesDefault extends EnumSyntax + implements DefaultValueAttribute +{ + + /** Specifies that each page should be printed on one sheet. */ + public static final SidesDefault ONE_SIDED = new SidesDefault(0); + + /** + * 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 SidesDefault TWO_SIDED_LONG_EDGE = + new SidesDefault(1); + + /** + * 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 SidesDefault TWO_SIDED_SHORT_EDGE = + new SidesDefault(2); + + /** An alias constant for "two sided long edge". */ + public static final SidesDefault DUPLEX = new SidesDefault(1); + + /** An alias constant for "two sided short edge". */ + public static final SidesDefault TUMBLE = new SidesDefault(2); + + private static final String[] stringTable = { "one-sided", + "two-sided-long-edge", + "two-sided-short-edge" }; + + private static final SidesDefault[] enumValueTable = { ONE_SIDED, + TWO_SIDED_LONG_EDGE, + TWO_SIDED_SHORT_EDGE }; + + + /** + * Creates a <code>SidesDefault</code> object. + * + * @param value the value of the enum + */ + protected SidesDefault(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class <code>SidesDefault</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return SidesDefault.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "sides-default". + */ + public String getName() + { + return "sides-default"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } + + /** + * Returns the equally enum of the standard attribute class + * of this DefaultValuesAttribute enum. + * + * @return The enum of the standard attribute class. + */ + public Attribute getAssociatedAttribute() + { + return IppUtilities.getEnumAttribute("sides", new Integer(getValue())); + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/job/AttributesCharset.java b/libjava/classpath/gnu/javax/print/ipp/attribute/job/AttributesCharset.java new file mode 100644 index 000000000..4fe2ce0d5 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/job/AttributesCharset.java @@ -0,0 +1,93 @@ +/* AttributesCharset.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.job; + +import gnu.javax.print.ipp.attribute.CharsetSyntax; + +import javax.print.attribute.Attribute; + +/** + * AttributesCharset attribute as described in RFC 2911 chapter + * 3.1.4 Character Set and Natural Language Operation Attributes. + * <p> + * This operation attribute identifies the charset used by any text + * and name attribute supplied by the client in the request. This + * charset must be used by the printer object in the response.<br> + * All clients and IPP objects must support the 'utf-8' charset. + * </p> + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class AttributesCharset extends CharsetSyntax + implements Attribute +{ + + /** Defines a default UTF-8 charset instance */ + public static final AttributesCharset UTF8 = new AttributesCharset("utf-8"); + + /** + * Creates a <code>AttributesCharset</code> object. + * + * @param value the charset string value. + */ + public AttributesCharset(String value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class <code>AttributesCharset</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return AttributesCharset.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "attributes-charset". + */ + public String getName() + { + return "attributes-charset"; + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/job/AttributesNaturalLanguage.java b/libjava/classpath/gnu/javax/print/ipp/attribute/job/AttributesNaturalLanguage.java new file mode 100644 index 000000000..151cec439 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/job/AttributesNaturalLanguage.java @@ -0,0 +1,95 @@ +/* AttributesNaturalLanguage.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.job; + + +import gnu.javax.print.ipp.attribute.NaturalLanguageSyntax; + +import javax.print.attribute.Attribute; + +/** + * AttributesNaturalLanguage attribute as described in RFC 2911 chapter + * 3.1.4 Character Set and Natural Language Operation Attributes. + * <p> + * This operation attribute identifies the natural language used + * by any text and name attribute supplied by the client in the request. + * The printer object should use this natural language for the response + * to this request. + * </p> + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class AttributesNaturalLanguage extends NaturalLanguageSyntax + implements Attribute +{ + + /** Defines the default language EN */ + public static final AttributesNaturalLanguage EN = + new AttributesNaturalLanguage("en"); + + /** + * Creates a <code>AttributesNaturalLanguage</code> object. + * + * @param value the language string value. + */ + public AttributesNaturalLanguage(String value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class <code>AttributesNaturalLanguage</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return AttributesNaturalLanguage.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "attributes-natural-language". + */ + public String getName() + { + return "attributes-natural-language"; + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/job/JobDetailedStatusMessages.java b/libjava/classpath/gnu/javax/print/ipp/attribute/job/JobDetailedStatusMessages.java new file mode 100644 index 000000000..5b83344a9 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/job/JobDetailedStatusMessages.java @@ -0,0 +1,92 @@ +/* JobDetailedStatusMessages.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.job; + +import java.util.Locale; + +import javax.print.attribute.Attribute; +import javax.print.attribute.TextSyntax; + +/** + * JobDetailedStatusMessages provides additional detailed and + * technical job informations. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class JobDetailedStatusMessages + extends TextSyntax implements Attribute +{ + + /** + * Creates a <code>JobDetailedStatusMessages</code> object with the given value + * and locale. + * + * @param value the value for this syntax + * @param locale the locale to use, if <code>null</code> the default + * locale is used. + * + * @exception NullPointerException if value is null + */ + public JobDetailedStatusMessages(String value, Locale locale) + { + super(value, locale); + } + + /** + * Returns category of this class. + * + * @return The class <code>JobDetailedStatusMessages</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return JobDetailedStatusMessages.class; + } + + + /** + * Returns the name of this attribute. + * + * @return The name "job-detailed-status-messages". + */ + public String getName() + { + return "job-detailed-status-messages"; + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/job/JobDocumentAccessErrors.java b/libjava/classpath/gnu/javax/print/ipp/attribute/job/JobDocumentAccessErrors.java new file mode 100644 index 000000000..c3fff057c --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/job/JobDocumentAccessErrors.java @@ -0,0 +1,93 @@ +/* JobDocumentAccessErrors.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.job; + +import java.util.Locale; + +import javax.print.attribute.Attribute; +import javax.print.attribute.TextSyntax; + +/** + * JobDocumentAccessErrors provides additional information + * for each access error for print-uri or document-uri jobs. + * technical job informations. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class JobDocumentAccessErrors + extends TextSyntax implements Attribute +{ + + /** + * Creates a <code>JobDocumentAccessErrors</code> object with the given value + * and locale. + * + * @param value the value for this syntax + * @param locale the locale to use, if <code>null</code> the default + * locale is used. + * + * @exception NullPointerException if value is null + */ + public JobDocumentAccessErrors(String value, Locale locale) + { + super(value, locale); + } + + /** + * Returns category of this class. + * + * @return The class <code>JobDocumentAccessErrors</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return JobDocumentAccessErrors.class; + } + + + /** + * Returns the name of this attribute. + * + * @return The name "job-document-access-errors". + */ + public String getName() + { + return "job-document-access-errors"; + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/job/JobId.java b/libjava/classpath/gnu/javax/print/ipp/attribute/job/JobId.java new file mode 100644 index 000000000..78c866723 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/job/JobId.java @@ -0,0 +1,87 @@ +/* JobId.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.job; + +import javax.print.attribute.Attribute; +import javax.print.attribute.IntegerSyntax; + +/** + * The <code>JobId</code> attribute contains the ID of a + * print job created or currently being processed. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class JobId extends IntegerSyntax implements Attribute +{ + + /** + * Creates a <code>IntegerSyntax</code> with the given value. + * + * @param value the integer to set + * @throws IllegalArgumentException if value is < 1 + */ + public JobId(int value) + { + super(value); + + if (value < 1) + throw new IllegalArgumentException("job-id may not be less than 1"); + } + + /** + * Returns category of this class. + * + * @return The class <code>JobId</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return JobId.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-id". + */ + public String getName() + { + return "job-id"; + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/job/JobMoreInfo.java b/libjava/classpath/gnu/javax/print/ipp/attribute/job/JobMoreInfo.java new file mode 100644 index 000000000..569400f40 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/job/JobMoreInfo.java @@ -0,0 +1,87 @@ +/* JobMoreInfo.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.job; + +import java.net.URI; + +import javax.print.attribute.Attribute; +import javax.print.attribute.URISyntax; + +/** + * JobMoreInfo attribute as described in RFC 2911 section + * 4.3.4 contains the URI where more information about a job + * (e.g. through a HTML page) can be found. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class JobMoreInfo extends URISyntax implements Attribute +{ + + /** + * Creates a <code>JobMoreInfo</code> object. + * + * @param uri the URI value for the syntax + * @throws NullPointerException if uri is null + */ + public JobMoreInfo(URI uri) + { + super(uri); + } + + /** + * Returns category of this class. + * + * @return The class <code>JobMoreInfo</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return JobMoreInfo.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-more-info". + */ + public String getName() + { + return "job-more-info"; + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/job/JobPrinterUri.java b/libjava/classpath/gnu/javax/print/ipp/attribute/job/JobPrinterUri.java new file mode 100644 index 000000000..1375a2419 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/job/JobPrinterUri.java @@ -0,0 +1,87 @@ +/* JobPrinterUri.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.job; + +import java.net.URI; + +import javax.print.attribute.Attribute; +import javax.print.attribute.URISyntax; + +/** + * JobPrinterUri attribute as described in RFC 2911 section + * 4.3.3 contains the URI of the printer which created and + * processes a job. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class JobPrinterUri extends URISyntax implements Attribute +{ + + /** + * Creates a <code>JobPrinterUri</code> object. + * + * @param uri the URI value for the syntax + * @throws NullPointerException if uri is null + */ + public JobPrinterUri(URI uri) + { + super(uri); + } + + /** + * Returns category of this class. + * + * @return The class <code>JobPrinterUri</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return JobPrinterUri.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-printer-uri". + */ + public String getName() + { + return "job-printer-uri"; + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/job/JobStateMessage.java b/libjava/classpath/gnu/javax/print/ipp/attribute/job/JobStateMessage.java new file mode 100644 index 000000000..d65126621 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/job/JobStateMessage.java @@ -0,0 +1,92 @@ +/* JobStateMessage.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.job; + +import java.util.Locale; + +import javax.print.attribute.Attribute; +import javax.print.attribute.TextSyntax; + +/** + * JobStateMessage attribute describes information about the + * job-state and job-state-reasons in human readable form. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class JobStateMessage + extends TextSyntax implements Attribute +{ + + /** + * Creates a <code>JobStateMessage</code> object with the given value + * and locale. + * + * @param value the value for this syntax + * @param locale the locale to use, if <code>null</code> the default + * locale is used. + * + * @exception NullPointerException if value is null + */ + public JobStateMessage(String value, Locale locale) + { + super(value, locale); + } + + /** + * Returns category of this class. + * + * @return The class <code>JobStateMessage</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return JobStateMessage.class; + } + + + /** + * Returns the name of this attribute. + * + * @return The name "job-state-message". + */ + public String getName() + { + return "job-state-message"; + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/job/JobUri.java b/libjava/classpath/gnu/javax/print/ipp/attribute/job/JobUri.java new file mode 100644 index 000000000..4b545b956 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/job/JobUri.java @@ -0,0 +1,87 @@ +/* JobUri.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.job; + +import java.net.URI; + +import javax.print.attribute.Attribute; +import javax.print.attribute.URISyntax; + +/** + * JobUri attribute as described in RFC 2911 section + * 4.3.1 contains the URI for a job generated by the printer + * after a create request. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class JobUri extends URISyntax implements Attribute +{ + + /** + * Creates a <code>JobUri</code> object. + * + * @param uri the URI value for the syntax + * @throws NullPointerException if uri is null + */ + public JobUri(URI uri) + { + super(uri); + } + + /** + * Returns category of this class. + * + * @return The class <code>JobUri</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return JobUri.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-uri". + */ + public String getName() + { + return "job-uri"; + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/printer/CharsetConfigured.java b/libjava/classpath/gnu/javax/print/ipp/attribute/printer/CharsetConfigured.java new file mode 100644 index 000000000..42430377c --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/printer/CharsetConfigured.java @@ -0,0 +1,86 @@ +/* CharsetConfigured.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.printer; + +import gnu.javax.print.ipp.attribute.CharsetSyntax; + +import javax.print.attribute.Attribute; + +/** + * CharsetConfigured attribute as described in RFC 2911 section + * 4.4.17 provides the charset which is configured by the + * server to be used in the name and text syntax attribute types. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class CharsetConfigured extends CharsetSyntax + implements Attribute +{ + + /** + * Creates a <code>CharsetConfigured</code> object. + * + * @param value the charset string value. + */ + public CharsetConfigured(String value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class <code>CharsetConfigured</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return CharsetConfigured.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "charset-configured". + */ + public String getName() + { + return "charset-configured"; + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/printer/DocumentFormat.java b/libjava/classpath/gnu/javax/print/ipp/attribute/printer/DocumentFormat.java new file mode 100644 index 000000000..9a5e01e1d --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/printer/DocumentFormat.java @@ -0,0 +1,111 @@ +/* DocumentFormat.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.printer; + +import java.util.Locale; + +import javax.print.DocFlavor; +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 DocumentFormat extends TextSyntax + implements SupportedValuesAttribute +{ + + /** + * Creates a <code>DocumentFormat</code> object with the + * given value and locale. + * + * @param value the value for this syntax + * @param locale the locale to use, if <code>null</code> the default + * locale is used. + * + * @exception NullPointerException if value is null + */ + public DocumentFormat(String value, Locale locale) + { + super(value, locale); + } + + /** + * Constructs a document format object for the given flavor. + * The constructor reworkes the mimetype of the given flavor + * to remove the quoted charset parameter if present. + * + * @param flavor the flavor with the mimetype + * @return The created document format. + */ + public static DocumentFormat createDocumentFormat(DocFlavor flavor) + { + String charset = flavor.getParameter("charset"); + String mimetype = flavor.getMediaType() + "/" + flavor.getMediaSubtype(); + if (charset != null) + mimetype += "; charset=" + charset; + + return new DocumentFormat(mimetype, null); + } + + /** + * Returns category of this class. + * + * @return The class <code>DocumentFormat</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return DocumentFormat.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "document-format". + */ + public String getName() + { + return "document-format"; + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/printer/MultipleOperationTimeOut.java b/libjava/classpath/gnu/javax/print/ipp/attribute/printer/MultipleOperationTimeOut.java new file mode 100644 index 000000000..bb00b8891 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/printer/MultipleOperationTimeOut.java @@ -0,0 +1,86 @@ +/* MultipleOperationTimeOut.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.printer; + +import javax.print.attribute.Attribute; +import javax.print.attribute.IntegerSyntax; + +/** + * MultipleOperationTimeOut attribute as described in RFC 2911 section + * 4.4.31 provides the minimum time ins second a printer object waits + * before time out and recovery. The printer object waits e.g. for + * additional SendDocument or SendUri operations. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class MultipleOperationTimeOut extends IntegerSyntax + implements Attribute +{ + + /** + * Creates a <code>MultipleOperationTimeOut</code> with the given value. + * + * @param value the integer to set + */ + public MultipleOperationTimeOut(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class <code>MultipleOperationTimeOut</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return MultipleOperationTimeOut.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "multiple-operation-time-out". + */ + public String getName() + { + return "multiple-operation-time-out"; + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/printer/NaturalLanguageConfigured.java b/libjava/classpath/gnu/javax/print/ipp/attribute/printer/NaturalLanguageConfigured.java new file mode 100644 index 000000000..8dc05fe58 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/printer/NaturalLanguageConfigured.java @@ -0,0 +1,86 @@ +/* NaturalLanguageConfigured.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.printer; + +import gnu.javax.print.ipp.attribute.NaturalLanguageSyntax; + +import javax.print.attribute.Attribute; + +/** + * NaturalLanguageConfigured attribute as described in RFC 2911 + * section 4.4.19 provides the natural language which is configured + * by the server to be used in the name and text syntax attribute types. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class NaturalLanguageConfigured extends NaturalLanguageSyntax + implements Attribute +{ + + /** + * Creates a <code>NaturalLanguageConfigured</code> object. + * + * @param value the charset string value. + */ + public NaturalLanguageConfigured(String value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class <code>NaturalLanguageConfigured</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return NaturalLanguageConfigured.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "natural-language-configured". + */ + public String getName() + { + return "natural-language-configured"; + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/printer/PrinterCurrentTime.java b/libjava/classpath/gnu/javax/print/ipp/attribute/printer/PrinterCurrentTime.java new file mode 100644 index 000000000..361916773 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/printer/PrinterCurrentTime.java @@ -0,0 +1,107 @@ +/* PrinterCurrentTime.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.printer; + +import java.util.Date; + +import javax.print.attribute.Attribute; +import javax.print.attribute.DateTimeSyntax; +import javax.print.attribute.PrintServiceAttribute; + +/** + * PrinterCurrentTime attribute as described in RFC 2911 section + * 4.4.30 provides the current time of the print service. + * Its to be used by other attributes like the date-time-at-xxx + * attributes in the creation process. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class PrinterCurrentTime extends DateTimeSyntax + implements PrintServiceAttribute +{ + + /** + * Creates a <code>PrinterCurrentTime</code> object. + * + * @param value the date at creation time + * + * @exception NullPointerException if value is null + */ + public PrinterCurrentTime(Date value) + { + super(value); + } + + /** + * 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, + * <code>false</code> otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof PrinterCurrentTime)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class <code>PrinterCurrentTime</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return PrinterCurrentTime.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "printer-current-time". + */ + public String getName() + { + return "printer-current-time"; + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/printer/PrinterDriverInstaller.java b/libjava/classpath/gnu/javax/print/ipp/attribute/printer/PrinterDriverInstaller.java new file mode 100644 index 000000000..28a2f4485 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/printer/PrinterDriverInstaller.java @@ -0,0 +1,88 @@ +/* PrinterDriverInstaller.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.printer; + +import java.net.URI; + +import javax.print.attribute.Attribute; +import javax.print.attribute.URISyntax; + +/** + * PrinterDriverInstaller attribute as described in RFC 2911 section + * 4.4.81 provides the URI where a printer driver installer + * can be found. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class PrinterDriverInstaller extends URISyntax + implements Attribute +{ + + /** + * Creates a <code>PrinterDriverInstaller</code> object. + * + * @param uri the URI value for the syntax + * @throws NullPointerException if uri is null + */ + public PrinterDriverInstaller(URI uri) + { + super(uri); + } + + /** + * Returns category of this class. + * + * @return The class <code>PrinterDriverInstaller</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return PrinterDriverInstaller.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "printer-driver-installer". + */ + public String getName() + { + return "printer-driver-installer"; + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/printer/PrinterStateMessage.java b/libjava/classpath/gnu/javax/print/ipp/attribute/printer/PrinterStateMessage.java new file mode 100644 index 000000000..07c458889 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/printer/PrinterStateMessage.java @@ -0,0 +1,94 @@ +/* PrinterStateMessage.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.printer; + +import java.util.Locale; + +import javax.print.attribute.Attribute; +import javax.print.attribute.PrintServiceAttribute; +import javax.print.attribute.TextSyntax; + +/** + * PrinterStateMessage attribute as described in RFC 2911 section + * 4.4.13 provides a textual representation of the attributes + * printer-state and printer-state-reasons for consumption by + * humans. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class PrinterStateMessage extends TextSyntax + implements PrintServiceAttribute +{ + + /** + * Creates a <code>PrinterStateMessage</code> object with the + * given value and locale. + * + * @param value the value for this syntax + * @param locale the locale to use, if <code>null</code> the default + * locale is used. + * + * @exception NullPointerException if value is null + */ + public PrinterStateMessage(String value, Locale locale) + { + super(value, locale); + } + + /** + * Returns category of this class. + * + * @return The class <code>PrinterStateMessage</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return PrinterStateMessage.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "printer-state-message". + */ + public String getName() + { + return "printer-state-message"; + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/printer/PrinterUpTime.java b/libjava/classpath/gnu/javax/print/ipp/attribute/printer/PrinterUpTime.java new file mode 100644 index 000000000..7bec92ed3 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/printer/PrinterUpTime.java @@ -0,0 +1,86 @@ +/* PrinterUpTime.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.printer; + +import javax.print.attribute.Attribute; +import javax.print.attribute.IntegerSyntax; + +/** + * PrinterUpTime attribute as described in RFC 2911 section + * 4.4.29 provides the uptime of the printer object. This + * is a value in second starting at 1 after a initialization + * or reboot of the printer object. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class PrinterUpTime extends IntegerSyntax + implements Attribute +{ + + /** + * Creates a <code>PrinterUpTime</code> with the given value. + * + * @param value the integer to set + */ + public PrinterUpTime(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class <code>PrinterUpTime</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return PrinterUpTime.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "printer-up-time". + */ + public String getName() + { + return "printer-up-time"; + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/supported/CharsetSupported.java b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/CharsetSupported.java new file mode 100644 index 000000000..22b484ef8 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/CharsetSupported.java @@ -0,0 +1,88 @@ +/* CharsetSupported.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +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 + * attribute types. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class CharsetSupported extends CharsetSyntax + implements SupportedValuesAttribute +{ + + /** + * Creates a <code>CharsetSupported</code> object. + * + * @param value the charset string value. + */ + public CharsetSupported(String value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class <code>CharsetSupported</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return CharsetSupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "charset-supported". + */ + public String getName() + { + return "charset-supported"; + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/supported/CompressionSupported.java b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/CompressionSupported.java new file mode 100644 index 000000000..768091cb2 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/CompressionSupported.java @@ -0,0 +1,161 @@ +/* CompressionSupported.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.javax.print.ipp.attribute.supported; + +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; + + +/** + * <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", + "gzip", "compress" }; + + private static final CompressionSupported[] enumValueTable = { NONE, DEFLATE, + GZIP, COMPRESS }; + + /** + * Constructs a <code>CompressionSupported</code> object. + * + * @param value the enum value + */ + protected CompressionSupported(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class <code>CompressionSupported</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return CompressionSupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "compression-supported". + */ + public String getName() + { + return "compression-supported"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + 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() + { + 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<Attribute> set) + { + Compression[] result = new Compression[set.size()]; + int j = 0; + for (Attribute tmp : set) + { + result[j] = ((CompressionSupported) tmp).getAssociatedAttribute(); + j++; + } + return result; + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/supported/DocumentFormatSupported.java b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/DocumentFormatSupported.java new file mode 100644 index 000000000..03449fa4f --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/DocumentFormatSupported.java @@ -0,0 +1,92 @@ +/* DocumentFormatSupported.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +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 + implements SupportedValuesAttribute +{ + + /** + * Creates a <code>DocumentFormatSupported</code> object with the + * given value and locale. + * + * @param value the value for this syntax + * @param locale the locale to use, if <code>null</code> the default + * locale is used. + * + * @exception NullPointerException if value is null + */ + public DocumentFormatSupported(String value, Locale locale) + { + super(value, locale); + } + + /** + * Returns category of this class. + * + * @return The class <code>DocumentFormatSupported</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return DocumentFormatSupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "document-format-supported". + */ + public String getName() + { + return "document-format-supported"; + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/supported/FinishingsSupported.java b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/FinishingsSupported.java new file mode 100644 index 000000000..f271fa71b --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/FinishingsSupported.java @@ -0,0 +1,302 @@ +/* FinishingsSupported.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.supported; + +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; + + +/** + * 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 + implements SupportedValuesAttribute +{ + + /** 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. + */ + public static final FinishingsSupported SADDLE_STITCH = + new FinishingsSupported(8); + + /** + * Bind the document(s) with one or more staples (wire stitches) + * along one edge. + */ + public static final FinishingsSupported EDGE_STITCH = + new FinishingsSupported(9); + + /** + * Bind the document(s) with one or more staples in the top left + * corner. + */ + public static final FinishingsSupported STAPLE_TOP_LEFT = + new FinishingsSupported(20); + + /** + * Bind the document(s) with one or more staples in the bottom + * left corner. + */ + 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 = + new FinishingsSupported(22); + + /** + * Bind the document(s) with one or more staples in the bottom right corner. + */ + public static final FinishingsSupported STAPLE_BOTTOM_RIGHT = + new FinishingsSupported(23); + + /** + * Bind the document(s) with one or more staples (wire stitches) + * along the left edge. + */ + public static final FinishingsSupported EDGE_STITCH_LEFT = + new FinishingsSupported(24); + + /** + * Bind the document(s) with one or more staples (wire stitches) along + * the top edge. + */ + public static final FinishingsSupported EDGE_STITCH_TOP = + new FinishingsSupported(25); + + /** + * Bind the document(s) with one or more staples (wire stitches) along + * the right edge. + */ + 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. + */ + public static final FinishingsSupported EDGE_STITCH_BOTTOM = + new FinishingsSupported(27); + + /** + * Bind the document(s) with two staples (wire stitches) along the + * left edge assuming a portrait document. + */ + public static final FinishingsSupported STAPLE_DUAL_LEFT = + new FinishingsSupported(28); + + /** + * Bind the document(s) with two staples (wire stitches) along the + * top edge assuming a portrait document. + */ + public static final FinishingsSupported STAPLE_DUAL_TOP = + new FinishingsSupported(29); + + /** + * Bind the document(s) with two staples (wire stitches) along the + * right edge assuming a portrait document. + */ + public static final FinishingsSupported STAPLE_DUAL_RIGHT = + new FinishingsSupported(30); + + /** + * Bind the document(s) with two staples (wire stitches) along the + * bottom edge assuming a portrait document. + */ + public static final FinishingsSupported STAPLE_DUAL_BOTTOM = + new FinishingsSupported(31); + + 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-right", + "edge-stitch-left", + "edge-stitch-top", + "edge-stitch-right", + "edge-stitch-bottom", + "staple-dual-left", + "staple-dual-top", + "staple-dual-right", + "staple-dual-bottom" }; + + private static final FinishingsSupported[] enumValueTable = { 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_RIGHT, + EDGE_STITCH_LEFT, + EDGE_STITCH_TOP, + EDGE_STITCH_RIGHT, + EDGE_STITCH_BOTTOM, + STAPLE_DUAL_LEFT, + STAPLE_DUAL_TOP, + STAPLE_DUAL_RIGHT, + STAPLE_DUAL_BOTTOM }; + + /** + * Constructs a <code>FinishingsSupported</code> object. + * + * @param value the value + */ + protected FinishingsSupported(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return the class <code>FinishingsSupported</code> itself + */ + public Class<? extends Attribute> getCategory() + { + return FinishingsSupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "finishings-supported". + */ + public String getName() + { + return "finishings-supported"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } + + /** + * Returns the lowest used value by the enumerations of this class. + * . + * @return The lowest value used. + */ + protected int getOffset() + { + 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() + { + 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<Attribute> set) + { + Finishings[] result = new Finishings[set.size()]; + int j = 0; + for (Attribute tmp : set) + { + result[j] = ((FinishingsSupported) tmp).getAssociatedAttribute(); + j++; + } + return result; + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/supported/GeneratedNaturalLanguageSupported.java b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/GeneratedNaturalLanguageSupported.java new file mode 100644 index 000000000..df1d33007 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/GeneratedNaturalLanguageSupported.java @@ -0,0 +1,89 @@ +/* GeneratedNaturalLanguageSupported.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +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 + * in RFC 2911 section 4.4.20 provides the natural languages + * 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 + implements SupportedValuesAttribute +{ + + /** + * Creates a <code>GeneratedNaturalLanguageSupported</code> object. + * + * @param value the charset string value. + */ + public GeneratedNaturalLanguageSupported(String value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class <code>GeneratedNaturalLanguageSupported</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return GeneratedNaturalLanguageSupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "generated-natural-language-supported". + */ + public String getName() + { + return "generated-natural-language-supported"; + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/supported/IppVersionsSupported.java b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/IppVersionsSupported.java new file mode 100644 index 000000000..072d7499a --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/IppVersionsSupported.java @@ -0,0 +1,122 @@ +/* IppVersionsSupported.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +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; + +/** + * 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 + 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 = + new IppVersionsSupported(0); + + /** IPP version 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, + V_1_1 }; + + /** + * Constructs a <code>IppVersionsSupported</code> object. + * + * @param value the enum value + */ + public IppVersionsSupported(int value) + { + super(value); + } + + /** + * Returns the category of this class. + * + * @return The class <code>IppVersionsSupported</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return IppVersionsSupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "ipp-versions-supported". + */ + public String getName() + { + return "ipp-versions-supported"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/supported/JobHoldUntilSupported.java b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/JobHoldUntilSupported.java new file mode 100644 index 000000000..2add4a0cd --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/JobHoldUntilSupported.java @@ -0,0 +1,134 @@ +/* JobHoldUntilSupported.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +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 + implements SupportedValuesAttribute +{ + + // 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 = + new JobHoldUntilSupported("no-hold", null); + + /** Job should be hold indefinitely. */ + public static final JobHoldUntilSupported INDEFINITE = + new JobHoldUntilSupported("indefinite", null); + + /** Job should be processed during the day. */ + public static final JobHoldUntilSupported DAY_TIME = + new JobHoldUntilSupported("day-time", null); + + /** Job should be processed in the evening. */ + public static final JobHoldUntilSupported EVENING = + new JobHoldUntilSupported("evening", null); + + /** Job should be processed during night. */ + public static final JobHoldUntilSupported NIGHT = + new JobHoldUntilSupported("night", null); + + /** Job should be processed during the weekend. */ + public static final JobHoldUntilSupported WEEKEND = + new JobHoldUntilSupported("weekend", null); + + /** + * Job should be processed as second-shift + * (after close of business). + */ + public static final JobHoldUntilSupported SECOND_SHIFT = + new JobHoldUntilSupported("second-shift", null); + + /** + * Job should be processed as third-shift + * (after midnight). + */ + public static final JobHoldUntilSupported THIRD_SHIFT = + new JobHoldUntilSupported("third-shift", null); + + /** + * Creates a <code>JobHoldUntilSupported</code> object with the + * given value and locale. + * + * @param value the value for this syntax + * @param locale the locale to use, if <code>null</code> the default + * locale is used. + * + * @throws NullPointerException if value is null + */ + public JobHoldUntilSupported(String value, Locale locale) + { + super(value, locale); + } + + /** + * Returns category of this class. + * + * @return The class <code>JobHoldUntilSupported</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return JobHoldUntilSupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-hold-until-supported". + */ + public String getName() + { + return "job-hold-until-supported"; + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/supported/JobSheetsSupported.java b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/JobSheetsSupported.java new file mode 100644 index 000000000..aeb86ff10 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/JobSheetsSupported.java @@ -0,0 +1,148 @@ +/* JobSheetsSupported.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.supported; + +import gnu.javax.print.ipp.attribute.defaults.JobSheetsDefault; + +import java.util.ArrayList; +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.JobSheets; + +/** + * JobSheetsSupported attribute provides the supported values + * of the job-sheets attribute. + * + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class JobSheetsSupported extends TextSyntax + implements SupportedValuesAttribute +{ + //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 = + new JobSheetsDefault("none", Locale.getDefault()); + + /** A job sheet is the default */ + public static final JobSheetsDefault STANDARD = + new JobSheetsDefault("standard", Locale.getDefault()); + + /** + * Creates a <code>JobSheetsSupported</code> object with the + * given value and locale. + * + * @param value the value for this syntax + * @param locale the locale to use, if <code>null</code> the default + * locale is used. + * + * @throws NullPointerException if value is null + */ + public JobSheetsSupported(String value, Locale locale) + { + super(value, locale); + } + + /** + * Returns category of this class. + * + * @return The class <code>JobSheetsSupported</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return JobSheetsSupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-sheets-supported". + */ + public String getName() + { + 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() + { + 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<Attribute> set) + { + ArrayList<JobSheets> result = new ArrayList<JobSheets>(); + int j = 0; + for (Attribute tmp : set) + { + JobSheets att = ((JobSheetsSupported) tmp).getAssociatedAttribute(); + if (att != null) + result.add(att); + j++; + } + return result.toArray(new JobSheets[result.size()]); + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/supported/MediaSupported.java b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/MediaSupported.java new file mode 100644 index 000000000..2684ebbec --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/MediaSupported.java @@ -0,0 +1,116 @@ +/* MediaSupported.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.print.ipp.attribute.supported; + +import gnu.javax.print.ipp.IppUtilities; + +import java.util.ArrayList; +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; + +/** + * 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 + implements SupportedValuesAttribute +{ + + /** + * Creates a <code>MediaSupported</code> object with the + * given value and locale. + * + * @param value the value for this syntax + * @param locale the locale to use, if <code>null</code> the default + * locale is used. + * + * @throws NullPointerException if value is null + */ + public MediaSupported(String value, Locale locale) + { + super(value, locale); + } + + /** + * Returns category of this class. + * + * @return The class <code>MediaSupported</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return MediaSupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "media-supported". + */ + public String getName() + { + 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<Attribute> set) + { + Media tmp2; + ArrayList<Media> result = new ArrayList<Media>(); + for (Attribute tmp : set) + { + tmp2 = (Media) IppUtilities.getEnumAttribute("media", tmp.toString()); + if (tmp2 != null) + result.add(tmp2); + } + return result.toArray(new Media[result.size()]); + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/supported/MultipleDocumentHandlingSupported.java b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/MultipleDocumentHandlingSupported.java new file mode 100644 index 000000000..73e5921f1 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/MultipleDocumentHandlingSupported.java @@ -0,0 +1,176 @@ +/* MultipleDocumentHandlingSupported.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.javax.print.ipp.attribute.supported; + +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; + + +/** + * <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 + * 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. + */ + public static final MultipleDocumentHandlingSupported SINGLE_DOCUMENT_NEW_SHEET = + new MultipleDocumentHandlingSupported(3); + + private static final String[] stringTable = { "single-document", + "separate-documents-uncollated-copies", + "separate-documents-collated-copies", + "single-document-new-sheet" }; + + 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) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class <code>MultipleDocumentHandlingSupported</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return MultipleDocumentHandlingSupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "multiple-document-handling-supported". + */ + public String getName() + { + return "multiple-document-handling-supported"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + 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() + { + 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<Attribute> set) + { + MultipleDocumentHandling[] result = new MultipleDocumentHandling[set.size()]; + int j = 0; + for (Attribute tmp : set) + { + result[j] = ((MultipleDocumentHandlingSupported) tmp).getAssociatedAttribute(); + j++; + } + return result; + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/supported/MultipleDocumentJobsSupported.java b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/MultipleDocumentJobsSupported.java new file mode 100644 index 000000000..1b2998456 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/MultipleDocumentJobsSupported.java @@ -0,0 +1,119 @@ +/* MultipleDocumentJobsSupported.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +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 + implements SupportedValuesAttribute +{ + + /** Multiple documents per job are not supported. */ + public static final MultipleDocumentJobsSupported NOT_SUPPORTED = + new MultipleDocumentJobsSupported(0); + + /** Multiple documents per job are supported. */ + public static final MultipleDocumentJobsSupported SUPPORTED = + new MultipleDocumentJobsSupported(1); + + private static final String[] stringTable = { "not-supported", "supported" }; + + private static final MultipleDocumentJobsSupported[] enumValueTable = + { NOT_SUPPORTED, SUPPORTED }; + + /** + * Constructs a <code>MultipleDocumentJobsSupported</code> object. + * + * @param value the enum value + */ + protected MultipleDocumentJobsSupported(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class <code>MultipleDocumentJobsSupported</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return MultipleDocumentJobsSupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "multiple-document-jobs-supported". + */ + public String getName() + { + return "multiple-document-jobs-supported"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/supported/OperationsSupported.java b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/OperationsSupported.java new file mode 100644 index 000000000..a059c89a5 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/OperationsSupported.java @@ -0,0 +1,231 @@ +/* OperationsSupported.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +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>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 + implements SupportedValuesAttribute +{ + /* + * Value Operation Name + ----------------- ------------------------------------- + 0x0000 reserved, not used + 0x0001 reserved, not used + 0x0002 Print-Job + 0x0003 Print-URI + 0x0004 Validate-Job + 0x0005 Create-Job + 0x0006 Send-Document + 0x0007 Send-URI + 0x0008 Cancel-Job + 0x0009 Get-Job-Attributes + 0x000A Get-Jobs + 0x000B Get-Printer-Attributes + 0x000C Hold-Job + 0x000D Release-Job + 0x000E Restart-Job + 0x000F reserved for a future operation + 0x0010 Pause-Printer + 0x0011 Resume-Printer + 0x0012 Purge-Jobs + 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 = + new OperationsSupported(0x02); + + /** Operation to print a document from an URI */ + public static final OperationsSupported PRINT_URI = + new OperationsSupported(0x03); + + /** Operation to validate a job before submission. */ + public static final OperationsSupported VALIDATE_JOB = + new OperationsSupported(0x04); + + /** + * Operation to create an initial job for use with multiple document per job. + */ + public static final OperationsSupported CREATE_JOB = + new OperationsSupported(0x05); + + /** + * Operation to send a document to a multidoc job created via CREATE_JOB + */ + 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. + */ + 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 = + new OperationsSupported(0x08); + + /** Operation to get job attributes of a current job. */ + public static final OperationsSupported GET_JOB_ATTRIBUTES = + new OperationsSupported(0x09); + + /** Operation to pause a 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 = + new OperationsSupported(0x0A); + + /** Operation to get the attributes of a printer. */ + 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 = + new OperationsSupported(0x0C); + + /** Operation to release a job by its ID or name. */ + 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 = + new OperationsSupported(0x0E); + + /** Not yet an operation - reserved for futher use. */ + public static final OperationsSupported RESERVED = + new OperationsSupported(0x0F); + + /** Operation to resume a 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 = + new OperationsSupported(0x12); + + + private static final String[] stringTable = { "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-job"}; + + 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) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class <code>OperationsSupported</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return OperationsSupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "operations-supported". + */ + public String getName() + { + return "operations-supported"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } + + // we start with 2 + protected int getOffset() + { + return 2; + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/supported/OrientationRequestedSupported.java b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/OrientationRequestedSupported.java new file mode 100644 index 000000000..4b87c53a5 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/OrientationRequestedSupported.java @@ -0,0 +1,178 @@ +/* OrientationRequestedSupported.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.javax.print.ipp.attribute.supported; + +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 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); + + + private static final String[] stringTable = { "portrait", "landscape", + "reverse-landscape", + "reverse-portrait" }; + + 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) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class <code>OrientationRequestedSupported</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return OrientationRequestedSupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "orientation-requested-supported". + */ + public String getName() + { + return "orientation-requested-supported"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } + + /** + * Returns the lowest used value by the enumerations of this class. + * . + * @return The lowest value used. + */ + protected int getOffset() + { + 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() + { + 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<Attribute> set) + { + OrientationRequested[] result = new OrientationRequested[set.size()]; + int j = 0; + for (Attribute tmp : set) + { + result[j] = ((OrientationRequestedSupported) tmp).getAssociatedAttribute(); + j++; + } + return result; + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/supported/PageRangesSupported.java b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/PageRangesSupported.java new file mode 100644 index 000000000..c58f76748 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/PageRangesSupported.java @@ -0,0 +1,117 @@ +/* PageRangesSupported.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +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 = + new PageRangesSupported(0); + + /** Page ranges are 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) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class <code>PageRangesSupported</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return PageRangesSupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "page-ranges-supported". + */ + public String getName() + { + return "page-ranges-supported"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/supported/PrintQualitySupported.java b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/PrintQualitySupported.java new file mode 100644 index 000000000..25cbf9f0b --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/PrintQualitySupported.java @@ -0,0 +1,169 @@ +/* PrintQualitySupported.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.javax.print.ipp.attribute.supported; + +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; + + +/** + * <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 = + new PrintQualitySupported(3); + + /** Normal quality of the printer. */ + public static final PrintQualitySupported NORMAL = + new PrintQualitySupported(4); + + /** High quality of the printer. */ + public static final PrintQualitySupported HIGH = + new PrintQualitySupported(5); + + private static final String[] stringTable = { "draft", "normal", "high" }; + + 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) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class <code>PrintQualitySupported</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return PrintQualitySupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "print-quality-supported". + */ + public String getName() + { + return "print-quality-supported"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } + + /** + * Returns the lowest used value by the enumerations of this class. + * . + * @return The lowest value used. + */ + protected int getOffset() + { + 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() + { + 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<Attribute> set) + { + PrintQuality[] result = new PrintQuality[set.size()]; + int j = 0; + for (Attribute tmp : set) + { + result[j] = ((PrintQualitySupported) tmp).getAssociatedAttribute(); + j++; + } + return result; + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/supported/PrinterResolutionSupported.java b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/PrinterResolutionSupported.java new file mode 100644 index 000000000..eb50aaac5 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/PrinterResolutionSupported.java @@ -0,0 +1,142 @@ +/* PrinterResolutionSupported.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +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 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 + * given arguments. + * + * @param crossFeedResolution the cross feed resolution + * @param feedResolution the feed resolution + * @param units the unit to use (e.g. {@link #DPCM} or {@link #DPI}) + * + * @exception IllegalArgumentException if preconditions fail + */ + 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, + * <code>false</code> otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof PrinterResolutionSupported)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class <code>PrinterResolutionSupported</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return PrinterResolutionSupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "printer-resolution-supported". + */ + public String getName() + { + 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() + { + 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<Attribute> set) + { + PrinterResolution[] result = new PrinterResolution[set.size()]; + int j = 0; + for (Attribute tmp : set) + { + result[j] = ((PrinterResolutionSupported) tmp).getAssociatedAttribute(); + j++; + } + return result; + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/supported/PrinterUriSupported.java b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/PrinterUriSupported.java new file mode 100644 index 000000000..0eed39c6c --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/PrinterUriSupported.java @@ -0,0 +1,89 @@ +/* PrinterUriSupported.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +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; + +/** + * 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 + implements SupportedValuesAttribute +{ + + /** + * Creates a <code>PrinterUriSupported</code> object. + * + * @param uri the URI value for the syntax + * @throws NullPointerException if uri is null + */ + public PrinterUriSupported(URI uri) + { + super(uri); + } + + /** + * Returns category of this class. + * + * @return The class <code>PrinterUriSupported</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return PrinterUriSupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "printer-uri-supported". + */ + public String getName() + { + return "printer-uri-supported"; + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/supported/SidesSupported.java b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/SidesSupported.java new file mode 100644 index 000000000..eff82c143 --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/SidesSupported.java @@ -0,0 +1,137 @@ +/* SidesSupported.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +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>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 + * front and back of one sheet for binding on the long edge. + */ + public static final SidesSupported TWO_SIDED_LONG_EDGE = + new SidesSupported(1); + + /** + * 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 = + 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", + "two-sided-long-edge", + "two-sided-short-edge" }; + + private static final SidesSupported[] + enumValueTable = { ONE_SIDED, TWO_SIDED_LONG_EDGE, + TWO_SIDED_SHORT_EDGE }; + + + /** + * Creates a <code>SidesSupported</code> object. + * + * @param value the value of the enum + */ + protected SidesSupported(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class <code>SidesSupported</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return SidesSupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "sides-supported". + */ + public String getName() + { + return "sides-supported"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/supported/UriAuthenticationSupported.java b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/UriAuthenticationSupported.java new file mode 100644 index 000000000..dc1a29f5c --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/UriAuthenticationSupported.java @@ -0,0 +1,142 @@ +/* UriAuthenticationSupported.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +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 + * 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 + 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 = + 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 = + new UriAuthenticationSupported(1); + + /** Supports HTTP basic authentication (RFC 2617) */ + public static final UriAuthenticationSupported BASIC = + new UriAuthenticationSupported(2); + + /** Supports HTTP digest authentication (RFC 2617) */ + public static final UriAuthenticationSupported DIGEST = + new UriAuthenticationSupported(3); + + /** Supports authentication through a client provided certificate */ + public static final UriAuthenticationSupported CERTIFICATE = + new UriAuthenticationSupported(4); + + private static final String[] stringTable = { "none", + "requesting-user-name", + "basic", "digest", + "certificate" }; + + 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) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class <code>UriAuthenticationSupported</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return UriAuthenticationSupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "uri-authentication-supported". + */ + public String getName() + { + return "uri-authentication-supported"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } + +} diff --git a/libjava/classpath/gnu/javax/print/ipp/attribute/supported/UriSecuritySupported.java b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/UriSecuritySupported.java new file mode 100644 index 000000000..03396978f --- /dev/null +++ b/libjava/classpath/gnu/javax/print/ipp/attribute/supported/UriSecuritySupported.java @@ -0,0 +1,127 @@ +/* UriSecuritySupported.java -- + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +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; + +/** + * UriSecuritySupported attribute as described in RFC 2911 section + * 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 + 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 = + new UriSecuritySupported(0); + + /** The URI has SSL3 communication */ + public static final UriSecuritySupported SSL3 = + new UriSecuritySupported(1); + + /** The URI has TLS (RFC 2246) communication */ + public static final UriSecuritySupported TLS = + new UriSecuritySupported(2); + + private static final String[] stringTable = { "none", "ssl3", "tls" }; + + private static final UriSecuritySupported[] enumValueTable = { NONE, + SSL3, TLS }; + + /** + * Constructs a <code>UriSecuritySupported</code> object. + * + * @param value the enum value + */ + public UriSecuritySupported(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class <code>UriSecuritySupported</code> itself. + */ + public Class<? extends Attribute> getCategory() + { + return UriSecuritySupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "uri-security-supported". + */ + public String getName() + { + return "uri-security-supported"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } + +} |