001 /* 002 * Copyright 2010-2015 UnboundID Corp. 003 * All Rights Reserved. 004 */ 005 /* 006 * Copyright (C) 2010-2015 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; 022 023 024 025 import com.unboundid.ldap.protocol.IntermediateResponseProtocolOp; 026 import com.unboundid.ldap.sdk.Control; 027 import com.unboundid.util.Extensible; 028 import com.unboundid.util.ThreadSafety; 029 import com.unboundid.util.ThreadSafetyLevel; 030 import com.unboundid.util.ObjectPair; 031 032 033 034 /** 035 * This interface may be implemented by a class which wishes to intercept and 036 * alter intermediate responses in some way before they are returned to the 037 * client, and/or to prevent them from being returned altogether. 038 */ 039 @Extensible() 040 @ThreadSafety(level=ThreadSafetyLevel.INTERFACE_THREADSAFE) 041 public interface IntermediateResponseTransformer 042 { 043 /** 044 * Transforms the provided intermediate response and/or set of controls to 045 * alter what will be returned to the client. 046 * 047 * @param messageID The message ID for the associated search operation. 048 * @param response The intermediate response to be processed. It will not 049 * be {@code null}. 050 * @param controls The set of controls to be processed. It will not be 051 * {@code null} but may be empty if there are no controls. 052 * 053 * @return An {@link ObjectPair} containing a possibly updated intermediate 054 * response and set of controls, or {@code null} to indicate that the 055 * response should not be returned to the client. 056 */ 057 ObjectPair<IntermediateResponseProtocolOp,Control[]> 058 transformIntermediateResponse(final int messageID, 059 final IntermediateResponseProtocolOp response, 060 final Control[] controls); 061 }