use of org.xwiki.query.QueryExecutor in project xwiki-platform by xwiki.
the class ConfiguredQueryExecutorProvider method init.
/**
* Switch the queryExecutor based on what main store is being used. This is called lazily because the XWikiContext
* might not yet exist when this class is instantiated.
*/
private void init() {
final XWikiContext context;
try {
context = (XWikiContext) this.exec.getContext().getProperty("xwikicontext");
} catch (NullPointerException e) {
this.logger.warn("The QueryExecutor was called without an XWikiContext available. " + "This means the old core (and likely the storage engine) is probably " + "not yet initialized. The default QueryExecutor will be returned.", e);
return;
}
final String storeName = context.getWiki().Param("xwiki.store.main.hint", "default");
try {
this.queryExecutor = this.manager.getInstance(QueryExecutor.class, storeName);
} catch (ComponentLookupException e) {
this.logger.warn("Could not find a QueryExecutor with hint [{}] which is the hint for the storage engine, " + "defined in your XWiki configuration under the [xwiki.store.main.hint] property. " + "The default QueryExecutor will be used instead. Reason: [{}]", storeName, ExceptionUtils.getRootCauseMessage(e));
}
this.initialized = true;
}
Aggregations