public synchronized static Object cacheLookup(Identity oid) { CacheElement element = oidCache.get(oid); if (element != null) { return element.getContent(); } return null; }
public List<PortletTrackingInfo> getOutOfServiceList() { List<PortletTrackingInfo> result = new ArrayList<PortletTrackingInfo>(); List<String> keys = trackingCache.getKeys(); for (String fullName : keys) { CacheElement element = trackingCache.get(fullName); if (element != null) { List<String> windows = (List<String>) element.getContent(); result.add(new PortletTrackingInfo(fullName, windows)); } } return result; }
public synchronized static Object cacheLookup(Identity oid) { CacheElement element = oidCache.get(oid); if (element != null) { return element.getContent(); } return null; }
/** * Clear node and all children based on specified path from cache. * * @param path full path of node to remove * @return count of nodes cleared from cache */ protected int clearCachedNodeAndAllChildren(String path) { int count = 0; String root = path.substring(0, path.length()-1); List preferenceCacheKeys = preferenceCache.getKeys(); for (Iterator iter = preferenceCacheKeys.iterator(); iter.hasNext();) { CacheElement preferenceCacheElement = preferenceCache.get(iter.next()); if (preferenceCacheElement != null) { String preferenceFullPath = ((NodeCache)preferenceCacheElement.getContent()).getNode().getFullPath(); if (preferenceFullPath.startsWith(path) || preferenceFullPath.equals(root)) { if (preferenceCache.removeQuiet(preferenceCacheElement.getKey())) { count++; } } } } return count; } }
private String getCachedContent( String cacheKey ) { CacheElement cachedElement = desktopContentCache.get(cacheKey); if (cachedElement != null) return (String)cachedElement.getContent(); return null; } private void setCachedContent( String cacheKey, String content )
for (String principalKey : principalKeys) CacheElement propertiesElement = principalPropertiesCache.get(principalKey); if (propertiesElement != null)
private NodeCache getNode(String cacheKey) { CacheElement cachedElement = preferenceCache.get(cacheKey); if (cachedElement != null) return (NodeCache)cachedElement.getContent(); return null; }
/** * Gets an entry from the cache given a key * * @param key the key to look up the entry by * @return the entry */ public FileCacheEntry get(String key) { FileCacheEntry entry = null; CacheElement element = this.cache.get(key); if (element != null) { entry = (FileCacheEntry) element.getContent(); } return entry; }
/** * Lookup principal fragment property list by principal key. * * @param principalKey principal key for fragment property list * @return fragment property list */ public synchronized static DatabasePageManagerCachedFragmentPropertyList principalFragmentPropertyListCacheLookup(String principalKey) { // return fragment properties list cached locally by key if (principalKey != null) { CacheElement propertiesElement = principalPropertiesCache.get(principalKey); if (propertiesElement != null) { return (DatabasePageManagerCachedFragmentPropertyList)propertiesElement.getContent(); } } return null; }
/** * Lookup fragment property list by cache key. * * @param fragmentKey fragment key for fragment property list * @return fragment property list */ public synchronized static DatabasePageManagerCachedFragmentPropertyList fragmentPropertyListCacheLookup(String fragmentKey) { // return fragment properties list cached locally by key if (fragmentKey != null) { CacheElement propertiesElement = propertiesCache.get(fragmentKey); if (propertiesElement != null) { return (DatabasePageManagerCachedFragmentPropertyList)propertiesElement.getContent(); } } return null; }
protected Properties getCachedConfiguration( String name, String type ) { if ( decorationConfigurationCache == null ) { if ( type.equals( ContentFragment.PORTLET ) ) { return (Properties)this.portletDecoratorProperties.get( name ); } else { return (Properties)this.layoutDecoratorProperties.get( name ); } } CacheElement cachedElement = decorationConfigurationCache.get( getCachedConfigurationKey( type, name ) ); if (cachedElement != null) return (Properties)cachedElement.getContent(); return null; } protected void setCachedConfiguration( String name, String type, Properties props )
public PortletTrackingInfo getOutOfServiceList(String fullPortletName) { CacheElement element = trackingCache.get(fullPortletName); if (element != null) { List<String> windows = (List<String>)element.getContent(); return new PortletTrackingInfo(fullPortletName, windows); } else { List<String> windows = new ArrayList<String>(); return new PortletTrackingInfo(fullPortletName, windows); } }
protected boolean removeFromCache(PortletWindow window) { String fullName = window.getPortletDefinition().getUniqueName(); CacheElement cachedElement = trackingCache.get(fullName); if (cachedElement == null) { return false; } List<String> windowIds = (List<String>)cachedElement.getContent(); if (!windowIds.contains(window.getWindowId())) { windowIds.remove(window.getWindowId()); trackingCache.put(cachedElement); return true; } return false; }
protected boolean addToCache(PortletWindow window) { String fullName = window.getPortletDefinition().getUniqueName(); CacheElement cachedElement = trackingCache.get(fullName); if (cachedElement == null) { List<String> windowIds = new ArrayList<String>(); windowIds.add(window.getWindowId()); cachedElement = trackingCache.createElement(fullName, windowIds); trackingCache.put(cachedElement); return true; } else { List<String> windowIds = (List<String>)cachedElement.getContent(); if (!windowIds.contains(window.getWindowId())) { windowIds.add(window.getWindowId()); trackingCache.put(cachedElement); return true; } } return false; }
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; }
CacheElement element = trackingCache.get(window.getPortletDefinition().getUniqueName()); if (element != null) { List<String> windows = (List<String>)element.getContent();
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 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()); }
CacheElement cachedElement = portletContentCache.get(cacheKey);
public void removeDefaults(org.apache.jetspeed.om.portlet.PortletDefinition pd, String preferenceName) { Criteria c = new Criteria(); c.addEqualTo(DTYPE, DISCRIMINATOR_PORTLET); c.addEqualTo(APPLICATION_NAME, pd.getApplication().getName()); c.addEqualTo(PORTLET_NAME, pd.getPortletName()); c.addEqualTo("name", preferenceName); QueryByCriteria query = QueryFactory.newQuery(DatabasePreference.class, c); getPersistenceBrokerTemplate().deleteByQuery(query); String defaultsCacheKey = getPortletPreferenceKey(pd.getApplication().getName(), pd.getPortletName()); JetspeedPreferencesMap map = (JetspeedPreferencesMap) preferenceCache.get(defaultsCacheKey).getContent(); map.remove(preferenceName); preferenceCache.put(preferenceCache.createElement(defaultsCacheKey, map)); }