本文整理汇总了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);
}
示例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);
}
示例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;
}
}
示例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;
}
}