KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ldap > server > db > Index


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.db;
18
19
20 import org.apache.ldap.common.schema.AttributeType;
21 import org.apache.regexp.RE;
22
23 import javax.naming.NamingException JavaDoc;
24 import javax.naming.directory.Attribute JavaDoc;
25 import javax.naming.directory.Attributes JavaDoc;
26 import java.math.BigInteger JavaDoc;
27
28
29 /**
30  * Required interfaces for an index.
31  *
32  * @author <a HREF="mailto:dev@directory.apache.org">Apache Directory Project</a>
33  * @version $Rev: 169198 $
34  */

35 public interface Index
36 {
37     /**
38      * Gets the attribute this Index is built upon.
39      *
40      * @return the id of the Index's attribute
41      */

42     AttributeType getAttribute();
43
44     /**
45      * Gets the normalized value for an attribute.
46      *
47      * @param attrVal the user provided value to normalize
48      * @return the normalized value.
49      * @throws NamingException if something goes wrong.
50      */

51     Object JavaDoc getNormalized( Object JavaDoc attrVal ) throws NamingException JavaDoc;
52
53     /**
54      * Gets the total scan count for this index.
55      *
56      * @return the number of key/value pairs in this index
57      * @throws NamingException if their is a failure accessing the index
58      */

59     int count() throws NamingException JavaDoc;
60
61     /**
62      * Gets the scan count for the occurance of a specific attribute value
63      * within the index.
64      *
65      * @param attrVal the value of the attribute to get a scan count for
66      * @return the number of key/value pairs in this index with the value value
67      * @throws NamingException if their is a failure accessing the index
68      */

69     int count( Object JavaDoc attrVal ) throws NamingException JavaDoc;
70
71     /**
72      * TODO Document me!
73      *
74      * @param attrVal TODO
75      * @param isGreaterThan TODO
76      * @return TODO
77      * @throws NamingException TODO
78      */

79     int count( Object JavaDoc attrVal, boolean isGreaterThan ) throws NamingException JavaDoc;
80
81     /**
82      * TODO Document me!
83      *
84      * @param attrVal TODO
85      * @return TODO
86      * @throws NamingException TODO
87      */

88     BigInteger JavaDoc forwardLookup( Object JavaDoc attrVal ) throws NamingException JavaDoc;
89
90     /**
91      * TODO Document me!
92      *
93      * @param id TODO
94      * @return TODO
95      * @throws NamingException TODO
96      */

97     Object JavaDoc reverseLookup( BigInteger JavaDoc id ) throws NamingException JavaDoc;
98
99     /**
100      * TODO Document me!
101      *
102      * @param attrVal TODO
103      * @param id TODO
104      * @throws NamingException TODO
105      */

106     void add( Object JavaDoc attrVal, BigInteger JavaDoc id ) throws NamingException JavaDoc;
107
108     /**
109      * TODO Document me!
110      *
111      * @param attr TODO
112      * @param id TODO
113      * @throws NamingException TODO
114      */

115     void add( Attribute JavaDoc attr, BigInteger JavaDoc id ) throws NamingException JavaDoc;
116
117     /**
118      * TODO Document me!
119      *
120      * @param attrs TODO
121      * @param id TODO
122      * @throws NamingException TODO
123      */

124     void add( Attributes JavaDoc attrs, BigInteger JavaDoc id ) throws NamingException JavaDoc;
125
126     /**
127      * TODO Document me!
128      *
129      * @param entryId TODO
130      * @throws NamingException TODO
131      */

132     void drop( BigInteger JavaDoc entryId ) throws NamingException JavaDoc;
133
134     /**
135      * TODO Document me!
136      *
137      * @param attrVal TODO
138      * @param id TODO
139      * @throws NamingException TODO
140      */

141     void drop( Object JavaDoc attrVal, BigInteger JavaDoc id ) throws NamingException JavaDoc;
142         
143     /**
144      * If the Attribute does not have any values then this reduces to a
145      * drop(BigInteger) call.
146      *
147      * @param attr TODO
148      * @param id TODO
149      * @throws NamingException TODO
150      */

151     void drop( Attribute JavaDoc attr, BigInteger JavaDoc id ) throws NamingException JavaDoc;
152         
153     /**
154      * If the Attribute for this index within the Attributes does not have any
155      * values then this reduces to a drop(BigInteger) call.
156      *
157      * @param attrs TODO
158      * @param id TODO
159      * @throws NamingException TODO
160      */

161     void drop( Attributes JavaDoc attrs, BigInteger JavaDoc id ) throws NamingException JavaDoc;
162         
163     /**
164      * TODO Document me!
165      *
166      * @param id TODO
167      * @return TODO
168      * @throws NamingException TODO
169      */

170     IndexEnumeration listReverseIndices( BigInteger JavaDoc id ) throws NamingException JavaDoc;
171
172     /**
173      * TODO Document me!
174      *
175      * @return TODO
176      * @throws NamingException TODO
177      */

178     IndexEnumeration listIndices() throws NamingException JavaDoc;
179
180     /**
181      * TODO Document me!
182      *
183      * @param attrVal TODO
184      * @return TODO
185      * @throws NamingException TODO
186      */

187     IndexEnumeration listIndices( Object JavaDoc attrVal ) throws NamingException JavaDoc;
188
189     /**
190      * TODO Document me!
191      *
192      * @param attrVal TODO
193      * @param isGreaterThan TODO
194      * @return TODO
195      * @throws NamingException TODO
196      */

197     IndexEnumeration listIndices( Object JavaDoc attrVal, boolean isGreaterThan )
198         throws NamingException JavaDoc;
199
200     /**
201      * TODO Document me!
202      *
203      * @param regex TODO
204      * @return TODO
205      * @throws NamingException TODO
206      */

207     IndexEnumeration listIndices( RE regex ) throws NamingException JavaDoc;
208
209     /**
210      * TODO Document me!
211      *
212      * @param regex TODO
213      * @param prefix TODO
214      * @return TODO
215      * @throws NamingException TODO
216      */

217     IndexEnumeration listIndices( RE regex, String JavaDoc prefix )
218         throws NamingException JavaDoc;
219
220     /**
221      * TODO Document me!
222      *
223      * @param attrVal TODO
224      * @param id TODO
225      * @return TODO
226      * @throws NamingException TODO
227      */

228     boolean hasValue( Object JavaDoc attrVal, BigInteger JavaDoc id )
229         throws NamingException JavaDoc;
230
231     /**
232      * TODO Document me!
233      *
234      * @param attrVal TODO
235      * @param id TODO
236      * @param isGreaterThan TODO
237      * @return TODO
238      * @throws NamingException TODO
239      */

240     boolean hasValue( Object JavaDoc attrVal, BigInteger JavaDoc id, boolean isGreaterThan )
241         throws NamingException JavaDoc;
242
243     /**
244      * TODO Document me!
245      *
246      * @param regex TODO
247      * @param id TODO
248      * @return TODO
249      * @throws NamingException TODO
250      */

251     boolean hasValue( RE regex, BigInteger JavaDoc id ) throws NamingException JavaDoc;
252
253     /**
254      * TODO Document me!
255      *
256      * @throws NamingException TODO
257      */

258     void close() throws NamingException JavaDoc;
259
260     /**
261      * TODO Document me!
262      *
263      * @throws NamingException TODO
264      */

265     void sync() throws NamingException JavaDoc;
266 }
267
Popular Tags