001 /*
002 * Copyright 2012-2015 UnboundID Corp.
003 * All Rights Reserved.
004 */
005 /*
006 * Copyright (C) 2015 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.ldap.sdk.unboundidds;
022
023
024
025 import com.unboundid.ldap.sdk.DN;
026 import com.unboundid.ldap.sdk.ReadOnlyEntry;
027 import com.unboundid.util.Extensible;
028 import com.unboundid.util.ThreadSafety;
029 import com.unboundid.util.ThreadSafetyLevel;
030
031
032
033 /**
034 * <BLOCKQUOTE>
035 * <B>NOTE:</B> This class is part of the Commercial Edition of the UnboundID
036 * LDAP SDK for Java. It is not available for use in applications that
037 * include only the Standard Edition of the LDAP SDK, and is not supported for
038 * use in conjunction with non-UnboundID products.
039 * </BLOCKQUOTE>
040 * This interface defines an API that may be implemented by classes which wish
041 * to be notified of processing performed in the course of moving a subtree
042 * between servers.
043 */
044 @Extensible()
045 @ThreadSafety(level=ThreadSafetyLevel.INTERFACE_NOT_THREADSAFE)
046 public interface MoveSubtreeListener
047 {
048 /**
049 * Performs any processing which may be needed before the provided entry is
050 * added to the target server.
051 *
052 * @param entry A read-only representation of the entry to be added to the
053 * target server.
054 *
055 * @return The original entry if the add should proceed without changes, a
056 * new entry (which must have the same DN as the provided entry) if
057 * the entry should be added with changes, or {@code null} if the
058 * entry should not be added to the target server (but will still be
059 * removed from the source server).
060 */
061 ReadOnlyEntry doPreAddProcessing(final ReadOnlyEntry entry);
062
063
064
065 /**
066 * Performs any processing which may be needed after the provided entry has
067 * been added to the target server.
068 *
069 * @param entry A read-only representation of the entry that was added to
070 * the target server. Note that depending on the algorithm
071 * used to perform the move, the entry may not yet be
072 * accessible in the target server. Also note that the add may
073 * potentially be reverted if move processing encounters an
074 * error later in its processing.
075 */
076 void doPostAddProcessing(final ReadOnlyEntry entry);
077
078
079
080 /**
081 * Performs any processing which may be needed before the specified entry is
082 * deleted from the source server.
083 *
084 * @param entryDN The DN of the entry that is to be removed from the
085 * source server. Note that depending on the algorithm used
086 * to perform the move, the entry may already be inaccessible
087 * in the source server.
088 */
089 void doPreDeleteProcessing(final DN entryDN);
090
091
092
093 /**
094 * Performs any processing which may be needed after the specified entry has
095 * been deleted from the source server.
096 *
097 * @param entryDN The DN of the entry that has been removed from the source
098 * server. Note that the delete may potentially be reverted
099 * if move processing encounters an error later in its
100 * processing.
101 */
102 void doPostDeleteProcessing(final DN entryDN);
103 }