1 /*
2 * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
51
52 /**
53 * @serial
54 */
55 private String name;
56
57 /**
58 * Create an <code>NTDomainPrincipal</code> with a Windows NT domain name.
59 *
60 * <p>
61 *
62 * @param name the Windows NT domain name for this user. <p>
63 *
64 * @exception NullPointerException if the <code>name</code>
65 * is <code>null</code>.
66 */
67 public NTDomainPrincipal(String name) {
68 if (name == null) {
69 java.text.MessageFormat form = new java.text.MessageFormat
70 (sun.security.util.ResourcesMgr.getString
71 ("invalid null input: value",
72 "sun.security.util.AuthResources"));
73 Object[] source = {"name"};
74 throw new NullPointerException(form.format(source));
75 }
76 this.name = name;
77 }
78
79 /**
80 * Return the Windows NT domain name for this
81 * <code>NTDomainPrincipal</code>.
82 *
83 * <p>
84 *
85 * @return the Windows NT domain name for this
86 * <code>NTDomainPrincipal</code>
87 */
88 public String getName() {
89 return name;
90 }
91
92 /**
93 * Return a string representation of this <code>NTDomainPrincipal</code>.
94 *
95 * <p>
96 *
97 * @return a string representation of this <code>NTDomainPrincipal</code>.
98 */
99 public String toString() {
100 java.text.MessageFormat form = new java.text.MessageFormat
101 (sun.security.util.ResourcesMgr.getString
102 ("NTDomainPrincipal: name",
103 "sun.security.util.AuthResources"));
104 Object[] source = {name};
105 return form.format(source);
106 }
107
108 /**
109 * Compares the specified Object with this <code>NTDomainPrincipal</code>
110 * for equality. Returns true if the given object is also a
111 * <code>NTDomainPrincipal</code> and the two NTDomainPrincipals
112 * have the same name.
113 *
114 * <p>
115 *
116 * @param o Object to be compared for equality with this
117 * <code>NTDomainPrincipal</code>.
118 *
119 * @return true if the specified Object is equal equal to this
120 * <code>NTDomainPrincipal</code>.
121 */
122 public boolean equals(Object o) {
|
1 /*
2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
51
52 /**
53 * @serial
54 */
55 private String name;
56
57 /**
58 * Create an <code>NTDomainPrincipal</code> with a Windows NT domain name.
59 *
60 * <p>
61 *
62 * @param name the Windows NT domain name for this user. <p>
63 *
64 * @exception NullPointerException if the <code>name</code>
65 * is <code>null</code>.
66 */
67 public NTDomainPrincipal(String name) {
68 if (name == null) {
69 java.text.MessageFormat form = new java.text.MessageFormat
70 (sun.security.util.ResourcesMgr.getString
71 ("invalid.null.input.value",
72 "sun.security.util.AuthResources"));
73 Object[] source = {"name"};
74 throw new NullPointerException(form.format(source));
75 }
76 this.name = name;
77 }
78
79 /**
80 * Return the Windows NT domain name for this
81 * <code>NTDomainPrincipal</code>.
82 *
83 * <p>
84 *
85 * @return the Windows NT domain name for this
86 * <code>NTDomainPrincipal</code>
87 */
88 public String getName() {
89 return name;
90 }
91
92 /**
93 * Return a string representation of this <code>NTDomainPrincipal</code>.
94 *
95 * <p>
96 *
97 * @return a string representation of this <code>NTDomainPrincipal</code>.
98 */
99 public String toString() {
100 java.text.MessageFormat form = new java.text.MessageFormat
101 (sun.security.util.ResourcesMgr.getString
102 ("NTDomainPrincipal.name",
103 "sun.security.util.AuthResources"));
104 Object[] source = {name};
105 return form.format(source);
106 }
107
108 /**
109 * Compares the specified Object with this <code>NTDomainPrincipal</code>
110 * for equality. Returns true if the given object is also a
111 * <code>NTDomainPrincipal</code> and the two NTDomainPrincipals
112 * have the same name.
113 *
114 * <p>
115 *
116 * @param o Object to be compared for equality with this
117 * <code>NTDomainPrincipal</code>.
118 *
119 * @return true if the specified Object is equal equal to this
120 * <code>NTDomainPrincipal</code>.
121 */
122 public boolean equals(Object o) {
|