001 /*
002 * Copyright 2009-2013 UnboundID Corp.
003 * All Rights Reserved.
004 */
005 /*
006 * Copyright (C) 2009-2013 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.persist;
022
023
024
025 import com.unboundid.ldap.sdk.SearchResultEntry;
026 import com.unboundid.ldap.sdk.SearchResultReference;
027 import com.unboundid.util.Extensible;
028 import com.unboundid.util.ThreadSafety;
029 import com.unboundid.util.ThreadSafetyLevel;
030
031
032
033 /**
034 * This interface defines a set of methods that provide access to objects
035 * returned by the {@link LDAPPersister} class in the course of performing a
036 * search.
037 *
038 * @param <T> The type of object handled by this class.
039 */
040 @Extensible()
041 @ThreadSafety(level=ThreadSafetyLevel.INTERFACE_NOT_THREADSAFE)
042 public interface ObjectSearchListener<T>
043 {
044 /**
045 * Indicates that the provided object was created from an entry retrieved from
046 * the directory server in the course of processing the search operation.
047 *
048 * @param o The object that has been decoded from the entry that was
049 * returned. It will never be {@code null}.
050 */
051 void objectReturned(final T o);
052
053
054
055 /**
056 * Indicates that the provided entry was retrieved from the director server
057 * in the course of processing the search operation, but an error occurred
058 * while attempting to instantiate an object from it.
059 *
060 * @param entry The entry that was retrieved from the directory server
061 * but could not be decoded as an object.
062 * @param exception The exception that was encountered while trying to
063 * create and initialize an object from the provided entry.
064 */
065 void unparsableEntryReturned(final SearchResultEntry entry,
066 final LDAPPersistException exception);
067
068
069
070 /**
071 * Indicates that the provided search result reference was retrieved from the
072 * directory server in the course of processing the search operation.
073 *
074 * @param searchReference The search result reference that has been
075 * retrieved from the server.
076 */
077 void searchReferenceReturned(final SearchResultReference searchReference);
078 }