Eclipse Update allows users to search for updates to the currently installed features. For each installed feature, Update uses the embedded URL to connect to the remote server and search for new versions. If there are updates, Eclipse allows users to initiate the install procedure. After downloading, installing and restarting the platform, new feature version is ready for use.
In companies with many users of the same Eclipse-based product (typically a commercial one), several problems can arise from this model:
First step for a product administrator would be to set up a local Eclipse update site on a server connected to the company's LAN (behind the firewall). The update site would be a subset of the product's update site on the Internet because it would contain only features and plug-ins related to the updates that the company wants applied at the moment. Technically, this site would be a regular Eclipse update site with site.xml, feature and plug-in archives.
Administrators would construct this site in two ways:
Since features have the update site URL embedded in the manifest, they are unaware of the local update sites set up by the administrators. It is therefore important to provide redirection capability. This and other update policy settings can be set for an Eclipse product by creating an update policy file and configuring Update to use that file when searching.
The file in question uses XML format and can have any name. The file can be set in Preferences>Install/Update in the Update Policy field. The text field is empty by default: users may set the URL of the update policy file. The file is managed by the local administrator and is shared for all the product installations. Sharing can be achieved in two ways:
The policy file must conform to the following DTD:
<?xml encoding="ISO-8859-1"?>
<!ELEMENT update-policy (url-map)*>
<!ATTLIST update-policy
><!ELEMENT url-map EMPTY>
<!ATTLIST url-map
pattern CDATA #REQUIRED
url CDATA #REQUIRED
>
This element is used to override Update URLs embedded in feature manifests. When looking for new updates, Eclipse search will check the update policy (if present) and check if url-map for the matching feature prefix is specified. If a match is found, the mapped URL will be used instead of the embedded one. This way, administrators can configure Eclipse products to search for updates in the local server behind the firewall. Meanwhile, third-party features installed by Eclipse Update will continue to be updated using the default mechanism because they will not find matches in the policy.
Several url-map elements may exist in the file. Feature prefixes can be chosen to be less or more specific. For example, to redirect all Eclipse updates, the pattern attribute would be "org.eclipse". Similarly, it is possible to use a complete feature ID as a pattern if redirection is required on a per-feature basis.
Patterns in the file may be chosen to progressively narrow the potential matches. This may result in multiple matches for a given feature. In this case, the match with a longest pattern will be used. For example:
<?xml version="1.0" encoding="UTF-8"?> <update-policy> <url-map pattern="org.eclipse" url="URL1"/> <url-map pattern="org.eclipse.jdt" url="URL2"/> </update-policy>
In the case above, all Eclipse features will be updated from URL1, except org.eclipse.jdt that will use URL2.
Update policy files do not contain translatable strings and therefore do not require special NL handling. In general, the files should use UTF-8 encoding.
The third part of the overall solution is covered by another topic but is mentioned here because it is an integral part of the solution. Automatic updates will allow Eclipse to run update search on a specified schedule (on each startup (the default), once a day, once a week etc.).
Here is the complete sequence of steps that comprise the solution: