1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *  
10   *    http://www.apache.org/licenses/LICENSE-2.0
11   *  
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License. 
18   *  
19   */
20  package org.apache.directory.server.xdbm.search.impl;
21  
22  
23  import org.apache.directory.shared.ldap.schema.*;
24  import org.apache.directory.shared.ldap.constants.SchemaConstants;
25  
26  import javax.naming.NamingException;
27  import java.util.Comparator;
28  
29  import jdbm.helper.StringComparator;
30  
31  
32  /**
33   * An attributeType used for testing situations when there is only an ordering
34   * matchingRule for one.
35   *
36   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
37   * @version $$Rev$$
38   */
39  public class OrderingOnlyMatchingRuleAttributeType implements AttributeType
40  {
41      private static final long serialVersionUID = 1L;
42  
43  
44      public boolean isSingleValue()
45      {
46          return false;
47      }
48  
49  
50      public boolean isCanUserModify()
51      {
52          return false;
53      }
54  
55  
56      public boolean isCollective()
57      {
58          return false;
59      }
60  
61  
62      public UsageEnum getUsage()
63      {
64          return null;
65      }
66  
67  
68      public AttributeType getSuperior() throws NamingException
69      {
70          return null;
71      }
72  
73  
74      public Syntax getSyntax() throws NamingException
75      {
76          return new BogusSyntax();
77      }
78  
79  
80      public int getLength()
81      {
82          return 0;
83      }
84  
85  
86      public MatchingRule getEquality() throws NamingException
87      {
88          return null;
89      }
90  
91  
92      public MatchingRule getOrdering() throws NamingException
93      {
94          return new MatchingRule()
95          {
96              private static final long serialVersionUID = 1L;
97  
98  
99              public Syntax getSyntax() throws NamingException
100             {
101                 return new BogusSyntax();
102             }
103 
104 
105             @SuppressWarnings("unchecked")
106             public Comparator<String> getComparator() throws NamingException
107             {
108                 return new StringComparator();
109             }
110 
111 
112             public Normalizer getNormalizer() throws NamingException
113             {
114                 return new NoOpNormalizer();
115             }
116 
117 
118             public boolean isObsolete()
119             {
120                 return false;
121             }
122 
123 
124             public String getOid()
125             {
126                 return null;
127             }
128 
129 
130             public String getName()
131             {
132                 return null;
133             }
134 
135 
136             public String getDescription()
137             {
138                 return null;
139             }
140 
141 
142             public String getSchema()
143             {
144                 return null;
145             }
146 
147 
148             public void setSchema( String schemaName )
149             {
150             }
151 
152 
153             public String[] getNamesRef()
154             {
155                 return null;
156             }
157         };
158     }
159 
160 
161     public MatchingRule getSubstr() throws NamingException
162     {
163         return null;
164     }
165 
166 
167     public boolean isAncestorOf( AttributeType descendant ) throws NamingException
168     {
169         return false;
170     }
171 
172 
173     public boolean isDescentantOf( AttributeType ancestor ) throws NamingException
174     {
175         return false;
176     }
177 
178 
179     public boolean isObsolete()
180     {
181         return false;
182     }
183 
184 
185     public String getOid()
186     {
187         return SchemaConstants.ATTRIBUTE_TYPES_AT_OID + ".2000";
188     }
189 
190 
191     public String[] getNames()
192     {
193         return new String[] { "bogus" };
194     }
195 
196 
197     public String getName()
198     {
199         return "bogus";
200     }
201 
202 
203     public String getDescription()
204     {
205         return "";
206     }
207 
208 
209     public String getSchema()
210     {
211         return "other";
212     }
213 
214 
215     public void setSchema( String schemaName )
216     {
217     }
218 
219 
220     public String[] getNamesRef()
221     {
222         return new String[] { "bogus" } ;
223     }
224 }