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
010     * trunk/opends/resource/legal-notices/OpenDS.LICENSE
011     * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
012     * See the License for the specific language governing permissions
013     * and limitations under the License.
014     *
015     * When distributing Covered Code, include this CDDL HEADER in each
016     * file and include the License file at
017     * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
018     * add the following below this CDDL HEADER, with the fields enclosed
019     * by brackets "[]" replaced with your own identifying information:
020     *      Portions Copyright [yyyy] [name of copyright owner]
021     *
022     * CDDL HEADER END
023     *
024     *
025     *      Copyright 2006-2008 Sun Microsystems, Inc.
026     */
027    package org.opends.server.api;
028    
029    
030    
031    import org.opends.server.types.Entry;
032    import org.opends.server.types.operation.PostResponseAddOperation;
033    import org.opends.server.types.operation.PostResponseDeleteOperation;
034    import org.opends.server.types.operation.PostResponseModifyOperation;
035    import org.opends.server.types.operation.
036                PostResponseModifyDNOperation;
037    
038    
039    
040    /**
041     * This interface defines a mechanism that Directory Server components
042     * may use if they need to be notified of changes that are made in the
043     * Directory Server.  Similar functionality can be achieved using
044     * post-response plugins, but this interface is better suited to core
045     * functionality that should not be considered optional, since plugins
046     * may be disabled.  Further, change notification listeners will only
047     * be invoked for successful operations.
048     * <BR><BR>
049     * Each change notification listener will be notified whenever an
050     * update is made in the server (just before the response is sent to
051     * the client), so the listener should use a very efficient mechanism
052     * for determining whether or not any action is required for the
053     * associated operation and quickly return for cases in which the
054     * update is not applicable.  Also note that even though the listener
055     * will be invoked before the response is sent to the client, it may
056     * not alter that response in any way and therefore the listener will
057     * be given what is essentially a read-only view of the associated
058     * operation.
059     * <BR><BR>
060     * Note that while this interface can be used by clients to be
061     * notified of changes to the configuration data just as easily as it
062     * can be used for any other entry anywhere in the server, components
063     * that are only interested in being notified of changes to the server
064     * configuration should use the {@code ConfigAddListener},
065     * {@code ConfigDeleteListener}, and/or the
066     * {@code ConfigChangeListener} interfaces instead.  They will be more
067     * efficient overall because they will only be invoked for operations
068     * in the server configuration, and then only for the specific entries
069     * with which the component has registered.
070     */
071    @org.opends.server.types.PublicAPI(
072         stability=org.opends.server.types.StabilityLevel.VOLATILE,
073         mayInstantiate=false,
074         mayExtend=true,
075         mayInvoke=false)
076    public interface ChangeNotificationListener
077    {
078      /**
079       * Performs any processing that may be required after an add
080       * operation.
081       *
082       * @param  addOperation  The add operation that was performed in the
083       *                       server.
084       * @param  entry         The entry that was added to the server.
085       */
086      public void handleAddOperation(
087                       PostResponseAddOperation addOperation,
088                       Entry entry);
089    
090    
091    
092      /**
093       * Performs any processing that may be required after a delete
094       * operation.
095       *
096       * @param  deleteOperation  The delete operation that was performed
097       *                          in the server.
098       * @param  entry            The entry that was removed from the
099       *                          server.
100       */
101      public void handleDeleteOperation(
102                       PostResponseDeleteOperation deleteOperation,
103                       Entry entry);
104    
105    
106    
107      /**
108       * Performs any processing that may be required after a modify
109       * operation.
110       *
111       * @param  modifyOperation  The modify operation that was performed
112       *                          in the server.
113       * @param  oldEntry         The entry before it was updated.
114       * @param  newEntry         The entry after it was updated.
115       */
116      public void handleModifyOperation(
117                       PostResponseModifyOperation modifyOperation,
118                       Entry oldEntry, Entry newEntry);
119    
120    
121    
122      /**
123       * Performs any processing that may be required after a modify DN
124       * operation.
125       *
126       * @param  modifyDNOperation  The modify DN operation that was
127       *                            performed in the server.
128       * @param  oldEntry           The entry before it was updated.
129       * @param  newEntry           The entry after it was updated.
130       */
131      public void handleModifyDNOperation(
132                       PostResponseModifyDNOperation modifyDNOperation,
133                       Entry oldEntry, Entry newEntry);
134    }
135