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.schema.registries.synchronizers;
021
022
023import org.apache.directory.api.ldap.model.entry.Entry;
024import org.apache.directory.api.ldap.model.exception.LdapException;
025import org.apache.directory.api.ldap.model.name.Dn;
026import org.apache.directory.api.ldap.model.name.Rdn;
027import org.apache.directory.server.core.api.interceptor.context.ModifyOperationContext;
028
029
030/**
031 * Interface used to detect and react to changes performed on schema entities
032 * to update registries so they're synchronized with entries on disk.
033 *
034 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
035 */
036public interface RegistrySynchronizer
037{
038    /** A constant to tell the caller that the schema has been modified */
039    boolean SCHEMA_MODIFIED = true;
040
041    /** A constant to tell the caller that the schema has not been modified */
042    boolean SCHEMA_UNCHANGED = false;
043
044
045    /**
046     * Adds a new SchemaObject to its registry
047     *
048     * @param entry The SchemObject to add
049     * @throws LdapException If the addition failed
050     */
051    void add( Entry entry ) throws LdapException;
052
053
054    /**
055     * Delete the schema object and update the registries
056     *
057     * @param entry The entry associated with the SchemaObject to delete
058     * @param cascaded unused
059     * @throws LdapException If the deletion failed
060     */
061    void delete( Entry entry, boolean cascaded ) throws LdapException;
062
063
064    /**
065     * Rename a schemaObject. It is not supposed to have any child
066     *
067     * @param entry The entry to be renamed
068     * @param newRdn The new entry name
069     * @param cascaded unused
070     * @throws LdapException If the rename failed
071     */
072    void rename( Entry entry, Rdn newRdn, boolean cascaded ) throws LdapException;
073
074
075    /**
076     * Applies a set of modification to an entry
077     *
078     * @param modifyContext The OperationContext, which contains the entry and the modifications to apply
079     * @param targetEntry The modified entry
080     * @param cascaded Unused
081     * @return True if the modification has been done
082     * @throws LdapException If the modification failed
083     */
084    boolean modify( ModifyOperationContext modifyContext, Entry targetEntry, boolean cascaded )
085        throws LdapException;
086
087
088    void moveAndRename( Dn oriChildName, Dn newParentName, Rdn newRn, boolean deleteOldRn, Entry entry,
089        boolean cascaded ) throws LdapException;
090
091
092    void move( Dn oriChildName, Dn newParentName, Entry entry, boolean cascaded ) throws LdapException;
093}