01: /*
02: * Created on 12-May-2005
03: *
04: */
05: package com.jofti.cache.adapter;
06:
07: import java.util.Map;
08:
09: 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 oldValue,
32: Object newValue) throws JoftiException;
33:
34: /**
35: * Registers that a new value has been added within a transaction.
36: * @param keyWrapper
37: * @param value
38: * @throws JoftiException
39: */
40: public void add(NameSpaceKey keyWrapper, Object value)
41: throws JoftiException;
42:
43: /**
44: * Registers a remocal of a value within a transaction.
45: * @param keyWrapper
46: * @param value
47: * @throws JoftiException
48: */
49: public void remove(NameSpaceKey keyWrapper, Object value)
50: throws JoftiException;
51:
52: /**
53: * Registers a key removal. This will also remove the values the index knows about, although
54: * the caller does not know what the values were.<p>
55: * @param keyWrapper
56: * @throws JoftiException
57: */
58: public void remove(NameSpaceKey keyWrapper) throws JoftiException;
59:
60: /**
61: * Used to check if the IndexCache contains the key.<p>
62: * @param keyWrapper
63: * @return a boolean indicating if the value exists in the index
64: * @throws JoftiException
65: */
66: public boolean contains(NameSpaceKey keyWrapper)
67: throws JoftiException;
68:
69: /**
70: * This queries the index and retrieves a map of matching elements (if any). The map contains
71: * key/value pairs and the result is ordered by the attribute being searched on (if a single attribute is used in the query).
72: * The ordering is preserved in the iteration as it is a @link {java.util.LinkedHashMap}.
73: * <p>
74: * @param query - the type of query to perform against the index and cache.
75: * <p>
76: * @return Map a map of the results of type @link {NameSpaceKey}
77: * @throws JoftiException a wrapper exception for errors in the query. <br>
78: */
79: public Map query(IndexQuery query, IndexCache cache)
80: throws JoftiException;
81:
82: }
|