use of org.xwiki.component.manager.ComponentManager in project xwiki-platform by xwiki.
the class XarScriptService method isXARExportAvailable.
/**
* @return true if the XAR export feature is available in the current XWiki instance, false otherwise
* @since 8.3RC1
*/
public boolean isXARExportAvailable() {
boolean available = false;
// Check the value of the xwiki.action.export.xar.usefilter config parameter in xwiki.cfg
int useFilter = this.xwikiCfgConfigurationSource.getProperty(EXPORT_USEFILTER_KEY, (Integer) 1);
if (useFilter == 1) {
// Are the following 2 components available?
ComponentManager cm = this.contextComponentManagerProvider.get();
if (cm.hasComponent(InputFilterStreamFactory.class, FilterStreamType.XWIKI_INSTANCE.serialize()) && cm.hasComponent(OutputFilterStreamFactory.class, FilterStreamType.XWIKI_XAR_CURRENT.serialize())) {
available = true;
}
} else {
// We're using the old packager plugin, verify it's there
XWikiContext xcontext = (XWikiContext) this.execution.getContext().getProperty(XWikiContext.EXECUTIONCONTEXT_KEY);
if (xcontext != null && xcontext.getWiki().getPlugin("package", xcontext) != null) {
available = true;
}
}
return available;
}
Aggregations