001/*
002* CDDL HEADER START
003 *
004 * The contents of this file are subject to the terms of the
005 * Common Development and Distribution License, Version 1.0 only
006 * (the "License").  You may not use this file except in compliance
007 * with the License.
008 *
009 * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
010 * or http://forgerock.org/license/CDDLv1.0.html.
011 * See the License for the specific language governing permissions
012 * and limitations under the License.
013 *
014 * When distributing Covered Code, include this CDDL HEADER in each
015 * file and include the License file at legal-notices/CDDLv1_0.txt.
016 * If applicable, add the following below this CDDL HEADER, with the
017 * fields enclosed by brackets "[]" replaced with your own identifying
018 * information:
019 *      Portions Copyright [yyyy] [name of copyright owner]
020 *
021 * CDDL HEADER END
022 *
023 *
024 *       Copyright 2008 Sun Microsystems, Inc.
025 *       Portions Copyright 2013-2014 ForgeRock AS.
026 */
027package org.forgerock.opendj.server.core;
028
029import org.forgerock.opendj.ldap.LdapPromise;
030import org.forgerock.opendj.ldap.LdapResultHandler;
031import org.forgerock.opendj.ldif.EntryWriter;
032
033/**
034 * A data provider which supports LDIF export functionality.
035 * <p>
036 * FIXME: the async APIs used below are a bad fit. We do not want to return an
037 * {@link LdapException}. We really need a more generic promises API.
038 */
039public interface ExportableDataProvider {
040
041    /**
042     * Exports the contents of this data provider to the provided entry writer.
043     * <p>
044     * Note that the server will not explicitly initialize this data provider
045     * before calling this method.
046     *
047     * @param writer
048     *            The entry writer.
049     * @param handler
050     *            A handler which will be notified when the export completes.
051     * @return A promise representing the completion of the export.
052     */
053    LdapPromise<Void> exportEntries(EntryWriter writer, LdapResultHandler<Void> handler);
054
055    /**
056     * Returns the ID of this data provider.
057     *
058     * @return The ID of this data provider.
059     */
060    DataProviderID getDataProviderID();
061}