dion 02/05/27 05:06:17
Modified: src/java/org/apache/maven/ant Ant.java ListTask.java
FileSetFromPath.java GetList.java CallTarget.java
AntUtils.java
src/java/org/apache/maven TaskListExecutor.java
SiteValidator.java UpdateMavenCheck.java
UpdatePomCheck.java XmlPomFormatter.java
XmlPomValidator.java
Log:
CheckStyle issues
Revision Changes Path
1.4 +25 -5 jakarta-turbine-maven/src/java/org/apache/maven/ant/Ant.java
Index: Ant.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/ant/Ant.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Ant.java 27 May 2002 08:04:15 -0000 1.3
+++ Ant.java 27 May 2002 12:06:16 -0000 1.4
@@ -143,6 +143,7 @@
* If true, inherit all properties from parent Project
* If false, inherit only userProperties and those defined
* inside the ant call itself
+ * @param value the new value of {@link inheritAll}
*/
public void setInheritAll(boolean value)
{
@@ -153,6 +154,7 @@
* If true, inherit all references from parent Project
* If false, inherit only those defined
* inside the ant call itself
+ * @param value the new value of {@link inheritRefs}
*/
public void setInheritRefs(boolean value)
{
@@ -338,6 +340,7 @@
/**
* Pass output sent to System.out to the new project.
*
+ * @param line a line of output from System.out
* @since Ant 1.5
*/
protected void handleOutput(String line)
@@ -355,6 +358,7 @@
/**
* Pass output sent to System.err to the new project.
*
+ * @param line a line of output from System.err
* @since Ant 1.5
*/
protected void handleErrorOutput(String line)
@@ -371,6 +375,7 @@
/**
* Do the execution.
+ * @throws BuildException when any error occurs
*/
public void execute() throws BuildException
{
@@ -426,7 +431,8 @@
// Are we trying to call the target in which we are defined?
if (newProject.getBaseDir().equals(project.getBaseDir()) &&
-
newProject.getProperty("ant.file").equals(project.getProperty("ant.file")) &&
+ newProject.getProperty("ant.file").equals(
+ project.getProperty("ant.file")) &&
getOwningTarget() != null &&
target.equals(this.getOwningTarget().getName()))
{
@@ -464,6 +470,7 @@
/**
* Override the properties in the new project with the one
* explicitly defined as nested elements here.
+ * @throws BuildException when an error occurs setting the new properties
*/
private void overrideProperties() throws BuildException
{
@@ -481,6 +488,8 @@
* new project. Also copy over all references that don't override
* existing references in the new project if inheritrefs has been
* requested.
+ * @throws BuildException when the refid attribute is missing from a
+ * reference
*/
private void addReferences() throws BuildException
{
@@ -489,7 +498,7 @@
Enumeration e;
if (references.size() > 0)
{
- for (e = references.elements(); e.hasMoreElements(); )
+ for (e = references.elements(); e.hasMoreElements();)
{
Reference ref = (Reference) e.nextElement();
String refid = ref.getRefId();
@@ -519,7 +528,7 @@
// subproject, if inheritRefs is true
if (inheritRefs)
{
- for (e = thisReferences.keys(); e.hasMoreElements(); )
+ for (e = thisReferences.keys(); e.hasMoreElements();)
{
String key = (String) e.nextElement();
if (newReferences.containsKey(key))
@@ -538,6 +547,8 @@
*
* <p>If we cannot clone it, copy the referenced object itself and
* keep our fingers crossed.</p>
+ * @param oldKey the name of the reference to be cloned
+ * @param newKey the name of the cloned reference in the new project
*/
private void copyReference(String oldKey, String newKey)
{
@@ -666,6 +677,7 @@
/**
* Set the dir attribute.
+ * @param d the directory as a {@link File}
*/
public void setDir(File d)
{
@@ -676,6 +688,7 @@
* set the build file, it can be either absolute or relative.
* If it is absolute, <tt>dir</tt> will be ignored, if it is
* relative it will be resolved relative to <tt>dir</tt>.
+ * @param s the build file
*/
public void setAntfile(String s)
{
@@ -688,6 +701,7 @@
/**
* set the target to execute. If none is defined it will
* execute the default target of the build file
+ * @param s the target to be executed
*/
public void setTarget(String s)
{
@@ -698,13 +712,16 @@
* Set the name of a log file. This will be resolved relative to
* the dir attribute if specified, relative to the current
* project's basedir otherwise.
+ * @param s the file name of the output
*/
public void setOutput(String s)
{
this.output = s;
}
- /** create a property to pass to the new project as a 'user property' */
+ /** create a property to pass to the new project as a 'user property'
+ * @return the created {@link Property}
+ */
public Property createProperty()
{
if (newProject == null)
@@ -725,6 +742,7 @@
/**
* create a reference element that identifies a data type that
* should be carried over to the new project.
+ * @param r the reference to be added to the project
*/
public void addReference(Reference r)
{
@@ -743,7 +761,9 @@
{
super();
}
-
+ /**
+ * the id under which this reference will be passed to the new project
+ */
private String targetid = null;
/**
1.4 +1 -1
jakarta-turbine-maven/src/java/org/apache/maven/ant/ListTask.java
Index: ListTask.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/ant/ListTask.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ListTask.java 23 May 2002 15:20:40 -0000 1.3
+++ ListTask.java 27 May 2002 12:06:16 -0000 1.4
@@ -132,7 +132,7 @@
}
catch (Exception e)
{
- e.printStackTrace();
+ e.printStackTrace();
}
return list;
1.3 +7 -3
jakarta-turbine-maven/src/java/org/apache/maven/ant/FileSetFromPath.java
Index: FileSetFromPath.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/ant/FileSetFromPath.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FileSetFromPath.java 27 May 2002 07:49:27 -0000 1.2
+++ FileSetFromPath.java 27 May 2002 12:06:16 -0000 1.3
@@ -91,6 +91,8 @@
* project</code>
* @param scanner a {@link FileScanner} to set up
* @param project the project the fileset is being used in
+ * @throws BuildException when required attributes are not set or the
+ * given <code>pathid</code> doesn't exist in the project
*/
public void execute() throws BuildException
{
@@ -144,7 +146,7 @@
{
// strip basedir and add it as includes/excludes where specified
String directory = pathElement.substring(basedir.length());
- if (!isFileSeparator(directory.charAt(directory.length()-1)))
+ if (!isFileSeparator(directory.charAt(directory.length() - 1)))
{
directory += File.separator;
}
@@ -152,14 +154,16 @@
{
directory = directory.substring(1);
}
- if (getIncludes() != null) {
+ if (getIncludes() != null)
+ {
String[] list = Strings.split(getIncludes(), ",");
for (int index = 0; index < list.length; index++)
{
fileset.createInclude().setName(directory + list[index]);
}
}
- if (getExcludes() != null) {
+ if (getExcludes() != null)
+ {
String[] list = Strings.split(getExcludes(), ",");
for (int index = 0; index < list.length; index++)
{
1.3 +1 -1 jakarta-turbine-maven/src/java/org/apache/maven/ant/GetList.java
Index: GetList.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/ant/GetList.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- GetList.java 22 Apr 2002 00:15:04 -0000 1.2
+++ GetList.java 27 May 2002 12:06:16 -0000 1.3
@@ -148,7 +148,7 @@
dest.getAbsolutePath());
}
- for (Iterator j = getList(getListFile()).iterator(); j.hasNext(); )
+ for (Iterator j = getList(getListFile()).iterator(); j.hasNext();)
{
try
{
1.2 +48 -21
jakarta-turbine-maven/src/java/org/apache/maven/ant/CallTarget.java
Index: CallTarget.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/ant/CallTarget.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CallTarget.java 19 Apr 2002 14:51:31 -0000 1.1
+++ CallTarget.java 27 May 2002 12:06:16 -0000 1.2
@@ -85,21 +85,25 @@
*
* @ant.task name="antcall" category="control"
*/
-public class CallTarget extends Task {
-
+public class CallTarget extends Task
+{
+ /** the calling ant task */
private Ant callee;
+ /** the target to be called */
private String subTarget;
- // must match the default value of Ant#inheritAll
+ /** must match the default value of {@link Ant#inheritAll} */
private boolean inheritAll = true;
- // must match the default value of Ant#inheritRefs
+ /** must match the default value of {@link Ant#inheritRefs} */
private boolean inheritRefs = false;
/**
* If true, inherit all properties from parent Project
* If false, inherit only userProperties and those defined
* inside the antcall call itself
+ * @param inherit the new value of {@link #inheritAll}
**/
- public void setInheritAll(boolean inherit) {
+ public void setInheritAll(boolean inherit)
+ {
inheritAll = inherit;
}
@@ -107,7 +111,8 @@
* set the inherit refs flag
* @param inheritRefs new value
*/
- public void setInheritRefs(boolean inheritRefs) {
+ public void setInheritRefs(boolean inheritRefs)
+ {
this.inheritRefs = inheritRefs;
}
@@ -115,7 +120,8 @@
* init this task by creating new instance of the ant task and
* configuring it's by calling its own init method.
*/
- public void init() {
+ public void init()
+ {
callee = (Ant) getProject().createTask("ant");
callee.setOwningTarget(getOwningTarget());
callee.setTaskName(getTaskName());
@@ -128,12 +134,15 @@
* @throws BuildException on validation failure or if the target didn't
* execute
*/
- public void execute() throws BuildException {
- if (callee == null) {
+ public void execute() throws BuildException
+ {
+ if (callee == null)
+ {
init();
}
- if (subTarget == null) {
+ if (subTarget == null)
+ {
throw new BuildException("Attribute target is required.",
location);
}
@@ -148,9 +157,12 @@
/**
* Create a nested param element.
+ * @return a new {@link Property} to be passed as a parameter
*/
- public Property createParam() {
- if (callee == null) {
+ public Property createParam()
+ {
+ if (callee == null)
+ {
init();
}
return callee.createProperty();
@@ -160,10 +172,13 @@
* create a reference element that identifies a data type that
* should be carried over to the new project.
*
+ * @param r the reference to be added
* @since Ant 1.5
*/
- public void addReference(Ant.Reference r) {
- if (callee == null) {
+ public void addReference(Ant.Reference r)
+ {
+ if (callee == null)
+ {
init();
}
callee.addReference(r);
@@ -171,20 +186,27 @@
/**
* Sets the target attribute, required.
+ * @param target the name of the target to call
*/
- public void setTarget(String target) {
+ public void setTarget(String target)
+ {
subTarget = target;
}
/**
* Pass output sent to System.out to the new project.
*
+ * @param line a line of output to be passed to System.out
* @since Ant 1.5
*/
- protected void handleOutput(String line) {
- if (callee != null) {
+ protected void handleOutput(String line)
+ {
+ if (callee != null)
+ {
callee.handleOutput(line);
- } else {
+ }
+ else
+ {
super.handleOutput(line);
}
}
@@ -192,12 +214,17 @@
/**
* Pass output sent to System.err to the new project.
*
+ * @param line a line of output to be passed to System.err
* @since Ant 1.5
*/
- protected void handleErrorOutput(String line) {
- if (callee != null) {
+ protected void handleErrorOutput(String line)
+ {
+ if (callee != null)
+ {
callee.handleErrorOutput(line);
- } else {
+ }
+ else
+ {
super.handleErrorOutput(line);
}
}
1.5 +4 -4
jakarta-turbine-maven/src/java/org/apache/maven/ant/AntUtils.java
Index: AntUtils.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/ant/AntUtils.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AntUtils.java 25 Apr 2002 16:00:15 -0000 1.4
+++ AntUtils.java 27 May 2002 12:06:16 -0000 1.5
@@ -67,7 +67,7 @@
* sets of values.
*
* @author <a href="[EMAIL PROTECTED]">Jason van Zyl</a>
- * @version $Id: AntUtils.java,v 1.4 2002/04/25 16:00:15 jvanzyl Exp $
+ * @version $Id: AntUtils.java,v 1.5 2002/05/27 12:06:16 dion Exp $
*/
public class AntUtils
{
@@ -88,7 +88,7 @@
{
Path classpath = new Path(project);
- for (Iterator i = list.iterator(); i.hasNext(); )
+ for (Iterator i = list.iterator(); i.hasNext();)
{
String jar = (String) i.next();
Path p = new Path(project);
@@ -116,7 +116,7 @@
StringBuffer excludesSb = new StringBuffer();
PatternSet patternSet = new PatternSet();
- for (Iterator i = list.iterator(); i.hasNext(); )
+ for (Iterator i = list.iterator(); i.hasNext();)
{
String line = (String) i.next();
line = line.trim();
@@ -179,7 +179,7 @@
StringBuffer includesSb = new StringBuffer();
PatternSet patternSet = new PatternSet();
- for (Iterator i = list.iterator(); i.hasNext(); )
+ for (Iterator i = list.iterator(); i.hasNext();)
{
String line = (String) i.next();
line = line.trim();
1.4 +6 -8
jakarta-turbine-maven/src/java/org/apache/maven/TaskListExecutor.java
Index: TaskListExecutor.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/TaskListExecutor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TaskListExecutor.java 6 May 2002 02:03:31 -0000 1.3
+++ TaskListExecutor.java 27 May 2002 12:06:16 -0000 1.4
@@ -3,7 +3,7 @@
/* ====================================================================
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,13 +25,13 @@
* 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 jakarta-turbine-maven" must not be used to endorse or promote
products
- * derived from this software without prior written permission. For
+ * 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 jakarta-turbine-maven", nor may "Apache" appear in their name,
without
+ * "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
@@ -52,8 +52,6 @@
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
- *
- * ====================================================================
*/
import java.io.File;
@@ -68,7 +66,7 @@
* various tags in JavaDoc of a project's source tree.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Pete Kazmier</a>
- * @version $Id: TaskListExecutor.java,v 1.3 2002/05/06 02:03:31 kaz Exp $
+ * @version $Id: TaskListExecutor.java,v 1.4 2002/05/27 12:06:16 dion Exp $
*/
public class TaskListExecutor extends FileProcessingExecutor
{
1.2 +17 -11
jakarta-turbine-maven/src/java/org/apache/maven/SiteValidator.java
Index: SiteValidator.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/SiteValidator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SiteValidator.java 1 Apr 2002 19:04:34 -0000 1.1
+++ SiteValidator.java 27 May 2002 12:06:16 -0000 1.2
@@ -6,7 +6,7 @@
* This software is open source.
* See the bottom of this file for the licence.
*
- * $Id: SiteValidator.java,v 1.1 2002/04/01 19:04:34 jvanzyl Exp $
+ * $Id: SiteValidator.java,v 1.2 2002/05/27 12:06:16 dion Exp $
*/
import java.io.File;
@@ -26,10 +26,9 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">James Strachan</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
- * @version $Id: SiteValidator.java,v 1.1 2002/04/01 19:04:34 jvanzyl Exp $
+ * @version $Id: SiteValidator.java,v 1.2 2002/05/27 12:06:16 dion Exp $
*/
-public class SiteValidator
- extends AbstractExecutor
+public class SiteValidator extends AbstractExecutor
{
/**
* Site directory to search for broken links.
@@ -48,6 +47,8 @@
/**
* Get the site directory that is being searched in for broken links.
+ * @return a {@link File} representing the directory that site files are
+ * stored in
*/
public File getSiteDirectory()
{
@@ -56,9 +57,9 @@
/**
* Perform the action.
+ * @throws Exception when any errors occur
*/
- public void execute()
- throws Exception
+ public void execute() throws Exception
{
// Get all the documents in the site directory.
String[] siteDocs = MavenUtils.getFiles(siteDirectory, "*.xml");
@@ -71,6 +72,9 @@
/**
* Read in an XML document and return a dom4j Document.
+ * @param xmlFile a file to be parsed into a {@link Document}
+ * @return an xml {@link Document}
+ * @throws Exception when there are errors parsing the file
*/
private Document parse(String xmlFile)
throws Exception
@@ -80,14 +84,15 @@
}
/**
- * Description of the Method
+ * process a document
+ * @param document a {@link Document} to be validated
+ * @throws Exception when any error occurs
*/
- private void process(Document document)
- throws Exception
+ private void process(Document document) throws Exception
{
List list = document.selectNodes("//a/@href");
- for (Iterator iter = list.iterator(); iter.hasNext(); )
+ for (Iterator iter = list.iterator(); iter.hasNext();)
{
Attribute attribute = (Attribute) iter.next();
checkReference(attribute.getValue());
@@ -97,6 +102,7 @@
/**
* Check a reference. This could either be a local reference
* to another document in the tree or an external reference.
+ * @param reference the reference to check
*/
private void checkReference(String reference)
{
@@ -153,5 +159,5 @@
*
* Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved.
*
- * $Id: SiteValidator.java,v 1.1 2002/04/01 19:04:34 jvanzyl Exp $
+ * $Id: SiteValidator.java,v 1.2 2002/05/27 12:06:16 dion Exp $
*/
1.8 +10 -11
jakarta-turbine-maven/src/java/org/apache/maven/UpdateMavenCheck.java
Index: UpdateMavenCheck.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/UpdateMavenCheck.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- UpdateMavenCheck.java 7 May 2002 16:09:40 -0000 1.7
+++ UpdateMavenCheck.java 27 May 2002 12:06:16 -0000 1.8
@@ -57,10 +57,8 @@
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
-
import java.net.URL;
-import org.apache.maven.project.Project;
import org.apache.maven.executor.AbstractExecutor;
import org.apache.maven.util.HttpUtils;
@@ -72,7 +70,7 @@
* the user's Maven installation up-to-date.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
- * @version $Id: UpdateMavenCheck.java,v 1.7 2002/05/07 16:09:40 glennm Exp $
+ * @version $Id: UpdateMavenCheck.java,v 1.8 2002/05/27 12:06:16 dion Exp $
*/
public class UpdateMavenCheck
extends AbstractExecutor
@@ -80,19 +78,19 @@
/**
* Name of the Maven version file.
*/
- private static String MAVEN_VERSION_FILE = "MAVEN_VERSION";
+ private static final String MAVEN_VERSION_FILE = "MAVEN_VERSION";
/**
* Execute
+ * @throws Exception when any error occurs
*/
- public void execute()
- throws Exception
+ public void execute() throws Exception
{
- URL mavenVersionUrl = new URL(getProject().getProperty("maven.updateSite")
+
- "/" + MAVEN_VERSION_FILE);
+ URL mavenVersionUrl = new URL(getProject().getProperty(
+ "maven.updateSite") + "/" + MAVEN_VERSION_FILE);
- File mavenVersionFile = new File(getProject().getProperty("maven.home"),
- MAVEN_VERSION_FILE);
+ File mavenVersionFile = new File(getProject().getProperty("maven.home"),
+ MAVEN_VERSION_FILE);
//!! Need to test if the connection is live first just in case
// the user isn't connected. Hopefully httpclient has all
@@ -100,7 +98,8 @@
HttpUtils.getFile(mavenVersionUrl, mavenVersionFile,
MAVEN_VERSION_FILE, false, true, false, null, null);
- BufferedReader in = new BufferedReader(new FileReader(mavenVersionFile));
+ BufferedReader in = new BufferedReader(new FileReader(
+ mavenVersionFile));
String mavenVersionString = in.readLine();
int mavenVersion = Integer.parseInt(mavenVersionString);
in.close();
1.2 +14 -9
jakarta-turbine-maven/src/java/org/apache/maven/UpdatePomCheck.java
Index: UpdatePomCheck.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/UpdatePomCheck.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- UpdatePomCheck.java 6 Apr 2002 16:26:01 -0000 1.1
+++ UpdatePomCheck.java 27 May 2002 12:06:16 -0000 1.2
@@ -61,9 +61,11 @@
/**
* XML project descriptor validator.
+ * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
+ * @author dion
+ * @version $Id: UpdatePomCheck.java,v 1.2 2002/05/27 12:06:16 dion Exp $
*/
-public class UpdatePomCheck
- extends AbstractExecutor
+public class UpdatePomCheck extends AbstractExecutor
{
/**
* XML project descriptor to validate
@@ -72,6 +74,7 @@
/**
* Set the project descriptor to validate.
+ * @param projectDescriptor the project descriptor as a {@link File}
*/
public void setProjectDescriptor(File projectDescriptor)
{
@@ -80,6 +83,7 @@
/**
* Get the project descriptor to validate.
+ * @return the project descriptor as a {@link File}
*/
public File getProjectDescriptor()
{
@@ -88,9 +92,9 @@
/**
* Execute
+ * @throws Exception when any error occurs
*/
- public void execute()
- throws Exception
+ public void execute() throws Exception
{
Project project = null;
@@ -114,15 +118,16 @@
project.setVersion("1");
}
- if (Integer.parseInt(project.getVersion()) != MavenConstants.POM_VERSION)
+ if (Integer.parseInt(project.getVersion()) !=
+ MavenConstants.POM_VERSION)
{
- getProject().setProperty("pomUpdateRequired","true");
- getProject().setProperty("fromVersion",project.getVersion());
+ getProject().setProperty("pomUpdateRequired", "true");
+ getProject().setProperty("fromVersion", project.getVersion());
getProject().setProperty("toVersion",
- Integer.toString(MavenConstants.POM_VERSION));
+ Integer.toString(MavenConstants.POM_VERSION));
log("fromVersion -> " + project.getVersion());
- log(" toVersion -> " + Integer.toString(MavenConstants.POM_VERSION));
+ log(" toVersion -> " + MavenConstants.POM_VERSION);
}
1.3 +22 -23
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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XmlPomFormatter.java 9 Apr 2002 15:58:22 -0000 1.2
+++ XmlPomFormatter.java 27 May 2002 12:06:16 -0000 1.3
@@ -6,19 +6,13 @@
* This software is open source.
* See the bottom of this file for the licence.
*
- * $Id: XmlPomFormatter.java,v 1.2 2002/04/09 15:58:22 jvanzyl Exp $
+ * $Id: XmlPomFormatter.java,v 1.3 2002/05/27 12:06:16 dion Exp $
*/
import java.io.FileWriter;
import java.io.File;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
import org.dom4j.Document;
-import org.dom4j.DocumentHelper;
-import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter;
import org.dom4j.io.SAXReader;
@@ -31,23 +25,20 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">James Strachan</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
- * @version $Id: XmlPomFormatter.java,v 1.2 2002/04/09 15:58:22 jvanzyl Exp $
+ * @version $Id: XmlPomFormatter.java,v 1.3 2002/05/27 12:06:16 dion Exp $
*/
-public class XmlPomFormatter
- extends AbstractExecutor
+public class XmlPomFormatter extends AbstractExecutor
{
- /**
- * Input xml.
- */
+ /** Input xml */
private File input;
- /**
- * Output xml.
- */
+ /** Output xml */
private File output;
/**
* Set input file.
+ * @param input the {@link File} to read the unformatted project object
+ * model from
*/
public void setInput(File input)
{
@@ -56,6 +47,7 @@
/**
* Get input file.
+ * @return the file the unformatted project object model will read from
*/
public File getInput()
{
@@ -64,6 +56,8 @@
/**
* Set output file.
+ * @param output the {@link File} to write the formatted project object
+ * object model to
*/
public void setOutput(File output)
{
@@ -72,6 +66,7 @@
/**
* Get output file.
+ * @return the file the formatted project object model will be written to
*/
public File getOutput()
{
@@ -81,9 +76,9 @@
/**
* Format the project descriptor.
+ * @throws Exception when any error occurs
*/
- public void execute()
- throws Exception
+ public void execute() throws Exception
{
Document document = createDocument();
OutputFormat format = new OutputFormat();
@@ -99,16 +94,20 @@
/**
* Description of the Method
+ * @return a {@link Document} from parsing the {@link #input input file}
+ * @throws Exception when any error occurs
*/
- protected Document createDocument()
- throws Exception
+ protected Document createDocument() throws Exception
{
SAXReader reader = new SAXReader();
return reader.read(input);
}
- public static void main(String[] args)
- throws Exception
+ /** Left over testing method - to be removed
+ * @param args command line arguments
+ * @throws Exception when any error occurs
+ */
+ public static void main(String[] args) throws Exception
{
System.out.println(args[0]);
System.out.println(args[1]);
@@ -162,5 +161,5 @@
*
* Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved.
*
- * $Id: XmlPomFormatter.java,v 1.2 2002/04/09 15:58:22 jvanzyl Exp $
+ * $Id: XmlPomFormatter.java,v 1.3 2002/05/27 12:06:16 dion Exp $
*/
1.4 +38 -39
jakarta-turbine-maven/src/java/org/apache/maven/XmlPomValidator.java
Index: XmlPomValidator.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/XmlPomValidator.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XmlPomValidator.java 9 Apr 2002 15:58:22 -0000 1.3
+++ XmlPomValidator.java 27 May 2002 12:06:16 -0000 1.4
@@ -56,18 +56,13 @@
import java.io.File;
import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.io.UnsupportedEncodingException;
-import org.xml.sax.Attributes;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.XMLReader;
import org.xml.sax.ErrorHandler;
-import org.xml.sax.helpers.DefaultHandler;
import org.apache.maven.executor.AbstractExecutor;
@@ -79,7 +74,7 @@
* only seem to get the validation with a schema to work with xerces2.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
- * @version $Id: XmlPomValidator.java,v 1.3 2002/04/09 15:58:22 jvanzyl Exp $
+ * @version $Id: XmlPomValidator.java,v 1.4 2002/05/27 12:06:16 dion Exp $
*/
public class XmlPomValidator
extends AbstractExecutor
@@ -88,41 +83,30 @@
/**
* Default parser name.
*/
- private final static String DEFAULT_PARSER_NAME =
+ private static final String DEFAULT_PARSER_NAME =
"org.apache.xerces.parsers.SAXParser";
- /**
- * Control document validation.
- */
+ /** Control document validation. */
private boolean validate = true;
- /**
- * Control use of namespaces in documents.
- */
+ /** Control use of namespaces in documents. */
private boolean setNameSpaces = true;
- /**
- * Control use of XML Schemas in documents.
- */
+ /** Control use of XML Schemas in documents. */
private boolean setSchemaSupport = true;
- /**
- * Control use of full XML Schema support.
- */
+ /** Control use of full XML Schema support. */
private boolean setSchemaFullSupport = true;
- /**
- * Maven project descriptor.
- */
+ /** Maven project descriptor. */
private File projectDescriptor;
- /**
- * XML Schema used to validate against.
- */
+ /** XML Schema used to validate against. */
private File xmlSchema;
/**
* Set the project descriptor file. This file must exist.
+ * @param projectDescriptor the pom to be validated
*/
public void setProjectDescriptor(File projectDescriptor)
{
@@ -131,6 +115,7 @@
/**
* Set the project descriptor file. This file must exist.
+ * @param xmlSchema the schema to validate against
*/
public void setXmlSchema(File xmlSchema)
{
@@ -139,30 +124,34 @@
/**
* Prints the output from the SAX callbacks.
+ * @throws Exception when any error occurs
*/
- public void execute()
- throws Exception
+ public void execute() throws Exception
{
try
{
String parserName = DEFAULT_PARSER_NAME;
- XMLReader parser = (XMLReader) Class.forName(parserName).newInstance();
+ XMLReader parser = (XMLReader) Class.forName(parserName).
+ newInstance();
parser.setErrorHandler(this);
// xml.org features and properties
- parser.setFeature("http://xml.org/sax/features/validation", validate);
- parser.setFeature("http://xml.org/sax/features/namespaces",
setNameSpaces);
+ parser.setFeature("http://xml.org/sax/features/validation",
+ validate);
+ parser.setFeature("http://xml.org/sax/features/namespaces",
+ setNameSpaces);
parser.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",
xmlSchema.getAbsolutePath());
// apache.org features and properties
- parser.setFeature("http://apache.org/xml/features/validation/schema",
- setSchemaSupport);
+ parser.setFeature("http://apache.org/xml/features/validation/schema"
+ , setSchemaSupport);
-
parser.setFeature("http://apache.org/xml/features/validation/schema-full-checking",
- setSchemaFullSupport);
+ parser.setFeature(
+ "http://apache.org/xml/features/validation/schema-full-checking"
+ , setSchemaFullSupport);
//parser.setEntityResolver(new XmlPomEntityResolver());
@@ -216,10 +205,10 @@
/**
* SAX Fatal error.
*
- * @param ex SAXParseException
+ * @param ex a {@link SAXParseException}
+ * @throws SAXException when an error occurs
*/
- public void fatalError(SAXParseException ex)
- throws SAXException
+ public void fatalError(SAXParseException ex) throws SAXException
{
System.err.println("[Fatal Error] " +
getLocationString(ex) + ": " +
@@ -227,7 +216,9 @@
}
/**
- * Returns a string of the location.
+ * Returns a string of the location of the exception
+ * @param ex a {@link SAXParseException}
+ * @return a string of the format: 'file:line#:column#'
*/
private String getLocationString(SAXParseException ex)
{
@@ -252,11 +243,19 @@
}
/**
- *
+ * Dummy entity resolver
*/
public static class XmlPomEntityResolver
implements EntityResolver
{
+ /** resolve the entity given by the provided Ids
+ * @param publicId the public id of the entity
+ * @param systemId the 'system location' (typically a URL) of the entity
+ * @return an {@link InputSource input source} for retrieval of the
+ * entity
+ * @throws IOException when an I/O error occurs retrieving the entity
+ * @throws SAXException if there are any problems
+ */
public InputSource resolveEntity(String publicId, String systemId)
throws IOException, SAXException
{
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>