Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.naming/share/classes/com/sun/jndi/ldap/UnsolicitedResponseImpl.java
41161 views
1
/*
2
* Copyright (c) 1999, 2011, 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
23
* questions.
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
44
UnsolicitedResponseImpl(String oid, byte[] berVal, Vector<Vector<String>> ref,
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++) {
53
// ref is a list of single-String Vectors
54
referrals[i] = ref.elementAt(i).elementAt(0);
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
68
* {@code ExtendedResponse.responseName} component.
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
82
* contents of the LDAP {@code ExtendedResponse.response}
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
}
116
117