So, there are two sections... here's the first:
Using Someone Else's Update Center
NetBeans 5.0 Beta Plug-in Module Sample Update Center
Note: If you're not using a recent post-5.0 development build, you'll probably encounter problems with the versions of the module dependencies...
Congratulations! You have successfully used my Update Center.
Now that you know how to use someone else's Update Center, let's make your own.
Creating Your Very Own Update Center
The principle of creating your own Update Center is incredibly simple. Take another look at step 3 above. When you're defining the Update Center, you specify a URL to an XML file:
To see what that XML file looks like, click here. Each plug-in module is described in this XML file. The XML file is called the autoupdate descriptor. This is what the description of just one of the plug-in modules looks like:
OpenIDE-Module-Display-Category="Plug-in module samples"
OpenIDE-Module-Long-Description="This project sample adds a helpset to the IDE's help system.
Go to Help > Contents and then look at the last section --
it should be called "My Plug-in" and it should contain
one topic. You can use this project sample to understand how helpfiles
work. Alternatively, you can just take this sample, and then add
help topics to it. In other words, this can be a template on top
of which you build your own helpset."
OpenIDE-Module-Module-Dependencies="org.jdesktop.layout/1 > 1.4, org.netbeans.modules.projectapi/1 >
1.10, org.netbeans.modules.projectuiapi/1 > 18.104.22.168,
org.openide.awt > 6.8, org.openide.dialogs > 6.6,
org.openide.filesystems > 6.5, org.openide.loaders > 5.10,
org.openide.util > 6.9"
OpenIDE-Module-Name="JavaHelp API Sample"
Everything you see in the description above is defined in the plug-in module's Project Properties dialog box—in the Libraries panel, the Display panel, and in the Packaging panel. So you define all the properties above (or, actually, in most cases the IDE defines them for you, when you create the plug-in module project and later when you use New File wizards, but you can finetune them in these panels in the Project Properties dialog box if necessary).
So, all you need to do to create your own Update Center is (1) define the autoupdate descriptor, (2) provide the NBM file(s) described in the autoupdate descriptor, and (3) put the autoupdate descriptor and the NBM file(s) somewhere where your target audience can reach them. (Make sure that the autoupdate descriptor's distribution element points to the location and name of the NBM file in question. You can use relative paths, as shown in the example above.) Then tell whoever needs your modules about the URL to the autoupdate descriptor (just like I did in step 3 of the previous section).
It's not quite as simple as it sounds, though. The main problem is: "How do I create the autoupdate descriptor?" It's not much fun to do it manually. In fact, it's really quite hard, especially the OpenIDE-Module-Module-Dependencies. And there's nothing in NetBeans IDE 5.0 to simplify the job of putting this descriptor together. However, since issue 64426 was fixed, you can use a new menu item in the development build of the release currently known as "5.1":
When you install this development build, you can put all your plug-in modules together into a module suite and then, when everything is nicely assembled, you can choose "Create NBMs":
When you do this, the IDE creates an NBM file for each plug-in module that is part of the suite. It also creates, in the same "updates" folder where the NBM files are created, a file called updates.xml. This is the autoupdate descriptor, created for you by the IDE. The only tweak I needed to perform was to rearrange the entries a bit and to give the items some structure, by means of <module_group name> tags. (You see these module groups in the Update Center.) I'm assuming these tweaks will not be necessary in the future, because this functionality is being worked on as we speak.
Now here's a great tip—since it's so easy to create an Update Center, why not use it to store backups of your applications? So, let's say you have an application open in the IDE (it could be any application, such as, for example, a web application, a standard desktop application, or a plug-in module). Use the NetBeans Project Sample Module Tutorial to create a plug-in module that contains your application as a sample. Then create an NBM file (created by means of one item, selected by right-clicking the plug-in module's node in the Projects window). Then just put the NBM file on a server somewhere far away (even on geocities.com or somewhere like that). All you need to do is make sure that the plug-in module is described in an autoupdate descriptor. Then, set up the Update Center in the IDE, as described in the first section, by pointing to the autoupdate descriptor from inside the Options window. And once you've done that, your application is available from the Update Center wizard, from where you install it into the New Project wizard (thanks to the instructions provided in the tutorial). It seems a bit lengthy, but it really isn't. Uploading the NBM file that contains my application (as a project sample) into my blog literally takes seconds. And, once you've defined the autoupdate decriptor once you don't really need to do so again (unless you keep developing the module, so that its dependencies change, or its description, etc).
So, anyway, that's all there is to it. If you follow the above instructions you too will have your own Update Center. And the funny thing that you realize, at the end of the whole story, is that an Update Center is nothing more than an XML file plus the NBM files that you want to distribute. It couldn't be much easier, could it?
Update: See Part 2 for another example of an Update Center... and a very cool module!