KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jofti > core > InternalIndex


1 /*
2  * Created on 08-Apr-2005
3  *
4  */

5 package com.jofti.core;
6
7 import java.util.Map JavaDoc;
8
9 import com.jofti.api.IndexQuery;
10 import com.jofti.exception.JoftiException;
11 import com.jofti.introspect.ClassIntrospector;
12 import com.jofti.parser.ParserManager;
13
14 /**
15  *
16  *
17  * The Internal IndexCache is the core interface that IndexCache implmentations must implement.
18  * This allows Adapters and the IndexCache Manager to interact with the IndexCache implementation.<p>
19  *
20  * @author xenephon (xenephon@jofti.com)
21  */

22 public interface InternalIndex {
23
24      /**
25      * Puts an object into the underlying index instance and indexes the object according to
26      * the class definitions in the index config file. Some indexes may only accept certain types of
27      * object.<p>
28      * @param key value to use as key in the index
29      * @param value value to put into cache and to be indexed
30      * @throws JoftiException thrown as a wrapper exception that contains any index specific exceptions.
31      */

32     public void insert(Object JavaDoc key, Object JavaDoc value) throws IllegalArgumentException JavaDoc, JoftiException;
33     
34     
35     public void insertEntry(Object JavaDoc key, Object JavaDoc value) throws IllegalArgumentException JavaDoc, JoftiException;
36     
37      /**
38      * Deletes an object from the index. Attempting to remove a non-existent, or expired object will
39      * not generate an exception.
40      * <p>
41      * @param key -the key to retrieve the cached object
42      * @param value - the object to be removed
43      * @throws JoftiException - A wrapper for any cache specific exceptions or exceptions generated by the index.
44      */

45     public void remove(Object JavaDoc key, Object JavaDoc value) throws IllegalArgumentException JavaDoc, JoftiException;
46      
47     /**
48      * Deletes all entries for the key from the index. Attempting to remove a non-existent, or expired object will
49      * not generate an exception.
50      * <p>
51      * @param key -the key to retrieve the cached object
52      * @throws JoftiException - A wrapper for any cache specific exceptions or exceptions generated by the index.
53      */

54     public void removeByKey(Object JavaDoc key) throws JoftiException;
55     
56     
57     /**
58      * Returns a Map of attribute values that the index has for the key from the index.
59      * <p>
60      * @param key -the key to retrieve the cached object
61      * @throws JoftiException - A wrapper for any cache specific exceptions or exceptions generated by the index.
62      */

63     public Map JavaDoc getAttributesByKey(Object JavaDoc key) throws JoftiException;
64     
65     /**
66      * Returns whether the index contains the key.
67      * <p>
68      * @param key -the key to check
69      * @throws JoftiException - A wrapper for any cache specific exceptions or exceptions generated by the index.
70      */

71     
72     public boolean contains(Object JavaDoc key) throws JoftiException;
73     
74     
75     /**
76      * Returns the keys that are stored under the entry.
77      * <p>
78      * @param key -the object to check
79      * @throws JoftiException - A wrapper for any cache specific exceptions or exceptions generated by the index.
80      */

81     public Map JavaDoc getEntries(Object JavaDoc key) throws JoftiException;
82     
83      /**
84      * This will remove all the values in the cache and dump the current index.<p>
85      * @throws JoftiException
86      */

87     public void removeAll() throws JoftiException;
88     
89     /**
90      * This queries the index and retrieves a map of matching elements (if any). The map contains
91      * key/value pairs and the result is ordered by the attribute being searched on (if a single attribute is used in the query).
92      * The ordering is preserved in the iteration as it is a @seejava.util.LinkedHashMap.
93      * <p>
94      * If you are using a NameSpacedIndex the keys returned
95      * in this map are of type @see NameSpaceKey.
96      * <p>
97      * @param query - the type of query to perform against the index and cache.
98      * <p>
99      * @return Map a map of the results<br>
100      * @throws JoftiException a wrapper exception for errors in the query. <br>
101      */

102     public Map JavaDoc query(IndexQuery query) throws JoftiException;
103      
104     
105     
106     public long getKeyNumber();
107     
108     public ClassIntrospector getIntrospector();
109     
110     
111     /**
112      * Returns the parser manager configured in this index.
113      * @return ParserManager
114      */

115     public ParserManager getParserManager();
116     
117     
118     
119       
120 }
121
Popular Tags