Skip to main content

Writing a Glassfish v3 Updatecenter module

Posted by driscoll on August 27, 2008 at 4:05 PM PDT

I just finished writing a Glassfish v3 update center module. It's a fairly different process from v2, which I also blogged about, so I thought I'd detail what's necessary to do it.

Now, it's still early days, so some of these details are going to change. In particular, the packaging tools are improving all the time, so I expect that we'll have to circle back and update this eventually - but for now, here's what you need to do.

First, you need to understand the basic concepts behind the new IPS packaging system. It's a client/server setup, much like subversion is... there's no file format, everything is stored on the server. Also, the IPS system is used for OpenSolaris, so unless you are running an OpenSolaris system, you're going to need all the tools.

These tools are available prepackaged, but they're changing fast enough right now that you'll probably just want to download the latest Updatecenter2 codebase from, and compile it (it's easy to do, don't panic).

Just point svn to:

svn svn checkout updatecenter2 --username username

and cd into that directory, then build with:

ant all

OK, now you've got the tools. You can find them under the project/build directory, in two zip files, ips-{arch}.zip and ips-toolkit-{arch}.zip. Install them and put them in your path, or just point to the unzipped stuff in project/build/dist. My example will just point to the build/dist code.

What files do you want to put on the server? Arrange these files in a directory, in the exact directory structure that you'd like to see them in in the finished product. Here's an example:







Let's put all this in a directory we'll call dist. When we install these, we'd like to create a top level directory called "sample" and put them all in there.

Now we need to create a file that describes the package, and lists the files to include. We'll have to do it in python, but again, it's pretty simple, so don't panic... We'll call the file

pkg = {
    "name" : "sample",
    "version" : "2.0.0-080826",
    "attributes" : {
                    "description" : "Sample Stuff",
                    "description_long" : "Updated samples, woo woo."

    "files"      : {
                    "sample/LICENSE"      : {"mode" : "0444"},
                    "sample/README"       : {"mode" : "0444"},

    "licenses"   : {
                    "sample/LICENSE"      : {"license" : "GPL"},

    "dirtrees"   : [

I trust the format is self explanatory.

OK, now we're ready to create the repository. We're going to do it locally first, just to test that this works.

# add the necessary libraries to python
export PYTHONPATH=$UCHOME/project/tools:$UCHOME/project/build/dist/linux-i386/pkg/vendor-packages:.
# create the repo
python $UCHOME/project/tools/ -d `pwd`/repo  -b dist sample_proto

Where $UCHOME is the location of the Updatecenter2 codebase. This takes the files from the dist directory, and puts them in a repository called repo in the current directory.

Now, let's start up a local repository:

$UCHOME/project/build/dist/linux-i386/pkg/bin/pkg.depotd -d repo -p 10000 &

You've now got a repository holding the sample code, running on port 10000.

Want to install this somewhere? Try this:

pkg set-authority -O http://yourhost:10000/ testrepo
pkg refresh
pkg install sample

or instead, you could do:

pkg image-create -U -a test=http://localhost:10000 /tmp/sample
cd /tmp/sample
pkg list -a
pkg install sample

Want to install this onto a glassfish server?

Run updatetool. Add the localhost:10000 repository, and you should see sample in the list. Just click to install.

Lastly, if you want to explore what's already in the Glassfish Updatecenter using the pkg tools (or just a browser), check out:

Well, that's about it. Hope this was helpful. One last thing: You'll note that I didn't give any instructions for running an arbitrary process after install - only basic file install in any directory is supported, unlike the previous version of Glassfish. Mostly, with OSGi it should be possible to get things installed without much fuss, but if you do need this kind of functionality, please log your interest on Glassfish Issue 5693.

Related Topics >>


There's a problem with the site right now, I've asked about it, try again in a day or so, after folks are back from the US holiday.

Looks almost painless - almost! :) I tried going to the link "" and I got "Firefox was unable to establish a connection..."