1 16 package org.apache.cocoon.components.store; 17 18 import org.apache.avalon.framework.thread.ThreadSafe; 19 20 import java.util.Enumeration ; 21 import java.util.Hashtable ; 22 23 35 public class MemoryStore implements Store, ThreadSafe { 36 41 42 43 private Hashtable table = new Hashtable (); 44 45 48 public synchronized Object get(Object key) { 49 return(table.get(key)); 50 } 51 52 57 public synchronized void store(Object key, Object value) { 58 this.hold(key,value); 59 } 60 61 66 public synchronized void hold(Object key, Object value) { 67 table.put(key,value); 68 } 69 70 73 public synchronized void remove(Object key) { 74 table.remove(key); 75 } 76 77 public synchronized void free() {} 78 79 82 public synchronized boolean containsKey(Object key) { 83 return(table.containsKey(key)); 84 } 85 86 89 public synchronized Enumeration keys() { 90 return(table.keys()); 91 } 92 93 97 public synchronized int size() 98 { 99 return table.size(); 100 } 101 } 102 | Popular Tags |