1 package com.jofti.store; 2 3 import java.util.Properties ; 4 5 import org.apache.commons.logging.Log; 6 import org.apache.commons.logging.LogFactory; 7 8 import com.jofti.btree.IPage; 9 import com.jofti.core.IStoreKey; 10 import com.jofti.exception.JoftiException; 11 12 public class PassThroughStoreManager extends AbstractStoreManager 13 { 14 15 private static Log log = LogFactory.getLog(AbstractStoreManager.class); 16 17 public void init(Properties properties) throws JoftiException 18 { 19 20 if (log.isInfoEnabled()) { 21 log.info("Initialising PassThrough store manager"); 22 } 23 super.init(properties); 24 if (log.isInfoEnabled()) { 25 log.info("Initialised PassThrough store manager"); 26 } 27 } 28 29 public void releasePage(IStoreKey key, IPage page) 30 { 31 if (page != null) { 32 pageManager.releasePage(page); 33 } 34 } 35 36 public IStoreKey store(IStoreKey key, IPage page) throws JoftiException 37 { 38 FilePositionHolder[] array = allocatePositions(key.getFilePositions(), 40 page.getBuffer().limit()); 41 key.setFilePositions(array); 42 43 key = doStore(key, page.getBuffer()); 44 releasePage(key, page); 45 46 return key; 47 } 48 49 public StoreWrapper retrieve(IStoreKey key) throws JoftiException 50 { 51 52 return new StoreWrapper(key, doRetrieve(key)); 53 54 } 55 56 public void remove(IStoreKey key, IPage page) throws JoftiException 57 { 58 releasePage(key, page); 59 doRemove(key); 60 61 } 62 63 66 protected IPage getNewPage(int size) 67 { 68 return doGetNewPage(size); 69 } 70 71 public void removeAll() throws JoftiException 72 { 73 doRemoveAll(); 74 75 } 76 77 } 78 | Popular Tags |