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