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