Jump to: navigation, search

Difference between revisions of "Using Policy Files"

(add category tags)
(add meaningful example and comment about using a local file instead of a server-hosted one)
Line 1: Line 1:
Policy files allow a user to configure which version of a feature to update to when checking for updates.
+
Policy files allow a user to configure where to search for updates to a feature when checking for updates.
  
 
==Creating the Policy File==
 
==Creating the Policy File==
 
A sample policy file is shown below:
 
A sample policy file is shown below:
  
 +
<?xml version="1.0" encoding="UTF-8"?>
 
  <update-policy>
 
  <update-policy>
   <url-map pattern="feature.id" url="http://hostname/update/nightly/site.xml"/>
+
   <url-map pattern="feature.id" url="<nowiki>http://hostname/update/nightly/policy.xml</nowiki>"/>
 
  </update-policy>
 
  </update-policy>
  
 
In this example, we save this to an XML file named "policy.xml". This is then placed next to the corresponding update site.xml. This effectively says "when I see feature with id x, instead go to update site y rather than the default". You can also use wildcards, such as feature.id.* if you have multiple features with the same prefix.
 
In this example, we save this to an XML file named "policy.xml". This is then placed next to the corresponding update site.xml. This effectively says "when I see feature with id x, instead go to update site y rather than the default". You can also use wildcards, such as feature.id.* if you have multiple features with the same prefix.
 +
 +
If you wanted to update from a non-standard update site, you could use a policy file to redirect from the default Update site to a secondary one. For example:
 +
 +
<?xml version="1.0" encoding="UTF-8"?>
 +
<update-policy>
 +
  <url-map pattern="*" url="http://download.eclipse.org/modeling/emf/updates/site-interim.xml"/>
 +
</update-policy>
  
 
==Using the Policy File==
 
==Using the Policy File==
# In Eclipse, navigate to Window > Preferences > Install/Update, and paste in the URL to the policy file (such as http://hostname/update/nightly/policy.xml).
+
 
# Select "OK"
+
In Eclipse, navigate to <code>Window > Preferences > Install/Update</code>, and paste in the URL to the policy file and hit OK, eg:
# The next time you search for updates, it should use the new URL specified in the policy file.
+
http://download.eclipse.org/modeling/mdt/updates/policy.xml
 +
:: or, for a local file:
 +
<nowiki>file:///home/nickb/workspace2/modeling/mdt/updates/policy.xml</nowiki>
 +
 
 +
The next time you search for updates, Eclipse will use the URL specified in the policy file.
 +
 
 +
 
 +
----
 +
 
  
 
An additional thought is to provide a preference page to allow the end user to choose which "release stream" they wish to subscribe to. In this case, there is a radio button that might specify "stable", "rc" and "nightly". Selecting one of these radio buttons would automatically set the policy file behind the scenes.
 
An additional thought is to provide a preference page to allow the end user to choose which "release stream" they wish to subscribe to. In this case, there is a radio button that might specify "stable", "rc" and "nightly". Selecting one of these radio buttons would automatically set the policy file behind the scenes.
  
 
[[Category:Releng]] [[Category:Coordinated]] [[Category:Europa]]
 
[[Category:Releng]] [[Category:Coordinated]] [[Category:Europa]]

Revision as of 16:42, 18 May 2007

Policy files allow a user to configure where to search for updates to a feature when checking for updates.

Creating the Policy File

A sample policy file is shown below:

<?xml version="1.0" encoding="UTF-8"?>
<update-policy>
  <url-map pattern="feature.id" url="http://hostname/update/nightly/policy.xml"/>
</update-policy>

In this example, we save this to an XML file named "policy.xml". This is then placed next to the corresponding update site.xml. This effectively says "when I see feature with id x, instead go to update site y rather than the default". You can also use wildcards, such as feature.id.* if you have multiple features with the same prefix.

If you wanted to update from a non-standard update site, you could use a policy file to redirect from the default Update site to a secondary one. For example:

<?xml version="1.0" encoding="UTF-8"?>
<update-policy>
  <url-map pattern="*" url="http://download.eclipse.org/modeling/emf/updates/site-interim.xml"/>
</update-policy>

Using the Policy File

In Eclipse, navigate to Window > Preferences > Install/Update, and paste in the URL to the policy file and hit OK, eg:

http://download.eclipse.org/modeling/mdt/updates/policy.xml
or, for a local file:
file:///home/nickb/workspace2/modeling/mdt/updates/policy.xml

The next time you search for updates, Eclipse will use the URL specified in the policy file.




An additional thought is to provide a preference page to allow the end user to choose which "release stream" they wish to subscribe to. In this case, there is a radio button that might specify "stable", "rc" and "nightly". Selecting one of these radio buttons would automatically set the policy file behind the scenes.