Search in sources :

Example 1 with IArticleEngineRole

use of com.celements.blog.article.IArticleEngineRole in project celements-blog by celements.

the class BlogService method getArticleEngine.

private IArticleEngineRole getArticleEngine() throws ArticleLoadException {
    IArticleEngineRole engine = null;
    String engineHint = getContext().getWiki().getXWikiPreference("blog_article_engine", "blog.article.engine", null, getContext());
    try {
        Map<String, IArticleEngineRole> engineMap = componentManager.lookupMap(IArticleEngineRole.class);
        engine = engineMap.get(engineHint);
        if (engine == null) {
            engine = engineMap.get("default");
        }
    } catch (ComponentLookupException exc) {
        LOGGER.error("Error looking up engine components", exc);
    }
    if (engine != null) {
        LOGGER.info("getArticleEngine: got engine '" + engine + "' for hint '" + engineHint + "'");
        return engine;
    } else {
        throw new ArticleLoadException("Unable to load engine for hint");
    }
}
Also used : IArticleEngineRole(com.celements.blog.article.IArticleEngineRole) ComponentLookupException(org.xwiki.component.manager.ComponentLookupException) ArticleLoadException(com.celements.blog.article.ArticleLoadException)

Aggregations

ArticleLoadException (com.celements.blog.article.ArticleLoadException)1 IArticleEngineRole (com.celements.blog.article.IArticleEngineRole)1 ComponentLookupException (org.xwiki.component.manager.ComponentLookupException)1