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.bootstrap;
021
022
023 import javax.naming.NamingException;
024
025 import org.apache.directory.server.schema.bootstrap.ProducerTypeEnum;
026 import org.apache.directory.server.schema.registries.Registries;
027 import org.apache.directory.shared.ldap.constants.SchemaConstants;
028
029
030 /**
031 * A simple matching rule configuration where objects and java code are used
032 * to create matching rules.
033 *
034 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
035 * @version $Rev: 781877 $
036 */
037 public class SystemMatchingRuleProducer extends AbstractBootstrapProducer
038 {
039 public SystemMatchingRuleProducer()
040 {
041 super( ProducerTypeEnum.MATCHING_RULE_PRODUCER );
042 }
043
044
045 public void produce( Registries registries, ProducerCallback cb ) throws NamingException
046 {
047 BootstrapMatchingRule mrule = null;
048
049 /*
050 * Straight out of RFC 4517
051 * Straight out of RFC 3698: Section 2.3
052 * http://www.faqs.org/rfcs/rfc3698.html
053 * =======================================
054 */
055 /*
056 * ( 2.5.13.0 NAME 'objectIdentifierMatch'
057 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )
058 */
059 mrule = new BootstrapMatchingRule( SchemaConstants.OBJECT_IDENTIFIER_MATCH_MR_OID, registries );
060 mrule.setNames( new String[]
061 { SchemaConstants.OBJECT_IDENTIFIER_MATCH_MR } );
062 mrule.setSyntaxOid( SchemaConstants.OID_SYNTAX );
063 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
064
065 /*
066 * ( 2.5.13.1 NAME 'distinguishedNameMatch'
067 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
068 */
069 mrule = new BootstrapMatchingRule( SchemaConstants.DISTINGUISHED_NAME_MATCH_MR_OID, registries );
070 mrule.setNames( new String[]
071 { SchemaConstants.DISTINGUISHED_NAME_MATCH_MR } );
072 mrule.setSyntaxOid( SchemaConstants.DN_SYNTAX );
073 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
074
075 /*
076 * ( 2.5.13.2 NAME 'caseIgnoreMatch'
077 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
078 */
079 mrule = new BootstrapMatchingRule( SchemaConstants.CASE_IGNORE_MATCH_MR_OID, registries );
080 mrule.setNames( new String[]
081 { SchemaConstants.CASE_IGNORE_MATCH_MR } );
082 mrule.setSyntaxOid( SchemaConstants.DIRECTORY_STRING_SYNTAX );
083 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
084
085 /*
086 * ( 2.5.13.3 NAME 'caseIgnoreOrderingMatch'
087 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
088 */
089 mrule = new BootstrapMatchingRule( SchemaConstants.CASE_IGNORE_ORDERING_MATCH_MR_OID, registries );
090 mrule.setNames( new String[]
091 { SchemaConstants.CASE_IGNORE_ORDERING_MATCH_MR } );
092 mrule.setSyntaxOid( SchemaConstants.DIRECTORY_STRING_SYNTAX );
093 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
094
095 /*
096 * ( 2.5.13.4 NAME 'caseIgnoreSubstringsMatch'
097 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
098 */
099 mrule = new BootstrapMatchingRule( SchemaConstants.CASE_IGNORE_SUBSTRING_MATCH_MR_OID, registries );
100 mrule.setNames( new String[]
101 { SchemaConstants.CASE_IGNORE_SUBSTRING_MATCH_MR } );
102 mrule.setSyntaxOid( SchemaConstants.SUBSTRING_ASSERTION_SYNTAX );
103 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
104
105 /*
106 * ( 2.5.13.5 NAME 'caseExactMatch'
107 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
108 */
109 mrule = new BootstrapMatchingRule( SchemaConstants.CASE_EXACT_MATCH_MR_OID, registries );
110 mrule.setNames( new String[]
111 { SchemaConstants.CASE_EXACT_MATCH_MR } );
112 mrule.setSyntaxOid( SchemaConstants.DIRECTORY_STRING_SYNTAX );
113 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
114
115 /*
116 * ( 2.5.13.6 NAME 'caseExactOrderingMatch'
117 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
118 */
119 mrule = new BootstrapMatchingRule( SchemaConstants.CASE_EXACT_ORDERING_MATCH_MR_OID, registries );
120 mrule.setNames( new String[]
121 { SchemaConstants.CASE_EXACT_ORDERING_MATCH_MR } );
122 mrule.setSyntaxOid( SchemaConstants.DIRECTORY_STRING_SYNTAX );
123 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
124
125 /*
126 * ( 2.5.13.7 NAME 'caseExactSubstringsMatch'
127 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
128 */
129 mrule = new BootstrapMatchingRule( SchemaConstants.CASE_EXACT_SUBSTRING_MATCH_MR_OID, registries );
130 mrule.setNames( new String[]
131 { SchemaConstants.CASE_EXACT_SUBSTRING_MATCH_MR } );
132 mrule.setSyntaxOid( SchemaConstants.SUBSTRING_ASSERTION_SYNTAX );
133 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
134
135 /*
136 * ( 2.5.13.8 NAME 'numericStringMatch'
137 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.36 )
138 */
139 mrule = new BootstrapMatchingRule( SchemaConstants.NUMERIC_STRING_MATCH_MR_OID, registries );
140 mrule.setNames( new String[]
141 { SchemaConstants.NUMERIC_STRING_MATCH_MR } );
142 mrule.setSyntaxOid( SchemaConstants.NUMERIC_STRING_SYNTAX );
143 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
144
145 /*
146 * ( 2.5.13.9 NAME 'numericStringOrderingMatch'
147 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.36 )
148 */
149 mrule = new BootstrapMatchingRule( SchemaConstants.NUMERIC_STRING_ORDERING_MATCH_MR_OID, registries );
150 mrule.setNames( new String[]
151 { SchemaConstants.NUMERIC_STRING_ORDERING_MATCH_MR } );
152 mrule.setSyntaxOid( SchemaConstants.NUMERIC_STRING_SYNTAX );
153 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
154
155 /*
156 * ( 2.5.13.10 NAME 'numericStringSubstringsMatch'
157 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
158 */
159 mrule = new BootstrapMatchingRule( SchemaConstants.NUMERIC_STRING_SUBSTRINGS_MATCH_MR_OID, registries );
160 mrule.setNames( new String[]
161 { SchemaConstants.NUMERIC_STRING_SUBSTRINGS_MATCH_MR } );
162 mrule.setSyntaxOid( SchemaConstants.SUBSTRING_ASSERTION_SYNTAX );
163 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
164
165 /*
166 * ( 2.5.13.11 NAME 'caseIgnoreListMatch'
167 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.41 )
168 */
169 mrule = new BootstrapMatchingRule( SchemaConstants.CASE_IGNORE_LIST_MATCH_MR_OID, registries );
170 mrule.setNames( new String[]
171 { SchemaConstants.CASE_IGNORE_LIST_MATCH_MR } );
172 mrule.setSyntaxOid( SchemaConstants.POSTAL_ADDRESS_SYNTAX );
173 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
174
175 /*
176 * ( 2.5.13.12 NAME 'caseIgnoreListSubstringsMatch'
177 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
178 */
179 mrule = new BootstrapMatchingRule( SchemaConstants.CASE_IGNORE_LIST_SUBSTRINGS_MATCH_MR_OID, registries );
180 mrule.setNames( new String[]
181 { SchemaConstants.CASE_IGNORE_LIST_SUBSTRINGS_MATCH_MR } );
182 mrule.setSyntaxOid( SchemaConstants.SUBSTRING_ASSERTION_SYNTAX );
183 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
184
185 /*
186 * ( 2.5.13.13 NAME 'booleanMatch'
187 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 )
188 */
189 mrule = new BootstrapMatchingRule( SchemaConstants.BOOLEAN_MATCH_MR_OID, registries );
190 mrule.setNames( new String[]
191 { SchemaConstants.BOOLEAN_MATCH_MR } );
192 mrule.setSyntaxOid( SchemaConstants.BOOLEAN_SYNTAX );
193 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
194
195 /*
196 * ( 2.5.13.14 NAME 'integerMatch'
197 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
198 */
199 mrule = new BootstrapMatchingRule( SchemaConstants.INTEGER_MATCH_MR_OID, registries );
200 mrule.setNames( new String[]
201 { SchemaConstants.INTEGER_MATCH_MR } );
202 mrule.setSyntaxOid( SchemaConstants.INTEGER_SYNTAX );
203 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
204
205 /*
206 * ( 2.5.13.15 NAME 'integerOrderingMatch'
207 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
208 */
209 mrule = new BootstrapMatchingRule( SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID, registries );
210 mrule.setNames( new String[]
211 { SchemaConstants.INTEGER_ORDERING_MATCH_MR } );
212 mrule.setSyntaxOid( SchemaConstants.INTEGER_SYNTAX );
213 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
214
215 /*
216 * ( 2.5.13.16 NAME 'bitStringMatch'
217 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.6 )
218 */
219 mrule = new BootstrapMatchingRule( SchemaConstants.BIT_STRING_MATCH_MR_OID, registries );
220 mrule.setNames( new String[]
221 { SchemaConstants.BIT_STRING_MATCH_MR } );
222 mrule.setSyntaxOid( SchemaConstants.BIT_STRING_SYNTAX );
223 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
224
225 /*
226 * ( 2.5.13.17 NAME 'octetStringMatch'
227 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )
228 */
229 mrule = new BootstrapMatchingRule( SchemaConstants.OCTET_STRING_MATCH_MR_OID, registries );
230 mrule.setNames( new String[]
231 { SchemaConstants.OCTET_STRING_MATCH_MR } );
232 mrule.setSyntaxOid( SchemaConstants.OCTET_STRING_SYNTAX );
233 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
234
235 /*
236 * ( 2.5.13.18 NAME 'octetStringOrderingMatch'
237 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )
238 */
239 mrule = new BootstrapMatchingRule( SchemaConstants.OCTET_STRING_ORDERING_MATCH_MR_OID, registries );
240 mrule.setNames( new String[]
241 { SchemaConstants.OCTET_STRING_ORDERING_MATCH_MR } );
242 mrule.setSyntaxOid( SchemaConstants.OCTET_STRING_SYNTAX );
243 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
244
245 /*
246 * ( 2.5.13.19 NAME 'octetStringSubstringsMatch'
247 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )
248 */
249 mrule = new BootstrapMatchingRule( SchemaConstants.OCTET_STRING_SUBSTRINGS_MATCH_MR_OID, registries );
250 mrule.setNames( new String[]
251 { SchemaConstants.OCTET_STRING_SUBSTRINGS_MATCH_MR } );
252 mrule.setSyntaxOid( SchemaConstants.OCTET_STRING_SYNTAX );
253 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
254
255 /*
256 * ( 2.5.13.20 NAME 'telephoneNumberMatch'
257 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 )
258 */
259 mrule = new BootstrapMatchingRule( SchemaConstants.TELEPHONE_NUMBER_MATCH_MR_OID, registries );
260 mrule.setNames( new String[]
261 { SchemaConstants.TELEPHONE_NUMBER_MATCH_MR } );
262 mrule.setSyntaxOid( SchemaConstants.TELEPHONE_NUMBER_SYNTAX );
263 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
264
265 /*
266 * ( 2.5.13.21 NAME 'telephoneNumberSubstringsMatch'
267 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
268 */
269 mrule = new BootstrapMatchingRule( SchemaConstants.TELEPHONE_NUMBER_SUBSTRINGS_MATCH_MR_OID, registries );
270 mrule.setNames( new String[]
271 { SchemaConstants.TELEPHONE_NUMBER_SUBSTRINGS_MATCH_MR } );
272 mrule.setSyntaxOid( SchemaConstants.SUBSTRING_ASSERTION_SYNTAX );
273 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
274
275 /*
276 * This MatchingRule is deprecated
277 *
278 * ( 2.5.13.22 NAME 'presentationAddressMatch'
279 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.43 )
280 */
281 mrule = new BootstrapMatchingRule( SchemaConstants.PRESENTATION_ADDRESS_MATCH_MATCH_MR_OID, registries );
282 mrule.setNames( new String[]
283 { SchemaConstants.PRESENTATION_ADDRESS_MATCH_MATCH_MR } );
284 mrule.setSyntaxOid( SchemaConstants.PRESENTATION_ADDRESS_SYNTAX );
285 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
286
287 /*
288 * ( 2.5.13.23 NAME 'uniqueMemberMatch'
289 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.34 )
290 */
291 mrule = new BootstrapMatchingRule( SchemaConstants.UNIQUE_MEMBER_MATCH_MATCH_MR_OID, registries );
292 mrule.setNames( new String[]
293 { SchemaConstants.UNIQUE_MEMBER_MATCH_MATCH_MR } );
294 mrule.setSyntaxOid( SchemaConstants.NAME_AND_OPTIONAL_UID_SYNTAX );
295 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
296
297 /*
298 * This MatchingRule is deprecated
299 *
300 * ( 2.5.13.24 NAME 'protocolInformationMatch'
301 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.42 )
302 */
303 mrule = new BootstrapMatchingRule( SchemaConstants.PROTOCOL_INFORMATION_MATCH_MATCH_MR_OID, registries );
304 mrule.setNames( new String[]
305 { SchemaConstants.PROTOCOL_INFORMATION_MATCH_MATCH_MR } );
306 mrule.setSyntaxOid( SchemaConstants.PROTOCOL_INFORMATION_SYNTAX );
307 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
308
309 // "2.5.13.25" is not used ...
310
311 // "2.5.13.26" is not used ...
312
313 /*
314 * ( 2.5.13.27 NAME 'generalizedTimeMatch'
315 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )
316 */
317 mrule = new BootstrapMatchingRule( SchemaConstants.GENERALIZED_TIME_MATCH_MR_OID, registries );
318 mrule.setNames( new String[]
319 { SchemaConstants.GENERALIZED_TIME_MATCH_MR } );
320 mrule.setSyntaxOid( SchemaConstants.GENERALIZED_TIME_SYNTAX );
321 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
322
323 /*
324 * ( 2.5.13.28 NAME 'generalizedTimeOrderingMatch'
325 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )
326 */
327 mrule = new BootstrapMatchingRule( SchemaConstants.GENERALIZED_TIME_ORDERING_MATCH_MR_OID, registries );
328 mrule.setNames( new String[]
329 { SchemaConstants.GENERALIZED_TIME_ORDERING_MATCH_MR } );
330 mrule.setSyntaxOid( SchemaConstants.GENERALIZED_TIME_SYNTAX );
331 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
332
333 /*
334 * ( 2.5.13.29 NAME 'integerFirstComponentMatch'
335 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
336 */
337 mrule = new BootstrapMatchingRule( SchemaConstants.INTEGER_FIRST_COMPONENT_MATCH_MR_OID, registries );
338 mrule.setNames( new String[]
339 { SchemaConstants.INTEGER_FIRST_COMPONENT_MATCH_MR } );
340 mrule.setSyntaxOid( SchemaConstants.INTEGER_SYNTAX );
341 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
342
343 /*
344 * ( 2.5.13.30 NAME 'objectIdentifierFirstComponentMatch'
345 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )
346 */
347 mrule = new BootstrapMatchingRule( SchemaConstants.OBJECT_IDENTIFIER_FIRST_COMPONENT_MATCH_MR_OID, registries );
348 mrule.setNames( new String[]
349 { SchemaConstants.OBJECT_IDENTIFIER_FIRST_COMPONENT_MATCH_MR } );
350 mrule.setSyntaxOid( SchemaConstants.OID_SYNTAX );
351 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
352
353 /*
354 * ( 2.5.13.31 NAME 'directoryStringFirstComponentMatch'
355 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
356 */
357 mrule = new BootstrapMatchingRule( SchemaConstants.DIRECTORY_STRING_FIRST_COMPONENT_MATCH_MR_OID, registries );
358 mrule.setNames( new String[]
359 { SchemaConstants.DIRECTORY_STRING_FIRST_COMPONENT_MATCH_MR } );
360 mrule.setSyntaxOid( SchemaConstants.DIRECTORY_STRING_SYNTAX );
361 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
362
363 /*
364 * ( 2.5.13.32 NAME 'wordMatch'
365 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )
366 */
367 mrule = new BootstrapMatchingRule( SchemaConstants.WORD_MATCH_MR_OID, registries );
368 mrule.setNames( new String[]
369 { SchemaConstants.WORD_MATCH_MR } );
370 mrule.setSyntaxOid( SchemaConstants.DIRECTORY_STRING_SYNTAX );
371 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
372
373 /*
374 * ( 2.5.13.33 NAME 'keywordMatch'
375 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )
376 */
377 mrule = new BootstrapMatchingRule( SchemaConstants.KEYWORD_MATCH_MR_OID, registries );
378 mrule.setNames( new String[]
379 { SchemaConstants.KEYWORD_MATCH_MR } );
380 mrule.setSyntaxOid( SchemaConstants.DIRECTORY_STRING_SYNTAX );
381 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
382
383 /*
384 * ( 1.3.6.1.4.1.1466.109.114.1 NAME 'caseExactIA5Match'
385 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
386 */
387 mrule = new BootstrapMatchingRule( SchemaConstants.CASE_EXACT_IA5_MATCH_MR_OID, registries );
388 mrule.setNames( new String[]
389 { SchemaConstants.CASE_EXACT_IA5_MATCH_MR } );
390 mrule.setSyntaxOid( SchemaConstants.IA5_STRING_SYNTAX );
391 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
392
393 /*
394 * ( 1.3.6.1.4.1.1466.109.114.2 NAME 'caseIgnoreIA5Match'
395 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
396 */
397 mrule = new BootstrapMatchingRule( SchemaConstants.CASE_IGNORE_IA5_MATCH_MR_OID, registries );
398 mrule.setNames( new String[]
399 { SchemaConstants.CASE_IGNORE_IA5_MATCH_MR } );
400 mrule.setSyntaxOid( SchemaConstants.IA5_STRING_SYNTAX );
401 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
402
403 /*
404 * ( 1.3.6.1.4.1.1466.109.114.3 NAME 'caseIgnoreIA5SubstringsMatch'
405 * SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
406 */
407 mrule = new BootstrapMatchingRule( SchemaConstants.CASE_IGNORE_IA5_SUBSTRINGS_MATCH_MR_OID, registries );
408 mrule.setNames( new String[]
409 { SchemaConstants.CASE_IGNORE_IA5_SUBSTRINGS_MATCH_MR } );
410 mrule.setSyntaxOid( SchemaConstants.SUBSTRING_ASSERTION_SYNTAX );
411 cb.schemaObjectProduced( this, mrule.getOid(), mrule );
412 }
413 }