01: /*
02: * Created on Dec 5, 2003
03: *
04: * To change the template for this generated file go to
05: * Window>Preferences>Java>Code Generation>Code and Comments
06: */
07: package org.xdev.base.core;
08:
09: import java.util.ArrayList;
10: import java.util.HashMap;
11:
12: import org.xdev.base.xssl.XSSLAction;
13: import org.xdev.base.xssl.XSSLComponent;
14: import org.xdev.base.xssl.XSSLReturn;
15:
16: /**
17: * @author AYegorov
18: *
19: * To change the template for this generated type comment go to
20: * Window>Preferences>Java>Code Generation>Code and Comments
21: */
22: public class InMemoryStorage extends AbstractPersistance {
23: private HashMap indexes = new HashMap();
24:
25: /**
26: * @param id
27: * @param properties
28: * @param template
29: */
30: public InMemoryStorage(String id, HashMap properties) {
31: super (id, properties);
32: }
33:
34: /* (non-Javadoc)
35: * @see org.xdev.base.transaction.AbstractTransactionPersistance#store(org.xdev.base.transaction.AbstractTransactionComponent, java.lang.Object)
36: */
37: protected synchronized void store(String id, Object obj)
38: throws Exception {
39: this .indexes.put(id, obj);
40: }
41:
42: public synchronized boolean exists(String id) {
43: return this .indexes.containsKey(id);
44: }
45:
46: public synchronized Object get(String id) {
47: return this .indexes.get(id);
48: }
49:
50: public synchronized Object remove(String id) {
51: return this .indexes.remove(id);
52: }
53:
54: public String toString() {
55: return indexes.toString();
56: }
57:
58: }
|