View Javadoc
1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *  
10   *    http://www.apache.org/licenses/LICENSE-2.0
11   *  
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License. 
18   *  
19   */
20  package org.apache.directory.api.ldap.model.schema.registries;
21  
22  
23  import java.io.IOException;
24  import java.util.Collection;
25  import java.util.List;
26  
27  import org.apache.directory.api.ldap.model.entry.Entry;
28  import org.apache.directory.api.ldap.model.exception.LdapException;
29  
30  
31  /**
32   * Loads schemas into registries.
33   *
34   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
35   */
36  public interface SchemaLoader
37  {
38      /**
39       * Gets a schema object based on it's name.
40       * 
41       * @param schemaName the name of the schema to load
42       * @return the Schema object associated with the name
43       */
44      Schema getSchema( String schemaName );
45  
46  
47      /**
48       * Build a list of AttributeTypes read from the underlying storage for
49       * a list of specified schema
50       *
51       * @param schemas the schemas from which AttributeTypes are loaded
52       * @return The list of loaded AttributeTypes
53       * @throws LdapException if there are failures accessing AttributeType information
54       * @throws IOException If we can't read the schemaObject
55       */
56      List<Entry> loadAttributeTypes( Schema... schemas ) throws LdapException, IOException;
57  
58  
59      /**
60       * Build a list of AttributeTypes read from the underlying storage for
61       * a list of specific schema, using their name
62       *
63       * @param schemaNames the schema names from which AttributeTypes are loaded
64       * @return The list of loaded AttributeTypes
65       * @throws LdapException if there are failures accessing AttributeType information
66       * @throws IOException If we can't read the schemaObject
67       */
68      List<Entry> loadAttributeTypes( String... schemaNames ) throws LdapException, IOException;
69  
70  
71      /**
72       * Build a list of Comparators read from the underlying storage for
73       * a list of specific schema.
74       *
75       * @param schemas the schemas from which Comparators are loaded
76       * @return The list of loaded Comparators
77       * @throws LdapException if there are failures accessing Comparator information
78       * @throws IOException If we can't read the schemaObject
79       */
80      List<Entry> loadComparators( Schema... schemas ) throws LdapException, IOException;
81  
82  
83      /**
84       * Build a list of Comparators read from the underlying storage for
85       * a list of specific schema, using their name
86       *
87       * @param schemaNames the schema names from which Comparators are loaded
88       * @return The list of loaded Comparators
89       * @throws LdapException if there are failures accessing Comparator information
90       * @throws IOException If we can't read the schemaObject
91       */
92      List<Entry> loadComparators( String... schemaNames ) throws LdapException, IOException;
93  
94  
95      /**
96       * Build a list of DitContentRules read from the underlying storage for
97       * a list of specific schema.
98       *
99       * @param schemas the schemas from which DitContentRules are loaded
100      * @return The list of loaded DitContentRules
101      * @throws LdapException if there are failures accessing DitContentRule information
102      * @throws IOException If we can't read the schemaObject
103      */
104     List<Entry> loadDitContentRules( Schema... schemas ) throws LdapException, IOException;
105 
106 
107     /**
108      * Build a list of DitContentRules read from the underlying storage for
109      * a list of specified schema names
110      *
111      * @param schemaNames the schema names from which DitContentRules are loaded
112      * @return The list of loaded DitContentRules
113      * @throws LdapException if there are failures accessing DitContentRule information
114      * @throws IOException If we can't read the schemaObject
115      */
116     List<Entry> loadDitContentRules( String... schemaNames ) throws LdapException, IOException;
117 
118 
119     /**
120      * Build a list of DitStructureRules read from the underlying storage for
121      * a list of specific schema.
122      *
123      * @param schemas the schemas from which DitStructureRules are loaded
124      * @return The list of loaded DitStructureRules
125      * @throws LdapException if there are failures accessing DitStructureRule information
126      * @throws IOException If we can't read the schemaObject
127      */
128     List<Entry> loadDitStructureRules( Schema... schemas ) throws LdapException, IOException;
129 
130 
131     /**
132      * Build a list of DitStructureRules read from the underlying storage for
133      * a list of specified schema names
134      *
135      * @param schemaNames the schema names from which DitStructureRules are loaded
136      * @return The list of loaded DitStructureRules
137      * @throws LdapException if there are failures accessing DitStructureRule information
138      * @throws IOException If we can't read the schemaObject
139      */
140     List<Entry> loadDitStructureRules( String... schemaNames ) throws LdapException, IOException;
141 
142 
143     /**
144      * Build a list of MatchingRules read from the underlying storage for
145      * a list of specific schema
146      *
147      * @param schemas the schemas from which MatchingRules are loaded
148      * @return The list of loaded MatchingRules
149      * @throws LdapException if there are failures accessing MatchingRule information
150      * @throws IOException If we can't read the schemaObject
151      */
152     List<Entry> loadMatchingRules( Schema... schemas ) throws LdapException, IOException;
153 
154 
155     /**
156      * Build a list of MatchingRules read from the underlying storage for
157      * a list of specific schema, using their name
158      *
159      * @param schemaNames the schema names from which MatchingRules are loaded
160      * @return The list of loaded MatchingRules
161      * @throws LdapException if there are failures accessing MatchingRule information
162      * @throws IOException If we can't read the schemaObject
163      */
164     List<Entry> loadMatchingRules( String... schemaNames ) throws LdapException, IOException;
165 
166 
167     /**
168      * Build a list of MatchingRuleUses read from the underlying storage for
169      * a list of specific schema.
170      *
171      * @param schemas the schemas from which MatchingRuleUses are loaded
172      * @return The list of loaded MatchingRuleUses
173      * @throws LdapException if there are failures accessing MatchingRuleUse information
174      * @throws IOException If we can't read the schemaObject
175      */
176     List<Entry> loadMatchingRuleUses( Schema... schemas ) throws LdapException, IOException;
177 
178 
179     /**
180      * Build a list of MatchingRuleUses read from the underlying storage for
181      * a list of specified schema names
182      *
183      * @param schemaNames the schema names from which MatchingRuleUses are loaded
184      * @return The list of loaded MatchingRuleUses
185      * @throws LdapException if there are failures accessing MatchingRuleUses information
186      * @throws IOException If we can't read the schemaObject
187      */
188     List<Entry> loadMatchingRuleUses( String... schemaNames ) throws LdapException, IOException;
189 
190 
191     /**
192      * Build a list of NameForms read from the underlying storage for
193      * a list of specific schema.
194      *
195      * @param schemas the schemas from which NameForms are loaded
196      * @return The list of loaded NameForms
197      * @throws LdapException if there are failures accessing NameForm information
198      * @throws IOException If we can't read the schemaObject
199      */
200     List<Entry> loadNameForms( Schema... schemas ) throws LdapException, IOException;
201 
202 
203     /**
204      * Build a list of NameForms read from the underlying storage for
205      * a list of specified schema names
206      *
207      * @param schemaNames the schema names from which NameForms are loaded
208      * @return The list of loaded NameForms
209      * @throws LdapException if there are failures accessing NameForms information
210      * @throws IOException If we can't read the schemaObject
211      */
212     List<Entry> loadNameForms( String... schemaNames ) throws LdapException, IOException;
213 
214 
215     /**
216      * Build a list of Normalizers read from the underlying storage for
217      * a list of specified schema
218      *
219      * @param schemas the schemas from which Normalizers are loaded
220      * @return The list of loaded Normalizers
221      * @throws LdapException if there are failures accessing Normalizer information
222      * @throws IOException If we can't read the schemaObject
223      */
224     List<Entry> loadNormalizers( Schema... schemas ) throws LdapException, IOException;
225 
226 
227     /**
228      * Build a list of Normalizers read from the underlying storage for
229      * a list of specified schema names
230      *
231      * @param schemaNames the schema names from which Normalizers are loaded
232      * @return The list of loaded Normalizers
233      * @throws LdapException if there are failures accessing Normalizer information
234      * @throws IOException If we can't read the schemaObject
235      */
236     List<Entry> loadNormalizers( String... schemaNames ) throws LdapException, IOException;
237 
238 
239     /**
240      * Build a list of ObjectClasses read from the underlying storage for
241      * a list of specific schema.
242      *
243      * @param schemas the schemas from which ObjectClasses are loaded
244      * @return The list of loaded ObjectClasses
245      * @throws LdapException if there are failures accessing ObjectClass information
246      * @throws IOException If we can't read the schemaObject
247      */
248     List<Entry> loadObjectClasses( Schema... schemas ) throws LdapException, IOException;
249 
250 
251     /**
252      * Build a list of ObjectClasses read from the underlying storage for
253      * a list of specified schema names
254      *
255      * @param schemaNames the schema names from which ObjectClasses are loaded
256      * @return The list of loaded ObjectClasses
257      * @throws LdapException if there are failures accessing ObjectClasses information
258      * @throws IOException If we can't read the schemaObject
259      */
260     List<Entry> loadObjectClasses( String... schemaNames ) throws LdapException, IOException;
261 
262 
263     /**
264      * Build a list of Syntaxes read from the underlying storage for
265      * a list of specified schema
266      *
267      * @param schemas the schemas from which Syntaxes are loaded
268      * @return The list of loaded Syntaxes
269      * @throws LdapException if there are failures accessing Syntax information
270      * @throws IOException If we can't read the schemaObject
271      */
272     List<Entry> loadSyntaxes( Schema... schemas ) throws LdapException, IOException;
273 
274 
275     /**
276      * Build a list of Syntaxes read from the underlying storage for
277      * a list of specified schema names
278      *
279      * @param schemaNames the schema names from which Syntaxes are loaded
280      * @return The list of loaded Syntaxes
281      * @throws LdapException if there are failures accessing Syntax information
282      * @throws IOException If we can't read the schemaObject
283      */
284     List<Entry> loadSyntaxes( String... schemaNames ) throws LdapException, IOException;
285 
286 
287     /**
288      * Build a list of SyntaxCheckers read from the underlying storage for
289      * a list of specified schema
290      *
291      * @param schemas the schemas from which SyntaxCheckers are loaded
292      * @return The list of loaded SyntaxeCheckers
293      * @throws LdapException if there are failures accessing SyntaxChecker information
294      * @throws IOException If we can't read the schemaObject
295      */
296     List<Entry> loadSyntaxCheckers( Schema... schemas ) throws LdapException, IOException;
297 
298 
299     /**
300      * Build a list of SyntaxCheckers read from the underlying storage for
301      * a list of specified schema names
302      *
303      * @param schemaNames the schema names from which SyntaxCheckers are loaded
304      * @return A list of loaded SyntaxCheckers
305      * @throws LdapException if there are failures accessing SyntaxChecker information
306      * @throws IOException If we had some issues loading the schemas
307      * @throws IOException If we can't read the schemaObject
308      */
309     List<Entry> loadSyntaxCheckers( String... schemaNames ) throws LdapException, IOException;
310 
311 
312     /**
313      * @return the list of enabled schemas
314      */
315     Collection<Schema> getAllEnabled();
316 
317 
318     /**
319      * @return the list of all schemas
320      */
321     Collection<Schema> getAllSchemas();
322 
323 
324     /**
325      * Add a new schema to the schema's list
326      * 
327      * @param schema The schema to add
328      */
329     void addSchema( Schema schema );
330 
331 
332     /**
333      * Remove a schema from the schema's list
334      * 
335      * @param schema The schema to remove
336      */
337     void removeSchema( Schema schema );
338     
339     
340     /**
341      * @return Tells if the SchemaLoader is in RELAXED mode
342      */
343     boolean isRelaxed();
344     
345     
346     /**
347      * @return Tells if the SchemaLoader is in STRICT mode
348      */
349     boolean isStrict();
350     
351     
352     /**
353      * Set the SchemzLoader in STRICT or RELAXED mode.
354      * 
355      * @param relaxed if <code>true</code>, the SchemaLoader will be in relaxed mode, otherwise
356      * it will be in strict mode (the default)
357      */
358     void setRelaxed( boolean relaxed );
359 }