jvanzyl 2002/07/05 20:40:59
Modified: src/java/org/apache/maven XmlPomFormatter.java
src/plugins/jxr plugin.jelly
Added: src/java/org/apache/maven/jxr Jxr.java
Removed: src/java/org/apache/maven Jxr.java ProjectProperties.java
SiteValidator.java UpdateProperties.java
UpdateResources.java
src/java/org/apache/maven/ant Ant.java CallTarget.java
Log:
o Cleaning out some cruft that isn't being used
o Put the Jxr task back in the jxr package, almost ready to push the
sources for the plugins into a plugin structure.
Revision Changes Path
1.6 +1 -46
jakarta-turbine-maven/src/java/org/apache/maven/XmlPomFormatter.java
Index: XmlPomFormatter.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/XmlPomFormatter.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XmlPomFormatter.java 27 May 2002 14:07:58 -0000 1.5
+++ XmlPomFormatter.java 6 Jul 2002 03:40:59 -0000 1.6
@@ -165,48 +165,3 @@
formatter.execute();
}
}
-
-/*
- * Redistribution and use of this software and associated documentation
- * ("Software"), with or without modification, are permitted provided
- * that the following conditions are met:
- *
- * 1. Redistributions of source code must retain copyright
- * statements and notices. Redistributions must also contain a
- * copy of this document.
- *
- * 2. Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and the
- * following disclaimer in the documentation and/or other
- * materials provided with the distribution.
- *
- * 3. The name "DOM4J" must not be used to endorse or promote
- * products derived from this Software without prior written
- * permission of MetaStuff, Ltd. For written permission,
- * please contact [EMAIL PROTECTED]
- *
- * 4. Products derived from this Software may not be called "DOM4J"
- * nor may "DOM4J" appear in their names without prior written
- * permission of MetaStuff, Ltd. DOM4J is a registered
- * trademark of MetaStuff, Ltd.
- *
- * 5. Due credit should be given to the DOM4J Project
- * (http://dom4j.org/).
- *
- * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
- * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved.
- *
- * $Id$
- */
1.1 jakarta-turbine-maven/src/java/org/apache/maven/jxr/Jxr.java
Index: Jxr.java
===================================================================
package org.apache.maven.jxr;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Maven" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Maven", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
import org.apache.maven.jxr.JXR;
import org.apache.maven.jxr.DirectoryIndexer;
import org.apache.maven.jxr.pacman.PackageManager;
import org.apache.maven.executor.AbstractExecutor;
import org.apache.tools.ant.types.Reference;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.BuildException;
import java.util.LinkedList;
import java.io.File;
import java.io.IOException;
/**
* Creates an html-based, cross referenced version of Java source code
* for a project.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Josh Lucas</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @version $Id: Jxr.java,v 1.1 2002/07/06 03:40:59 jvanzyl Exp $
*/
public class Jxr
extends AbstractExecutor
{
/**
* Directories to be cross-referenced
*/
private Path sourcePath;
/**
* Reference object contatining multiple paths to be cross-referenced
*/
private Reference ref;
/**
* the destination directory
*/
private String destDir;
/**
* Root javadocs directory
*/
private String javadocDir;
/**
* the location of the folder.gif
*/
private String imageFolder;
/**
* the location of the file.gif
*/
private String imageFile;
/**
* Starts the cross-referencing and indexing.
* @throws BuildException when any error occurs
*/
public void execute()
throws BuildException
{
// ant's TaskAdapter doesn't set the Project until this method, so
// figure out which path to use here.
if (sourcePath == null)
{
if (ref != null)
{
sourcePath = new Path(getProject());
sourcePath.createPath().setRefid(ref);
}
else
{
String err = "Must specify either sourcePathRef or sourcePath";
throw new BuildException(err);
}
}
// get a relative link to the javadocs
String javadocLinkDir = null;
try
{
javadocLinkDir = getRelativeLink(destDir, javadocDir);
}
catch (IOException ioe)
{
throw new BuildException("Error finding javadocs", ioe);
}
// go through each source directory and xref the java files
PackageManager pkgmgr = PackageManager.getInstance();
String[] paths = sourcePath.list();
for (int i = 0; i < paths.length; ++i)
{
pkgmgr.process(paths[i]);
new JXR(paths[i], destDir, javadocLinkDir, "HEAD");
}
// once we have all the source files xref'd, create the index pages
try
{
new DirectoryIndexer(destDir, destDir, imageFolder, imageFile,
DirectoryIndexer.MODE_JAVA);
}
catch (IOException ioe)
{
throw new BuildException(ioe);
}
}
/**
* Creates a relative link from one directory to another.
*
* Example:
* given /foo/bar/baz/oink
* and /foo/bar/schmoo
*
* this method will return a string of "../../schmoo/"
*
* @param fromDir The directory from which the link is relative.
* @param toDir The directory into which the link points.
* @throws IOException
* If a problem is encountered while navigating through the directories.
* @return a string of format "../../schmoo/"
*/
private String getRelativeLink(String fromDir, String toDir)
throws IOException
{
StringBuffer toLink = new StringBuffer(); // up from fromDir
StringBuffer fromLink = new StringBuffer(); // down into toDir
// assume they are both at least rooted at the project's baseDir
File baseDir = new File(getProject().getBaseDir().getCanonicalPath());
// create a List of toDir's parent directories
LinkedList parents = new LinkedList();
File f = new File(new File(javadocDir).getCanonicalPath());
while (f != null && !f.equals(baseDir))
{
parents.add(f);
f = new File(f.getParent());
}
// walk up fromDir to find the common parent
f = new File(new File(destDir).getCanonicalPath());
f = new File(f.getParent());
boolean found = false;
while (f != null && !found && !f.equals(baseDir))
{
for (int i = 0; i < parents.size(); ++i)
{
File parent = (File) parents.get(i);
if (f.equals(parent))
{
// when we find the common parent, add the subdirectories
// down to toDir itself
for (int j = 0; j < i; ++j)
{
File p = (File) parents.get(j);
toLink.insert(0, p.getName() + "/");
}
found = true;
break;
}
}
f = new File(f.getParent());
fromLink.append("../");
}
return fromLink.append(toLink).toString();
}
/**
* Sets the imageFile attribute of the JxrTask object
* @param imageFile the image to be used for the {@link DirectoryIndexer}
*/
public void setImageFile(String imageFile)
{
this.imageFile = imageFile;
}
/**
* Sets the imageFolder attribute of the JxrTask object
* @param imageFolder the folder for the {@link #imageFile}
*/
public void setImageFolder(String imageFolder)
{
this.imageFolder = imageFolder;
}
/**
* Sets the source path to a single path, or
* appends onto the existing source path.
* @param src The source directory to be cross-referenced.
*/
public void setSourcepath(Path src)
{
if (sourcePath == null)
{
sourcePath = src;
}
else
{
sourcePath.append(src);
}
}
/**
* Sets the source path to a reference object
* @param ref The Reference object containing paths to be cross-referenced.
*/
public void setSourcepathref(Reference ref)
{
this.ref = ref;
}
/**
* Sets the destDir attribute of the JxrTask object
* @param destDir the destination directory for jxr output
*/
public void setDestDir(String destDir)
{
this.destDir = destDir;
}
/**
* Sets the javadocDir attribute of the JxrTask object
* @param javadocDir The root directory containing javadocs
*/
public void setJavadocDir(String javadocDir)
{
this.javadocDir = javadocDir;
}
}
1.5 +1 -1 jakarta-turbine-maven/src/plugins/jxr/plugin.jelly
Index: plugin.jelly
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/plugins/jxr/plugin.jelly,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- plugin.jelly 5 Jul 2002 21:48:19 -0000 1.4
+++ plugin.jelly 6 Jul 2002 03:40:59 -0000 1.5
@@ -8,7 +8,7 @@
<taskdef
name="jxr"
- classname="org.apache.maven.Jxr">
+ classname="org.apache.maven.jxr.Jxr">
<classpath refid="maven-classpath"/>
</taskdef>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>