KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jofti > cache > adapter > JBossIndexer


1 /*
2  * Created on 12-May-2005
3  *
4  */

5 package com.jofti.cache.adapter;
6
7 import java.util.Map JavaDoc;
8
9 import com.jofti.api.IndexCache;
10 import com.jofti.api.IndexQuery;
11 import com.jofti.api.NameSpaceKey;
12 import com.jofti.exception.JoftiException;
13
14 /**
15  *
16  *
17  * The interface provides common operations for the local indexer used in
18  * the JBossCacheAdapter to isolate changes within transactions.<p>
19  *
20  * @author Steve Woodcock
21  */

22 public interface JBossIndexer {
23
24     /**
25      * Registers the fact that a value has been updated within a transacton.
26      * @param keyWrapper
27      * @param oldValue
28      * @param newValue
29      * @throws JoftiException
30      */

31     public void update(NameSpaceKey keyWrapper, Object JavaDoc oldValue, Object JavaDoc newValue) throws JoftiException;
32     
33     /**
34      * Registers that a new value has been added within a transaction.
35      * @param keyWrapper
36      * @param value
37      * @throws JoftiException
38      */

39     public void add(NameSpaceKey keyWrapper, Object JavaDoc value)throws JoftiException;
40     
41     /**
42      * Registers a remocal of a value within a transaction.
43      * @param keyWrapper
44      * @param value
45      * @throws JoftiException
46      */

47     public void remove(NameSpaceKey keyWrapper, Object JavaDoc value)throws JoftiException;
48     
49     
50     /**
51      * Registers a key removal. This will also remove the values the index knows about, although
52      * the caller does not know what the values were.<p>
53      * @param keyWrapper
54      * @throws JoftiException
55      */

56     public void remove(NameSpaceKey keyWrapper)throws JoftiException;
57     
58     /**
59      * Used to check if the IndexCache contains the key.<p>
60      * @param keyWrapper
61      * @return a boolean indicating if the value exists in the index
62      * @throws JoftiException
63      */

64     public boolean contains(NameSpaceKey keyWrapper)throws JoftiException;
65     
66        /**
67      * This queries the index and retrieves a map of matching elements (if any). The map contains
68      * key/value pairs and the result is ordered by the attribute being searched on (if a single attribute is used in the query).
69      * The ordering is preserved in the iteration as it is a @link {java.util.LinkedHashMap}.
70      * <p>
71      * @param query - the type of query to perform against the index and cache.
72      * <p>
73      * @return Map a map of the results of type @link {NameSpaceKey}
74      * @throws JoftiException a wrapper exception for errors in the query. <br>
75      */

76     public Map JavaDoc query(IndexQuery query,IndexCache cache) throws JoftiException;
77     
78     
79 }
80
Popular Tags