dion 02/05/27 06:34:31
Modified: src/java/org/apache/maven/changelog ChangeLogEntry.java
ChangeLogParser.java ChangeLogFile.java
ChangeLogGenerator.java ChangeLog.java
src/java/org/apache/maven UpdateResources.java
Log:
More checkstyle fixes (you asked for it pete :) )
Revision Changes Path
1.3 +4 -2
jakarta-turbine-maven/src/java/org/apache/maven/changelog/ChangeLogEntry.java
Index: ChangeLogEntry.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/changelog/ChangeLogEntry.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ChangeLogEntry.java 12 May 2002 19:24:41 -0000 1.2
+++ ChangeLogEntry.java 27 May 2002 13:34:31 -0000 1.3
@@ -52,6 +52,8 @@
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
+ *
+ * ====================================================================
*/
import java.text.ParseException;
@@ -66,7 +68,7 @@
* @todo add time of change to the entry
* @todo investigate betwixt for toXML method
* @author <a href="mailto:[EMAIL PROTECTED]">dIon Gillard</a>
- * @version $Id: ChangeLogEntry.java,v 1.2 2002/05/12 19:24:41 tcopeland Exp $
+ * @version $Id: ChangeLogEntry.java,v 1.3 2002/05/27 13:34:31 dion Exp $
*/
public class ChangeLogEntry
{
@@ -148,7 +150,7 @@
.append(author)
.append("]]></author>\n");
ChangeLogFile file = null;
- for (Enumeration e = files.elements(); e.hasMoreElements(); )
+ for (Enumeration e = files.elements(); e.hasMoreElements();)
{
file = (ChangeLogFile) e.nextElement();
buffer.append("\t\t<file>\n")
1.2 +5 -3
jakarta-turbine-maven/src/java/org/apache/maven/changelog/ChangeLogParser.java
Index: ChangeLogParser.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/changelog/ChangeLogParser.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ChangeLogParser.java 30 Apr 2002 14:40:59 -0000 1.1
+++ ChangeLogParser.java 27 May 2002 13:34:31 -0000 1.2
@@ -52,6 +52,8 @@
* 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.InputStream;
@@ -64,7 +66,7 @@
* {@link ChangeLogEntry} objects.
*
* @author Glenn McAllister
- * @version $Id: ChangeLogParser.java,v 1.1 2002/04/30 14:40:59 dion Exp $
+ * @version $Id: ChangeLogParser.java,v 1.2 2002/05/27 13:34:31 dion Exp $
*/
public interface ChangeLogParser
{
@@ -76,7 +78,7 @@
*
* @param changeLog the controlling ChangeLog instance
*/
- void init( ChangeLog changeLog );
+ void init(ChangeLog changeLog);
/**
* Returns a {@link java.util.Collection} of ChangeLogEntry objects, parsed
@@ -89,7 +91,7 @@
* @return a Collection of ChangeLogEntry objects
* @throws IOException if there is an error while parsing the input stream
*/
- Collection parse( InputStream in ) throws IOException;
+ Collection parse(InputStream in) throws IOException;
/**
* Provides the opportunity for the parser to do any required cleanup.
1.2 +3 -1
jakarta-turbine-maven/src/java/org/apache/maven/changelog/ChangeLogFile.java
Index: ChangeLogFile.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/changelog/ChangeLogFile.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ChangeLogFile.java 30 Apr 2002 14:40:59 -0000 1.1
+++ ChangeLogFile.java 27 May 2002 13:34:31 -0000 1.2
@@ -52,6 +52,8 @@
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
+ *
+ * ====================================================================
*/
/**
@@ -59,7 +61,7 @@
* command
* @todo remove previous revision along with parser changes
* @author <a href="mailto:[EMAIL PROTECTED]">dIon Gillard</a>
- * @version $Id: ChangeLogFile.java,v 1.1 2002/04/30 14:40:59 dion Exp $
+ * @version $Id: ChangeLogFile.java,v 1.2 2002/05/27 13:34:31 dion Exp $
*/
public class ChangeLogFile
{
1.2 +6 -3
jakarta-turbine-maven/src/java/org/apache/maven/changelog/ChangeLogGenerator.java
Index: ChangeLogGenerator.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/changelog/ChangeLogGenerator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ChangeLogGenerator.java 30 Apr 2002 14:40:59 -0000 1.1
+++ ChangeLogGenerator.java 27 May 2002 13:34:31 -0000 1.2
@@ -52,6 +52,8 @@
* 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.IOException;
@@ -63,7 +65,8 @@
* individual {@link ChangeLogEntry} objects.
*
* @author Glenn McAllister
- * @version $Id: ChangeLogGenerator.java,v 1.1 2002/04/30 14:40:59 dion Exp $
+ * @author dion
+ * @version $Id: ChangeLogGenerator.java,v 1.2 2002/05/27 13:34:31 dion Exp $
*/
public interface ChangeLogGenerator
{
@@ -75,7 +78,7 @@
*
* @param changeLog the controlling ChangeLog instance
*/
- void init( ChangeLog changeLog );
+ void init(ChangeLog changeLog);
/**
* Return a Collection of ChangeLogEntry objects. This method should
@@ -93,7 +96,7 @@
* @throws IOException if there is an error while creating the
* ChangeLogEntry objects
*/
- Collection getEntries( ChangeLogParser parser ) throws IOException;
+ Collection getEntries(ChangeLogParser parser) throws IOException;
/**
* Provides the opportunity for the generator to do any required cleanup.
1.3 +22 -20
jakarta-turbine-maven/src/java/org/apache/maven/changelog/ChangeLog.java
Index: ChangeLog.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/changelog/ChangeLog.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ChangeLog.java 11 May 2002 14:03:58 -0000 1.2
+++ ChangeLog.java 27 May 2002 13:34:31 -0000 1.3
@@ -52,6 +52,8 @@
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
+ *
+ * ====================================================================
*/
// java imports
@@ -83,7 +85,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">dIon Gillard</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Stefan Bodewig</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
- * @version $Id: ChangeLog.java,v 1.2 2002/05/11 14:03:58 dion Exp $
+ * @version $Id: ChangeLog.java,v 1.3 2002/05/27 13:34:31 dion Exp $
*/
public class ChangeLog extends ProjectExecutor
{
@@ -125,7 +127,7 @@
*
* @param generatorClassName the fully qualified generator class name
*/
- public void setGenerator( String generatorClassName )
+ public void setGenerator(String generatorClassName)
{
clGeneratorClass = generatorClassName;
}
@@ -136,7 +138,7 @@
*
* @param parserClassName the fully qualified parser class name.
*/
- public void setParser( String parserClassName )
+ public void setParser(String parserClassName)
{
clParserClass = parserClassName;
}
@@ -221,12 +223,12 @@
ChangeLogGenerator generator = createGenerator();
ChangeLogParser parser = createParser();
- generator.init( this );
- parser.init( this );
+ generator.init(this);
+ parser.init(this);
try
{
- setEntries( generator.getEntries( parser ) );
+ setEntries(generator.getEntries(parser));
log("ChangeLog found: " + getEntries().size() + " entries");
}
finally
@@ -245,7 +247,7 @@
*/
private ChangeLogGenerator createGenerator() throws IOException
{
- return (ChangeLogGenerator) createObject( clGeneratorClass );
+ return (ChangeLogGenerator) createObject(clGeneratorClass);
}
/**
@@ -257,7 +259,7 @@
*/
private ChangeLogParser createParser() throws IOException
{
- return (ChangeLogParser) createObject( clParserClass );
+ return (ChangeLogParser) createObject(clParserClass);
}
/**
@@ -267,27 +269,27 @@
* @return the new instance
* @throws IOException if there is a problem creating the instance.
*/
- private Object createObject( String className ) throws IOException
+ private Object createObject(String className) throws IOException
{
try
{
- Class clazz = Class.forName( className );
+ Class clazz = Class.forName(className);
return clazz.newInstance();
}
catch (ClassNotFoundException cnfe)
{
- throw new IOException( "Cannot find class " + className +
- " " + cnfe.toString() );
+ throw new IOException("Cannot find class " + className +
+ " " + cnfe.toString());
}
catch (IllegalAccessException iae)
{
- throw new IOException( "Cannot access class " + className +
- " " + iae.toString() );
+ throw new IOException("Cannot access class " + className +
+ " " + iae.toString());
}
catch (InstantiationException ie)
{
- throw new IOException( "Cannot instantiate class " + className +
- " " + ie.toString() );
+ throw new IOException("Cannot instantiate class " + className +
+ " " + ie.toString());
}
}
@@ -303,7 +305,7 @@
List developers = getMavenProject().getDevelopers();
Developer developer = null;
- for (Iterator i = developers.iterator(); i.hasNext(); )
+ for (Iterator i = developers.iterator(); i.hasNext();)
{
developer = (Developer) i.next();
userList.put(developer.getId(), developer.getName());
@@ -319,7 +321,7 @@
{
Properties userList = getUserList();
ChangeLogEntry entry = null;
- for (Iterator i = getEntries().iterator(); i.hasNext(); )
+ for (Iterator i = getEntries().iterator(); i.hasNext();)
{
entry = (ChangeLogEntry) i.next();
if (userList.containsKey(entry.getAuthor()))
@@ -353,14 +355,14 @@
private String toXML()
{
StringBuffer buffer = new StringBuffer();
- buffer.append( "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" )
+ buffer.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n")
.append("<document>\n")
.append("<properties><title>Change Log</title></properties>\n")
.append("<body>\n")
.append("<section name=\"Change Log\"/>\n")
.append("<changelog>\n");
- for (Iterator i = getEntries().iterator(); i.hasNext(); )
+ for (Iterator i = getEntries().iterator(); i.hasNext();)
{
buffer.append(((ChangeLogEntry) i.next()).toXML());
}
1.19 +89 -54
jakarta-turbine-maven/src/java/org/apache/maven/UpdateResources.java
Index: UpdateResources.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/UpdateResources.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- UpdateResources.java 27 May 2002 12:19:51 -0000 1.18
+++ UpdateResources.java 27 May 2002 13:34:31 -0000 1.19
@@ -1,9 +1,9 @@
package org.apache.maven;
-/*
+/* ====================================================================
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2000-2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -18,21 +18,21 @@
* 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 acknowlegement:
+ * 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 acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" 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"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
+ * 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
@@ -57,17 +57,7 @@
*/
import java.io.File;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.IOException;
-
import java.net.URL;
-import java.net.URLConnection;
-import java.net.HttpURLConnection;
-import java.util.Date;
-
-import java.util.List;
-import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;
import java.util.HashMap;
@@ -90,21 +80,33 @@
* @author [EMAIL PROTECTED] (Added Java 1.1 style HTTP basic auth)
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
*/
-public class UpdateResources
- extends ProjectExecutor
+public class UpdateResources extends ProjectExecutor
{
+ /** destination file to write to */
private File dest;
+ /** level of logging displayed. Defaults to <code>false</code> */
private boolean verbose = false;
+ /** whether to check the timestamp of the local file vs the remote one.
+ * Defaults to <code>true</code>
+ */
private boolean useTimestamp = true;//on by default
+ /** whether to ignore errors in http retrievals. <code>true</code> by
+ * default
+ */
private boolean ignoreErrors = true;
+ /** password for http basic authentication */
private String uname = null;
+ /** password for http basic authentication */
private String pword = null;
- private static final String NON_DIST_JAR_LIST = "non-distributable-jars.list";
+ /** file name for the list of non distributable jars*/
+ private static final String NON_DIST_JAR_LIST =
+ "non-distributable-jars.list";
+ /** baseUrl of the Get object */
private String baseUrl;
- private StringBuffer warnings = new StringBuffer();
/**
* Sets the baseUrl attribute of the Get object
+ * @param baseUrl the new value for {@link #baseUrl}
*/
public void setBaseUrl(String baseUrl)
{
@@ -113,6 +115,7 @@
/**
* Sets the proxyHost attribute of the Get object
+ * @param proxyHost the host acting as a proxy
*/
public void setProxyHost(String proxyHost)
{
@@ -122,6 +125,7 @@
/**
* Sets the proxyPort attribute of the Get object
+ * @param proxyPort the port to connect to the proxy
*/
public void setProxyPort(String proxyPort)
{
@@ -157,12 +161,13 @@
URL nonDistJarsUrl = new URL(baseUrl + NON_DIST_JAR_LIST);
File f = new File(dest, NON_DIST_JAR_LIST);
- getFile(nonDistJarsUrl, f, NON_DIST_JAR_LIST,verbose,
- ignoreErrors,useTimestamp,uname,pword);
+ getFile(nonDistJarsUrl, f, NON_DIST_JAR_LIST, verbose, ignoreErrors,
+ useTimestamp, uname, pword);
Map nonDistMap = getNonDistMap(f);
-
- for (Iterator j = getMavenProject().getDependencies().iterator();
j.hasNext(); )
+ StringBuffer warnings = new StringBuffer();
+ for (Iterator j = getMavenProject().getDependencies().iterator();
+ j.hasNext();)
{
String file = ((Dependency) j.next()).getJar();
File destinationFile = new File(dest, file);
@@ -177,27 +182,30 @@
{
if (!destinationFile.exists())
{
- String[] entry =
Strings.split((String)nonDistMap.get(file),"$");
+ String[] entry = Strings.split((String) nonDistMap.get(file)
+ , "$");
String downloadLocation = entry[0];
String additionalNotes = entry[1];
-
warnings.append("-------------------------------------------------\n");
- warnings.append("W A R N I N G\n");
-
warnings.append("------------------------------------------------\n");
- warnings.append("The following JAR must be downloaded
manually:\n");
- warnings.append(file + "\n");
- warnings.append("\n");
- warnings.append("You can find the JAR here:\n");
- warnings.append(downloadLocation + "\n");
- warnings.append("\n\n");
- warnings.append("NOTE: " + additionalNotes + "\n");
+ warnings.append(
+ "-------------------------------------------------\n")
+ .append("W A R N I N G\n")
+ .append(
+ "------------------------------------------------\n")
+ .append(
+ "The following JAR must be downloaded manually:\n")
+ .append(file + "\n\n")
+ .append("You can find the JAR here:\n")
+ .append(downloadLocation + "\n")
+ .append("\n\n")
+ .append("NOTE: " + additionalNotes + "\n");
continue;
}
continue;
}
- getFile(source, destinationFile, file, verbose,
- ignoreErrors,useTimestamp,uname,pword);
+ getFile(source, destinationFile, file, verbose, ignoreErrors,
+ useTimestamp, uname, pword);
}
if (warnings.length() > 1)
@@ -206,6 +214,11 @@
}
}
+ /** retrieve the list of non distributable jars as a map, where the jar
+ * name is the key and the location to download is the value
+ * @param f the file containing the list of non distributable jars
+ * @return the map of names to locations
+ */
public Map getNonDistMap(File f)
{
Map nonDistMap = new HashMap();
@@ -214,38 +227,60 @@
try
{
BufferedReader in = new BufferedReader(new FileReader(f));
- while ((line=in.readLine()) != null)
+ while ((line = in.readLine()) != null)
{
line = line.trim();
// Allow comments to be placed in the payload
// descriptor.
- if (line.startsWith("#") || line.startsWith("--") || line.length()
< 1)
+ if (line.startsWith("#") || line.startsWith("--") ||
+ line.length() < 1)
{
continue;
}
- String[] entry = Strings.split(line,"|");
+ String[] entry = Strings.split(line, "|");
// The name of the non-dist JAR is the key, and the value is the
// location where the user can find it.
nonDistMap.put(entry[0], entry[1]);
}
}
- catch (Exception e) {e.printStackTrace();}
+ catch (Exception e)
+ {
+ // FIXME: need a reason to ignore Exceptions
+ e.printStackTrace();
+ }
return nonDistMap;
}
+ /**
+ * Retrieve a file via http.
+ * @param source the {@link URL} of the file to retrieve
+ * @param destinationFile where to store it
+ * @param file <strong>doesn't appear to be used</strong>
+ * @param verbose the amount of logging to be displayed
+ * @param ignoreErrors whether to ignore errors during I/O or throw an
+ * exception when they happen
+ * @param useTimestamp whether to check the modified timestamp on the
+ * <code>destinationFile</code> against the remote <code>source</code>
+ * @param uname the user name to use for basic authentication
+ * @param pword the password to use for basic authentication
+ */
public static void getFile(URL source, File destinationFile, String file,
- boolean verbose, boolean ignoreErrors, boolean
useTimestamp,
- String uname, String pword)
+ boolean verbose, boolean ignoreErrors, boolean useTimestamp,
+ String uname, String pword)
{
- HttpUtils.getFile(source,destinationFile,file,verbose,
- ignoreErrors,useTimestamp,uname,pword);
+ HttpUtils.getFile(source, destinationFile, file, verbose, ignoreErrors,
+ useTimestamp, uname, pword);
}
- // We need to move to the commons-logging goodies here.
+ /**
+ * Log a message to System.out
+ * We need to move to the commons-logging goodies here.
+ * @param message the message to be logged.
+ */
private static void logx(String message)
{
System.out.println(message);
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>