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-2014 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.EntryReader; 022 023/** 024 * A data provider which supports LDIF import functionality. 025 * <p> 026 * FIXME: the async APIs used below are a bad fit. We do not want to return an 027 * {@link LdapException}. We really need a more generic promises API. 028 * <p> 029 * FIXME: it would be nice if we can use EntryReader, however we may need to 030 * provide an optimized implementation for use in multi-threaded imports. E.g. 031 * performing DN checking as early as possible before doing schema validation. 032 * <p> 033 * FIXME: import allows you to append, merge, replace entries. Do we need to 034 * expose that here? 035 */ 036public interface ImportableDataProvider { 037 038 /** 039 * Returns the ID of this data provider. 040 * 041 * @return The ID of this data provider. 042 */ 043 DataProviderID getDataProviderID(); 044 045 /** 046 * Imports the contents of this data provider from the provided entry 047 * reader. 048 * <p> 049 * Note that the server will not explicitly initialize this data provider 050 * before calling this method. 051 * 052 * @param reader 053 * The entry reader. 054 * @param handler 055 * A handler which will be notified when the import completes. 056 * @return A promise representing the completion of the import. 057 */ 058 LdapPromise<Void> importEntries(EntryReader reader, LdapResultHandler<Void> handler); 059}