public synchronized static Object cacheLookup(Identity oid) { CacheElement element = oidCache.get(oid); if (element != null) { return element.getContent(); } return null; }
private void setCachedContent( String cacheKey, String content ) { CacheElement cachedElement = desktopContentCache.createElement( cacheKey, content ); cachedElement.setTimeToIdleSeconds(desktopContentCache.getTimeToIdleSeconds()); cachedElement.setTimeToLiveSeconds(desktopContentCache.getTimeToLiveSeconds()); desktopContentCache.put( cachedElement ); }
/** * 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; } }
public synchronized static Object cacheLookup(Identity oid) { CacheElement element = oidCache.get(oid); if (element != null) { return element.getContent(); } return null; }
protected void addToCache(NodeCache content) { CacheElement cachedElement = preferenceCache.createElement(content.getCacheKey(), content); cachedElement.setTimeToIdleSeconds(preferenceCache.getTimeToIdleSeconds()); cachedElement.setTimeToLiveSeconds(preferenceCache.getTimeToLiveSeconds()); preferenceCache.put(cachedElement); }
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 )
protected void setCachedConfiguration( String name, String type, Properties props ) { if ( decorationConfigurationCache == null ) { if ( type.equals( ContentFragment.PORTLET ) ) { this.portletDecoratorProperties.put( name, props ); } else { this.layoutDecoratorProperties.put( name, props ); } } else { CacheElement cachedElement = decorationConfigurationCache.createElement( getCachedConfigurationKey( type, name ), props ); cachedElement.setTimeToIdleSeconds(decorationConfigurationCache.getTimeToIdleSeconds()); cachedElement.setTimeToLiveSeconds(decorationConfigurationCache.getTimeToLiveSeconds()); decorationConfigurationCache.put( cachedElement ); } } protected String getCachedConfigurationKey( String type, String name )
private NodeCache getNode(String cacheKey) { CacheElement cachedElement = preferenceCache.get(cacheKey); if (cachedElement != null) return (NodeCache)cachedElement.getContent(); return null; }
protected void addToCache(RequestContext context, PortletContent content) { CacheElement cachedElement = portletContentCache.createElement(content.getCacheKey(), content); if (content.getExpiration() == -1) { cachedElement.setTimeToIdleSeconds(portletContentCache.getTimeToIdleSeconds()); cachedElement.setTimeToLiveSeconds(portletContentCache.getTimeToLiveSeconds()); } else { cachedElement.setTimeToIdleSeconds(content.getExpiration()); cachedElement.setTimeToLiveSeconds(content.getExpiration()); } portletContentCache.put(cachedElement); context.getPortalURL().getNavigationalState().registerPortletContentCachedForPublicRenderParameters(context, content); }
/** * 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 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 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 void invalidate(RequestContext context) { ContentPage page = context.getPage(); ContentCacheKey themeContentCacheKey = createCacheKey(context, page.getId()); CacheElement themeCacheElem = get(themeContentCacheKey); if (themeCacheElem != null) { Theme theme = (Theme) themeCacheElem.getContent(); theme.setInvalidated(true); } } }
FileCacheEntry entry = (FileCacheEntry) element.getContent(); File file = entry.getFile(); Date modified = new Date(file.lastModified());
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; }