001 /*
002 * Copyright 2014-2016 UnboundID Corp.
003 * All Rights Reserved.
004 */
005 /*
006 * Copyright (C) 2014-2016 UnboundID Corp.
007 *
008 * This program is free software; you can redistribute it and/or modify
009 * it under the terms of the GNU General Public License (GPLv2 only)
010 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
011 * as published by the Free Software Foundation.
012 *
013 * This program is distributed in the hope that it will be useful,
014 * but WITHOUT ANY WARRANTY; without even the implied warranty of
015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
016 * GNU General Public License for more details.
017 *
018 * You should have received a copy of the GNU General Public License
019 * along with this program; if not, see <http://www.gnu.org/licenses>.
020 */
021 package com.unboundid.ldap.listener.interceptor;
022
023
024
025 import com.unboundid.ldap.sdk.LDAPException;
026
027 import com.unboundid.util.Extensible;
028 import com.unboundid.util.ThreadSafety;
029 import com.unboundid.util.ThreadSafetyLevel;
030
031
032
033 /**
034 * This class defines an API that may be used to intercept and potentially alter
035 * communication between an LDAP client and the in-memory directory server. An
036 * operation interceptor may be enabled for use with the in-memory directory
037 * server by registering it with the
038 * {@link com.unboundid.ldap.listener.InMemoryDirectoryServerConfig}. The
039 * default implementation of all methods defined in this class is to return the
040 * provided request or result without altering it in any way.
041 * <BR><BR>
042 * Note that any operation interceptors configured for use will be invoked only
043 * for requests received via LDAP. Operations processed via method calls made
044 * directly to the {@link com.unboundid.ldap.listener.InMemoryDirectoryServer}
045 * class via the {@link com.unboundid.ldap.sdk.LDAPInterface} interface will not
046 * cause any operation interceptors to be invoked.
047 */
048 @Extensible()
049 @ThreadSafety(level=ThreadSafetyLevel.INTERFACE_THREADSAFE)
050 public abstract class InMemoryOperationInterceptor
051 {
052 /**
053 * Invokes any processing that should be performed for the provided add
054 * request before it is passed to the in-memory directory server.
055 *
056 * @param request Information about the request that was received from the
057 * client.
058 *
059 * @throws LDAPException If the provided operation should not be passed onto
060 * the in-memory directory server, but the result
061 * represented by this exception should be used
062 * instead.
063 */
064 public void processAddRequest(final InMemoryInterceptedAddRequest request)
065 throws LDAPException
066 {
067 // No processing will be performed by default.
068 }
069
070
071
072 /**
073 * Invokes any processing that should be performed for the provided add result
074 * before it is returned to the client.
075 *
076 * @param result Information about the add result that is to be returned to
077 * the client.
078 */
079 public void processAddResult(final InMemoryInterceptedAddResult result)
080 {
081 // No processing will be performed by default.
082 }
083
084
085
086 /**
087 * Invokes any processing that should be performed for the provided simple
088 * bind request before it is passed to the in-memory directory server.
089 *
090 * @param request Information about the request that was received from the
091 * client.
092 *
093 * @throws LDAPException If the provided operation should not be passed onto
094 * the in-memory directory server, but the result
095 * represented by this exception should be used
096 * instead.
097 */
098 public void processSimpleBindRequest(
099 final InMemoryInterceptedSimpleBindRequest request)
100 throws LDAPException
101 {
102 // No processing will be performed by default.
103 }
104
105
106
107 /**
108 * Invokes any processing that should be performed for the provided simple
109 * bind result before it is returned to the client.
110 *
111 * @param result Information about the bind result that is to be returned to
112 * the client.
113 */
114 public void processSimpleBindResult(
115 final InMemoryInterceptedSimpleBindResult result)
116 {
117 // No processing will be performed by default.
118 }
119
120
121
122 /**
123 * Invokes any processing that should be performed for the provided SASL bind
124 * request before it is passed to the in-memory directory server.
125 *
126 * @param request Information about the request that was received from the
127 * client.
128 *
129 * @throws LDAPException If the provided operation should not be passed onto
130 * the in-memory directory server, but the result
131 * represented by this exception should be used
132 * instead.
133 */
134 public void processSASLBindRequest(
135 final InMemoryInterceptedSASLBindRequest request)
136 throws LDAPException
137 {
138 // No processing will be performed by default.
139 }
140
141
142
143 /**
144 * Invokes any processing that should be performed for the provided SASL bind
145 * result before it is returned to the client.
146 *
147 * @param result Information about the bind result that is to be returned to
148 * the client.
149 */
150 public void processSASLBindResult(
151 final InMemoryInterceptedSASLBindResult result)
152 {
153 // No processing will be performed by default.
154 }
155
156
157
158 /**
159 * Invokes any processing that should be performed for the provided compare
160 * request before it is passed to the in-memory directory server.
161 *
162 * @param request Information about the request that was received from the
163 * client.
164 *
165 * @throws LDAPException If the provided operation should not be passed onto
166 * the in-memory directory server, but the result
167 * represented by this exception should be used
168 * instead.
169 */
170 public void processCompareRequest(
171 final InMemoryInterceptedCompareRequest request)
172 throws LDAPException
173 {
174 // No processing will be performed by default.
175 }
176
177
178
179 /**
180 * Invokes any processing that should be performed for the provided compare
181 * result before it is returned to the client.
182 *
183 * @param result Information about the compare result that is to be returned
184 * to the client.
185 */
186 public void processCompareResult(
187 final InMemoryInterceptedCompareResult result)
188 {
189 // No processing will be performed by default.
190 }
191
192
193
194 /**
195 * Invokes any processing that should be performed for the provided delete
196 * request before it is passed to the in-memory directory server.
197 *
198 * @param request Information about the request that was received from the
199 * client.
200 *
201 * @throws LDAPException If the provided operation should not be passed onto
202 * the in-memory directory server, but the result
203 * represented by this exception should be used
204 * instead.
205 */
206 public void processDeleteRequest(
207 final InMemoryInterceptedDeleteRequest request)
208 throws LDAPException
209 {
210 // No processing will be performed by default.
211 }
212
213
214
215 /**
216 * Invokes any processing that should be performed for the provided delete
217 * result before it is returned to the client.
218 *
219 * @param result Information about the delete result that is to be returned
220 * to the client.
221 */
222 public void processDeleteResult(final InMemoryInterceptedDeleteResult result)
223 {
224 // No processing will be performed by default.
225 }
226
227
228
229 /**
230 * Invokes any processing that should be performed for the provided extended
231 * request before it is passed to the in-memory directory server.
232 *
233 * @param request Information about the request that was received from the
234 * client.
235 *
236 * @throws LDAPException If the provided operation should not be passed onto
237 * the in-memory directory server, but the result
238 * represented by this exception should be used
239 * instead.
240 */
241 public void processExtendedRequest(
242 final InMemoryInterceptedExtendedRequest request)
243 throws LDAPException
244 {
245 // No processing will be performed by default.
246 }
247
248
249
250 /**
251 * Invokes any processing that should be performed for the provided extended
252 * result before it is returned to the client.
253 *
254 * @param result Information about the extended result that is to be
255 * returned to the client.
256 */
257 public void processExtendedResult(
258 final InMemoryInterceptedExtendedResult result)
259 {
260 // No processing will be performed by default.
261 }
262
263
264
265 /**
266 * Invokes any processing that should be performed for the provided modify
267 * request before it is passed to the in-memory directory server.
268 *
269 * @param request Information about the request that was received from the
270 * client.
271 *
272 * @throws LDAPException If the provided operation should not be passed onto
273 * the in-memory directory server, but the result
274 * represented by this exception should be used
275 * instead.
276 */
277 public void processModifyRequest(
278 final InMemoryInterceptedModifyRequest request)
279 throws LDAPException
280 {
281 // No processing will be performed by default.
282 }
283
284
285
286 /**
287 * Invokes any processing that should be performed for the provided modify
288 * result before it is returned to the client.
289 *
290 * @param result Information about the modify result that is to be returned
291 * to the client.
292 */
293 public void processModifyResult(final InMemoryInterceptedModifyResult result)
294 {
295 // No processing will be performed by default.
296 }
297
298
299
300 /**
301 * Invokes any processing that should be performed for the provided modify DN
302 * request before it is passed to the in-memory directory server.
303 *
304 * @param request Information about the request that was received from the
305 * client.
306 *
307 * @throws LDAPException If the provided operation should not be passed onto
308 * the in-memory directory server, but the result
309 * represented by this exception should be used
310 * instead.
311 */
312 public void processModifyDNRequest(
313 final InMemoryInterceptedModifyDNRequest request)
314 throws LDAPException
315 {
316 // No processing will be performed by default.
317 }
318
319
320
321 /**
322 * Invokes any processing that should be performed for the provided modify DN
323 * result before it is returned to the client.
324 *
325 * @param result Information about the modify DN result that is to be
326 * returned to the client.
327 */
328 public void processModifyDNResult(
329 final InMemoryInterceptedModifyDNResult result)
330 {
331 // No processing will be performed by default.
332 }
333
334
335
336 /**
337 * Invokes any processing that should be performed for the provided search
338 * request before it is passed to the in-memory directory server.
339 *
340 * @param request Information about the request that was received from the
341 * client.
342 *
343 * @throws LDAPException If the provided operation should not be passed onto
344 * the in-memory directory server, but the result
345 * represented by this exception should be used
346 * instead.
347 */
348 public void processSearchRequest(
349 final InMemoryInterceptedSearchRequest request)
350 throws LDAPException
351 {
352 // No processing will be performed by default.
353 }
354
355
356
357 /**
358 * Invokes any processing that should be performed for the provided search
359 * result entry before it is returned to the client.
360 *
361 * @param entry Information about the search result entry to be returned
362 */
363 public void processSearchEntry(final InMemoryInterceptedSearchEntry entry)
364 {
365 // No processing will be performed by default.
366 }
367
368
369
370 /**
371 * Invokes any processing that should be performed for the provided search
372 * result reference before it is returned to the client.
373 *
374 * @param reference Information about the search result reference to be
375 * returned
376 */
377 public void processSearchReference(
378 final InMemoryInterceptedSearchReference reference)
379 {
380 // No processing will be performed by default.
381 }
382
383
384
385 /**
386 * Invokes any processing that should be performed for the provided search
387 * result before it is returned to the client.
388 *
389 * @param result Information about the search result that is to be returned
390 * to the client.
391 */
392 public void processSearchResult(final InMemoryInterceptedSearchResult result)
393 {
394 // No processing will be performed by default.
395 }
396
397
398
399 /**
400 * Invokes any processing that should be performed for the provided
401 * intermediate response before it is returned to the client.
402 *
403 * @param response Information about the intermediate response to be
404 * returned to the client.
405 */
406 public void processIntermediateResponse(
407 final InMemoryInterceptedIntermediateResponse response)
408 {
409 // No processing will be performed by default.
410 }
411 }