Search in sources :

Example 6 with PluginManager

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");
    }
}
Also used : PluginManager(org.jivesoftware.openfire.container.PluginManager) Registration(net.sf.kraken.registration.Registration) NotFoundException(org.jivesoftware.util.NotFoundException) GroupNotFoundException(org.jivesoftware.openfire.group.GroupNotFoundException) UserNotFoundException(org.jivesoftware.openfire.user.UserNotFoundException) KrakenPlugin(net.sf.kraken.KrakenPlugin)

Example 7 with PluginManager

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");
    }
}
Also used : PluginManager(org.jivesoftware.openfire.container.PluginManager) UserNotFoundException(org.jivesoftware.openfire.user.UserNotFoundException) Registration(net.sf.kraken.registration.Registration) RegistrationHandler(net.sf.kraken.registration.RegistrationHandler) NotFoundException(org.jivesoftware.util.NotFoundException) GroupNotFoundException(org.jivesoftware.openfire.group.GroupNotFoundException) UserNotFoundException(org.jivesoftware.openfire.user.UserNotFoundException) BaseTransport(net.sf.kraken.BaseTransport) KrakenPlugin(net.sf.kraken.KrakenPlugin)

Example 8 with PluginManager

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();
    }
}
Also used : PluginManager(org.jivesoftware.openfire.container.PluginManager)

Example 9 with PluginManager

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;
}
Also used : PluginManager(org.jivesoftware.openfire.container.PluginManager)

Example 10 with PluginManager

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;
}
Also used : PluginManager(org.jivesoftware.openfire.container.PluginManager) URL(java.net.URL) Plugin(org.jivesoftware.openfire.container.Plugin) PluginClassLoader(org.jivesoftware.openfire.container.PluginClassLoader)

Aggregations

PluginManager (org.jivesoftware.openfire.container.PluginManager)20 Plugin (org.jivesoftware.openfire.container.Plugin)8 KrakenPlugin (net.sf.kraken.KrakenPlugin)7 IOException (java.io.IOException)5 URL (java.net.URL)5 PluginClassLoader (org.jivesoftware.openfire.container.PluginClassLoader)5 UserNotFoundException (org.jivesoftware.openfire.user.UserNotFoundException)4 Registration (net.sf.kraken.registration.Registration)3 GroupNotFoundException (org.jivesoftware.openfire.group.GroupNotFoundException)3 NotFoundException (org.jivesoftware.util.NotFoundException)3 File (java.io.File)2 FileInputStream (java.io.FileInputStream)2 FileNotFoundException (java.io.FileNotFoundException)2 Locale (java.util.Locale)2 BaseTransport (net.sf.kraken.BaseTransport)2 RegistrationHandler (net.sf.kraken.registration.RegistrationHandler)2 Element (org.dom4j.Element)2 XMPPServer (org.jivesoftware.openfire.XMPPServer)2 JID (org.xmpp.packet.JID)2 InputStream (java.io.InputStream)1