KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ldap > server > schema > bootstrap > SystemComparatorProducer


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 JavaDoc;
24 import java.util.Comparator JavaDoc;
25
26
27 /**
28  * Document this class.
29  *
30  * @author <a HREF="mailto:dev@directory.apache.org">Apache Directory Project</a>
31  * @version $Rev: 169198 $
32  */

33 public class SystemComparatorProducer extends AbstractBootstrapProducer
34 {
35     public SystemComparatorProducer()
36     {
37         super( ProducerTypeEnum.COMPARATOR_PRODUCER );
38     }
39
40
41     public void produce( BootstrapRegistries registries, ProducerCallback cb )
42             throws NamingException JavaDoc
43     {
44         Comparator JavaDoc comparator;
45
46         /*
47          * Straight out of RFC 2252: Section 8
48          * =======================================
49         ( 2.5.13.0 NAME 'objectIdentifierMatch'
50           SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )
51          */

52          comparator = new ComparableComparator();
53          cb.schemaObjectProduced( this, "2.5.13.0", comparator );
54
55         /*
56         ( 2.5.13.1 NAME 'distinguishedNameMatch'
57           SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
58           */

59          comparator = new DnComparator( new ConcreteNameComponentNormalizer(
60                  registries.getAttributeTypeRegistry() ) );
61          cb.schemaObjectProduced( this, "2.5.13.1", comparator );
62
63          /*
64         ( 2.5.13.2 NAME 'caseIgnoreMatch'
65           SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
66           */

67          comparator = new NormalizingComparator(
68                  new CachingNormalizer( new DeepTrimToLowerNormalizer() ),
69                  new ComparableComparator() );
70          cb.schemaObjectProduced( this, "2.5.13.2", comparator );
71
72          /*
73         ( 2.5.13.3 NAME 'caseIgnoreOrderingMatch'
74           SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
75           */

76          comparator = new NormalizingComparator(
77                  new CachingNormalizer( new DeepTrimToLowerNormalizer() ),
78                  new ComparableComparator() );
79          cb.schemaObjectProduced( this, "2.5.13.3", comparator );
80
81          /*
82         ( 2.5.13.4 NAME 'caseIgnoreSubstringsMatch'
83          SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
84          */

85          comparator = new NormalizingComparator(
86                 new CachingNormalizer( new DeepTrimToLowerNormalizer() ),
87                 new ComparableComparator() );
88          cb.schemaObjectProduced( this, "2.5.13.4", comparator );
89
90         /*
91         ( 2.5.13.8 NAME 'numericStringMatch'
92           SYNTAX 1.3.6.1.4.1.1466.115.121.1.36 )
93           */

94          comparator = new ComparableComparator();
95          cb.schemaObjectProduced( this, "2.5.13.8", comparator );
96
97          /*
98         ( 2.5.13.10 NAME 'numericStringSubstringsMatch'
99           SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
100           */

101          comparator = new ComparableComparator();
102          cb.schemaObjectProduced( this, "2.5.13.10", comparator );
103
104          /*
105         ( 2.5.13.11 NAME 'caseIgnoreListMatch'
106           SYNTAX 1.3.6.1.4.1.1466.115.121.1.41 )
107           */

108          comparator = new NormalizingComparator(
109                  new CachingNormalizer( new DeepTrimToLowerNormalizer() ),
110                  new ComparableComparator() );
111          cb.schemaObjectProduced( this, "2.5.13.11", comparator );
112
113          /*
114         ( 2.5.13.14 NAME 'integerMatch'
115           SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
116           */

117          comparator = new ComparableComparator();
118          cb.schemaObjectProduced( this, "2.5.13.14", comparator );
119
120         /*
121        ( 2.5.13.16 NAME 'bitStringMatch'
122          SYNTAX 1.3.6.1.4.1.1466.115.121.1.6 )
123          */

124         comparator = new ComparableComparator();
125         cb.schemaObjectProduced( this, "2.5.13.16", comparator );
126
127         /*
128        ( 2.5.13.17 NAME 'octetStringMatch'
129          SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )
130          */

131         comparator = new ComparableComparator();
132         cb.schemaObjectProduced( this, "2.5.13.17", comparator );
133
134          /*
135         ( 2.5.13.20 NAME 'telephoneNumberMatch'
136           SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 )
137           */

138          comparator = new ComparableComparator();
139          cb.schemaObjectProduced( this, "2.5.13.20", comparator );
140
141          /*
142         ( 2.5.13.21 NAME 'telephoneNumberSubstringsMatch'
143           SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
144           */

145          comparator = new ComparableComparator();
146          cb.schemaObjectProduced( this, "2.5.13.21", comparator );
147
148          /*
149         ( 2.5.13.22 NAME 'presentationAddressMatch'
150           SYNTAX 1.3.6.1.4.1.1466.115.121.1.43 )
151           */

152          comparator = new ComparableComparator();
153          cb.schemaObjectProduced( this, "2.5.13.22", comparator );
154
155          /*
156         ( 2.5.13.23 NAME 'uniqueMemberMatch'
157           SYNTAX 1.3.6.1.4.1.1466.115.121.1.34 )
158           */

159          comparator = new NormalizingComparator(
160                  new CachingNormalizer( new DeepTrimNormalizer() ),
161                  new ComparableComparator() );
162          cb.schemaObjectProduced( this, "2.5.13.23", comparator );
163
164          /*
165         ( 2.5.13.24 NAME 'protocolInformationMatch'
166           SYNTAX 1.3.6.1.4.1.1466.115.121.1.42 )
167           */

168          comparator = new ComparableComparator();
169          cb.schemaObjectProduced( this, "2.5.13.24", comparator );
170
171          /*
172         ( 2.5.13.27 NAME 'generalizedTimeMatch'
173           SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )
174           */

175          comparator = new ComparableComparator();
176          cb.schemaObjectProduced( this, "2.5.13.27", comparator );
177
178          /*
179         ( 2.5.13.28 NAME 'generalizedTimeOrderingMatch'
180           SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )
181           */

182          comparator = new ComparableComparator();
183          cb.schemaObjectProduced( this, "2.5.13.28", comparator );
184
185          /*
186         ( 2.5.13.29 NAME 'integerFirstComponentMatch'
187           SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
188           */

189          comparator = new ComparableComparator();
190          cb.schemaObjectProduced( this, "2.5.13.29", comparator );
191
192          /*
193         ( 2.5.13.30 NAME 'objectIdentifierFirstComponentMatch'
194           SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )
195           */

196          comparator = new ComparableComparator();
197          cb.schemaObjectProduced( this, "2.5.13.30", comparator );
198
199          /*
200         ( 1.3.6.1.4.1.1466.109.114.1 NAME 'caseExactIA5Match'
201           SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
202           */

203          comparator = new NormalizingComparator(
204                  new CachingNormalizer( new DeepTrimNormalizer() ),
205                  new ComparableComparator() );
206          cb.schemaObjectProduced( this, "1.3.6.1.4.1.1466.109.114.1", comparator );
207
208          /*
209         ( 1.3.6.1.4.1.1466.109.114.2 NAME 'caseIgnoreIA5Match'
210           SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
211           */

212          comparator = new NormalizingComparator(
213                  new CachingNormalizer( new DeepTrimToLowerNormalizer() ),
214                  new ComparableComparator() );
215          cb.schemaObjectProduced( this, "1.3.6.1.4.1.1466.109.114.2", comparator );
216
217         /*
218          * MatchingRules from section 2 of http://www.faqs.org/rfcs/rfc3698.html
219          * for Additional MatchingRules
220
221          ( 2.5.13.13 NAME 'booleanMatch'
222            SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 )
223
224          */

225
226         comparator = new ComparableComparator();
227         cb.schemaObjectProduced( this, "2.5.13.13", comparator );
228
229     }
230 }
231
Popular Tags