KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > print > attribute > standard > RequestingUserName


1 /*
2  * @(#)RequestingUserName.java 1.10 04/05/05
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7 package javax.print.attribute.standard;
8
9 import java.util.Locale JavaDoc;
10
11 import javax.print.attribute.Attribute JavaDoc;
12 import javax.print.attribute.TextSyntax JavaDoc;
13 import javax.print.attribute.PrintRequestAttribute JavaDoc;
14
15 /**
16  * Class RequestingUserName is a printing attribute class, a text attribute,
17  * that specifies the name of the end user that submitted the print job. A
18  * requesting user name is an arbitrary string defined by the client. The
19  * printer does not put the client-specified RequestingUserName attribute into
20  * the Print Job's attribute set; rather, the printer puts in a {@link
21  * JobOriginatingUserName JobOriginatingUserName} attribute.
22  * This means that services which support specifying a username with this
23  * attribute should also report a JobOriginatingUserName in the job's
24  * attribute set. Note that many print services may have a way to independently
25  * authenticate the user name, and so may state support for a
26  * requesting user name, but in practice will then report the user name
27  * authenticated by the service rather than that specified via this
28  * attribute.
29  * <P>
30  * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
31  * locale gives the IPP natural language. The category name returned by
32  * <CODE>getName()</CODE> gives the IPP attribute name.
33  * <P>
34  *
35  * @author Alan Kaminsky
36  */

37 public final class RequestingUserName extends TextSyntax JavaDoc
38     implements PrintRequestAttribute JavaDoc {
39
40     private static final long serialVersionUID = -2683049894310331454L;
41
42     /**
43      * Constructs a new requesting user name attribute with the given user
44      * name and locale.
45      *
46      * @param userName User name.
47      * @param locale Natural language of the text string. null
48      * is interpreted to mean the default locale as returned
49      * by <code>Locale.getDefault()</code>
50      *
51      * @exception NullPointerException
52      * (unchecked exception) Thrown if <CODE>userName</CODE> is null.
53      */

54     public RequestingUserName(String JavaDoc userName, Locale JavaDoc locale) {
55     super (userName, locale);
56     }
57
58     /**
59      * Returns whether this requesting user name attribute is equivalent to
60      * the passed in object. To be equivalent, all of the following
61      * conditions must be true:
62      * <OL TYPE=1>
63      * <LI>
64      * <CODE>object</CODE> is not null.
65      * <LI>
66      * <CODE>object</CODE> is an instance of class RequestingUserName.
67      * <LI>
68      * This requesting user name attribute's underlying string and
69      * <CODE>object</CODE>'s underlying string are equal.
70      * <LI>
71      * This requesting user name attribute's locale and
72      * <CODE>object</CODE>'s locale are equal.
73      * </OL>
74      *
75      * @param object Object to compare to.
76      *
77      * @return True if <CODE>object</CODE> is equivalent to this requesting
78      * user name attribute, false otherwise.
79      */

80     public boolean equals(Object JavaDoc object) {
81     return (super.equals(object) &&
82         object instanceof RequestingUserName JavaDoc);
83     }
84
85     /**
86      * Get the printing attribute class which is to be used as the "category"
87      * for this printing attribute value.
88      * <P>
89      * For class RequestingUserName, the
90      * category is class RequestingUserName itself.
91      *
92      * @return Printing attribute class (category), an instance of class
93      * {@link java.lang.Class java.lang.Class}.
94      */

95     public final Class JavaDoc<? extends Attribute JavaDoc> getCategory() {
96     return RequestingUserName JavaDoc.class;
97     }
98
99     /**
100      * Get the name of the category of which this attribute value is an
101      * instance.
102      * <P>
103      * For class RequestingUserName, the
104      * category name is <CODE>"requesting-user-name"</CODE>.
105      *
106      * @return Attribute category name.
107      */

108     public final String JavaDoc getName() {
109     return "requesting-user-name";
110     }
111
112 }
113
Popular Tags