001/*
002 * Copyright 2008-2014 UnboundID Corp.
003 * All Rights Reserved.
004 */
005/*
006 * Copyright (C) 2008-2014 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 */
021package com.unboundid.ldif;
022
023
024
025import com.unboundid.ldap.sdk.Entry;
026import com.unboundid.util.Extensible;
027import com.unboundid.util.ThreadSafety;
028import com.unboundid.util.ThreadSafetyLevel;
029
030
031
032/**
033 * This interface is used by the LDIFReader to translate entries read from the
034 * input or filter them out before they are returned via readEntry().
035 */
036@Extensible()
037@ThreadSafety(level=ThreadSafetyLevel.INTERFACE_THREADSAFE)
038public interface LDIFReaderEntryTranslator
039{
040  /**
041   * Applies some special transformation or filtering to the original Entry.
042   *
043   * @param original        The original Entry that was read and parsed from the
044   *                        input file.
045   * @param firstLineNumber The first line number of the LDIF record
046   *                        corresponding to the read Entry.  This is most
047   *                        useful when throwing an LDIFException.
048   *
049   * @return The Entry that should be returned in the call to readEntry. This
050   *         can be the original parameter Entry, a newly constructed Entry, or
051   *         {@code null} to signal that this Entry should be skipped.
052   *
053   * @throws LDIFException If there is an exception during processing.  This
054   *                       Exception will be re-thrown to the caller of
055   *                       readEntry.
056   */
057  Entry translate(Entry original, long firstLineNumber)
058       throws LDIFException;
059}