KickJava   Java API By Example, From Geeks To Geeks.

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


1 package com.jofti.core;
2
3 import java.util.Properties JavaDoc;
4
5 import com.jofti.btree.EntrySplitWrapper;
6 import com.jofti.btree.IPage;
7 import com.jofti.exception.JoftiException;
8 import com.jofti.store.StoreWrapper;
9
10 /**
11  * <p>The store manager is responsible for mediating between the store implementations and
12  * the the index.
13  * </p>
14  * <p>
15  * After retrieving a page the caller SHOULD ensure they call either store, remove or release after finishing with a page. Failure to do so may well
16  * have an impact on the performance of the store in being able to recycle pages.
17  * </p>
18  *
19  * @author xenephon
20  * @since Jofti 1.2
21  */

22 public interface IStoreManager {
23
24     /**
25      * Initialises the store manager.
26      *
27      * @param properties
28      * @throws JoftiException
29      */

30     public abstract void init(Properties JavaDoc properties) throws JoftiException;
31     
32     public abstract String JavaDoc getName();
33
34     public abstract void setName(String JavaDoc name);
35
36     /**
37      * <p>
38      * Stores the page in the store. Any changes to the storekey are made in the return key object.
39      * </p>
40      * <p>
41      * </p>
42      * @param key - containing the locations to store the page under (possibly more than one)
43      * @param obj - the page to store.
44      * @return
45      * @throws JoftiException - thrown if the key cannot be stored.
46      */

47     public IStoreKey store(IStoreKey key,IPage obj) throws JoftiException;
48     
49     /**
50      * Called by the client to notify the manager that they have finished with the page.
51      *
52      * @param key
53      * @param obj
54      */

55     public void releasePage(IStoreKey key,IPage obj);
56     
57     /**
58      * Returns the next available storeKey to the caller.
59      *
60      * @return
61      * @throws JoftiException
62      */

63     public IStoreKey getNextKey() throws JoftiException;
64     
65     
66     /**
67      * Returns a StoreWrapper object which containes the StoreKey and the IPage the
68      * key refers to.
69      *
70      * @param key
71      * @return
72      * @throws JoftiException
73      */

74     public StoreWrapper retrieve(IStoreKey key) throws JoftiException;
75     
76     /**
77      * Removes all entries from the store.
78      * @throws JoftiException
79      */

80     public void removeAll() throws JoftiException;
81     
82     /**
83      * Removes the page from the store and frees up the positions specified in the storeKey.
84      * @param key
85      * @param page
86      * @throws JoftiException
87      */

88     public void remove(IStoreKey key, IPage page) throws JoftiException;
89     
90     /**
91      * Splits an IPage into two IPage objects with a fair distribution of entries. The EntrySplitWrapper
92      * contains both the page and the number of entries in the page.
93      *
94      * @param page
95      * @param entryNumber
96      * @return
97      */

98     public EntrySplitWrapper[] split(IPage page, int entryNumber);
99     
100   
101 }
Popular Tags