当前位置: 首页>>代码示例>>Java>>正文


Java XMPPServer.getPluginManager方法代码示例

本文整理汇总了Java中org.jivesoftware.openfire.XMPPServer.getPluginManager方法的典型用法代码示例。如果您正苦于以下问题:Java XMPPServer.getPluginManager方法的具体用法?Java XMPPServer.getPluginManager怎么用?Java XMPPServer.getPluginManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jivesoftware.openfire.XMPPServer的用法示例。


在下文中一共展示了XMPPServer.getPluginManager方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPluginResourceBundle

import org.jivesoftware.openfire.XMPPServer; //导入方法依赖的package包/类
/**
 * Retrieve the <code>ResourceBundle</code> that is used with this plugin.
 *
 * @param pluginName the name of the plugin.
 * @return the ResourceBundle used with this plugin.
 * @throws Exception thrown if an exception occurs.
 */
public static ResourceBundle getPluginResourceBundle(String pluginName) throws Exception {
    final Locale locale = JiveGlobals.getLocale();

    String i18nFile = getI18nFile(pluginName);

    // Retrieve classloader from pluginName.
    final XMPPServer xmppServer = XMPPServer.getInstance();
    PluginManager pluginManager = xmppServer.getPluginManager();
    Plugin plugin = pluginManager.getPlugin(pluginName);
    if (plugin == null) {
        throw new NullPointerException("Plugin could not be located.");
    }

    ClassLoader pluginClassLoader = pluginManager.getPluginClassloader(plugin);
    return ResourceBundle.getBundle(i18nFile, locale, pluginClassLoader);
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:24,代码来源:LocaleUtils.java

示例2: getPluginResourceBundle

import org.jivesoftware.openfire.XMPPServer; //导入方法依赖的package包/类
/**
 * Retrieve the <code>ResourceBundle</code> that is used with this plugin.
 *
 * @param pluginName the name of the plugin.
 * @return the ResourceBundle used with this plugin.
 * @throws Exception thrown if an exception occurs.
 */
public static ResourceBundle getPluginResourceBundle(String pluginName) throws Exception {
    final Locale locale = JiveGlobals.getLocale();

    String i18nFile = pluginName + "_i18n";

    // Retrieve classloader from pluginName.
    final XMPPServer xmppServer = XMPPServer.getInstance();
    PluginManager pluginManager = xmppServer.getPluginManager();
    Plugin plugin = pluginManager.getPlugin(pluginName);
    if (plugin == null) {
        throw new NullPointerException("Plugin could not be located.");
    }

    ClassLoader pluginClassLoader = pluginManager.getPluginClassloader(plugin);
    return ResourceBundle.getBundle(i18nFile, locale, pluginClassLoader);
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:24,代码来源:LocaleUtils.java

示例3: getLocalizedString

import org.jivesoftware.openfire.XMPPServer; //导入方法依赖的package包/类
/**
 * Returns an internationalized string loaded from a resource bundle from
 * the passed in plugin, using the passed in Locale.
 * 
 * If the plugin name is <tt>null</tt>, the key will be looked up using the
 * standard resource bundle.
 * 
 * If the locale is <tt>null</tt>, the Jive Global locale will be used.
 * 
 * @param key
 *            the key to use for retrieving the string from the appropriate
 *            resource bundle.
 * @param pluginName
 *            the name of the plugin to load the require resource bundle
 *            from.
 * @param arguments
 *            a list of objects to use which are formatted, then inserted
 *            into the pattern at the appropriate places.
 * @param locale
 *            the locale to use for retrieving the appropriate
 *            locale-specific string.
 * @param fallback
 *            if <tt>true</tt>, the global locale used by Openfire will be
 *            used if the requested locale is not available)
 * @return the localized string.
 */
public static String getLocalizedString(String key, String pluginName, List<?> arguments, Locale locale, boolean fallback) {
    if (pluginName == null) {
        return getLocalizedString(key, arguments);
    }

    if (locale == null) {
        locale = JiveGlobals.getLocale();
    }
    String i18nFile = getI18nFile(pluginName);

    // Retrieve classloader from pluginName.
    final XMPPServer xmppServer = XMPPServer.getInstance();
    PluginManager pluginManager = xmppServer.getPluginManager();
    Plugin plugin = pluginManager.getPlugin(pluginName);
    if (plugin == null) {
        throw new NullPointerException("Plugin could not be located: " + pluginName);
    }

    ClassLoader pluginClassLoader = pluginManager.getPluginClassloader(plugin);
    try {
        ResourceBundle bundle = ResourceBundle.getBundle(i18nFile, locale, pluginClassLoader);
        return getLocalizedString(key, locale, arguments, bundle);
    }
    catch (MissingResourceException mre) {
        Locale jivesLocale = JiveGlobals.getLocale();
        if (fallback && !jivesLocale.equals(locale)) {
            Log.info("Could not find the requested locale. Falling back to default locale.", mre);
            return getLocalizedString(key, pluginName, arguments, jivesLocale, false);
        }
        
        Log.error(mre.getMessage(), mre);
        return key;
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:61,代码来源:LocaleUtils.java

示例4: getLocalizedString

import org.jivesoftware.openfire.XMPPServer; //导入方法依赖的package包/类
/**
* Returns an internationalized string loaded from a resource bundle from
* the passed in plugin, using the passed in Locale.
* 
* If the plugin name is <tt>null</tt>, the key will be looked up using the
* standard resource bundle.
* 
* If the locale is <tt>null</tt>, the Jive Global locale will be used.
* 
* @param key
*            the key to use for retrieving the string from the appropriate
*            resource bundle.
* @param pluginName
*            the name of the plugin to load the require resource bundle
*            from.
* @param arguments
*            a list of objects to use which are formatted, then inserted
*            into the pattern at the appropriate places.
* @param locale
*            the locale to use for retrieving the appropriate
*            locale-specific string.
* @param fallback
*            if <tt>true</tt>, the global locale used by Openfire will be
*            used if the requested locale is not available)
* @return the localized string.
*/
  public static String getLocalizedString(String key, String pluginName, List arguments, Locale locale, boolean fallback) {
      if (pluginName == null) {
          return getLocalizedString(key, arguments);
      }

      if (locale == null) {
      	locale = JiveGlobals.getLocale();
      }
      String i18nFile = pluginName + "_i18n";

      // Retrieve classloader from pluginName.
      final XMPPServer xmppServer = XMPPServer.getInstance();
      PluginManager pluginManager = xmppServer.getPluginManager();
      Plugin plugin = pluginManager.getPlugin(pluginName);
      if (plugin == null) {
          throw new NullPointerException("Plugin could not be located: " + pluginName);
      }

      ClassLoader pluginClassLoader = pluginManager.getPluginClassloader(plugin);
      try {
          ResourceBundle bundle = ResourceBundle.getBundle(i18nFile, locale, pluginClassLoader);
          return getLocalizedString(key, locale, arguments, bundle);
      }
      catch (MissingResourceException mre) {
      	Locale jivesLocale = JiveGlobals.getLocale();
      	if (fallback && !jivesLocale.equals(locale)) {
      		Log.info("Could not find the requested locale. Falling back to default locale.", mre);
          	return getLocalizedString(key, pluginName, arguments, jivesLocale, false);
      	}
      	
          Log.error(mre.getMessage(), mre);
          return key;
      }
  }
 
开发者ID:coodeer,项目名称:g3server,代码行数:61,代码来源:LocaleUtils.java


注:本文中的org.jivesoftware.openfire.XMPPServer.getPluginManager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。