use of org.jivesoftware.openfire.container.PluginManager in project Openfire by igniterealtime.
the class ConfigManager method updateRegistration.
/**
* 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");
}
}
use of org.jivesoftware.openfire.container.PluginManager in project Openfire by igniterealtime.
the class ConfigManager method deleteRegistration.
/**
* Deletes a registration via the web interface.
*
* @param registrationID ID number associated with registration to delete.
* @return Error message or null on success.
*/
public String deleteRegistration(Integer registrationID) {
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");
}
final BaseTransport transport = plugin.getTransportInstance(reg.getTransportType().toString()).getTransport();
new RegistrationHandler(transport).deleteRegistration(reg.getJID());
return null;
} catch (NotFoundException e) {
// Ok, nevermind.
Log.error("Not found while deleting id " + registrationID, e);
return LocaleUtils.getLocalizedString("gateway.web.registrations.xmppnotfound", "kraken");
} catch (UserNotFoundException e) {
// Ok, nevermind.
Log.error("Not found while deleting id " + registrationID, e);
return LocaleUtils.getLocalizedString("gateway.web.registrations.regnotfound", "kraken");
}
}
use of org.jivesoftware.openfire.container.PluginManager in project Openfire by igniterealtime.
the class XMPPServer method start.
public void start() {
try {
initialize();
// Create PluginManager now (but don't start it) so that modules may use it
File pluginDir = new File(openfireHome, "plugins");
pluginManager = new PluginManager(pluginDir);
// If the server has already been setup then we can start all the server's modules
if (!setupMode) {
verifyDataSource();
// First load all the modules so that modules may access other modules while
// being initialized
loadModules();
// Initize all the modules
initModules();
// Start all the modules
startModules();
}
// Initialize statistics
ServerTrafficCounter.initStatistics();
// Load plugins (when in setup mode only the admin console will be loaded)
pluginManager.start();
// Log that the server has been started
String startupBanner = LocaleUtils.getLocalizedString("short.title") + " " + xmppServerInfo.getVersion().getVersionString() + " [" + JiveGlobals.formatDateTime(new Date()) + "]";
logger.info(startupBanner);
System.out.println(startupBanner);
started = true;
// Notify server listeners that the server has been started
for (XMPPServerListener listener : listeners) {
listener.serverStarted();
}
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
System.out.println(LocaleUtils.getLocalizedString("startup.error"));
shutdownServer();
}
}
use of org.jivesoftware.openfire.container.PluginManager in project Openfire by igniterealtime.
the class BaseTransport method getVersionString.
/**
* @return the version string of the gateway.
*/
public String getVersionString() {
if (versionString == null) {
PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();
versionString = pluginManager.getVersion(pluginManager.getPlugin("kraken"));
}
return versionString;
}
use of org.jivesoftware.openfire.container.PluginManager in project Openfire by igniterealtime.
the class ClusterClassLoader method getResource.
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;
}
Aggregations