Commit 1cb144fe authored by Guus der Kinderen's avatar Guus der Kinderen

OF-1353: Change from 'maxServerVersion' to 'priorToServerVersion'

'max' implies to specify a server version that still supports the plugin, while typically, one would like to specify the first version in which support was dropped. That version should thus be 'exclusive'.
parent 92450df2
......@@ -2645,7 +2645,7 @@ plugin.admin.changelog = Change Log
plugin.admin.update = Update
plugin.admin.updating = Updating
plugin.admin.failed.minserverversion=The version of the plugin that is installed requires Openfire {0} or later versions!
plugin.admin.failed.maxserverversion=The version of the plugin that is installed only works with Openfire {0} or earlier versions!
plugin.admin.failed.priortoserverversion=The version of the plugin that is installed is not longer compatible with Openfire {0} and later versions!
# System Email
......
......@@ -436,13 +436,13 @@ public class PluginManager
}
// See if the plugin specifies a maximum version of Openfire required to run.
if ( metadata.getMaxServerVersion() != null )
if ( metadata.getPriorToServerVersion() != null )
{
// OF-1338: Ignore release status when comparing maximum server version requirement.
final Version compareVersion = new Version( currentServerVersion.getMajor(), currentServerVersion.getMinor(), currentServerVersion.getMicro(), null, -1 );
if ( compareVersion.isNewerThan( metadata.getMaxServerVersion() ) )
if ( !metadata.getPriorToServerVersion().isNewerThan( compareVersion ) )
{
Log.warn( "Ignoring plugin '{}': compatible with server versions up to and including {}. Current server version is {}.", canonicalName, metadata.getMaxServerVersion(), currentServerVersion );
Log.warn( "Ignoring plugin '{}': compatible with server versions up to but excluding {}. Current server version is {}.", canonicalName, metadata.getPriorToServerVersion(), currentServerVersion );
failureToLoadCount.put( canonicalName, Integer.MAX_VALUE ); // Don't retry - this cannot be recovered from.
return false;
}
......
......@@ -74,14 +74,14 @@ public class PluginMetadata
private final String license;
/**
* Minimum server version required by this plugin as specified in plugin.xml.
* Minimum server version (inclusive) required by this plugin as specified in plugin.xml.
*/
private final Version minServerVersion;
/**
* Maximum server version required by this plugin as specified in plugin.xml.
* Maximum server version (exclusive) required by this plugin as specified in plugin.xml.
*/
private final Version maxServerVersion;
private final Version priorToServerVersion;
/**
* Constructs a metadata object based on a plugin.
......@@ -104,7 +104,7 @@ public class PluginMetadata
PluginMetadataHelper.getReadme( pluginDir ),
PluginMetadataHelper.getLicense( pluginDir ),
PluginMetadataHelper.getMinServerVersion( pluginDir ),
PluginMetadataHelper.getMaxServerVersion( pluginDir )
PluginMetadataHelper.getPriorToServerVersion( pluginDir )
);
}
......@@ -129,13 +129,13 @@ public class PluginMetadata
PluginMetadataHelper.getReadme( plugin ),
PluginMetadataHelper.getLicense( plugin ),
PluginMetadataHelper.getMinServerVersion( plugin ),
PluginMetadataHelper.getMaxServerVersion( plugin )
PluginMetadataHelper.getPriorToServerVersion( plugin )
);
}
public PluginMetadata( String name, String canonicalName, String description, Version version, String author,
URL icon, URL changelog, URL readme, String license,
Version minServerVersion, Version maxServerVersion )
Version minServerVersion, Version priorToServerVersion )
{
this.name = name;
this.canonicalName = canonicalName;
......@@ -147,7 +147,7 @@ public class PluginMetadata
this.readme = readme;
this.license = license;
this.minServerVersion = minServerVersion;
this.maxServerVersion = maxServerVersion;
this.priorToServerVersion = priorToServerVersion;
}
public String getName()
......@@ -200,9 +200,9 @@ public class PluginMetadata
return minServerVersion;
}
public Version getMaxServerVersion()
public Version getPriorToServerVersion()
{
return maxServerVersion;
return priorToServerVersion;
}
public String getHashCode() {
......
......@@ -278,8 +278,8 @@ public class PluginMetadataHelper
}
/**
* Returns the maximum server version this plugin can run within. The value is retrieved from the plugin.xml file
* of the plugin. If the value could not be found, <tt>null</tt> will be returned.
* Returns the server version up, but not including, in which this plugin can run within. The value is retrieved from
* the plugin.xml file of the plugin. If the value could not be found, <tt>null</tt> will be returned.
*
* Note that this method will return data only for plugins that have successfully been installed. To obtain data
* from plugin (directories) that have not (yet) been installed, refer to the overloaded method that takes a Path
......@@ -288,21 +288,21 @@ public class PluginMetadataHelper
* @param plugin The plugin (cannot be null)
* @return the plugin's maximum server version (possibly null).
*/
public static Version getMaxServerVersion( Plugin plugin )
public static Version getPriorToServerVersion( Plugin plugin )
{
return getMaxServerVersion( XMPPServer.getInstance().getPluginManager().getPluginPath( plugin ) );
return getPriorToServerVersion( XMPPServer.getInstance().getPluginManager().getPluginPath( plugin ) );
}
/**
* Returns the maximum server version this plugin can run within. The value is retrieved from the plugin.xml file
* of the plugin. If the value could not be found, <tt>null</tt> will be returned.
* Returns the server version up, but not including, in which this plugin can run within. The value is retrieved from
* the plugin.xml file of the plugin. If the value could not be found, <tt>null</tt> will be returned.
*
* @param pluginDir the path of the plugin directory.
* @return the plugin's maximum server version (possibly null).
*/
public static Version getMaxServerVersion( Path pluginDir )
public static Version getPriorToServerVersion( Path pluginDir )
{
final String value = getElementValue( pluginDir, "/plugin/maxServerVersion" );
final String value = getElementValue( pluginDir, "/plugin/priorToServerVersion" );
if ( value == null || value.trim().isEmpty() )
{
return null;
......
......@@ -120,11 +120,11 @@ public class AvailablePlugin extends PluginMetadata
minServerVersion = new Version( minServerVersionValue );
}
Version maxServerVersion = null;
String maxServerVersionValue = plugin.attributeValue("maxServerVersion");
if ( maxServerVersionValue != null && !maxServerVersionValue.isEmpty() )
Version priorToServerVersion = null;
String priorToServerVersionValue = plugin.attributeValue("priorToServerVersion");
if ( priorToServerVersionValue != null && !priorToServerVersionValue.isEmpty() )
{
maxServerVersion = new Version( maxServerVersionValue );
priorToServerVersion = new Version( priorToServerVersionValue );
}
long fileSize = -1;
......@@ -147,7 +147,7 @@ public class AvailablePlugin extends PluginMetadata
readme,
license,
minServerVersion,
maxServerVersion,
priorToServerVersion,
downloadUrl,
fileSize
);
......@@ -155,7 +155,7 @@ public class AvailablePlugin extends PluginMetadata
}
public AvailablePlugin( String name, String canonicalName, String description, Version latestVersion, String author,
URL icon, URL changelog, URL readme, String license,
Version minServerVersion, Version maxServerVersion, URL downloadUrl, long fileSize ) {
Version minServerVersion, Version priorToServerVersion, URL downloadUrl, long fileSize ) {
super(
name,
canonicalName,
......@@ -167,7 +167,7 @@ public class AvailablePlugin extends PluginMetadata
readme,
license,
minServerVersion,
maxServerVersion
priorToServerVersion
);
this.downloadURL = downloadUrl;
this.fileSize = fileSize;
......
......@@ -342,7 +342,7 @@ public class UpdateManager extends BasicModule {
}
// Remove plugins that require an older server version.
if ( availablePlugin.getMaxServerVersion() != null && currentServerVersion.isNewerThan( availablePlugin.getMaxServerVersion() ) )
if ( availablePlugin.getPriorToServerVersion() != null && !availablePlugin.getPriorToServerVersion().isNewerThan( currentServerVersion ) )
{
iterator.remove();
}
......@@ -658,8 +658,8 @@ public class UpdateManager extends BasicModule {
continue;
}
final Version pluginMaxServerVersion = latestPlugin.getMaxServerVersion();
if ( pluginMaxServerVersion != null && currentServerVersion.isNewerThan( pluginMaxServerVersion ))
final Version pluginPriorToServerVersion = latestPlugin.getPriorToServerVersion();
if ( pluginPriorToServerVersion != null && !pluginPriorToServerVersion.isNewerThan( currentServerVersion ))
{
continue;
}
......@@ -724,7 +724,7 @@ public class UpdateManager extends BasicModule {
component.addAttribute("description", plugin.getDescription());
component.addAttribute("icon", plugin.getIcon() != null ? plugin.getIcon().toExternalForm() : null );
component.addAttribute("minServerVersion", plugin.getMinServerVersion() != null ? plugin.getMinServerVersion().getVersionString() : null);
component.addAttribute("maxServerVersion", plugin.getMaxServerVersion() != null ? plugin.getMaxServerVersion().getVersionString() : null);
component.addAttribute("priorToServerVersion", plugin.getPriorToServerVersion() != null ? plugin.getPriorToServerVersion().getVersionString() : null);
component.addAttribute("readme", plugin.getReadme() != null ? plugin.getReadme().toExternalForm() : null );
component.addAttribute( "licenseType", plugin.getLicense() );
component.addAttribute("fileSize", Long.toString(plugin.getFileSize()));
......
......@@ -379,8 +379,8 @@ tr.lowerhalf > td:last-child {
<c:set var="plugin" value="${entry.value}"/>
<c:if test="${canonicalName != 'admin'}">
<c:set var="minServerVersionFail" value="${not empty plugin.minServerVersion and plugin.minServerVersion.isNewerThan(serverVersion)}"/>
<c:set var="maxServerVersionFail" value="${not empty plugin.maxServerVersion and serverVersion.isNewerThan(plugin.maxServerVersion)}"/>
<c:set var="unsupported" value="${ minServerVersionFail or maxServerVersionFail }"/>
<c:set var="priorToServerVersionFail" value="${not empty plugin.priorToServerVersion and not plugin.priorToServerVersion.isNewerThan( serverVersion )}"/>
<c:set var="unsupported" value="${ minServerVersionFail or priorToServerVersionFail }"/>
<c:set var="update" value="${updateManager.getPluginUpdate( plugin.name, plugin.version) }"/>
<c:choose>
<c:when test="${unsupported}">
......@@ -461,9 +461,9 @@ tr.lowerhalf > td:last-child {
<fmt:param value="${plugin.minServerVersion}"/>
</fmt:message>
</c:if>
<c:if test="${maxServerVersionFail}">
<fmt:message key="plugin.admin.failed.maxserverversion">
<fmt:param value="${plugin.maxServerVersion}"/>
<c:if test="${priorToServerVersionFail}">
<fmt:message key="plugin.admin.failed.priortoserverversion">
<fmt:param value="${plugin.priorToServerVersion}"/>
</fmt:message>
</c:if>
</span>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment