public CacheElement createElement(Object key, Object content) { if (!(key instanceof Serializable)) { throw new IllegalArgumentException("The cache key must be serializable."); } if (content instanceof Serializable) { return new EhCacheElementImpl((Serializable)key, (Serializable)content); } else { return new EhCacheElementImpl((Serializable)key, content); } }
public CacheElement get(Object key) { Element element = ehcache.get(key); if (element == null) return null; return new EhCacheElementImpl(element); }
public synchronized static void cacheAdd(Identity oid, Object obj) { oidCache.remove(oid); CacheElement entry = new EhCacheElementImpl(oid, obj); oidCache.put(entry); PortletApplication pa = (PortletApplication)obj; DistributedCacheObject wrapper = new RegistryCacheObjectWrapper(oid, pa.getName()); nameCache.remove(pa.getName()); CacheElement nameEntry = nameCache.createElement(pa.getName(), wrapper); nameCache.put(nameEntry); if (listeners != null) { for (int ix=0; ix < listeners.size(); ix++) { RegistryEventListener listener = (RegistryEventListener)listeners.get(ix); listener.applicationUpdated((PortletApplication)obj); } } }
public synchronized static void cacheAdd(Identity oid, Object obj) { oidCache.remove(oid); PortletDefinition pd = (PortletDefinition)obj; if (pd.getApplication() == null) { return; } CacheElement entry = new EhCacheElementImpl(oid, obj); oidCache.put(entry); DistributedCacheObject wrapper = new RegistryCacheObjectWrapper(oid, pd.getUniqueName()); nameCache.remove(pd.getUniqueName()); CacheElement nameEntry = nameCache.createElement(pd.getUniqueName(), wrapper); nameCache.put(nameEntry); if (listeners != null) { for (int ix=0; ix < listeners.size(); ix++) { RegistryEventListener listener = (RegistryEventListener)listeners.get(ix); listener.portletUpdated((PortletDefinition)obj); } } }