001    /*
002     * Copyright 2007-2016 UnboundID Corp.
003     * All Rights Reserved.
004     */
005    /*
006     * Copyright (C) 2008-2016 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.sdk;
022    
023    
024    
025    
026    
027    
028    /**
029     * This interface provides the ability to perform custom processing immediately
030     * after creating an LDAP connection for use in a connection pool.  It may be
031     * used, for example, to perform StartTLS negotiation on the connection before
032     * it is made available for use in the pool.
033     * <BR><BR>
034     * Implementations of this interface must be threadsafe to allow for the
035     * possibility of performing post-connect processing on different connections
036     * at the same time in separate threads.
037     */
038    public interface PostConnectProcessor
039    {
040      /**
041       * Performs any appropriate processing on the provided connection before
042       * making it available for use in a connection pool.  This method will be
043       * invoked immediately after the connection has been established but before
044       * any attempt has been made to perform any authentication.
045       *
046       * @param  connection  The connection for which the processing is to be
047       *                     performed.
048       *
049       * @throws  LDAPException  If a problem occurs during processing.  If an
050       *                         exception is thrown, then the connection will be
051       *                         terminated and not used in the pool.
052       */
053      void processPreAuthenticatedConnection(final LDAPConnection connection)
054           throws LDAPException;
055    
056    
057    
058      /**
059       * Performs any appropriate processing on the provided connection before
060       * making it available for use in a connection pool.  This method will be
061       * invoked immediately after any appropriate authentication has been performed
062       * on the connection.
063       *
064       * @param  connection  The connection for which the processing is to be
065       *                     performed.
066       *
067       * @throws  LDAPException  If a problem occurs during processing.  If an
068       *                         exception is thrown, then the connection will be
069       *                         terminated and not used in the pool.
070       */
071      void processPostAuthenticatedConnection(final LDAPConnection connection)
072           throws LDAPException;
073    }