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