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  import org.apache.ldap.common.schema.CachingNormalizer;
23  import org.apache.ldap.common.schema.DeepTrimNormalizer;
24  import org.apache.ldap.common.schema.DeepTrimToLowerNormalizer;
25  import org.apache.ldap.common.schema.DnNormalizer;
26  import org.apache.ldap.common.schema.NoOpNormalizer;
27  import org.apache.ldap.common.schema.Normalizer;
28  import org.apache.ldap.server.schema.ConcreteNameComponentNormalizer;
29  
30  
31  /***
32   * A bootstrap producer which creates and announces newly created Normalizers
33   * for various matchingRules in the core schema.
34   *
35   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
36   * @version $Rev: 264732 $
37   */
38  public class SystemNormalizerProducer extends AbstractBootstrapProducer
39  {
40      public SystemNormalizerProducer()
41      {
42          super( ProducerTypeEnum.NORMALIZER_PRODUCER );
43      }
44  
45  
46      public void produce( BootstrapRegistries registries, ProducerCallback cb )
47              throws NamingException
48      {
49          Normalizer normalizer;
50  
51          /*
52           * Straight out of RFC 2252: Section 8
53           * =======================================
54  
55          ( 2.5.13.1 NAME 'distinguishedNameMatch'
56            SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
57           */
58          normalizer = new CachingNormalizer( new DnNormalizer(
59                  new ConcreteNameComponentNormalizer(
60                          registries.getAttributeTypeRegistry() ) ) ) ;
61          cb.schemaObjectProduced( this, "2.5.13.1", normalizer );
62  
63          /*
64          ( 1.3.6.1.4.1.1466.109.114.2 NAME 'caseIgnoreIA5Match'
65            SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
66            */
67          normalizer = new CachingNormalizer( new DeepTrimToLowerNormalizer() );
68          cb.schemaObjectProduced( this, "1.3.6.1.4.1.1466.109.114.2", normalizer );
69  
70          /*
71          ( 2.5.13.11 NAME 'caseIgnoreListMatch'
72            SYNTAX 1.3.6.1.4.1.1466.115.121.1.41 )
73            */
74          normalizer = new CachingNormalizer( new DeepTrimToLowerNormalizer() );
75          cb.schemaObjectProduced( this, "2.5.13.11", normalizer );
76  
77          /*
78          ( 2.5.13.2 NAME 'caseIgnoreMatch'
79            SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
80            */
81          normalizer = new CachingNormalizer( new DeepTrimToLowerNormalizer() );
82          cb.schemaObjectProduced( this, "2.5.13.2", normalizer );
83  
84          /*
85          ( 2.5.13.3 NAME 'caseIgnoreOrderingMatch'
86            SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
87            */
88          normalizer = new CachingNormalizer( new DeepTrimToLowerNormalizer() );
89          cb.schemaObjectProduced( this, "2.5.13.3", normalizer );
90  
91          /*
92          ( 2.5.13.4 NAME 'caseIgnoreSubstringsMatch'
93            SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
94            */
95          normalizer = new CachingNormalizer( new DeepTrimToLowerNormalizer() );
96          cb.schemaObjectProduced( this, "2.5.13.4", normalizer );
97  
98          /*
99           ( 2.5.13.6 NAME 'caseExactOrderingMatch'
100            SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
101          */
102         normalizer = new NoOpNormalizer();
103         cb.schemaObjectProduced( this, "2.5.13.6", normalizer );
104 
105         /*
106         ( 2.5.13.0 NAME 'objectIdentifierMatch'
107           SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )
108           */
109         normalizer = new NoOpNormalizer();
110         cb.schemaObjectProduced( this, "2.5.13.0", normalizer );
111 
112         /*
113         ( 2.5.13.8 NAME 'numericStringMatch'
114           SYNTAX 1.3.6.1.4.1.1466.115.121.1.36 )
115           */
116         normalizer = new NoOpNormalizer();
117         cb.schemaObjectProduced( this, "2.5.13.8", normalizer );
118 
119         /*
120         ( 2.5.13.10 NAME 'numericStringSubstringsMatch'
121           SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
122           */
123         normalizer = new NoOpNormalizer();
124         cb.schemaObjectProduced( this, "2.5.13.10", normalizer );
125 
126         /*
127         ( 2.5.13.14 NAME 'integerMatch'
128           SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
129           */
130         normalizer = new NoOpNormalizer();
131         cb.schemaObjectProduced( this, "2.5.13.14", normalizer );
132 
133         /*
134         ( 2.5.13.14 NAME 'integerOrderingMatch'
135           SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
136           */
137         normalizer = new NoOpNormalizer();
138         cb.schemaObjectProduced( this, "2.5.13.15", normalizer );
139 
140         /*
141         ( 2.5.13.16 NAME 'bitStringMatch'
142           SYNTAX 1.3.6.1.4.1.1466.115.121.1.6 )
143           */
144         normalizer = new NoOpNormalizer();
145         cb.schemaObjectProduced( this, "2.5.13.16", normalizer );
146 
147         /*
148        ( 2.5.13.17 NAME 'octetStringMatch'
149          SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )
150          */
151         normalizer = new NoOpNormalizer();
152         cb.schemaObjectProduced( this, "2.5.13.17", normalizer );
153 
154         /*
155         ( 2.5.13.18 NAME 'octetStringOrderingMatch'
156           SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )
157           */
158          normalizer = new NoOpNormalizer();
159          cb.schemaObjectProduced( this, "2.5.13.18", normalizer );
160 
161         /*
162         ( 2.5.13.20 NAME 'telephoneNumberMatch'
163           SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 )
164           */
165         normalizer = new NoOpNormalizer();
166         cb.schemaObjectProduced( this, "2.5.13.20", normalizer );
167 
168         /*
169         ( 2.5.13.21 NAME 'telephoneNumberSubstringsMatch'
170           SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
171           */
172         normalizer = new NoOpNormalizer();
173         cb.schemaObjectProduced( this, "2.5.13.21", normalizer );
174 
175         /*
176         ( 2.5.13.22 NAME 'presentationAddressMatch'
177           SYNTAX 1.3.6.1.4.1.1466.115.121.1.43 )
178           */
179         normalizer = new NoOpNormalizer();
180         cb.schemaObjectProduced( this, "2.5.13.22", normalizer );
181 
182         /*
183         ( 2.5.13.23 NAME 'uniqueMemberMatch'
184           SYNTAX 1.3.6.1.4.1.1466.115.121.1.34 )
185           */
186         normalizer = new CachingNormalizer( new DeepTrimNormalizer() );
187         cb.schemaObjectProduced( this, "2.5.13.23", normalizer );
188 
189         /*
190         ( 2.5.13.24 NAME 'protocolInformationMatch'
191           SYNTAX 1.3.6.1.4.1.1466.115.121.1.42 )
192           */
193         normalizer = new CachingNormalizer( new DeepTrimNormalizer() );
194         cb.schemaObjectProduced( this, "2.5.13.24", normalizer );
195 
196         /*
197         ( 2.5.13.27 NAME 'generalizedTimeMatch'
198           SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )
199           */
200         normalizer = new CachingNormalizer( new DeepTrimNormalizer() );
201         cb.schemaObjectProduced( this, "2.5.13.27", normalizer );
202 
203         /*
204         ( 2.5.13.28 NAME 'generalizedTimeOrderingMatch'
205           SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )
206           */
207         normalizer = new CachingNormalizer( new DeepTrimNormalizer() );
208         cb.schemaObjectProduced( this, "2.5.13.28", normalizer );
209 
210         /*
211         ( 2.5.13.29 NAME 'integerFirstComponentMatch'
212           SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
213           */
214         normalizer = new NoOpNormalizer();
215         cb.schemaObjectProduced( this, "2.5.13.29", normalizer );
216 
217         /*
218         ( 2.5.13.30 NAME 'objectIdentifierFirstComponentMatch'
219           SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )
220           */
221         normalizer = new NoOpNormalizer();
222         cb.schemaObjectProduced( this, "2.5.13.30", normalizer );
223 
224         /*
225         ( 1.3.6.1.4.1.1466.109.114.1 NAME 'caseExactIA5Match'
226           SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
227           */
228         normalizer = new CachingNormalizer( new DeepTrimNormalizer() );
229         cb.schemaObjectProduced( this, "1.3.6.1.4.1.1466.109.114.1", normalizer );
230 
231         /*
232          * MatchingRules from section 2 of http://www.faqs.org/rfcs/rfc3698.html
233          * for Additional MatchingRules
234 
235          ( 2.5.13.13 NAME 'booleanMatch'
236            SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 )
237 
238          */
239 
240         normalizer = new NoOpNormalizer();
241         cb.schemaObjectProduced( this, "2.5.13.13", normalizer );
242     }
243 }