Index: build.xml
===================================================================
RCS file: /home/cvspublic/jakarta-alexandria/proposal/gump/build.xml,v
retrieving revision 1.9
diff -u -r1.9 build.xml
--- build.xml	4 Mar 2002 08:08:18 -0000	1.9
+++ build.xml	19 Mar 2002 19:19:15 -0000
@@ -98,6 +98,12 @@
            style="stylesheet/pubdocs.xsl"/>
   </target>
 
+  <!-- Generate publish instructions for the javadocs -->
+  <target name="pubsite" depends="gen">
+    <style in="work/merge.xml" out="work/pubsite.pl" 
+           style="stylesheet/pubsite.xsl"/>
+  </target>
+
   <!-- Produce the gump web site -->
   <target name="site">
     <ant dir="site"/>
Index: java/Project.java
===================================================================
RCS file: /home/cvspublic/jakarta-alexandria/proposal/gump/java/Project.java,v
retrieving revision 1.35
diff -u -r1.35 Project.java
--- java/Project.java	15 Mar 2002 09:12:40 -0000	1.35
+++ java/Project.java	19 Mar 2002 19:20:00 -0000
@@ -80,7 +80,8 @@
 
         Element home = null;
         Element javadoc = null;
-
+        Element site = null;
+        
         Node child=element.getFirstChild();
         for (; child != null; child=child.getNextSibling()) {
             if (child.getNodeName().equals("depend")) {
@@ -102,6 +103,8 @@
                 url = (Element)child;
             } else if (child.getNodeName().equals("javadoc")) {
                 javadoc = (Element)child;
+            } else if (child.getNodeName().equals("site")) {
+                site = (Element)child;
             } else if (child.getNodeName().equals("jar")) {
                 jars.put(((Element)child).getAttribute("id"), child);
             }
@@ -118,7 +121,8 @@
         }
 
         resolveJavadoc(javadoc);
-
+        resolveSite(site);
+        
         // if only one jar is found, make sure that it can be accessed without
         // specifying an id.
         if (jars.size() == 1) {
@@ -650,6 +654,78 @@
         module.appendChild(javadoc);
     }
 
+    /**
+     * If a site child was found, add any missing project, module,
+     * or description information; resolve path; and copy the resulting
+     * node to the specified module.
+     * @param site child XML element
+     */
+    private void resolveSite(Element site) throws Exception {
+        if (site == null) return;
+
+        // retrieve url and dir of site from the workspace
+        Element config = Workspace.getSite();
+        if (config == null) return;
+        String url = config.getAttribute("url");
+        String siteDir = config.getAttribute("dir");
+
+        // default project attribute to the name of this project
+        if (site.getAttributeNode("project") == null)
+            site.setAttribute("project", name);
+
+        // default module attribute to the module which this project belongs
+        String moduleName = site.getAttribute("module");
+        if (moduleName.equals("")) moduleName = this.get("module");
+        Module module = Module.find(moduleName);
+        require (module, "module", moduleName);
+
+        if (!moduleName.equals(this.get("module"))) {
+            site.setAttribute("defined-in", this.get("module"));
+        }
+
+        // if there are no child nodes, add this project's description
+        if (!site.hasChildNodes() && description!=null) {
+            Element desc = (Element) description.cloneNode(true);
+            site.appendChild(desc);
+        }
+
+        // resolve relative and full path to this site entry
+        String path = site.getAttribute("nested");
+        String fullpath;
+        if (!path.equals("")) {
+            fullpath = get("srcdir") + "/" + path;
+        } else {
+            path = site.getAttribute("parent");
+            fullpath = Workspace.getBaseDir() + "/" + path;
+        }
+        path = moduleName + "/" + path;
+
+        // for each description entry, resolve source, url, and dest attrs.
+        Node child=site.getFirstChild();
+        for (; child != null; child=child.getNextSibling()) {
+            if (child.getNodeName().equals("description")) {
+                Element desc = (Element) child;
+                String dir = desc.getAttribute("dir");
+                String append = "";
+                if (!dir.equals("")) append = "/" + dir;
+
+                desc.setAttribute("source", fullpath + append);
+
+                if (url.equals("")) {
+                    desc.setAttribute("url", "file:///" + fullpath);
+                } else {
+                    desc.setAttribute("url", url + path + append);
+                }
+
+                if (!siteDir.equals("")) {
+                    desc.setAttribute("dest", siteDir + "/" + path + append);
+                }
+            }
+        }
+
+        // copy the entire result to the desired module
+        module.appendChild(site);
+    }
     /**
      * Require that a specified object not be null, otherwise produce an error
      * message indicating what attribute the problem occurred on.
Index: java/Workspace.java
===================================================================
RCS file: /home/cvspublic/jakarta-alexandria/proposal/gump/java/Workspace.java,v
retrieving revision 1.3
diff -u -r1.3 Workspace.java
--- java/Workspace.java	14 Jan 2002 13:29:34 -0000	1.3
+++ java/Workspace.java	19 Mar 2002 19:20:32 -0000
@@ -8,6 +8,7 @@
     private static Element element;
     private static String basedir;
     private static Element javadoc;
+    private static Element site;
 
     /**
      * Static property accessor for basedir attribute.
@@ -42,6 +43,14 @@
     }
 
     /**
+     * Static property accessor for site element.
+     * @return Site element (if any) associated with this workspace
+     */
+    public static Element getSite() {
+        return site;
+    }
+    
+    /**
      * Default and verify various workspace attributes.
      * If not specified:
      *   banner-image="http://jakarta.apache.org/images/jakarta-logo.gif"
@@ -86,6 +95,13 @@
         for (; child != null; child=child.getNextSibling()) {
             if (child.getNodeName().equals("javadoc")) {
                 javadoc = (Element) child;
+            }
+        }
+        
+        Node child=element.getFirstChild();
+        for (; child != null; child=child.getNextSibling()) {
+            if (child.getNodeName().equals("site")) {
+                site = (Element) child;
             }
         }
     }

