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: 157708 $
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 2252: Section 8
89           * =======================================
90          ( 2.5.13.8 NAME 'numericStringMatch'
91            SYNTAX 1.3.6.1.4.1.1466.115.121.1.36 )
92  
93          ( 2.5.13.10 NAME 'numericStringSubstringsMatch'
94            SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
95  
96          ( 2.5.13.11 NAME 'caseIgnoreListMatch'
97            SYNTAX 1.3.6.1.4.1.1466.115.121.1.41 )
98  
99          ( 2.5.13.14 NAME 'integerMatch'
100           SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
101 
102         ( 2.5.13.16 NAME 'bitStringMatch'
103           SYNTAX 1.3.6.1.4.1.1466.115.121.1.6 )
104 
105         ( 2.5.13.17 NAME 'octetStringMatch'
106           SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )
107         */
108 
109         mrule = new BootstrapMatchingRule( "2.5.13.8", registries  );
110         mrule.setNames( new String[] { "numericStringMatch" } );
111         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.36" );
112         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
113 
114         mrule = new BootstrapMatchingRule( "2.5.13.10", registries  );
115         mrule.setNames( new String[] { "numericStringSubstringsMatch" } );
116         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.58" );
117         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
118 
119         mrule = new BootstrapMatchingRule( "2.5.13.11", registries  );
120         mrule.setNames( new String[] { "caseIgnoreListMatch" } );
121         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.41" );
122         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
123 
124         mrule = new BootstrapMatchingRule( "2.5.13.14", registries  );
125         mrule.setNames( new String[] { "integerMatch" } );
126         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.27" );
127         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
128 
129         mrule = new BootstrapMatchingRule( "2.5.13.16", registries  );
130         mrule.setNames( new String[] { "bitStringMatch" } );
131         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.6" );
132         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
133 
134         mrule = new BootstrapMatchingRule( "2.5.13.17", registries  );
135         mrule.setNames( new String[] { "octetStringMatch" } );
136         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.40" );
137         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
138 
139         /*
140          * Straight out of RFC 2252: Section 8
141          * =======================================
142         ( 2.5.13.20 NAME 'telephoneNumberMatch'
143           SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 )
144 
145         ( 2.5.13.21 NAME 'telephoneNumberSubstringsMatch'
146           SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
147 
148         ( 2.5.13.22 NAME 'presentationAddressMatch'
149           SYNTAX 1.3.6.1.4.1.1466.115.121.1.43 )
150 
151         ( 2.5.13.23 NAME 'uniqueMemberMatch'
152           SYNTAX 1.3.6.1.4.1.1466.115.121.1.34 )
153 
154         ( 2.5.13.24 NAME 'protocolInformationMatch'
155           SYNTAX 1.3.6.1.4.1.1466.115.121.1.42 )
156         */
157 
158         mrule = new BootstrapMatchingRule( "2.5.13.20", registries  );
159         mrule.setNames( new String[] { "telephoneNumberMatch" } );
160         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.50" );
161         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
162 
163         mrule = new BootstrapMatchingRule( "2.5.13.21", registries  );
164         mrule.setNames( new String[] { "telephoneNumberSubstringsMatch" } );
165         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.58" );
166         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
167 
168         mrule = new BootstrapMatchingRule( "2.5.13.22", registries  );
169         mrule.setNames( new String[] { "presentationAddressMatch" } );
170         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.43" );
171         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
172 
173         mrule = new BootstrapMatchingRule( "2.5.13.23", registries  );
174         mrule.setNames( new String[] { "uniqueMemberMatch" } );
175         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.34" );
176         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
177 
178         mrule = new BootstrapMatchingRule( "2.5.13.24", registries  );
179         mrule.setNames( new String[] { "protocolInformationMatch" } );
180         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.42" );
181         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
182 
183         /*
184          * Straight out of RFC 2252: Section 8
185          * =======================================
186         ( 2.5.13.27 NAME 'generalizedTimeMatch'
187           SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )
188 
189         ( 2.5.13.28 NAME 'generalizedTimeOrderingMatch'
190           SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )
191 
192         ( 2.5.13.29 NAME 'integerFirstComponentMatch'
193           SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
194 
195         ( 2.5.13.30 NAME 'objectIdentifierFirstComponentMatch'
196           SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )
197 
198         ( 1.3.6.1.4.1.1466.109.114.1 NAME 'caseExactIA5Match'
199           SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
200 
201         ( 1.3.6.1.4.1.1466.109.114.2 NAME 'caseIgnoreIA5Match'
202           SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
203 
204         */
205 
206         mrule = new BootstrapMatchingRule( "2.5.13.27", registries  );
207         mrule.setNames( new String[] { "generalizedTimeMatch" } );
208         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.24" );
209         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
210 
211         mrule = new BootstrapMatchingRule( "2.5.13.28", registries  );
212         mrule.setNames( new String[] { "generalizedTimeOrderingMatch" } );
213         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.24" );
214         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
215 
216         mrule = new BootstrapMatchingRule( "2.5.13.29", registries  );
217         mrule.setNames( new String[] { "integerFirstComponentMatch" } );
218         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.27" );
219         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
220 
221         mrule = new BootstrapMatchingRule( "2.5.13.30", registries  );
222         mrule.setNames( new String[] { "objectIdentifierFirstComponentMatch" } );
223         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.38" );
224         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
225 
226         mrule = new BootstrapMatchingRule( "1.3.6.1.4.1.1466.109.114.1", registries  );
227         mrule.setNames( new String[] { "caseExactIA5Match" } );
228         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.26" );
229         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
230 
231         mrule = new BootstrapMatchingRule( "1.3.6.1.4.1.1466.109.114.2", registries  );
232         mrule.setNames( new String[] { "caseIgnoreIA5Match" } );
233         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.26" );
234         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
235 
236         /*
237          * MatchingRules from section 2 of http://www.faqs.org/rfcs/rfc3698.html
238          * for Additional MatchingRules
239 
240          ( 2.5.13.13 NAME 'booleanMatch'
241            SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 )
242 
243          */
244 
245         mrule = new BootstrapMatchingRule( "2.5.13.13", registries  );
246         mrule.setNames( new String[] { "booleanMatch" } );
247         mrule.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.7" );
248         cb.schemaObjectProduced( this, mrule.getOid(), mrule );
249 
250     }
251 }