1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.api.ldap.model.exception;
21
22
23 import java.util.ArrayList;
24 import java.util.Collection;
25 import java.util.List;
26 import java.util.Map;
27
28 import javax.naming.Context;
29 import javax.naming.NamingException;
30
31 import org.apache.directory.api.ldap.model.message.ResultCodeEnum;
32 import org.apache.directory.api.ldap.model.name.Dn;
33 import org.apache.directory.api.util.exception.NotImplementedException;
34
35
36
37
38
39
40
41
42 public class LdapReferralException extends AbstractLdapReferralException
43 {
44
45 static final long serialVersionUID = 1L;
46
47
48 private final List<String> refs;
49
50
51 private int index = 0;
52
53
54 private Dn remainingDn;
55
56
57 private Object resolvedObject;
58
59
60
61
62
63
64
65
66 public LdapReferralException( Collection<String> refs )
67 {
68 super( null );
69 this.refs = new ArrayList<>( refs );
70 }
71
72
73
74
75
76
77
78
79
80 public LdapReferralException( Collection<String> refs, String explanation )
81 {
82 super( explanation );
83 this.refs = new ArrayList<>( refs );
84 }
85
86
87
88
89
90
91
92 @Override
93 public ResultCodeEnum getResultCode()
94 {
95 return ResultCodeEnum.REFERRAL;
96 }
97
98
99
100
101
102 public String getReferralInfo()
103 {
104 return refs.get( index );
105 }
106
107
108 @Override
109 public Context getReferralContext() throws NamingException
110 {
111 throw new NotImplementedException();
112 }
113
114
115 @Override
116 public Context getReferralContext( Map<?, ?> arg ) throws NamingException
117 {
118 throw new NotImplementedException();
119 }
120
121
122
123
124
125
126 public boolean skipReferral()
127 {
128 index++;
129 return index < refs.size();
130 }
131
132
133 @Override
134 public void retryReferral()
135 {
136 throw new NotImplementedException();
137 }
138
139
140
141
142
143 @Override
144 public Dn getRemainingDn()
145 {
146 return remainingDn;
147 }
148
149
150
151
152
153 @Override
154 public void setRemainingDn( Dn remainingDn )
155 {
156 this.remainingDn = remainingDn;
157 }
158
159
160
161
162
163 @Override
164 public Object getResolvedObject()
165 {
166 return resolvedObject;
167 }
168
169
170
171
172
173 @Override
174 public void setResolvedObject( Object resolvedObject )
175 {
176 this.resolvedObject = resolvedObject;
177 }
178 }