1 package org.jahia.services.cache.treecache; 2 3 import org.jahia.services.cache.CacheListener; 4 import org.jboss.cache.Fqn; 5 import org.jboss.cache.TreeCache; 6 import org.jboss.cache.TreeCacheListener; 7 import org.jgroups.View; 8 9 public class TreeCacheListenerWrapper implements TreeCacheListener { 10 private CacheListener cacheListener = null; 11 12 15 private CacheListener getCacheListener() { 16 return cacheListener; 17 } 18 19 public TreeCacheListenerWrapper(CacheListener listener) { 20 super(); 21 22 cacheListener = listener; 23 } 24 25 public void nodeCreated(Fqn arg0) { 26 } 29 30 public void nodeRemoved(Fqn arg0) { 31 } 33 34 public void nodeLoaded(Fqn arg0) { 35 36 } 37 38 public void nodeEvicted(Fqn arg0) { 39 } 40 41 public void nodeModified(Fqn arg0) { 42 String cacheName = (String ) arg0.get(0); 43 Object entryKey = arg0.size() > 1 ? arg0.get(1) : null; 44 cacheListener.onCachePut(cacheName, entryKey); 45 } 46 47 public void nodeVisited(Fqn arg0) { 48 } 49 50 public void cacheStarted(TreeCache arg0) { 51 } 52 53 public void cacheStopped(TreeCache arg0) { 54 } 55 56 public void viewChange(View arg0) { 57 } 58 59 public int hashCode() { 60 return cacheListener.hashCode(); 61 } 62 63 public boolean equals(Object obj) { 64 boolean isEqual = false; 65 if (obj instanceof TreeCacheListenerWrapper) { 66 isEqual = cacheListener.equals(((TreeCacheListenerWrapper) obj).getCacheListener()); 67 } 68 return isEqual; 69 } 70 } 71 | Popular Tags |