author | lmesnik |
Tue, 02 Apr 2019 17:11:04 -0700 | |
changeset 54389 | 772f62a13376 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
10324
e28265130e4f
7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents:
5506
diff
changeset
|
2 |
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 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 |
* |
|
5506 | 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 |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
package com.sun.jndi.ldap; |
|
27 |
||
28 |
import javax.naming.ldap.UnsolicitedNotification; |
|
29 |
import javax.naming.NamingException; |
|
30 |
import javax.naming.ldap.Control; |
|
31 |
import java.util.Vector; |
|
32 |
||
33 |
/** |
|
34 |
* A concrete implementation of an UnsolicitedNotification. |
|
35 |
* @author Rosanna Lee |
|
36 |
*/ |
|
37 |
final class UnsolicitedResponseImpl implements UnsolicitedNotification { |
|
38 |
private String oid; |
|
39 |
private String[] referrals; |
|
40 |
private byte[] extensionValue; |
|
41 |
private NamingException exception; |
|
42 |
private Control[] controls; |
|
43 |
||
10324
e28265130e4f
7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents:
5506
diff
changeset
|
44 |
UnsolicitedResponseImpl(String oid, byte[] berVal, Vector<Vector<String>> ref, |
2 | 45 |
int status, String msg, String matchedDN, Control[] controls) { |
46 |
this.oid = oid; |
|
47 |
this.extensionValue = berVal; |
|
48 |
||
49 |
if (ref != null && ref.size() > 0) { |
|
50 |
int len = ref.size(); |
|
51 |
referrals = new String[len]; |
|
52 |
for (int i = 0; i < len; i++) { |
|
10324
e28265130e4f
7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents:
5506
diff
changeset
|
53 |
// ref is a list of single-String Vectors |
e28265130e4f
7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents:
5506
diff
changeset
|
54 |
referrals[i] = ref.elementAt(i).elementAt(0); |
2 | 55 |
} |
56 |
} |
|
57 |
exception = LdapCtx.mapErrorCode(status, msg); |
|
58 |
// matchedDN ignored for now; could be used to set resolvedName |
|
59 |
// exception.setResolvedName(new CompositeName().add(matchedDN)); |
|
60 |
||
61 |
this.controls = controls; |
|
62 |
} |
|
63 |
||
64 |
/** |
|
65 |
* Retrieves the object identifier of the response. |
|
66 |
* |
|
67 |
* @return A possibly null object identifier string representing the LDAP |
|
30655 | 68 |
* {@code ExtendedResponse.responseName} component. |
2 | 69 |
*/ |
70 |
public String getID() { |
|
71 |
return oid; |
|
72 |
} |
|
73 |
||
74 |
/** |
|
75 |
* Retrieves the ASN.1 BER encoded value of the LDAP extended operation |
|
76 |
* response. Null is returned if the value is absent from the response |
|
77 |
* sent by the LDAP server. |
|
78 |
* The result is the raw BER bytes including the tag and length of |
|
79 |
* the response value. It does not include the response OID. |
|
80 |
* |
|
81 |
* @return A possibly null byte array representing the ASN.1 BER encoded |
|
30655 | 82 |
* contents of the LDAP {@code ExtendedResponse.response} |
2 | 83 |
* component. |
84 |
*/ |
|
85 |
public byte[] getEncodedValue() { |
|
86 |
return extensionValue; |
|
87 |
} |
|
88 |
||
89 |
/** |
|
90 |
* Retrieves the referral(s) sent by the server. |
|
91 |
* |
|
92 |
* @return A possibly null array of referrals, each of which is represented |
|
93 |
* by a URL string. If null, no referral was sent by the server. |
|
94 |
*/ |
|
95 |
public String[] getReferrals() { |
|
96 |
return referrals; |
|
97 |
} |
|
98 |
||
99 |
/** |
|
100 |
* Retrieves the exception as constructed using information |
|
101 |
* sent by the server. |
|
102 |
* @return A possibly null exception as constructed using information |
|
103 |
* sent by the server. If null, a "success" status was indicated by |
|
104 |
* the server. |
|
105 |
*/ |
|
106 |
public NamingException getException() { |
|
107 |
return exception; |
|
108 |
} |
|
109 |
||
110 |
public Control[] getControls() throws NamingException { |
|
111 |
return controls; |
|
112 |
} |
|
113 |
||
114 |
private static final long serialVersionUID = 5913778898401784775L; |
|
115 |
} |