Search in sources :

Example 1 with PluginMetadata

use of org.jivesoftware.openfire.container.PluginMetadata in project Openfire by igniterealtime.

the class UpdateManager method buildPluginsUpdateList.

/**
 * Recreate the list of plugins that need to be updated based on the list of
 * available plugins at igniterealtime.org.
 */
private void buildPluginsUpdateList() {
    // Reset list of plugins that need to be updated
    pluginUpdates = new ArrayList<>();
    XMPPServer server = XMPPServer.getInstance();
    Version currentServerVersion = XMPPServer.getInstance().getServerInfo().getVersion();
    // Compare local plugins versions with latest ones
    for (final PluginMetadata plugin : server.getPluginManager().getMetadataExtractedPlugins().values()) {
        final AvailablePlugin latestPlugin = availablePlugins.get(plugin.getName());
        if (latestPlugin == null) {
            continue;
        }
        final Version latestPluginVersion = latestPlugin.getVersion();
        if (latestPluginVersion.isNewerThan(plugin.getVersion())) {
            // Check if the update can run in the current version of the server
            final Version pluginMinServerVersion = latestPlugin.getMinServerVersion();
            if (pluginMinServerVersion != null && pluginMinServerVersion.isNewerThan(currentServerVersion)) {
                continue;
            }
            final Version pluginPriorToServerVersion = latestPlugin.getPriorToServerVersion();
            if (pluginPriorToServerVersion != null && !pluginPriorToServerVersion.isNewerThan(currentServerVersion)) {
                continue;
            }
            final Update update = new Update(plugin.getName(), latestPlugin.getVersion().getVersionString(), latestPlugin.getChangelog().toExternalForm(), latestPlugin.getDownloadURL().toExternalForm());
            pluginUpdates.add(update);
        }
    }
}
Also used : XMPPServer(org.jivesoftware.openfire.XMPPServer) PluginMetadata(org.jivesoftware.openfire.container.PluginMetadata)

Example 2 with PluginMetadata

use of org.jivesoftware.openfire.container.PluginMetadata in project Openfire by igniterealtime.

the class GetClusteredVersions method run.

@Override
public void run() {
    final XMPPServer xmppServer = XMPPServer.getInstance();
    openfireVersion = xmppServer.getServerInfo().getVersion().toString();
    pluginVersions = new HashMap<>();
    pluginVersions = xmppServer.getPluginManager().getMetadataExtractedPlugins().values().stream().filter(pluginMetadata -> !pluginMetadata.getCanonicalName().equals("admin")).collect(Collectors.toMap(PluginMetadata::getName, pluginMetadata -> pluginMetadata.getVersion().toString()));
}
Also used : XMPPServer(org.jivesoftware.openfire.XMPPServer) PluginMetadata(org.jivesoftware.openfire.container.PluginMetadata)

Aggregations

XMPPServer (org.jivesoftware.openfire.XMPPServer)2 PluginMetadata (org.jivesoftware.openfire.container.PluginMetadata)2