01: package com.jofti.store;
02:
03: import java.util.Properties;
04:
05: import org.apache.commons.logging.Log;
06: import org.apache.commons.logging.LogFactory;
07:
08: import com.jofti.btree.IPage;
09: import com.jofti.core.IStoreKey;
10: import com.jofti.exception.JoftiException;
11:
12: public class PassThroughStoreManager extends AbstractStoreManager {
13:
14: private static Log log = LogFactory
15: .getLog(AbstractStoreManager.class);
16:
17: public void init(Properties properties) throws JoftiException {
18:
19: if (log.isInfoEnabled()) {
20: log.info("Initialising PassThrough store manager");
21: }
22: super .init(properties);
23: if (log.isInfoEnabled()) {
24: log.info("Initialised PassThrough store manager");
25: }
26: }
27:
28: public void releasePage(IStoreKey key, IPage page) {
29: if (page != null) {
30: pageManager.releasePage(page);
31: }
32: }
33:
34: public IStoreKey store(IStoreKey key, IPage page)
35: throws JoftiException {
36: // RecordWrapper wrapper = new RecordWrapper(key,obj,true);
37: FilePositionHolder[] array = allocatePositions(key
38: .getFilePositions(), page.getBuffer().limit());
39: key.setFilePositions(array);
40:
41: key = doStore(key, page.getBuffer());
42: releasePage(key, page);
43:
44: return key;
45: }
46:
47: public StoreWrapper retrieve(IStoreKey key) throws JoftiException {
48:
49: return new StoreWrapper(key, doRetrieve(key));
50:
51: }
52:
53: public void remove(IStoreKey key, IPage page) throws JoftiException {
54: releasePage(key, page);
55: doRemove(key);
56:
57: }
58:
59: /* (non-Javadoc)
60: * @see com.jofti.store.AbstractStoreManager#getNewPage(int)
61: */
62: protected IPage getNewPage(int size) {
63: return doGetNewPage(size);
64: }
65:
66: public void removeAll() throws JoftiException {
67: doRemoveAll();
68:
69: }
70:
71: }
|