1 7 package org.jboss.cache.loader; 8 9 import org.jboss.cache.CacheImpl; 10 import org.jboss.cache.Fqn; 11 import org.jboss.cache.Modification; 12 import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig; 13 14 import java.io.ObjectInputStream ; 15 import java.io.ObjectOutputStream ; 16 import java.util.HashMap ; 17 import java.util.List ; 18 import java.util.Map ; 19 import java.util.Set ; 20 21 26 public class DummyCacheLoader extends AbstractCacheLoader 27 { 28 private int getChildrenNamesCount = 0, getCount = 0, putCount = 0, existsCount = 0, removeCount = 0; 29 private Map m_transactions = new HashMap (); 30 31 public int getGetChildrenNamesCount() 32 { 33 return getChildrenNamesCount; 34 } 35 36 public int getGetCount() 37 { 38 return getCount; 39 } 40 41 public int getPutCount() 42 { 43 return putCount; 44 } 45 46 public int getExistsCount() 47 { 48 return existsCount; 49 } 50 51 public int getRemoveCount() 52 { 53 return removeCount; 54 } 55 56 57 62 public void setConfig(IndividualCacheLoaderConfig config) 63 { 64 } 65 66 public IndividualCacheLoaderConfig getConfig() 67 { 68 return null; 69 } 70 71 79 public void setCache(CacheImpl c) 80 { 81 } 82 83 91 public Set getChildrenNames(Fqn fqn) throws Exception 92 { 93 getChildrenNamesCount++; 94 return null; 95 } 96 97 104 public Object get(Fqn name, Object key) throws Exception 105 { 106 getCount++; 107 return null; 108 } 109 110 118 public Map get(Fqn name) throws Exception 119 { 120 getCount++; 121 return null; 122 } 123 124 130 public boolean exists(Fqn name) throws Exception 131 { 132 existsCount++; 133 return false; 134 } 135 136 140 public Object put(Fqn name, Object key, Object value) throws Exception 141 { 142 putCount++; 143 return null; 144 } 145 146 155 public void put(Fqn name, Map attributes) throws Exception 156 { 157 putCount++; 158 } 159 160 167 public void put(List <Modification> modifications) throws Exception 168 { 169 putCount++; 170 } 171 172 175 public Object remove(Fqn name, Object key) throws Exception 176 { 177 removeCount++; 178 return null; 179 } 180 181 185 public void remove(Fqn name) throws Exception 186 { 187 removeCount++; 188 } 189 190 196 public void removeData(Fqn name) throws Exception 197 { 198 removeCount++; 199 } 200 201 216 public void prepare(Object tx, List <Modification> modifications, boolean one_phase) throws Exception 217 { 218 if (one_phase) 219 { 220 put(modifications); 221 } 222 else 223 { 224 m_transactions.put(tx, modifications); 225 } 226 } 227 228 237 public void commit(Object tx) throws Exception 238 { 239 List modifications = (List ) m_transactions.get(tx); 240 if (modifications == null) 241 { 242 return; 243 } 244 put(modifications); 245 m_transactions.remove(tx); 246 } 247 248 254 public void rollback(Object tx) 255 { 256 List modifications = (List ) m_transactions.get(tx); 257 if (modifications == null) 258 { 259 return; 260 } 261 m_transactions.remove(tx); 262 } 263 264 public void loadEntireState(ObjectOutputStream os) throws Exception 265 { 266 } 268 269 public void loadState(Fqn subtree, ObjectOutputStream os) throws Exception 270 { 271 } 273 274 public void storeEntireState(ObjectInputStream is) throws Exception 275 { 276 } 278 279 public void storeState(Fqn subtree, ObjectInputStream is) throws Exception 280 { 281 } 283 284 public void create() throws Exception 285 { 286 } 287 288 public void start() throws Exception 289 { 290 } 291 292 public void stop() 293 { 294 } 295 296 public void destroy() 297 { 298 getChildrenNamesCount = 0; 299 getCount = 0; 300 putCount = 0; 301 existsCount = 0; 302 removeCount = 0; 303 } 304 } | Popular Tags |