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