001/*
002 * Copyright 2014-2017 UnboundID Corp.
003 * All Rights Reserved.
004 */
005/*
006 * Copyright (C) 2014-2017 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.LDAPException;
027import com.unboundid.ldap.sdk.ReadOnlySearchRequest;
028import com.unboundid.ldap.sdk.SearchRequest;
029import com.unboundid.ldap.sdk.SearchResultReference;
030import com.unboundid.util.NotExtensible;
031import com.unboundid.util.ThreadSafety;
032import com.unboundid.util.ThreadSafetyLevel;
033
034
035
036/**
037 * This class provides an API that can be used in the course of processing a
038 * search request via the {@link InMemoryOperationInterceptor} API.
039 */
040@NotExtensible()
041@ThreadSafety(level=ThreadSafetyLevel.INTERFACE_NOT_THREADSAFE)
042public interface InMemoryInterceptedSearchRequest
043       extends InMemoryInterceptedRequest
044{
045  /**
046   * Retrieves the search request to be processed.
047   *
048   * @return  The search request to be processed.
049   */
050  ReadOnlySearchRequest getRequest();
051
052
053
054  /**
055   * Replaces the search request to be processed.
056   *
057   * @param  searchRequest  The search request that should be processed
058   *                        instead of the one that was originally received
059   *                        from the client.  It must not be {@code null}.
060   */
061  void setRequest(final SearchRequest searchRequest);
062
063
064
065  /**
066   * Sends the provided search result entry to the client.  It will be processed
067   * by the {@link InMemoryOperationInterceptor#processSearchEntry} method of
068   * all registered operation interceptors.
069   *
070   * @param  entry  The search result entry to be returned to the client.  It
071   *                must not be {@code null}.  If the provided entry is a
072   *                {@code SearchResultEntry}, then it may optionally include
073   *                one or more controls to provide to the client.  If it is any
074   *                other type of {@code Entry}, then it will not include any
075   *                controls.
076   *
077   * @throws  LDAPException  If a problem is encountered while trying to send
078   *                         the search result entry.
079   */
080  void sendSearchEntry(final Entry entry)
081       throws LDAPException;
082
083
084
085  /**
086   * Sends the provided search result reference to the client.  It will be
087   * processed by the
088   * {@link InMemoryOperationInterceptor#processSearchReference} method of all
089   * registered operation interceptors.
090   *
091   * @param  reference  The search result reference to be returned to the
092   *                    client.  It must not be {@code null}.
093   *
094   * @throws  LDAPException  If a problem is encountered while trying to send
095   *                         the search result reference.
096   */
097  void sendSearchReference(final SearchResultReference reference)
098       throws LDAPException;
099}