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