1 17 18 package org.sape.carbon.services.cache.total; 19 20 import java.util.Collection ; 21 import java.util.Map ; 22 import java.util.Set ; 23 24 import org.sape.carbon.core.component.lifecycle.Startable; 25 import org.sape.carbon.core.component.lifecycle.Suspendable; 26 import org.sape.carbon.services.cache.Cache; 27 import org.sape.carbon.services.cache.CacheLoadException; 28 29 43 public abstract class AbstractTotalCache 44 implements Cache, Startable, Suspendable { 45 46 53 public abstract void refreshAll() throws CacheLoadException; 54 55 58 public void clear() { 59 getCacheMap().clear(); 60 } 61 62 63 70 public boolean containsKey(Object key) { 71 return getCacheMap().containsKey(key); 72 } 73 74 75 86 public boolean containsValue(Object value) { 87 return getCacheMap().containsValue(value); 88 } 89 90 91 103 public Set entrySet() { 104 return getCacheMap().entrySet(); 105 } 106 107 108 118 public Object get(Object key) { 119 return getCacheMap().get(key); 120 } 121 122 123 128 public boolean isEmpty() { 129 return getCacheMap().isEmpty(); 130 } 131 132 133 137 public Set keySet() { 138 return getCacheMap().keySet(); 139 } 140 141 142 149 public Object put(Object key, Object value) { 150 return getCacheMap().put(key, value); 151 } 152 153 154 161 public void putAll(Map t) { 162 getCacheMap().putAll(t); 163 } 164 165 166 173 public Object remove(Object key) { 174 return getCacheMap().remove(key); 175 } 176 177 178 184 public int size() { 185 return getCacheMap().size(); 186 } 187 188 189 196 public Collection values() { 197 return getCacheMap().values(); 198 } 199 200 203 public void start() throws CacheLoadException { 204 refreshAll(); 205 } 206 207 210 public void stop() { 211 } 212 213 216 public void resume() throws CacheLoadException { 217 refreshAll(); 218 } 219 220 223 public void suspend() { 224 } 225 226 233 public void runScheduledTask() throws CacheLoadException { 234 refreshAll(); 235 } 236 237 243 protected abstract Map getCacheMap(); 244 } | Popular Tags |