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