View Javadoc

1   /*
2    *   Copyright 2004 The Apache Software Foundation
3    *
4    *   Licensed under the Apache License, Version 2.0 (the "License");
5    *   you may not use this file except in compliance with the License.
6    *   You may obtain a copy of the License at
7    *
8    *       http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *   Unless required by applicable law or agreed to in writing, software
11   *   distributed under the License is distributed on an "AS IS" BASIS,
12   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *   See the License for the specific language governing permissions and
14   *   limitations under the License.
15   *
16   */
17  package org.apache.ldap.server.schema.bootstrap;
18  
19  
20  import javax.naming.NamingException;
21  
22  
23  /***
24   * A simple maching rule configuration where objects and java code are used
25   * to create matching rules.
26   *
27   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
28   * @version $Rev: 264732 $
29   */
30  public class SystemMatchingRuleProducer extends AbstractBootstrapProducer
31  {
32      public SystemMatchingRuleProducer()
33      {
34          super( ProducerTypeEnum.MATCHING_RULE_PRODUCER );
35      }
36  
37  
38      public void produce( BootstrapRegistries registries, ProducerCallback cb )
39          throws NamingException
40      {
41          BootstrapMatchingRule mrule = null;
42  
43          /*
44           * Straight out of RFC 2252: Section 8
45           * =======================================
46          ( 2.5.13.0 NAME 'objectIdentifierMatch'
47            SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )
48  
49          ( 2.5.13.1 NAME 'distinguishedNameMatch'
50            SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
51  
52          ( 2.5.13.2 NAME 'caseIgnoreMatch'
53            SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
54  
55          ( 2.5.13.3 NAME 'caseIgnoreOrderingMatch'
56            SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
57  
58          ( 2.5.13.4 NAME 'caseIgnoreSubstringsMatch'
59           SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
60          */
61  
62          mrule = new BootstrapMatchingRule( "2.5.13.0", registries );
63          mrule.setNames( new String[] { "objectIdentifierMatch" } );
64          mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.38" );
65          cb.schemaObjectProduced( this, mrule.getOid(), mrule );
66  
67          mrule = new BootstrapMatchingRule( "2.5.13.1", registries  );
68          mrule.setNames( new String[] { "distinguishedNameMatch" } );
69          mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.12" );
70          cb.schemaObjectProduced( this, mrule.getOid(), mrule );
71  
72          mrule = new BootstrapMatchingRule( "2.5.13.2", registries  );
73          mrule.setNames( new String[] { "caseIgnoreMatch" } );
74          mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.15" );
75          cb.schemaObjectProduced( this, mrule.getOid(), mrule );
76  
77          mrule = new BootstrapMatchingRule( "2.5.13.3", registries  );
78          mrule.setNames( new String[] { "caseIgnoreOrderingMatch" } );
79          mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.15" );
80          cb.schemaObjectProduced( this, mrule.getOid(), mrule );
81  
82          mrule = new BootstrapMatchingRule( "2.5.13.4", registries  );
83          mrule.setNames( new String[] { "caseIgnoreSubstringsMatch" } );
84          mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.58" );
85          cb.schemaObjectProduced( this, mrule.getOid(), mrule );
86  
87          /*
88           * Straight out of RFC 3698: Section 2.3
89           * http://www.faqs.org/rfcs/rfc3698.html
90           * =======================================
91           ( 2.5.13.6 NAME 'caseExactOrderingMatch'
92             SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
93           */
94  
95          mrule = new BootstrapMatchingRule( "2.5.13.6", registries  );
96          mrule.setNames( new String[] { "caseExactOrderingMatch" } );
97          mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.15" );
98          cb.schemaObjectProduced( this, mrule.getOid(), mrule );
99  
100         /*
101          * Straight out of RFC 2252: Section 8
102          * =======================================
103         ( 2.5.13.8 NAME 'numericStringMatch'
104           SYNTAX 1.3.6.1.4.1.1466.115.121.1.36 )
105 
106         ( 2.5.13.10 NAME 'numericStringSubstringsMatch'
107           SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
108 
109         ( 2.5.13.11 NAME 'caseIgnoreListMatch'
110           SYNTAX 1.3.6.1.4.1.1466.115.121.1.41 )
111 
112         ( 2.5.13.14 NAME 'integerMatch'
113           SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
114 
115         ( 2.5.13.16 NAME 'bitStringMatch'
116           SYNTAX 1.3.6.1.4.1.1466.115.121.1.6 )
117 
118         ( 2.5.13.17 NAME 'octetStringMatch'
119           SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )
120         */
121 
122         mrule = new BootstrapMatchingRule( "2.5.13.8", registries  );
123         mrule.setNames( new String[] { "numericStringMatch" } );
124         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.36" );
125         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
126 
127         mrule = new BootstrapMatchingRule( "2.5.13.10", registries  );
128         mrule.setNames( new String[] { "numericStringSubstringsMatch" } );
129         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.58" );
130         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
131 
132         mrule = new BootstrapMatchingRule( "2.5.13.11", registries  );
133         mrule.setNames( new String[] { "caseIgnoreListMatch" } );
134         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.41" );
135         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
136 
137         mrule = new BootstrapMatchingRule( "2.5.13.14", registries  );
138         mrule.setNames( new String[] { "integerMatch" } );
139         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.27" );
140         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
141 
142         /*
143          * Straight out of RFC 3698: Section 2.7
144          * http://www.faqs.org/rfcs/rfc3698.html
145          * =======================================
146          ( 2.5.13.15 NAME 'integerOrderingMatch'
147            SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
148          */
149 
150         mrule = new BootstrapMatchingRule( "2.5.13.15", registries  );
151         mrule.setNames( new String[] { "integerOrderingMatch" } );
152         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.27" );
153         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
154 
155         mrule = new BootstrapMatchingRule( "2.5.13.16", registries  );
156         mrule.setNames( new String[] { "bitStringMatch" } );
157         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.6" );
158         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
159 
160         mrule = new BootstrapMatchingRule( "2.5.13.17", registries  );
161         mrule.setNames( new String[] { "octetStringMatch" } );
162         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.40" );
163         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
164 
165         /*
166          * Straight out of RFC 2252: Section 8
167          * =======================================
168         ( 2.5.13.20 NAME 'telephoneNumberMatch'
169           SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 )
170 
171         ( 2.5.13.21 NAME 'telephoneNumberSubstringsMatch'
172           SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
173 
174         ( 2.5.13.22 NAME 'presentationAddressMatch'
175           SYNTAX 1.3.6.1.4.1.1466.115.121.1.43 )
176 
177         ( 2.5.13.23 NAME 'uniqueMemberMatch'
178           SYNTAX 1.3.6.1.4.1.1466.115.121.1.34 )
179 
180         ( 2.5.13.24 NAME 'protocolInformationMatch'
181           SYNTAX 1.3.6.1.4.1.1466.115.121.1.42 )
182         */
183 
184         mrule = new BootstrapMatchingRule( "2.5.13.20", registries  );
185         mrule.setNames( new String[] { "telephoneNumberMatch" } );
186         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.50" );
187         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
188 
189         mrule = new BootstrapMatchingRule( "2.5.13.21", registries  );
190         mrule.setNames( new String[] { "telephoneNumberSubstringsMatch" } );
191         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.58" );
192         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
193 
194         mrule = new BootstrapMatchingRule( "2.5.13.22", registries  );
195         mrule.setNames( new String[] { "presentationAddressMatch" } );
196         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.43" );
197         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
198 
199         mrule = new BootstrapMatchingRule( "2.5.13.23", registries  );
200         mrule.setNames( new String[] { "uniqueMemberMatch" } );
201         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.34" );
202         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
203 
204         mrule = new BootstrapMatchingRule( "2.5.13.24", registries  );
205         mrule.setNames( new String[] { "protocolInformationMatch" } );
206         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.42" );
207         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
208 
209         /*
210          * Straight out of RFC 2252: Section 8
211          * =======================================
212         ( 2.5.13.27 NAME 'generalizedTimeMatch'
213           SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )
214 
215         ( 2.5.13.28 NAME 'generalizedTimeOrderingMatch'
216           SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )
217 
218         ( 2.5.13.29 NAME 'integerFirstComponentMatch'
219           SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
220 
221         ( 2.5.13.30 NAME 'objectIdentifierFirstComponentMatch'
222           SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )
223 
224         ( 1.3.6.1.4.1.1466.109.114.1 NAME 'caseExactIA5Match'
225           SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
226 
227         ( 1.3.6.1.4.1.1466.109.114.2 NAME 'caseIgnoreIA5Match'
228           SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
229 
230         */
231 
232         mrule = new BootstrapMatchingRule( "2.5.13.27", registries  );
233         mrule.setNames( new String[] { "generalizedTimeMatch" } );
234         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.24" );
235         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
236 
237         mrule = new BootstrapMatchingRule( "2.5.13.28", registries  );
238         mrule.setNames( new String[] { "generalizedTimeOrderingMatch" } );
239         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.24" );
240         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
241 
242         mrule = new BootstrapMatchingRule( "2.5.13.29", registries  );
243         mrule.setNames( new String[] { "integerFirstComponentMatch" } );
244         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.27" );
245         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
246 
247         mrule = new BootstrapMatchingRule( "2.5.13.30", registries  );
248         mrule.setNames( new String[] { "objectIdentifierFirstComponentMatch" } );
249         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.38" );
250         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
251 
252         mrule = new BootstrapMatchingRule( "1.3.6.1.4.1.1466.109.114.1", registries  );
253         mrule.setNames( new String[] { "caseExactIA5Match" } );
254         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.26" );
255         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
256 
257         mrule = new BootstrapMatchingRule( "1.3.6.1.4.1.1466.109.114.2", registries  );
258         mrule.setNames( new String[] { "caseIgnoreIA5Match" } );
259         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.26" );
260         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
261 
262         /*
263          * MatchingRules from section 2 of http://www.faqs.org/rfcs/rfc3698.html
264          * for Additional MatchingRules
265 
266          ( 2.5.13.13 NAME 'booleanMatch'
267            SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 )
268            
269          ( 2.5.13.18 NAME 'octetStringOrderingMatch'
270            SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )
271 
272          */
273 
274         mrule = new BootstrapMatchingRule( "2.5.13.13", registries  );
275         mrule.setNames( new String[] { "booleanMatch" } );
276         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.7" );
277         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
278         
279         mrule = new BootstrapMatchingRule( "2.5.13.18", registries  );
280         mrule.setNames( new String[] { "octetStringOrderingMatch" } );
281         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.40" );
282         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
283     }
284 }