本文整理汇总了Java中org.jivesoftware.openfire.container.PluginManager.getPlugin方法的典型用法代码示例。如果您正苦于以下问题:Java PluginManager.getPlugin方法的具体用法?Java PluginManager.getPlugin怎么用?Java PluginManager.getPlugin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.openfire.container.PluginManager
的用法示例。
在下文中一共展示了PluginManager.getPlugin方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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();
}
}
示例3: updateRegistration
import org.jivesoftware.openfire.container.PluginManager; //导入方法依赖的package包/类
/**
* Updates a registration via the web interface.
*
*
* @param registrationID ID number associated with registration to modify.
* @param legacyUsername User's updated username on the legacy service.
* @param legacyPassword User's updated password on the legacy service, null if no change.
* @param legacyNickname User's updated nickname on the legacy service.
* @return Error message or null on success.
*/
public String updateRegistration(Integer registrationID, String legacyUsername, String legacyPassword, String legacyNickname) {
PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();
KrakenPlugin plugin = (KrakenPlugin)pluginManager.getPlugin("kraken");
try {
Registration reg = new Registration(registrationID);
if (!plugin.getTransportInstance(reg.getTransportType().toString()).isEnabled()) {
return LocaleUtils.getLocalizedString("gateway.web.registrations.notenabled", "kraken");
}
reg.setUsername(legacyUsername);
if (legacyPassword != null) {
reg.setPassword(legacyPassword);
}
reg.setNickname(legacyNickname);
return null;
}
catch (NotFoundException e) {
// Ok, nevermind.
Log.error("Not found while editing id "+registrationID, e);
return LocaleUtils.getLocalizedString("gateway.web.registrations.regnotfound", "kraken");
}
}
示例4: logoutSession
import org.jivesoftware.openfire.container.PluginManager; //导入方法依赖的package包/类
/**
* Logs out session via the web interface.
*
*
* @param registrationID ID number associated with registration to log off.
* @return registration ID on success, -1 on failure (-1 so that js cb_logoutSession knows which Div to edit)
*/
public Integer logoutSession(Integer registrationID)
{
try
{
PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();
KrakenPlugin plugin = (KrakenPlugin)pluginManager.getPlugin("kraken");
Registration registration = new Registration(registrationID);
if (!plugin.getTransportInstance(registration.getTransportType().toString()).isEnabled()) {
return -1;
}
JID jid = registration.getJID();
TransportSession session = plugin.getTransportInstance(registration.getTransportType().toString()).getTransport().getSessionManager().getSession(jid);
plugin.getTransportInstance(registration.getTransportType().toString()).getTransport().registrationLoggedOut(session);
return registrationID;
}
catch(NotFoundException e)
{
return -1;
}
}
示例5: logoutSession
import org.jivesoftware.openfire.container.PluginManager; //导入方法依赖的package包/类
/**
* Logs out session via the web interface.
*
*
* @param registrationID ID number associated with registration to log off.
* @return registration ID on success, -1 on failure (-1 so that js cb_logoutSession knows which Div to edit)
*/
public Integer logoutSession(Integer registrationID)
{
try
{
PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();
KrakenPlugin plugin = (KrakenPlugin)pluginManager.getPlugin("kraken");
Registration registration = new Registration(registrationID);
if (!plugin.getTransportInstance(registration.getTransportType().toString()).isEnabled()) {
return -1;
}
JID jid = registration.getJID();
TransportSession session = plugin.getTransportInstance(registration.getTransportType().toString()).getTransport().getSessionManager().getSession(jid);
plugin.getTransportInstance(registration.getTransportType().toString()).getTransport().registrationLoggedOut(session);
return registrationID;
}
catch(NotFoundException e)
{
return -1;
}
}
示例6: 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);
}
示例7: 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();
}
}
示例8: 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;
}
}
示例9: getActiveTransports
import org.jivesoftware.openfire.container.PluginManager; //导入方法依赖的package包/类
/**
* Retrieve a list of all active/enabled transports.
*
* @param password Auth password for making changes
* @return List of active transports.
*/
public List<String> getActiveTransports(String password) {
if (!verifyPassword(password)) {
return Arrays.asList("Authorization failed!");
}
PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();
KrakenPlugin plugin = (KrakenPlugin)pluginManager.getPlugin("kraken");
List<String> activeTransports = new ArrayList<String>();
for (String transport : plugin.getTransports()) {
if (plugin.serviceEnabled(transport)) {
activeTransports.add(transport);
}
}
return activeTransports;
}
示例10: toggleTransport
import org.jivesoftware.openfire.container.PluginManager; //导入方法依赖的package包/类
/**
* Toggles whether a transport is enabled or disabled.
*
* @param transportName Name of the transport to be enabled or disabled (type of transport)
* @return True or false if the transport is enabled after this call.
*/
public boolean toggleTransport(String transportName) {
PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();
KrakenPlugin plugin = (KrakenPlugin)pluginManager.getPlugin("kraken");
if (!plugin.serviceEnabled(transportName)) {
plugin.enableService(transportName);
return true;
}
else {
plugin.disableService(transportName);
return false;
}
}
示例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();
}
}
示例12: 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;
}
}