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 2010 Sun Microsystems, Inc. 015 * Portions Copyright 2015-2016 ForgeRock AS. 016 */ 017package org.opends.server.api; 018 019 020 021import org.opends.server.types.DirectoryException; 022import org.opends.server.types.Entry; 023 024 025 026/** 027 * This interface defines a mechanism that Directory Server components 028 * may use if they need to be notified of changes that are being made 029 * to subentries in the Directory Server. 030 * <BR><BR> 031 * Each change listener will be notified whenever an update is being 032 * made to subentry in the server, so the listener should use a very 033 * efficient mechanism for determining whether any action is 034 * required for the associated operation and quickly return for cases 035 * in which the update is not applicable. 036 * <BR><BR> 037 * The interface consists of two separate classes of methods. Check 038 * methods are invoked to verify that a specific operation performed 039 * on subentry is acceptable and if so the server may proceed with 040 * that operation further. Handle methods are invoked to notify that 041 * specific operation has occured on subentry thus serving purely as 042 * notification mechanism. While Check methods can affect the outcome 043 * of given operation Handle methods cannot affect the operation out- 044 * come in any way. Also note that Handle methods are invoked before 045 * any actual operation response to the client is sent. 046 * <BR><BR> 047 * This interface is intended for the server components that either 048 * require to track changes to subentries within the server or need 049 * to evaluate and take actions on specific changes being made to 050 * subentries within the server. Eg server components implementing 051 * their configuration objects as administrative subentries. 052 */ 053@org.opends.server.types.PublicAPI( 054 stability=org.opends.server.types.StabilityLevel.VOLATILE, 055 mayInstantiate=false, 056 mayExtend=true, 057 mayInvoke=false) 058public interface SubentryChangeListener 059{ 060 /** 061 * Performs any checking that may be required before 062 * subentry add operation. 063 * @param entry subentry being added to the server. 064 * @throws DirectoryException if operation is not 065 * acceptable for this subentry. 066 */ 067 void checkSubentryAddAcceptable(Entry entry) 068 throws DirectoryException; 069 070 /** 071 * Performs any checking that may be required before 072 * subentry delete operation. 073 * @param entry subentry being deleted in the server. 074 * @throws DirectoryException if operation is not 075 * acceptable for this subentry. 076 */ 077 void checkSubentryDeleteAcceptable(Entry entry) 078 throws DirectoryException; 079 080 /** 081 * Performs any checking that may be required before 082 * subentry modify operation. 083 * @param oldEntry subentry being modified in the server. 084 * @param newEntry subentry with modifications applied. 085 * @throws DirectoryException if operation is not 086 * acceptable for this subentry. 087 */ 088 void checkSubentryModifyAcceptable(Entry oldEntry, 089 Entry newEntry) throws DirectoryException; 090 091 /** 092 * Performs any checking that may be required before 093 * subentry modify DN operation. 094 * @param oldEntry subentry being modified in the server. 095 * @param newEntry subentry with modifications applied. 096 * @throws DirectoryException if operation is not 097 * acceptable for this subentry. 098 */ 099 void checkSubentryModifyDNAcceptable(Entry oldEntry, 100 Entry newEntry) throws DirectoryException; 101 102 /** 103 * Performs any processing that may be required after a 104 * subentry add operation. 105 * 106 * @param entry The subentry that was added to the 107 * server. 108 */ 109 void handleSubentryAdd(Entry entry); 110 111 /** 112 * Performs any processing that may be required after a 113 * subentry delete operation. 114 * 115 * @param entry The subentry that was removed from the 116 * server. 117 */ 118 void handleSubentryDelete(Entry entry); 119 120 /** 121 * Performs any processing that may be required after a 122 * subentry modify operation. 123 * 124 * @param oldEntry The subentry before it was updated. 125 * @param newEntry The subentry after it was updated. 126 */ 127 void handleSubentryModify(Entry oldEntry, Entry newEntry); 128 129 /** 130 * Performs any processing that may be required after a 131 * subentry modify DN operation. 132 * 133 * @param oldEntry The subentry before it was updated. 134 * @param newEntry The subentry after it was updated. 135 */ 136 void handleSubentryModifyDN(Entry oldEntry, Entry newEntry); 137}