com.xpn.xwiki.web.Utils.getComponentManager()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(105)

本文整理了Java中com.xpn.xwiki.web.Utils.getComponentManager()方法的一些代码示例,展示了Utils.getComponentManager()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.getComponentManager()方法的具体详情如下:
包路径:com.xpn.xwiki.web.Utils
类名称:Utils
方法名:getComponentManager

Utils.getComponentManager介绍

暂无

代码示例

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core

/**
 * TODO: This is only a temporary work around, we need to use a component-based init mechanism instead. Note that we
 * need DB access to be available (at component initialization) to make this possible.
 * <p>
 * This method is protected to be able to skip it in unit tests.
 */
protected void registerWikiMacros()
{
  try {
    WikiMacroInitializer wikiMacroInitializer = Utils.getComponentManager().lookup(WikiMacroInitializer.class);
    wikiMacroInitializer.registerExistingWikiMacros();
  } catch (Exception ex) {
    LOG.error("Error while registering wiki macros.", ex);
  }
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-scheduler-api

@Override
public void init(XWikiContext context)
{
  Thread thread = new Thread(new ExecutionContextRunnable(new Runnable()
  {
    @Override
    public void run()
    {
      initAsync();
    }
  }, Utils.getComponentManager()));
  thread.setName("XWiki Scheduler initialization");
  thread.setDaemon(true);
  thread.start();
  // Start listening to documents modifications
  Utils.getComponent(ObservationManager.class).addListener(this);
}

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core

/**
 * Gets all syntaxes supported by the rendering as an output for a syntax conversion.
 * 
 * @param token The authentication token.
 * @return A list containing all syntaxes supported by renderers.
 * @throws Exception An invalid token is provided or the syntax lookup fails.
 */
public List<String> getOutputSyntaxes(String token) throws Exception
{
  XWikiXmlRpcUser user = XWikiUtils.checkToken(token, this.xwikiContext);
  List<String> syntaxes = new ArrayList<String>();
  List<PrintRendererFactory> renderers;
  ComponentManager componentManager = Utils.getComponentManager();
  try {
    // TODO: use BlockRenderer
    renderers = componentManager.lookupList(PrintRendererFactory.class);
    for (PrintRendererFactory renderer : renderers) {
      syntaxes.add(renderer.getSyntax().toIdString());
    }
  } catch (ComponentLookupException e) {
    throw new RuntimeException("Failed to lookup the list of available renderer syntaxes", e);
  }
  return syntaxes;
}

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core

/**
 * Gets all syntaxes supported by the rendering parsers as an input for a syntax conversion.
 * 
 * @param token The authentication token.
 * @return A list containing all syntaxes supported by rendering parsers.
 * @throws Exception An invalid token is provided or the syntax lookup fails.
 */
public List<String> getInputSyntaxes(String token) throws Exception
{
  XWikiXmlRpcUser user = XWikiUtils.checkToken(token, this.xwikiContext);
  List<String> syntaxes = new ArrayList<String>();
  List<Parser> parsers;
  ComponentManager componentManager = Utils.getComponentManager();
  try {
    parsers = componentManager.lookupList(Parser.class);
    for (Parser parser : parsers) {
      syntaxes.add(parser.getSyntax().toIdString());
    }
  } catch (ComponentLookupException e) {
    throw new RuntimeException("Failed to lookup the list of available parser syntaxes", e);
  }
  return syntaxes;
}

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core

/**
 * Ensure that mandatory classes (ie classes XWiki needs to work properly) exist and create them if they don't
 * exist.
 */
private void initializeMandatoryClasses(XWikiContext context) throws XWikiException
{
  getPrefsClass(context);
  getUserClass(context);
  getTagClass(context);
  getGroupClass(context);
  getRightsClass(context);
  getCommentsClass(context);
  getSkinClass(context);
  getGlobalRightsClass(context);
  getSheetClass(context);
  try {
    WikiMacroInitializer wikiMacroInitializer = Utils.getComponentManager().lookup(WikiMacroInitializer.class);
    wikiMacroInitializer.installOrUpgradeWikiMacroClasses();
  } catch (Exception ex) {
    LOG.error("Error while installing / upgrading xwiki classes required for wiki macros.", ex);
  }
  if (context.getDatabase().equals(context.getMainXWiki())
    && "1".equals(context.getWiki().Param("xwiki.preferences.redirect"))) {
    getRedirectClass(context);
  }
}

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core

public void initCache(int iCapacity, int iClassCapacity, XWikiContext context) throws XWikiException
{
  try {
    CacheManager cacheManager = Utils.getComponentManager().lookup(CacheManager.class);
    CacheConfiguration configuration = new CacheConfiguration();
    configuration.setConfigurationId("xwiki.groovy.content");
    LRUEvictionConfiguration lru = new LRUEvictionConfiguration();
    lru.setMaxEntries(iCapacity);
    configuration.put(LRUEvictionConfiguration.CONFIGURATIONID, lru);
    this.cache = cacheManager.createNewLocalCache(configuration);
    configuration = new CacheConfiguration();
    configuration.setConfigurationId("xwiki.groovy.class");
    lru = new LRUEvictionConfiguration();
    lru.setMaxEntries(iClassCapacity);
    configuration.put(LRUEvictionConfiguration.CONFIGURATIONID, lru);
    this.classCache = cacheManager.createNewLocalCache(configuration);
  } catch (CacheException e) {
    throw new XWikiException(XWikiException.MODULE_XWIKI_CACHE, XWikiException.ERROR_CACHE_INITIALIZING,
      "Failed to initilize caches", e);
  } catch (ComponentLookupException e) {
    throw new XWikiException(XWikiException.MODULE_XWIKI_CACHE, XWikiException.ERROR_CACHE_INITIALIZING,
      "Failed to initilize caches", e);
  }
}

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core

} else if (Utils.getComponentManager().hasComponent(BlockRenderer.class,
    backlinkDocument.getSyntax().toIdString())) {
    backlinkDocument.refactorDocumentLinks(getDocumentReference(), newDocumentReference, context);
if (Utils.getComponentManager().hasComponent(BlockRenderer.class, getSyntax().toIdString())) {

相关文章

微信公众号

最新文章

更多