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 */ 020 package org.apache.directory.server.core.schema.registries.synchronizers; 021 022 023 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext; 024 import org.apache.directory.shared.ldap.entry.ServerEntry; 025 import org.apache.directory.shared.ldap.name.DN; 026 import org.apache.directory.shared.ldap.name.RDN; 027 028 029 /** 030 * Interface used to detect and react to changes performed on schema entities 031 * to update registries so they're synchronized with entries on disk. 032 * 033 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 034 * @version $Rev$ 035 */ 036 public interface RegistrySynchronizer 037 { 038 /** A constant to tell the caller that the schema has been modified */ 039 static final boolean SCHEMA_MODIFIED = true; 040 041 /** A constant to tell the caller that the schema has not been modified */ 042 static final 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 Exception If the addition failed 050 */ 051 void add( ServerEntry entry ) throws Exception; 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 Exception If the deletion failed 060 */ 061 void delete( ServerEntry entry, boolean cascaded ) throws Exception; 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 Exception If the rename failed 071 */ 072 void rename( ServerEntry entry, RDN newRdn, boolean cascaded ) throws Exception; 073 074 075 /** 076 * Applies a set of modification to an entry 077 * 078 * @param opContext 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 Exception If the modification failed 083 */ 084 boolean modify( ModifyOperationContext opContext, ServerEntry targetEntry, boolean cascaded ) 085 throws Exception; 086 087 void moveAndRename( DN oriChildName, DN newParentName, RDN newRn, boolean deleteOldRn, ServerEntry entry, 088 boolean cascaded ) throws Exception; 089 090 void move( DN oriChildName, DN newParentName, ServerEntry entry, boolean cascaded ) throws Exception; 091 }