Search in sources :

Example 1 with XWikiPluginInterface

use of com.xpn.xwiki.plugin.XWikiPluginInterface in project xwiki-platform by xwiki.

the class DefaultRenderingCache method buildCachedItem.

/**
 * Create cached item with all dependencies.
 *
 * @param context current xwiki context
 * @param renderedContent rendered page content
 * @return properly cached item
 */
private CachedItem buildCachedItem(XWikiContext context, String renderedContent) {
    CachedItem cachedItem = new CachedItem();
    for (RenderingCacheAware component : this.renderingCacheAwareProvider.get()) {
        cachedItem.extensions.put(component, component.getCacheResources(context));
    }
    // support for legacy core -> build non-blocking list (lazy)
    if (this.legacyRenderingCacheAware == null) {
        this.legacyRenderingCacheAware = new LinkedList<RenderingCacheAware>();
        XWikiPluginManager pluginManager = context.getWiki().getPluginManager();
        for (String pluginName : pluginManager.getPlugins()) {
            XWikiPluginInterface plugin = pluginManager.getPlugin(pluginName);
            if (plugin instanceof RenderingCacheAware) {
                this.legacyRenderingCacheAware.add((RenderingCacheAware) plugin);
            }
        }
    }
    for (RenderingCacheAware component : this.legacyRenderingCacheAware) {
        cachedItem.extensions.put(component, component.getCacheResources(context));
    }
    cachedItem.rendered = renderedContent;
    return cachedItem;
}
Also used : XWikiPluginManager(com.xpn.xwiki.plugin.XWikiPluginManager) XWikiPluginInterface(com.xpn.xwiki.plugin.XWikiPluginInterface)

Aggregations

XWikiPluginInterface (com.xpn.xwiki.plugin.XWikiPluginInterface)1 XWikiPluginManager (com.xpn.xwiki.plugin.XWikiPluginManager)1