001 /*
002 * Copyright 2010-2014 UnboundID Corp.
003 * All Rights Reserved.
004 */
005 /*
006 * Copyright (C) 2010-2014 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.SearchResultReferenceProtocolOp;
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 search result references in some way before they are returned to the
037 * client, and/or to prevent them from being returned altogether. Search
038 * reference transformers may be enabled or disabled by adding them to or
039 * removing them from an {@link LDAPListenerClientConnection}.
040 */
041 @Extensible()
042 @ThreadSafety(level=ThreadSafetyLevel.INTERFACE_THREADSAFE)
043 public interface SearchReferenceTransformer
044 {
045 /**
046 * Transforms the provided search result reference and/or set of controls to
047 * alter what will be returned to the client.
048 *
049 * @param messageID The message ID for the associated search operation.
050 * @param reference The search result reference to be processed. It will
051 * not be {@code null}.
052 * @param controls The set of controls to be processed. It will not be
053 * {@code null} but may be empty if there are no controls.
054 *
055 * @return An {@link ObjectPair} containing a possibly updated reference and
056 * set of controls, or {@code null} to indicate that the reference
057 * should not be returned to the client.
058 */
059 ObjectPair<SearchResultReferenceProtocolOp,Control[]> transformReference(
060 final int messageID, final SearchResultReferenceProtocolOp reference,
061 final Control[] controls);
062 }