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 org.apache.ldap.common.schema.*;
21  import org.apache.ldap.server.schema.ConcreteNameComponentNormalizer;
22  
23  import javax.naming.NamingException;
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: 159259 $
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.0 NAME 'objectIdentifierMatch'
95            SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )
96            */
97          normalizer = new NoOpNormalizer();
98          cb.schemaObjectProduced( this, "2.5.13.0", normalizer );
99  
100         /*
101         ( 2.5.13.8 NAME 'numericStringMatch'
102           SYNTAX 1.3.6.1.4.1.1466.115.121.1.36 )
103           */
104         normalizer = new NoOpNormalizer();
105         cb.schemaObjectProduced( this, "2.5.13.8", normalizer );
106 
107         /*
108         ( 2.5.13.10 NAME 'numericStringSubstringsMatch'
109           SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
110           */
111         normalizer = new NoOpNormalizer();
112         cb.schemaObjectProduced( this, "2.5.13.10", normalizer );
113 
114         /*
115         ( 2.5.13.14 NAME 'integerMatch'
116           SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
117           */
118         normalizer = new NoOpNormalizer();
119         cb.schemaObjectProduced( this, "2.5.13.14", normalizer );
120 
121         /*
122         ( 2.5.13.16 NAME 'bitStringMatch'
123           SYNTAX 1.3.6.1.4.1.1466.115.121.1.6 )
124           */
125         normalizer = new NoOpNormalizer();
126         cb.schemaObjectProduced( this, "2.5.13.16", normalizer );
127 
128         /*
129        ( 2.5.13.17 NAME 'octetStringMatch'
130          SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )
131          */
132         normalizer = new NoOpNormalizer();
133         cb.schemaObjectProduced( this, "2.5.13.17", normalizer );
134 
135         /*
136         ( 2.5.13.20 NAME 'telephoneNumberMatch'
137           SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 )
138           */
139         normalizer = new NoOpNormalizer();
140         cb.schemaObjectProduced( this, "2.5.13.20", normalizer );
141 
142         /*
143         ( 2.5.13.21 NAME 'telephoneNumberSubstringsMatch'
144           SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
145           */
146         normalizer = new NoOpNormalizer();
147         cb.schemaObjectProduced( this, "2.5.13.21", normalizer );
148 
149         /*
150         ( 2.5.13.22 NAME 'presentationAddressMatch'
151           SYNTAX 1.3.6.1.4.1.1466.115.121.1.43 )
152           */
153         normalizer = new NoOpNormalizer();
154         cb.schemaObjectProduced( this, "2.5.13.22", normalizer );
155 
156         /*
157         ( 2.5.13.23 NAME 'uniqueMemberMatch'
158           SYNTAX 1.3.6.1.4.1.1466.115.121.1.34 )
159           */
160         normalizer = new CachingNormalizer( new DeepTrimNormalizer() );
161         cb.schemaObjectProduced( this, "2.5.13.23", normalizer );
162 
163         /*
164         ( 2.5.13.24 NAME 'protocolInformationMatch'
165           SYNTAX 1.3.6.1.4.1.1466.115.121.1.42 )
166           */
167         normalizer = new CachingNormalizer( new DeepTrimNormalizer() );
168         cb.schemaObjectProduced( this, "2.5.13.24", normalizer );
169 
170         /*
171         ( 2.5.13.27 NAME 'generalizedTimeMatch'
172           SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )
173           */
174         normalizer = new CachingNormalizer( new DeepTrimNormalizer() );
175         cb.schemaObjectProduced( this, "2.5.13.27", normalizer );
176 
177         /*
178         ( 2.5.13.28 NAME 'generalizedTimeOrderingMatch'
179           SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )
180           */
181         normalizer = new CachingNormalizer( new DeepTrimNormalizer() );
182         cb.schemaObjectProduced( this, "2.5.13.28", normalizer );
183 
184         /*
185         ( 2.5.13.29 NAME 'integerFirstComponentMatch'
186           SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
187           */
188         normalizer = new NoOpNormalizer();
189         cb.schemaObjectProduced( this, "2.5.13.29", normalizer );
190 
191         /*
192         ( 2.5.13.30 NAME 'objectIdentifierFirstComponentMatch'
193           SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )
194           */
195         normalizer = new NoOpNormalizer();
196         cb.schemaObjectProduced( this, "2.5.13.30", normalizer );
197 
198         /*
199         ( 1.3.6.1.4.1.1466.109.114.1 NAME 'caseExactIA5Match'
200           SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
201           */
202         normalizer = new CachingNormalizer( new DeepTrimNormalizer() );
203         cb.schemaObjectProduced( this, "1.3.6.1.4.1.1466.109.114.1", normalizer );
204 
205         /*
206          * MatchingRules from section 2 of http://www.faqs.org/rfcs/rfc3698.html
207          * for Additional MatchingRules
208 
209          ( 2.5.13.13 NAME 'booleanMatch'
210            SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 )
211 
212          */
213 
214         normalizer = new NoOpNormalizer();
215         cb.schemaObjectProduced( this, "2.5.13.13", normalizer );
216     }
217 }