1 46 47 package org.mr.core.persistent.db; 48 49 import java.io.IOException ; 50 import java.nio.ByteBuffer ; 51 52 import org.mr.core.persistent.PersistentManager; 53 import org.mr.core.util.byteable.Byteable; 54 55 64 public class DBPersistencyManager implements PersistentManager { 65 private String name; 66 private DBPersistencyProxy proxy; 67 public DBPersistencyManager(String name) { 68 this.name = name; 71 this.proxy = DBPersistencyProxy.getInstance(); 72 } 74 78 public DBPersistencyManager() { 79 name = null; 80 this.proxy = DBPersistencyProxy.getInstance(); 81 } 82 83 public void recover() { 84 } 85 86 public int[] getKeys() { 87 return this.proxy.getKeys(this.name); 88 } 89 90 public Object getPersistentObject(int i) { 91 return this.proxy.getPersistentObject(this.name, i); 92 } 93 94 public void deletePersistentObject(int i) { 95 this.proxy.deletePersistentObject(this.name, i); 96 } 97 98 public void savePersistentObject(int i, Byteable object) 99 throws IOException 100 { 101 this.proxy.savePersistentObject(this.name, i, object); 102 } 103 104 public void clearStorage() throws IOException { 105 this.proxy.clearStorage(this.name); 106 } 107 108 public void savePersistentBuffer(int i, ByteBuffer buffer) 109 throws IOException 110 { 111 this.proxy.savePersistentBuffer(this.name, i, buffer); 112 } 113 114 public ByteBuffer getPersistentBuffer(int i) { 115 return this.proxy.getPersistentBuffer(this.name, i); 116 } 117 118 public String getStorageName() { 119 return this.name; 120 } 121 122 public String [] getAllServices() { 123 return this.proxy.getAllServices(); 124 } 125 } | Popular Tags |