001/*
002 *   Licensed to the Apache Software Foundation (ASF) under one
003 *   or more contributor license agreements.  See the NOTICE file
004 *   distributed with this work for additional information
005 *   regarding copyright ownership.  The ASF licenses this file
006 *   to you under the Apache License, Version 2.0 (the
007 *   "License"); you may not use this file except in compliance
008 *   with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 *   Unless required by applicable law or agreed to in writing,
013 *   software distributed under the License is distributed on an
014 *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 *   KIND, either express or implied.  See the License for the
016 *   specific language governing permissions and limitations
017 *   under the License.
018 *
019 */
020package org.apache.directory.server.core.api.event;
021
022
023import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
024import org.apache.directory.server.core.api.interceptor.context.DeleteOperationContext;
025import org.apache.directory.server.core.api.interceptor.context.ModifyOperationContext;
026import org.apache.directory.server.core.api.interceptor.context.MoveAndRenameOperationContext;
027import org.apache.directory.server.core.api.interceptor.context.MoveOperationContext;
028import org.apache.directory.server.core.api.interceptor.context.RenameOperationContext;
029
030
031/**
032 * A listener which is notified of changes to the directory service.
033 *
034 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
035 */
036public interface DirectoryListener
037{
038    /**
039     * Called when an entry has been added.
040     *
041     * @param addContext the add operation context responsible for the change
042     */
043    void entryAdded( AddOperationContext addContext );
044
045
046    /**
047     * Called when an entry has been deleted.
048     *
049     * @param deleteContext the delete operation context responsible for the change
050     */
051    void entryDeleted( DeleteOperationContext deleteContext );
052
053
054    /**
055     * Called when an entry has been modified.
056     *
057     * @param modifyContext the modify operation context responsible for the change
058     */
059    void entryModified( ModifyOperationContext modifyContext );
060
061
062    /**
063     * Called when an entry has been renamed.
064     *
065     * @param renameContext the rename operation context responsible for the change
066     */
067    void entryRenamed( RenameOperationContext renameContext );
068
069
070    /**
071     * Called when an entry is moved.
072     *
073     * @param moveContext the move operation context responsible for the change
074     */
075    void entryMoved( MoveOperationContext moveContext );
076
077
078    /**
079     * Called when an entry is moved and renamed at the same time.
080     *
081     * @param moveAndRenameContext the move/rename operation context responsible for the change
082     */
083    void entryMovedAndRenamed( MoveAndRenameOperationContext moveAndRenameContext );
084    
085    
086    /**
087     * indicates if this listener needs to be invoked synchronously
088     *  
089     * @return true if should be invoked synchronously, false otherwise
090     */
091    boolean isSynchronous();
092}