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.server.schema.bootstrap;
21  
22  
23  import javax.naming.NamingException;
24  
25  import org.apache.directory.server.schema.bootstrap.ProducerTypeEnum;
26  import org.apache.directory.server.schema.registries.Registries;
27  
28  
29  /**
30   * A simple maching rule configuration where objects and java code are used
31   * to create matching rules.
32   *
33   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
34   * @version $Rev: 491471 $
35   */
36  public class SystemMatchingRuleProducer extends AbstractBootstrapProducer
37  {
38      public SystemMatchingRuleProducer()
39      {
40          super( ProducerTypeEnum.MATCHING_RULE_PRODUCER );
41      }
42  
43  
44      public void produce( Registries registries, ProducerCallback cb ) throws NamingException
45      {
46          BootstrapMatchingRule mrule = null;
47  
48          /*
49           * Straight out of RFC 2252: Section 8
50           * =======================================
51           ( 2.5.13.0 NAME 'objectIdentifierMatch'
52           SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )
53  
54           ( 2.5.13.1 NAME 'distinguishedNameMatch'
55           SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
56  
57           ( 2.5.13.2 NAME 'caseIgnoreMatch'
58           SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
59  
60           ( 2.5.13.3 NAME 'caseIgnoreOrderingMatch'
61           SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
62  
63           ( 2.5.13.4 NAME 'caseIgnoreSubstringsMatch'
64           SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
65           */
66  
67          mrule = new BootstrapMatchingRule( "2.5.13.0", registries );
68          mrule.setNames( new String[]
69              { "objectIdentifierMatch" } );
70          mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.38" );
71          cb.schemaObjectProduced( this, mrule.getOid(), mrule );
72  
73          mrule = new BootstrapMatchingRule( "2.5.13.1", registries );
74          mrule.setNames( new String[]
75              { "distinguishedNameMatch" } );
76          mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.12" );
77          cb.schemaObjectProduced( this, mrule.getOid(), mrule );
78  
79          mrule = new BootstrapMatchingRule( "2.5.13.2", registries );
80          mrule.setNames( new String[]
81              { "caseIgnoreMatch" } );
82          mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.15" );
83          cb.schemaObjectProduced( this, mrule.getOid(), mrule );
84  
85          mrule = new BootstrapMatchingRule( "2.5.13.3", registries );
86          mrule.setNames( new String[]
87              { "caseIgnoreOrderingMatch" } );
88          mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.15" );
89          cb.schemaObjectProduced( this, mrule.getOid(), mrule );
90  
91          mrule = new BootstrapMatchingRule( "2.5.13.4", registries );
92          mrule.setNames( new String[]
93              { "caseIgnoreSubstringsMatch" } );
94          mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.58" );
95          cb.schemaObjectProduced( this, mrule.getOid(), mrule );
96  
97          /*
98           * Straight out of RFC 3698: Section 2.3
99           * http://www.faqs.org/rfcs/rfc3698.html
100          * =======================================
101          ( 2.5.13.6 NAME 'caseExactOrderingMatch'
102          SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
103          */
104 
105         mrule = new BootstrapMatchingRule( "2.5.13.6", registries );
106         mrule.setNames( new String[]
107             { "caseExactOrderingMatch" } );
108         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.15" );
109         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
110 
111         /*
112          * Straight out of RFC 2252: Section 8
113          * =======================================
114          ( 2.5.13.8 NAME 'numericStringMatch'
115          SYNTAX 1.3.6.1.4.1.1466.115.121.1.36 )
116 
117          ( 2.5.13.10 NAME 'numericStringSubstringsMatch'
118          SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
119 
120          ( 2.5.13.11 NAME 'caseIgnoreListMatch'
121          SYNTAX 1.3.6.1.4.1.1466.115.121.1.41 )
122 
123          ( 2.5.13.14 NAME 'integerMatch'
124          SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
125 
126          ( 2.5.13.16 NAME 'bitStringMatch'
127          SYNTAX 1.3.6.1.4.1.1466.115.121.1.6 )
128 
129          ( 2.5.13.17 NAME 'octetStringMatch'
130          SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )
131          */
132 
133         mrule = new BootstrapMatchingRule( "2.5.13.8", registries );
134         mrule.setNames( new String[]
135             { "numericStringMatch" } );
136         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.36" );
137         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
138 
139         mrule = new BootstrapMatchingRule( "2.5.13.10", registries );
140         mrule.setNames( new String[]
141             { "numericStringSubstringsMatch" } );
142         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.58" );
143         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
144 
145         mrule = new BootstrapMatchingRule( "2.5.13.11", registries );
146         mrule.setNames( new String[]
147             { "caseIgnoreListMatch" } );
148         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.41" );
149         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
150 
151         mrule = new BootstrapMatchingRule( "2.5.13.14", registries );
152         mrule.setNames( new String[]
153             { "integerMatch" } );
154         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.27" );
155         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
156 
157         /*
158          * Straight out of RFC 3698: Section 2.7
159          * http://www.faqs.org/rfcs/rfc3698.html
160          * =======================================
161          ( 2.5.13.15 NAME 'integerOrderingMatch'
162          SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
163          */
164 
165         mrule = new BootstrapMatchingRule( "2.5.13.15", registries );
166         mrule.setNames( new String[]
167             { "integerOrderingMatch" } );
168         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.27" );
169         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
170 
171         mrule = new BootstrapMatchingRule( "2.5.13.16", registries );
172         mrule.setNames( new String[]
173             { "bitStringMatch" } );
174         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.6" );
175         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
176 
177         mrule = new BootstrapMatchingRule( "2.5.13.17", registries );
178         mrule.setNames( new String[]
179             { "octetStringMatch" } );
180         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.40" );
181         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
182 
183         /*
184          * Straight out of RFC 2252: Section 8
185          * =======================================
186          ( 2.5.13.20 NAME 'telephoneNumberMatch'
187          SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 )
188 
189          ( 2.5.13.21 NAME 'telephoneNumberSubstringsMatch'
190          SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
191 
192          ( 2.5.13.22 NAME 'presentationAddressMatch'
193          SYNTAX 1.3.6.1.4.1.1466.115.121.1.43 )
194 
195          ( 2.5.13.23 NAME 'uniqueMemberMatch'
196          SYNTAX 1.3.6.1.4.1.1466.115.121.1.34 )
197 
198          ( 2.5.13.24 NAME 'protocolInformationMatch'
199          SYNTAX 1.3.6.1.4.1.1466.115.121.1.42 )
200          */
201 
202         mrule = new BootstrapMatchingRule( "2.5.13.20", registries );
203         mrule.setNames( new String[]
204             { "telephoneNumberMatch" } );
205         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.50" );
206         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
207 
208         mrule = new BootstrapMatchingRule( "2.5.13.21", registries );
209         mrule.setNames( new String[]
210             { "telephoneNumberSubstringsMatch" } );
211         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.58" );
212         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
213 
214         mrule = new BootstrapMatchingRule( "2.5.13.22", registries );
215         mrule.setNames( new String[]
216             { "presentationAddressMatch" } );
217         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.43" );
218         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
219 
220         mrule = new BootstrapMatchingRule( "2.5.13.23", registries );
221         mrule.setNames( new String[]
222             { "uniqueMemberMatch" } );
223         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.34" );
224         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
225 
226         mrule = new BootstrapMatchingRule( "2.5.13.24", registries );
227         mrule.setNames( new String[]
228             { "protocolInformationMatch" } );
229         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.42" );
230         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
231 
232         /*
233          * Straight out of RFC 2252: Section 8
234          * =======================================
235          ( 2.5.13.27 NAME 'generalizedTimeMatch'
236          SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )
237 
238          ( 2.5.13.28 NAME 'generalizedTimeOrderingMatch'
239          SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )
240 
241          ( 2.5.13.29 NAME 'integerFirstComponentMatch'
242          SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
243 
244          ( 2.5.13.30 NAME 'objectIdentifierFirstComponentMatch'
245          SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )
246 
247          ( 1.3.6.1.4.1.1466.109.114.1 NAME 'caseExactIA5Match'
248          SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
249 
250          ( 1.3.6.1.4.1.1466.109.114.2 NAME 'caseIgnoreIA5Match'
251          SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
252 
253          */
254 
255         mrule = new BootstrapMatchingRule( "2.5.13.27", registries );
256         mrule.setNames( new String[]
257             { "generalizedTimeMatch" } );
258         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.24" );
259         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
260 
261         mrule = new BootstrapMatchingRule( "2.5.13.28", registries );
262         mrule.setNames( new String[]
263             { "generalizedTimeOrderingMatch" } );
264         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.24" );
265         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
266 
267         mrule = new BootstrapMatchingRule( "2.5.13.29", registries );
268         mrule.setNames( new String[]
269             { "integerFirstComponentMatch" } );
270         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.27" );
271         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
272 
273         mrule = new BootstrapMatchingRule( "2.5.13.30", registries );
274         mrule.setNames( new String[]
275             { "objectIdentifierFirstComponentMatch" } );
276         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.38" );
277         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
278 
279         /*
280          * Straight out of RFC 3698: Section 2.6
281          * http://www.faqs.org/rfcs/rfc3698.html
282          * =======================================
283          * ( 2.5.13.31 NAME 'directoryStringFirstComponentMatch'
284          *   SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
285          */
286 
287         mrule = new BootstrapMatchingRule( "2.5.13.31", registries );
288         mrule.setNames( new String[]
289             { "directoryStringFirstComponentMatch" } );
290         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.15" );
291         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
292 
293         mrule = new BootstrapMatchingRule( "1.3.6.1.4.1.1466.109.114.1", registries );
294         mrule.setNames( new String[]
295             { "caseExactIA5Match" } );
296         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.26" );
297         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
298 
299         mrule = new BootstrapMatchingRule( "1.3.6.1.4.1.1466.109.114.2", registries );
300         mrule.setNames( new String[]
301             { "caseIgnoreIA5Match" } );
302         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.26" );
303         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
304 
305         /*
306          * MatchingRules from section 2 of http://www.faqs.org/rfcs/rfc3698.html
307          * for Additional MatchingRules
308 
309          ( 2.5.13.13 NAME 'booleanMatch'
310          SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 )
311 
312          ( 2.5.13.18 NAME 'octetStringOrderingMatch'
313          SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )
314 
315          */
316 
317         mrule = new BootstrapMatchingRule( "2.5.13.13", registries );
318         mrule.setNames( new String[]
319             { "booleanMatch" } );
320         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.7" );
321         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
322 
323         mrule = new BootstrapMatchingRule( "2.5.13.18", registries );
324         mrule.setNames( new String[]
325             { "octetStringOrderingMatch" } );
326         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.40" );
327         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
328 
329         /*
330          * Straight out of RFC 2798 for InetOrgPerson: Section 9.3.3
331          * =========================================================
332 
333          ( 2.5.13.5 NAME 'caseExactMatch'
334          SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
335 
336          ( 2.5.13.7 NAME 'caseExactSubstringsMatch'
337          SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
338 
339          ( 2.5.13.12 NAME 'caseIgnoreListSubstringsMatch'
340          SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
341          */
342 
343         mrule = new BootstrapMatchingRule( "2.5.13.5", registries );
344         mrule.setNames( new String[]
345             { "caseExactMatch" } );
346         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.15" );
347         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
348 
349         mrule = new BootstrapMatchingRule( "2.5.13.7", registries );
350         mrule.setNames( new String[]
351             { "caseExactSubstringsMatch" } );
352         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.58" );
353         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
354 
355         mrule = new BootstrapMatchingRule( "2.5.13.12", registries );
356         mrule.setNames( new String[]
357             { "caseIgnoreListSubstringsMatch" } );
358         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.58" );
359         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
360 
361         /*
362          * Straight out of RFC 2798 for InetOrgPerson: Section 9.3.4
363          * =========================================================
364 
365          ( 1.3.6.1.4.1.1466.109.114.3 NAME 'caseIgnoreIA5SubstringsMatch'
366          SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
367          */
368 
369         mrule = new BootstrapMatchingRule( "1.3.6.1.4.1.1466.109.114.3", registries );
370         mrule.setNames( new String[]
371             { "caseIgnoreIA5SubstringsMatch" } );
372         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.58" );
373         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
374     }
375 }