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.BindResult;
026import com.unboundid.ldap.sdk.IntermediateResponse;
027import com.unboundid.ldap.sdk.LDAPException;
028import com.unboundid.ldap.sdk.SimpleBindRequest;
029import com.unboundid.util.NotExtensible;
030import com.unboundid.util.ThreadSafety;
031import com.unboundid.util.ThreadSafetyLevel;
032
033
034
035/**
036 * This class provides an API that can be used in the course of processing a
037 * simple bind request via the {@link InMemoryOperationInterceptor} API.
038 */
039@NotExtensible()
040@ThreadSafety(level=ThreadSafetyLevel.INTERFACE_NOT_THREADSAFE)
041public interface InMemoryInterceptedSimpleBindResult
042       extends InMemoryInterceptedResult
043{
044  /**
045   * Retrieves the simple bind request that was processed.  If the request was
046   * altered between the time it was received from the client and the time it
047   * was actually processed by the in-memory directory server, then this will be
048   * the most recently altered version.
049   *
050   * @return  The simple bind request that was processed.
051   */
052  SimpleBindRequest getRequest();
053
054
055
056  /**
057   * Retrieves the bind result to be returned to the client.
058   *
059   * @return  The bind result to be returned to the client.
060   */
061  BindResult getResult();
062
063
064
065  /**
066   * Replaces the bind result to be returned to the client.
067   *
068   * @param  bindResult  The bind result that should be returned to the client
069   *                     instead of the result originally generated by the
070   *                     in-memory directory server.  It must not be
071   *                     {@code null}.
072   */
073  void setResult(final BindResult bindResult);
074
075
076
077  /**
078   * Sends the provided intermediate response message to the client.  It will
079   * be processed by the
080   * {@link InMemoryOperationInterceptor#processIntermediateResponse} method of
081   * all registered operation interceptors.
082   *
083   * @param  intermediateResponse  The intermediate response to send to the
084   *                               client.  It must not be {@code null}.
085   *
086   * @throws  LDAPException  If a problem is encountered while trying to send
087   *                         the intermediate response.
088   */
089  void sendIntermediateResponse(final IntermediateResponse intermediateResponse)
090         throws LDAPException;
091}