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.EntryReader; 032 033/** 034 * A data provider which supports LDIF import 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 * <p> 039 * FIXME: it would be nice if we can use EntryReader, however we may need to 040 * provide an optimized implementation for use in multi-threaded imports. E.g. 041 * performing DN checking as early as possible before doing schema validation. 042 * <p> 043 * FIXME: import allows you to append, merge, replace entries. Do we need to 044 * expose that here? 045 */ 046public interface ImportableDataProvider { 047 048 /** 049 * Returns the ID of this data provider. 050 * 051 * @return The ID of this data provider. 052 */ 053 DataProviderID getDataProviderID(); 054 055 /** 056 * Imports the contents of this data provider from the provided entry 057 * reader. 058 * <p> 059 * Note that the server will not explicitly initialize this data provider 060 * before calling this method. 061 * 062 * @param reader 063 * The entry reader. 064 * @param handler 065 * A handler which will be notified when the import completes. 066 * @return A promise representing the completion of the import. 067 */ 068 LdapPromise<Void> importEntries(EntryReader reader, LdapResultHandler<Void> handler); 069}