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