RefEntryGenerator Class

package org.mcraig.cs445.refentry;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Properties;

/** 
 * Generates a HashSet of RefEntry objects.
 * @author <a href="mailto:mark@mcraig.org">Mark Craig</a>
 */
class RefEntryGenerator {
    /** Default constructor. */
    public RefEntryGenerator() { 
        Stylesheets = new Properties();
        Sources     = new Properties();
    }
    /** XSLT stylesheets. */
    private Properties Stylesheets;
    /** RefEntry source files. */
    private Properties Sources;
    /** 
     * Mutator for set of XSLT stylesheets.
     * @param stylesheets Path to Properties file indicating XSLT files.
     */
    public void setStyleSheets(String stylesheets) {
        try {
            FileInputStream fip = new FileInputStream(stylesheets);
            Stylesheets.load(new BufferedInputStream(fip));
            fip.close();
        } catch (Exception e) {
            System.err.println("In RefEntryGenerator::setStyleSheets...");
            System.err.println("Failed to load properties: " + stylesheets);
            System.err.println(e.toString());
        }
    }
    /** 
     * Mutator for set of RefEntry sources.
     * @param sources Path to Properties file indicating RefEntry sources.
     */
    public void setSources(String sources) {
        try {
            FileInputStream fip = new FileInputStream(sources);
            Sources.load(new BufferedInputStream(fip));
            fip.close();
        } catch (Exception e) {
            System.err.println("In RefEntryGenerator::setSources...");
            System.err.println("Failed to load properties: " + sources);
            System.err.println(e.toString());
        }
    }
    /** Generate a HashSet of RefEntry documents. */
    public HashSet generate() {
        HashSet refentrys = new HashSet();
        try {
            Enumeration e = Sources.propertyNames();
            String      element;
            while (e.hasMoreElements()) {
                element  = (String)e.nextElement();
                File src = new File(Sources.getProperty(element));
                File htm = File.createTempFile(element, ".html");

                RefEntry re = new RefEntry(src, htm, Stylesheets);

                refentrys.add(re);
            }
        } catch (Exception e) {
            System.err.println("In RefEntryGenerator::generate...");
            System.err.println("Failed to : ");
            System.err.println(e.toString());
        }
        return refentrys;
    }
}