Welcome and Overview

This document will show you how to use the Java classes in the sfutils.frs and sfutils.frs.web packages.

The basic idea is simple. Assemble a FileRelease object, install a Publisher, and tell the FileRelease to publish itself. We'll step through them below.

Assembling a FileRelease

The easiest way to start assembling a FileRelease is to work backwards. A FileRelease belongs to a Package, which in turn belongs to a Project, which needs an Administrator. So let's start there:

final Administrator admin = new Administrator();

Next, we should create the Project to which our Administrator belongs:

final Project project = new Project();
project.setName("My Project"); // the "normal" project name
project.setShortName("myproj"); // must be a valid SourceForge project shortname

Notice that we do not set the ID property. Project identifiers are assigned by SourceForge, and at least in this release of the sfutils project a Publisher is the only class that should be calling the setID() method. This will change in a future release. For now, you are free to call this method, but any value you set will be overridden by the appropriate SourceForge-supplied one.

Now we create the file release Package that will hold our file release:

final Package packaj = new Package();
packaj.setName("myproj"); // name it whatever you like

Now, assuming that we have a file or two lying around somewhere that we want to release, we create the FileRelease itself:

final FileRelease release = new FileRelease();
release.setName("myproj-1.0"); // name it whatever you like
release.setReleaseDate(new Date()); // or whenever you like

We can supply this FileRelease with a change log by loading a File or by supplying the text directly. For this example, we'll load it from a file:

final File changeLogFile = new File("/path/to/changelog.txt");

The same sort of thing goes for the release notes. For variety, we'll supply some text ourselves:

release.setReleaseNotes("Behold the release notes");

Now we'll actually add a file to this file release. The files must exist, must be readable, must be named sanely, and must be between 20 and 256,000 bytes in length (so says SourceForge).

final FileSpecification spec1 = new FileSpecification();
spec1.setFile(new File("/path/to/file1.txt"));
spec1.setReleaseDate(new Date());

release.setFileSpecifications(new FileSpecification[] { spec1 });

Finally, we can publish and upload this file release!

release.setPublisher(new HttpUnitPublisher());