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


Java PluginManager.getPluginClassloader方法代码示例

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


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

示例1: getPluginResourceBundle

import org.jivesoftware.openfire.container.PluginManager; //导入方法依赖的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: getClusteredCacheStrategyClassLoader

import org.jivesoftware.openfire.container.PluginManager; //导入方法依赖的package包/类
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();
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:27,代码来源:CacheFactory.java

示例3: loadClass

import org.jivesoftware.openfire.container.PluginManager; //导入方法依赖的package包/类
public Class<?> loadClass(String name) throws ClassNotFoundException {
    try {
        return hazelcastClassloader.loadClass(name);
    }
    catch (ClassNotFoundException e) {
        PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();
        for (Plugin plugin : pluginManager.getPlugins()) {
            String pluginName = pluginManager.getPluginDirectory(plugin).getName();
            if ("hazelcast".equals(pluginName) || "admin".equals(pluginName)) {
                continue;
            }
            PluginClassLoader pluginClassloader = pluginManager.getPluginClassloader(plugin);
            try {
                return pluginClassloader.loadClass(name);
            }
            catch (ClassNotFoundException e1) {
                // Do nothing. Continue to the next plugin
            }
        }
    }
    throw new ClassNotFoundException(name);
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:23,代码来源:ClusterClassLoader.java

示例4: getResource

import org.jivesoftware.openfire.container.PluginManager; //导入方法依赖的package包/类
public URL getResource(String name) {
    URL resource = hazelcastClassloader.getResource(name);
    if (resource == null) {
        PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();
        for (Plugin plugin : pluginManager.getPlugins()) {
            String pluginName = pluginManager.getPluginDirectory(plugin).getName();
            if ("hazelcast".equals(pluginName) || "admin".equals(pluginName)) {
                continue;
            }
            PluginClassLoader pluginClassloader = pluginManager.getPluginClassloader(plugin);
            resource = pluginClassloader.getResource(name);
            if (resource != null) {
                return resource;
            }
        }
    }
    return resource;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:19,代码来源:ClusterClassLoader.java

示例5: getPluginResourceBundle

import org.jivesoftware.openfire.container.PluginManager; //导入方法依赖的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

示例6: loadClass

import org.jivesoftware.openfire.container.PluginManager; //导入方法依赖的package包/类
public Class<?> loadClass(String name) throws ClassNotFoundException {
    try {
        return enterpriseClassloader.loadClass(name);
    }
    catch (ClassNotFoundException e) {
        PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();
        for (Plugin plugin : pluginManager.getPlugins()) {
            String pluginName = pluginManager.getPluginDirectory(plugin).getName();
            if ("clustering".equals(pluginName) || "admin".equals(pluginName)) {
                continue;
            }
            PluginClassLoader pluginClassloader = pluginManager.getPluginClassloader(plugin);
            try {
                return pluginClassloader.loadClass(name);
            }
            catch (ClassNotFoundException e1) {
                // Do nothing. Continue to the next plugin
            }
        }
    }
    throw new ClassNotFoundException(name);
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:23,代码来源:ClusterClassLoader.java

示例7: getResource

import org.jivesoftware.openfire.container.PluginManager; //导入方法依赖的package包/类
public URL getResource(String name) {
    URL resource = enterpriseClassloader.getResource(name);
    if (resource == null) {
        PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();
        for (Plugin plugin : pluginManager.getPlugins()) {
            String pluginName = pluginManager.getPluginDirectory(plugin).getName();
            if ("clustering".equals(pluginName) || "admin".equals(pluginName)) {
                continue;
            }
            PluginClassLoader pluginClassloader = pluginManager.getPluginClassloader(plugin);
            resource = pluginClassloader.getResource(name);
            if (resource != null) {
                return resource;
            }
        }
    }
    return resource;
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:19,代码来源:ClusterClassLoader.java

示例8: getClusteredCacheStrategyClassLoader

import org.jivesoftware.openfire.container.PluginManager; //导入方法依赖的package包/类
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();
    }
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:27,代码来源:CacheFactory.java

示例9: getLocalizedString

import org.jivesoftware.openfire.container.PluginManager; //导入方法依赖的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

示例10: getLocalizedString

import org.jivesoftware.openfire.container.PluginManager; //导入方法依赖的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

示例11: getClusteredCacheStrategyClassLoader

import org.jivesoftware.openfire.container.PluginManager; //导入方法依赖的package包/类
private static ClassLoader getClusteredCacheStrategyClassLoader() {
    PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();
    Plugin plugin = pluginManager.getPlugin("clustering");
    if (plugin == null) {
        plugin = pluginManager.getPlugin("enterprise");
    }
    PluginClassLoader pluginLoader = pluginManager.getPluginClassloader(plugin);
    if (pluginLoader != null) {
        return pluginLoader;
    }
    else {
        Log.debug("CacheFactory - Unable to find a Plugin that provides clustering support.");
        return Thread.currentThread().getContextClassLoader();
    }
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:16,代码来源:CacheFactory.java


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