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     * docs/licenses/cddl.txt
011     * or http://www.opensource.org/licenses/cddl1.php.
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     * docs/licenses/cddl.txt.  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 2010-2013 UnboundID Corp.
026     */
027    package com.unboundid.directory.sdk.ds.api;
028    
029    
030    
031    import com.unboundid.directory.sdk.common.operation.AddRequest;
032    import com.unboundid.directory.sdk.common.operation.AddResult;
033    import com.unboundid.directory.sdk.common.operation.DeleteRequest;
034    import com.unboundid.directory.sdk.common.operation.DeleteResult;
035    import com.unboundid.directory.sdk.common.operation.ModifyRequest;
036    import com.unboundid.directory.sdk.common.operation.ModifyResult;
037    import com.unboundid.directory.sdk.common.operation.ModifyDNRequest;
038    import com.unboundid.directory.sdk.common.operation.ModifyDNResult;
039    import com.unboundid.directory.sdk.common.types.CompletedOperationContext;
040    import com.unboundid.directory.sdk.common.types.Entry;
041    import com.unboundid.directory.sdk.ds.internal.DirectoryServerExtension;
042    import com.unboundid.directory.sdk.proxy.internal.DirectoryProxyServerExtension;
043    import com.unboundid.directory.sdk.sync.internal.SynchronizationServerExtension;
044    import com.unboundid.util.Extensible;
045    import com.unboundid.util.ThreadSafety;
046    import com.unboundid.util.ThreadSafetyLevel;
047    
048    
049    
050    /**
051     * This interface defines a set of methods that may be implemented by an
052     * extension which should be used to receive information about changes processed
053     * within the server as the result of add, delete, modify, or modify DN
054     * operations.  The {@code ServerContext.registerChangeListener} method should
055     * be used to register a change listener with the server, and the corresponding
056     * {@code deregisterChangeListener} method should be used to deregister the
057     * listener if it is no longer needed.
058     * <BR><BR>
059     * Note that notification will only be provided for changes successfully
060     * processed within the local server.  Notification will not be provided for
061     * changes to data located in remote servers even if the change was processed
062     * through this server.  Notification will also not be provided for operations
063     * that did not complete successfully.
064     * <BR><BR>
065     * Also note that notification about matching changes will be provided to change
066     * listeners asynchronously after the change has been processed within the
067     * server and the result has been returned to the client.  Other changes to the
068     * target entry may be in progress (and perhaps may have already completed) as
069     * a result of other operations by the same or other clients.
070     */
071    @Extensible()
072    @DirectoryServerExtension()
073    @DirectoryProxyServerExtension(appliesToLocalContent=true,
074         appliesToRemoteContent=false)
075    @SynchronizationServerExtension(appliesToLocalContent=true,
076         appliesToSynchronizedContent=false)
077    @ThreadSafety(level=ThreadSafetyLevel.INTERFACE_THREADSAFE)
078    public interface ChangeListener
079    {
080      /**
081       * Indicates that an add operation has been processed within the server.
082       *
083       * @param  operationContext  The context for the add operation.
084       * @param  addRequest        Information about the request for the add
085       *                           operation that was processed.
086       * @param  addResult         Information about the result for the add
087       *                           operation that was processed.
088       * @param  entry             The entry that was added to the server.
089       */
090      void addOperationProcessed(final CompletedOperationContext operationContext,
091                                 final AddRequest addRequest,
092                                 final AddResult addResult,
093                                 final Entry entry);
094    
095    
096    
097      /**
098       * Indicates that a delete operation has been processed within the server.
099       *
100       * @param  operationContext  The context for the delete operation.
101       * @param  deleteRequest     Information about the request for the delete
102       *                           operation that was processed.
103       * @param  deleteResult      Information about the result for the delete
104       *                           operation that was processed.
105       * @param  entry             The entry that was removed from the server.
106       */
107      void deleteOperationProcessed(
108                final CompletedOperationContext operationContext,
109                final DeleteRequest deleteRequest, final DeleteResult deleteResult,
110                final Entry entry);
111    
112    
113    
114      /**
115       * Indicates that a modify operation has been processed within the server.
116       *
117       * @param  operationContext  The context for the modify operation.
118       * @param  modifyRequest     Information about the request for the modify
119       *                           operation that was processed.
120       * @param  modifyResult      Information about the result for the modify
121       *                           operation that was processed.
122       * @param  oldEntry          The entry as it appeared before the change was
123       *                           processed.
124       * @param  newEntry          The entry as it appeared immediately after the
125       *                           change was processed.
126       */
127      void modifyOperationProcessed(
128                final CompletedOperationContext operationContext,
129                final ModifyRequest modifyRequest, final ModifyResult modifyResult,
130                final Entry oldEntry, final Entry newEntry);
131    
132    
133    
134      /**
135       * Indicates that a modify DN operation has been processed within the server.
136       *
137       * @param  operationContext  The context for the modify DN operation.
138       * @param  modifyDNRequest   Information about the request for the modify DN
139       *                           operation that was processed.
140       * @param  modifyDNResult    Information about the result for the modify DN
141       *                           operation that was processed.
142       * @param  oldEntry          The entry as it appeared before the change was
143       *                           processed.
144       * @param  newEntry          The entry as it appeared immediately after the
145       *                           change was processed.
146       */
147      void modifyDNOperationProcessed(
148                final CompletedOperationContext operationContext,
149                final ModifyDNRequest modifyDNRequest,
150                final ModifyDNResult modifyDNResult, final Entry oldEntry,
151                final Entry newEntry);
152    }