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 defines a method that may be invoked if an unsolicited
030     * notification is received from the directory server.  An unsolicited
031     * notification handler should be defined in the {@code LDAPConnectionOptions}
032     * for an {@code LDAPConnection} to be called whenever an unsolicited
033     * notification is received for that connection.
034     * <BR><BR>
035     * An unsolicited notification is a type of extended response that is sent from
036     * the server to the client without a corresponding request, and it may be used
037     * to alert the client of a significant server-side event.  For example,
038     * section 4.4.1 of <A HREF="http://www.ietf.org/rfc/rfc4511.txt">RFC 4511</A>
039     * defines a notice of disconnection unsolicited notification that can be used
040     *  by the server to inform the client that it is about to close the connection.
041     * <BR><BR>
042     * Implementations of this interface should be threadsafe to ensure that
043     * multiple connections will be able to safely use the same
044     * {@code UnsolicitedNotificationHandler} instance.
045     */
046    public interface UnsolicitedNotificationHandler
047    {
048      /**
049       * Performs any processing that may be necessary in response to the provided
050       * unsolicited notification that has been received from the server.
051       *
052       * @param  connection    The connection on which the unsolicited notification
053       *                       was received.
054       * @param  notification  The unsolicited notification that has been received
055       *                       from the server.
056       */
057      void handleUnsolicitedNotification(final LDAPConnection connection,
058                                         final ExtendedResult notification);
059    }