DevFaqUpdateCenterMirror

How to mirroring Update Centers

Server side

Use the unix command
wget --mirror
or any similar on other systems and expose downloaded {catalog.xml.gz} and corresponding NBMs. Like this wget --mirror http://updates.netbeans.org/netbeans/updates/6.1/uc/final for Update Centers in NetBeans IDE 6.1.

IDE side

Use Autoupdate Services API to manipulate URL of subscribed Update Centers. The API contains the class UpdateUnitProviderFactory which can return all subscribed Update Center, ask them for its URL and change them to new (mirroring) location.

for (UpdateUnitProvider p : UpdateUnitProviderFactory.getDefault ().getUpdateUnitProviders (false)) {
     URL oldurl = p.getProviderURL ();
     URL newurl = <...your mirror...>
     p.setProviderURL (newurl);
}

There is a sample NetBeans project Update Center Mirror ( zipped project w/ sources) using this pattern to re-direct NetBeans Update Center from original location to mirrors. NetBeans module built from these sources can be installed in IDE. Users can use several options to take control over that module:

  • update.center.mirror.replace specifies prefix of URL which will be replaced, like this -J-Dupdate.center.mirror.replace=http://updates.netbeans.org/netbeans/
  • update.center.mirror.path specifies path to mirror, like this -J-Dupdate.center.mirror.path=https://mirror.company.com/netbeans/
  • update.center.mirrors.only if true (as default value) then all Update Centers with a different URL than specified in update.center.mirror.replace will be deactivated. If false the Update Centers will be left same vice-versa.

Prototype of Update Center Mirror plugin

  • Download NBM
  • Launch NetBeans 6.1 IDE and invoke Tools|Plugins
  • Go into Download tab and install the NBM
  • Use launcher options specified above to control Update Center Mirror plugin. Like this
./netbeans/bin/netbeans --userdir ./mytestmirror
-J-Dupdate.center.mirror.replace=http://updates.netbeans.org/netbeans/
-J-Dupdate.center.mirror.path=file:///space/temp/updates.netbeans.org/netbeans/

This is a prototype only: play with it on own risk. Need to customize to each particular usage.


Applies to: NetBeans 6.1 or newer

Platforms: All


Do not hesitate to contact me on mailto:jrechtacek@netbeans.org if you have any question.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo