Bug 5668 - Plugin version match on fragments too restrictive (2.0)
Summary: Plugin version match on fragments too restrictive (2.0)
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Debbie Wilson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-11-08 11:54 EST by Debbie Wilson CLA
Modified: 2001-11-13 10:24 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Debbie Wilson CLA 2001-11-08 11:54:52 EST
See bug 5581 for 1.0 version.


When specifying a fragment in xml, this fragment must be linked to a plugin 
descriptor:

<?xml version="1.0" encoding="UTF-8"?>
<fragment
  name="Fragment Test"
  id="fragmentTest"
  version="1.0"
  plugin-id="tests.a"
  plugin-version="1.2">

</fragment>

This example will look for plugin 'tests.a' version 1.2.0.  

However, the match on the plugin version number must be identical (i.e. this 
fragment will not match with plugin 'tests.a' version 1.2.1).  This matching 
algorithm is too restrictive.
Comment 1 Debbie Wilson CLA 2001-11-08 15:50:16 EST
Fixed in version 20011107.  API changes.


We are now able to specify a match type for a fragment.  This relates to the 
match between the plugin-version specified by the fragment and the version in 
the associate plugin descriptor.  The interface for fragments is as follows:

<!ELEMENT fragment (requires*, runtime*, extension-point*, extension*)>
<!ATTLIST fragment
  name                	CDATA #REQUIRED
  id                  	CDATA #REQUIRED
  version             	CDATA #REQUIRED
  plugin-id		CDATA #REQUIRED
  plugin-version	CDATA #REQUIRED
  match		        CDATA #IMPLIED
>

The match types for versions are defined as follows (note that this mirrors the
match attribute of plugin prerequisites):

perfect Version (a.b.c is a perfect match with d.e.f) if:
- a = d and
- b = e and 
- c = f

equivalent Version (a.b.c is an exact match with d.e.f) if:
- a = d and 
- b = e and
- c >= f

compatible Version (a.b.c is compatible with d.e.f) if:
- a = d and 
- b > e or (b = e and c >= f)

greaterOrEqual Version (a.b.c is a higher version than d.e.f) if:
- a > d or
- a = d and b > e or
- a = d and b = e and c >= f


The PluginFragmentModel has changed.  There is a new attribute (field) called 
pluginMatch which contains a byte value depending on the type of match 
specified.  There are some new constants to look for as byte code values for 
the new pluginMatch field . 

	public static final byte FRAGMENT_MATCH_UNSPECIFIED = 0;
	public static final byte FRAGMENT_MATCH_PERFECT = 1;
	public static final byte FRAGMENT_MATCH_EQUIVALENT = 2;
	public static final byte FRAGMENT_MATCH_COMPATIBLE = 3;
	public static final byte FRAGMENT_MATCH_GREATER_OR_EQUAL = 4;

	private byte pluginMatch = FRAGMENT_MATCH_UNSPECIFIED;

The match value will be listed as UNSPECIFIED unless a version number exists in 
this fragment.  If there is a version number but no match value, we will efault 
to a COMPATIBLE match.

Some new methods exist in the class PluginFragmentModel:

/**
 * Returns a byte code indicating the type of match this fragment requires
 * when trying to find its associated plugin.
 * The byte code can be any one of the following:
 * FRAGMENT_MATCH_UNSPECIFIED			initial value
 * FRAGMENT_MATCH_PERFECT			perfectly equal match
 * FRAGMENT_MATCH_EQUIVALENT			equivalent match
 * FRAGMENT_MATCH_COMPATIBLE			compatible match
 * FRAGMENT_MATCH_GREATER_OR_EQUAL		greater than or equal to match
 *
 * @return a byte code indicating the type of match this fragment requires
 */
public byte getMatch() {
	return pluginMatch;
}

/**
 * Sets the type of match this fragment requires when trying to
 * find its associated plugin.  The value parameter may be any
 * one of the following:
 * FRAGMENT_MATCH_UNSPECIFIED			initial value
 * FRAGMENT_MATCH_PERFECT			perfectly equal match
 * FRAGMENT_MATCH_EQUIVALENT			equivalent match
 * FRAGMENT_MATCH_COMPATIBLE			compatible match
 * FRAGMENT_MATCH_GREATER_OR_EQUAL		greater than or equal to match
 * This object must not be read-only.
 *
 * @param value the type of match required with the associated plugin
 */
public void setMatch(byte value) {
	assertIsWriteable();
	Assert.isTrue ((value == FRAGMENT_MATCH_PERFECT) ||
	               (value == FRAGMENT_MATCH_EQUIVALENT) ||
	               (value == FRAGMENT_MATCH_COMPATIBLE) ||
	               (value == FRAGMENT_MATCH_GREATER_OR_EQUAL));
	pluginMatch = value;
}


Comment 2 Rodrigo Peretti CLA 2001-11-13 10:24:18 EST
Fixed in v210