org.jivesoftware.openfire.container.Plugin Java Examples
The following examples show how to use
org.jivesoftware.openfire.container.Plugin.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LocaleUtils.java From Openfire with Apache License 2.0 | 6 votes |
/** * 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); }
Example #2
Source File: CacheFactory.java From Openfire with Apache License 2.0 | 6 votes |
private static ClassLoader getClusteredCacheStrategyClassLoader() { PluginManager pluginManager = XMPPServer.getInstance().getPluginManager(); Plugin plugin = pluginManager.getPlugin("hazelcast"); if (plugin == null) { plugin = pluginManager.getPlugin("clustering"); if (plugin == null) { plugin = pluginManager.getPlugin("enterprise"); } } PluginClassLoader pluginLoader = pluginManager.getPluginClassloader(plugin); if (pluginLoader != null) { if (log.isDebugEnabled()) { StringBuffer pluginLoaderDetails = new StringBuffer("Clustering plugin class loader: "); pluginLoaderDetails.append(pluginLoader.getClass().getName()); for (URL url : pluginLoader.getURLs()) { pluginLoaderDetails.append("\n\t").append(url.toExternalForm()); } log.debug(pluginLoaderDetails.toString()); } return pluginLoader; } else { log.warn("CacheFactory - Unable to find a Plugin that provides clustering support."); return Thread.currentThread().getContextClassLoader(); } }
Example #3
Source File: OfMeetPlugin.java From openfire-ofmeet-plugin with Apache License 2.0 | 5 votes |
@Override public void pluginCreated( final String pluginName, final Plugin plugin ) { if ( "offocus".equalsIgnoreCase( pluginName ) ) { System.out.println( "OFMeet plugin detected incompatible OFFocus plugin. Please remove OFFocus!" ); Log.error( "The OFMeet plugin detected that the OFFocus plugin is installed. This version of OFMeet no longer requires the OFFocus plugin. Running the OFFocus plugin and this version of OFMeet might lead to unpredictable behavior! OFFocus should be removed!" ); } }
Example #4
Source File: LocaleUtils.java From Openfire with Apache License 2.0 | 5 votes |
/** * Returns an internationalized string loaded from a resource bundle from * the passed in plugin, using the passed in Locale. * * If the plugin name is {@code null}, the key will be looked up using the * standard resource bundle. * * If the locale is {@code null}, 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 {@code true}, 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; } }
Example #5
Source File: OfMeetPlugin.java From openfire-ofmeet-plugin with Apache License 2.0 | 4 votes |
@Override public void pluginDestroyed( final String pluginName, final Plugin plugin ) {}
Example #6
Source File: ModuleManager.java From openfire-ofmeet-plugin with Apache License 2.0 | 4 votes |
public ModuleManager( final Plugin plugin ) { this.plugin = plugin; }