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.
      
          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();
admin.setName("username");
admin.setPassword("password");
        
          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
project.setAdministrator(admin);
          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
packaj.setHidden(false);
packaj.setProject(project);
          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.setPackage(packaj);
release.setHidden(false);
release.setReleaseDate(new Date()); // or whenever you like
release.setNotifyOthers(true);
          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");
release.setChangeLogFile(changeLogFile);
          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.setFileType(FileSpecification.TEXT_FILE);
spec1.setProcessorType(FileSpecification.PLATFORM_INDEPENDENT_PROCESSOR);
spec1.setReleaseDate(new Date());
release.setFileSpecifications(new FileSpecification[] { spec1 });
          Finally, we can publish and upload this file release!
          
          
    
release.setPublisher(new HttpUnitPublisher()); release.publish();