public String getCacheKey() { return getKey(); }
public synchronized static void cacheRemoveQuiet(String key, RegistryCacheObjectWrapper w) { RegistryCacheObjectWrapper wrapper = w; if (wrapper == null) { CacheElement cacheElement = nameCache.get(key); if (cacheElement != null) { wrapper = (RegistryCacheObjectWrapper) cacheElement.getContent(); } } if (wrapper == null) { return; } Identity oid = wrapper.getId(); PortletDefinition pd = (PortletDefinition)cacheLookup(oid); if (pd == null) return; oidCache.removeQuiet(oid); nameCache.removeQuiet(pd.getUniqueName()); }
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 cacheRemoveQuiet(String key, RegistryCacheObjectWrapper w) { RegistryCacheObjectWrapper wrapper = w; if (wrapper == null) { CacheElement cacheElement = nameCache.get(key); if (cacheElement != null) { wrapper = (RegistryCacheObjectWrapper) cacheElement.getContent(); } } if (wrapper == null) { return; } Identity oid = wrapper.getId(); PortletApplication pd = (PortletApplication)cacheLookup(oid); if (pd == null) return; oidCache.removeQuiet(oid); nameCache.removeQuiet(pd.getName()); }
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); } } }
public PortletApplication getPortletApplication(String name, boolean fromCache) { if (fromCache) { CacheElement cacheElement = applicationNameCache.get(name); if (cacheElement != null) { cacheElement = applicationOidCache.get(((RegistryCacheObjectWrapper)cacheElement.getContent()).getId()); if (cacheElement != null) { return (PortletApplication)cacheElement.getContent(); } } } Criteria c = new Criteria(); c.addEqualTo("name", name); PortletApplication app = (PortletApplication) getPersistenceBrokerTemplate().getObjectByQuery( QueryFactory.newQuery(PortletApplicationDefinitionImpl.class, c)); postLoad(app); return app; }
public int hashCode() { return getKey().hashCode(); }
public PortletDefinition getPortletDefinitionByUniqueName( String name, boolean fromCache ) { if (fromCache) { CacheElement cacheElement = portletNameCache.get(name); if (cacheElement != null) { cacheElement = portletOidCache.get(((RegistryCacheObjectWrapper)cacheElement.getContent()).getId()); if (cacheElement != null) { return (PortletDefinition)cacheElement.getContent(); } } } String appName = PortletRegistryHelper.parseAppName(name); String portletName = PortletRegistryHelper.parsePortletName(name); Criteria c = new Criteria(); c.addEqualTo("app.name", appName); c.addEqualTo("portletName", portletName); PortletDefinition def = (PortletDefinition) getPersistenceBrokerTemplate().getObjectByQuery( QueryFactory.newQuery(PortletDefinitionImpl.class, c)); if (def != null && def.getApplication() == null) { final String msg = "getPortletDefinitionByIdentifier() returned a PortletDefinition that has no parent PortletApplication."; throw new IllegalStateException(msg); } postLoad(def); return def; }
public void notifyChange(int action) { switch (action) { case CacheElement.ActionAdded: // System.out.println("CacheObjectAdded =" + this.getKey()); break; case CacheElement.ActionChanged: // System.out.println("CacheObjectChanged =" + this.getKey()); break; case CacheElement.ActionRemoved: // System.out.println("CacheObjectRemoved =" + this.getKey()); break; case CacheElement.ActionEvicted: // System.out.println("CacheObjectEvicted =" + this.getKey()); break; case CacheElement.ActionExpired: // System.out.println("CacheObjectExpired =" + this.getKey()); break; default: System.out.println("CacheObject -UNKOWN OPRERATION =" + this.getKey()); return; } return; } }