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.shared.ldap.model.schema.registries;
021
022
023import java.io.IOException;
024import java.util.Collection;
025import java.util.List;
026
027import org.apache.directory.shared.ldap.model.entry.Entry;
028import org.apache.directory.shared.ldap.model.exception.LdapException;
029
030
031/**
032 * Loads schemas into registries.
033 *
034 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
035 */
036public interface SchemaLoader
037{
038    /**
039     * Sets listener used to notify of newly loaded schemas.
040     * 
041     * @param listener the listener to notify (only one is enough for us)
042     */
043    void setListener( SchemaLoaderListener listener );
044
045
046    /**
047     * Gets a schema object based on it's name.
048     * 
049     * @param schemaName the name of the schema to load
050     * @return the Schema object associated with the name
051     */
052    Schema getSchema( String schemaName );
053
054    
055    /**
056     * Build a list of AttributeTypes read from the underlying storage for
057     * a list of specified schema
058     *
059     * @param schemas the schemas from which AttributeTypes are loaded
060     * @throws Exception if there are failures accessing AttributeType information
061     */
062    List<Entry> loadAttributeTypes( Schema... schemas ) throws LdapException, IOException;
063
064
065    /**
066     * Build a list of AttributeTypes read from the underlying storage for
067     * a list of specific schema, using their name
068     *
069     * @param schemaNames the schema names from which AttributeTypes are loaded
070     * @throws Exception if there are failures accessing AttributeType information
071     */
072    List<Entry> loadAttributeTypes( String... schemaNames ) throws Exception;
073
074
075    /**
076     * Build a list of Comparators read from the underlying storage for
077     * a list of specific schema.
078     *
079     * @param schemas the schemas from which Comparators are loaded
080     * @throws Exception if there are failures accessing Comparator information
081     */
082    List<Entry> loadComparators( Schema... schemas ) throws LdapException, IOException;
083
084
085    /**
086     * Build a list of Comparators read from the underlying storage for
087     * a list of specific schema, using their name
088     *
089     * @param schemaNames the schema names from which Comparators are loaded
090     * @throws Exception if there are failures accessing Comparator information
091     */
092    List<Entry> loadComparators( String... schemaNames ) throws Exception;
093
094
095    /**
096     * Build a list of DitContentRules read from the underlying storage for
097     * a list of specific schema.
098     *
099     * @param schemas the schemas from which DitContentRules are loaded
100     * @throws Exception if there are failures accessing DitContentRule information
101     */
102    List<Entry> loadDitContentRules( Schema... schemas ) throws LdapException, IOException;
103
104
105    /**
106     * Build a list of DitContentRules read from the underlying storage for
107     * a list of specified schema names
108     *
109     * @param schemaNames the schema names from which DitContentRules are loaded
110     * @throws Exception if there are failures accessing DitContentRule information
111     */
112    List<Entry> loadDitContentRules( String... schemaNames ) throws Exception;
113
114
115    /**
116     * Build a list of DitStructureRules read from the underlying storage for
117     * a list of specific schema.
118     *
119     * @param schemas the schemas from which DitStructureRules are loaded
120     * @throws Exception if there are failures accessing DitStructureRule information
121     */
122    List<Entry> loadDitStructureRules( Schema... schemas ) throws LdapException, IOException;
123
124
125    /**
126     * Build a list of DitStructureRules read from the underlying storage for
127     * a list of specified schema names
128     *
129     * @param schemaNames the schema names from which DitStructureRules are loaded
130     * @throws Exception if there are failures accessing DitStructureRule information
131     */
132    List<Entry> loadDitStructureRules( String... schemaNames ) throws Exception;
133
134
135    /**
136     * Build a list of MatchingRules read from the underlying storage for
137     * a list of specific schema
138     *
139     * @param schemas the schemas from which MatchingRules are loaded
140     * @throws Exception if there are failures accessing MatchingRule information
141     */
142    List<Entry> loadMatchingRules( Schema... schemas ) throws LdapException, IOException;
143
144
145    /**
146     * Build a list of MatchingRules read from the underlying storage for
147     * a list of specific schema, using their name
148     *
149     * @param schemaNames the schema names from which MatchingRules are loaded
150     * @throws Exception if there are failures accessing MatchingRule information
151     */
152    List<Entry> loadMatchingRules( String... schemaNames ) throws Exception;
153
154
155    /**
156     * Build a list of MatchingRuleUses read from the underlying storage for
157     * a list of specific schema.
158     *
159     * @param schemas the schemas from which MatchingRuleUses are loaded
160     * @throws Exception if there are failures accessing MatchingRuleUse information
161     */
162    List<Entry> loadMatchingRuleUses( Schema... schemas ) throws LdapException, IOException;
163
164
165    /**
166     * Build a list of MatchingRuleUses read from the underlying storage for
167     * a list of specified schema names
168     *
169     * @param schemaNames the schema names from which MatchingRuleUses are loaded
170     * @throws Exception if there are failures accessing MatchingRuleUses information
171     */
172    List<Entry> loadMatchingRuleUses( String... schemaNames ) throws Exception;
173
174
175    /**
176     * Build a list of NameForms read from the underlying storage for
177     * a list of specific schema.
178     *
179     * @param schemas the schemas from which NameForms are loaded
180     * @throws Exception if there are failures accessing NameForm information
181     */
182    List<Entry> loadNameForms( Schema... schemas ) throws LdapException, IOException;
183
184
185    /**
186     * Build a list of NameForms read from the underlying storage for
187     * a list of specified schema names
188     *
189     * @param schemaNames the schema names from which NameForms are loaded
190     * @throws Exception if there are failures accessing NameForms information
191     */
192    List<Entry> loadNameForms( String... schemaNames ) throws Exception;
193
194
195    /**
196     * Build a list of Normalizers read from the underlying storage for
197     * a list of specified schema
198     *
199     * @param schemas the schemas from which Normalizers are loaded
200     * @throws Exception if there are failures accessing Normalizer information
201     */
202    List<Entry> loadNormalizers( Schema... schemas ) throws LdapException, IOException;
203
204
205    /**
206     * Build a list of Normalizers read from the underlying storage for
207     * a list of specified schema names
208     *
209     * @param schemaNames the schema names from which Normalizers are loaded
210     * @throws Exception if there are failures accessing Normalizer information
211     */
212    List<Entry> loadNormalizers( String... schemaNames ) throws Exception;
213
214
215    /**
216     * Build a list of ObjectClasses read from the underlying storage for
217     * a list of specific schema.
218     *
219     * @param schemas the schemas from which ObjectClasses are loaded
220     * @throws Exception if there are failures accessing ObjectClass information
221     */
222    List<Entry> loadObjectClasses( Schema... schemas ) throws LdapException, IOException;
223
224
225    /**
226     * Build a list of ObjectClasses read from the underlying storage for
227     * a list of specified schema names
228     *
229     * @param schemaNames the schema names from which ObjectClasses are loaded
230     * @throws Exception if there are failures accessing ObjectClasses information
231     */
232    List<Entry> loadObjectClasses( String... schemaNames ) throws Exception;
233
234
235    /**
236     * Build a list of Syntaxes read from the underlying storage for
237     * a list of specified schema
238     *
239     * @param schemas the schemas from which Syntaxes are loaded
240     * @throws Exception if there are failures accessing Syntax information
241     */
242    List<Entry> loadSyntaxes( Schema... schemas ) throws LdapException, IOException;
243
244
245    /**
246     * Build a list of Syntaxes read from the underlying storage for
247     * a list of specified schema names
248     *
249     * @param schemaNames the schema names from which Syntaxes are loaded
250     * @throws Exception if there are failures accessing Syntax information
251     */
252    List<Entry> loadSyntaxes( String... schemaNames ) throws Exception;
253
254
255    /**
256     * Build a list of SyntaxCheckers read from the underlying storage for
257     * a list of specified schema
258     *
259     * @param schemas the schemas from which SyntaxCheckers are loaded
260     * @throws Exception if there are failures accessing SyntaxChecker information
261     */
262    List<Entry> loadSyntaxCheckers( Schema... schemas ) throws LdapException, IOException;
263
264
265    /**
266     * Build a list of SyntaxCheckers read from the underlying storage for
267     * a list of specified schema names
268     *
269     * @param schemaNames the schema names from which SyntaxCheckers are loaded
270     * @throws Exception if there are failures accessing SyntaxChecker information
271     */
272    List<Entry> loadSyntaxCheckers( String... schemaNames ) throws Exception;
273
274
275    /**
276     * @return the list of enabled schemas
277     * @throws Exception TODO
278     */
279    Collection<Schema> getAllEnabled() throws Exception;
280
281    
282    /**
283     * @return the list of all schemas
284     * @throws Exception TODO
285     */
286    Collection<Schema> getAllSchemas() throws Exception;
287
288    
289    /**
290     * Add a new schema to the schema's list
291     */
292    void addSchema( Schema schema );
293
294    
295    /**
296     * Remove a schema from the schema's list
297     */
298    void removeSchema( Schema schema );
299}