01: package org.enhydra.shark.caching;
02:
03: import org.enhydra.shark.api.internal.caching.CacheMgr;
04: import org.enhydra.shark.api.internal.caching.ProcessCache;
05: import org.enhydra.shark.api.internal.caching.ResourceCache;
06: import org.enhydra.shark.api.internal.working.CallbackUtilities;
07:
08: /**
09: * This class creates and manages process cache and recource caches.
10: * These caches are implemented as a HashMap.
11: *
12: * @author Sasa Bojanic
13: */
14: public class SimpleCacheMgr implements CacheMgr {
15:
16: protected ProcessCache processes = null;
17: protected ResourceCache resources = null;
18:
19: /**
20: * Configures caches.
21: *
22: * @param cus an instance of CallbackUtilities used to get
23: * properties for configuring caches.
24: * @exception Exception Thrown if an error occurs.
25: */
26: public void configure(CallbackUtilities cus) throws Exception {
27: processes = new SimpleProcessCache();
28: processes.configure(cus);
29: resources = new SimpleResourceCache();
30: resources.configure(cus);
31: }
32:
33: /**
34: * Returns process cache.
35: *
36: * @return process cache.
37: */
38: public ProcessCache getProcessCache() {
39: return processes;
40: }
41:
42: /**
43: * Returns resource cache.
44: *
45: * @return resource cache.
46: */
47: public ResourceCache getResourceCache() {
48: return resources;
49: }
50:
51: }
|