1 package org.apache.ojb.broker.prevayler; 2 3 17 18 19 import java.io.Serializable ; 20 import java.util.Hashtable ; 21 22 import org.apache.ojb.broker.Identity; 23 import org.apache.ojb.broker.PersistenceBroker; 24 import org.prevayler.implementation.AbstractPrevalentSystem; 25 26 36 public class Database extends AbstractPrevalentSystem 37 { 38 39 private final Hashtable table = new Hashtable (); 40 41 private transient PersistenceBroker broker; 42 43 44 public void store(Object obj) 45 { 46 Identity oid = new Identity(obj,broker); 47 this.getTable().put(oid.toString(), obj); 48 } 49 50 public void remove(Object obj) 51 { 52 Identity oid = new Identity(obj,broker); 53 this.getTable().remove(oid.toString()); 54 } 55 56 public Serializable lookupObjectByIdentity(Identity oid) 57 { 58 return (Serializable ) this.getTable().get(oid.toString()); 59 } 60 61 65 public Hashtable getTable() 66 { 67 return table; 68 } 69 70 74 public PersistenceBroker getBroker() 75 { 76 return broker; 77 } 78 79 83 public void setBroker(PersistenceBroker broker) 84 { 85 this.broker = broker; 86 } 87 88 } 89 | Popular Tags |