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.schema.registries;
021    
022    
023    import java.util.Iterator;
024    
025    import javax.naming.NamingException;
026    
027    import org.apache.directory.shared.ldap.schema.Normalizer;
028    import org.apache.directory.shared.ldap.schema.parsers.NormalizerDescription;
029    
030    
031    /**
032     * Normalizer registry service interface.
033     *
034     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
035     * @version $Rev: 780471 $
036     */
037    public interface NormalizerRegistry extends Iterable<String>
038    {
039        /**
040         * Registers a Normalizer with this registry.
041         * 
042         * @param normalizer the Normalizer to register
043         * @throws NamingException if the Normalizer is already registered or the
044         *      registration operation is not supported
045         */
046        void register( NormalizerDescription description, Normalizer normalizer ) throws NamingException;
047    
048    
049        /**
050         * Looks up a Normalizer by its unique Object Identifier.
051         * 
052         * @param oid the object identifier
053         * @return the Normalizer for the oid
054         * @throws NamingException if there is a backing store failure or the 
055         *      Normalizer does not exist.
056         */
057        Normalizer lookup( String oid ) throws NamingException;
058    
059    
060        /**
061         * Gets the name of the schema this schema object is associated with.
062         *
063         * @param oid the object identifier
064         * @return the schema name
065         * @throws NamingException if the schema object does not exist
066         */
067        String getSchemaName( String oid ) throws NamingException;
068    
069    
070        /**
071         * Checks to see if a Normalizer exists.  Backing store failures simply 
072         * return false.
073         * 
074         * @param oid the object identifier
075         * @return true if a Normalizer definition exists for the oid, false 
076         *      otherwise
077         */
078        boolean hasNormalizer( String oid );
079        
080        
081        /**
082         * Used to iterate through all normalizers.  We have to iterate over the
083         * OID String keys because these objects do not associate a matchingRule OID
084         * with them as a class member.
085         *  
086         * @return an Iterator over the set of OID Strings in this registry
087         */
088        Iterator<String> iterator();
089    
090        
091        /**
092         * Used to iterate through all normalizerDescriptions.
093         *  
094         * @return an Iterator over the set of NormalizerDescriptions in this registry
095         */
096        Iterator<NormalizerDescription> normalizerDescriptionIterator();
097    
098        
099        /**
100         * Unregisters a normalizer from this registry by OID.
101         * 
102         * @param oid the numeric OID of the matchingRule the normalizer is for
103         * @throws NamingException if the provided argument is not a numeric OID
104         */
105        void unregister( String oid ) throws NamingException;
106        
107        
108        /**
109         * Unregisters normalizers from this registry associated with a schema.
110         *
111         * @param schemaName the name of the schema whose normalizers are 
112         * removed from this registry
113         */
114        void unregisterSchemaElements( String schemaName );
115    
116        
117        /**
118         * Renames the schemaName associated with entities within this 
119         * registry to a new schema name.
120         * 
121         * @param originalSchemaName the original schema name
122         * @param newSchemaName the new name to give to the schema
123         */
124        void renameSchema( String originalSchemaName, String newSchemaName );
125    }