public static int getDatabaseVersion( Path pluginDir )
    {
        String versionString = getElementValue( pluginDir, "/plugin/databaseVersion" );
        if ( versionString != null )
        {
            try
            {
                return Integer.parseInt( versionString.trim() );
            }
            catch ( NumberFormatException nfe )
            {
                Log.error( "Unable to parse the database version for plugin '{}'.", getCanonicalName( pluginDir ), nfe );
            }
        }
        return -1;
    }
Returns the database schema version of a plugin, if it exists. The value is retrieved from the plugin.xml file of
the plugin. If the value could not be found, {@code -1} will be returned.

@param pluginDir the path of the plugin directory.
@return the plugin's database schema version or {@code -1} if it doesn't exist.
xmppserver/src/main/java/org/jivesoftware/openfire/container/PluginMetadataHelper.java