001/*
002 * Copyright 2014 UnboundID Corp.
003 * All Rights Reserved.
004 */
005/*
006 * Copyright (C) 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 */
021package com.unboundid.ldap.listener.interceptor;
022
023
024
025import com.unboundid.ldap.sdk.Entry;
026import com.unboundid.ldap.sdk.ReadOnlySearchRequest;
027import com.unboundid.ldap.sdk.SearchResultEntry;
028import com.unboundid.util.NotExtensible;
029import com.unboundid.util.ThreadSafety;
030import com.unboundid.util.ThreadSafetyLevel;
031
032
033
034/**
035 * This class provides an API that can be used in the course of processing a
036 * search request via the {@link InMemoryOperationInterceptor} API.
037 */
038@NotExtensible()
039@ThreadSafety(level=ThreadSafetyLevel.INTERFACE_NOT_THREADSAFE)
040public interface InMemoryInterceptedSearchEntry
041       extends InMemoryInterceptedResult
042{
043  /**
044   * Retrieves the search request that is being processed.  If the request was
045   * altered between the time it was received from the client and the time it
046   * was actually processed by the in-memory directory server, then this will be
047   * the most recently altered version.
048   *
049   * @return  The search request that was processed.
050   */
051  ReadOnlySearchRequest getRequest();
052
053
054
055  /**
056   * Retrieves the search result entry to be returned to the client.
057   *
058   * @return  The search result entry to be returned to the client.
059   */
060  SearchResultEntry getSearchEntry();
061
062
063
064  /**
065   * Replaces the search result entry to be returned to the client.  It may be
066   * {@code null} if the entry should be suppressed rather than being returned
067   * to the client.  If the provided entry is a {@code SearchResultEntry}, then
068   * it may optionally include one or more controls to provide to the client.
069   * If it is any other type of {@code Entry}, then it will not include any
070   * controls.
071   *
072   * @param  entry  The search result entry to be returned to the client.  It
073   *                may be {@code null} if the entry should be suppressed rather
074   *                than being returned to the client.  If the provided entry is
075   *                a {@code SearchResultEntry}, then it may optionally include
076   *                one or more controls to provide to the client.  If it is any
077   *                other type of {@code Entry}, then it will not include any
078   *                controls.
079   */
080  void setSearchEntry(final Entry entry);
081}