Skip to main content

Dependency Managment with Glassfish Updatecenter and IPS

Posted by driscoll on October 1, 2008 at 3:23 PM PDT

In a previous blog on the topic, I talked about creating a Glassfish Update Center Module.

The example I used didn't have any notion of dependencies. This is fine for the very simple case, but obviously most pacakges actually rely on other packages as well. This notion is pretty common to most dependency management systems, and IPS handles it pretty well.

The documentation for IPS has gotten a lot better since I last wrote about this, so I'd urge you to check it out. In particular, the passage on dependency management is pretty easy to understand.

Here's a section from that document that explains the three types of dependencies:

Type Dependency is satisfied if: Notes
require the specified package is installed and of a sufficient version IPS will automatically install or upgrade packages as needed in order to satisfy required package dependencies.
optional the specified package is not installed, or it is installed and of sufficient version IPS will automatically upgrade installed packages to satisfy optional package dependencies. It will not install new packages to satisfy an optional dependency since the dependency on those packages is optional.
incorporate the specified package is not installed, or it is installed and of sufficient version. Like optional except that the version of the package is more tightly constrainted (both a floor and a ceiling of the package version is specified).

So, the first two (require and optional) seem pretty straightforward, but what would you use the last one for? Why would you ever need to specify both a floor and a ceiling for the package dependency?

As it happens, the answer is pretty straightforward. In the case of releasing beta software, you want to NOT automatically update, but rather, have the user manually select the software for update.

Here's how to format an incorporate dependency for a beta release (this assumes that you already have a sample version 4 installed):

    "name"          : "sample",
    "version"       : "5.0",
    "depends"       : {
                       "pkg:/sample@5" : {"type" : "incorporate"}

Note that there's currently a bug in Glassfish's updatetool - if you specify an incorporate dependency, it won't automatically update, but it will also not automatically display as an available update. You have to manually choose to display all versions (Menu - View - Veiw All Versions) to see it in the list of available updates. This is currently listed as a bug, and I expect it'll be fixed by FCS.

Related Topics >>