stevel 2002/06/17 22:51:11
Modified: src/main/org/apache/tools/ant/taskdefs Tag: ANT_15_BRANCH
Manifest.java Mkdir.java Move.java Pack.java
Parallel.java Patch.java PathConvert.java
Log:
javadoc updates.
Revision Changes Path
No revision
No revision
1.33.2.1 +115 -104
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Manifest.java
Index: Manifest.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Manifest.java,v
retrieving revision 1.33
retrieving revision 1.33.2.1
diff -u -r1.33 -r1.33.2.1
--- Manifest.java 29 Apr 2002 11:02:49 -0000 1.33
+++ Manifest.java 18 Jun 2002 05:51:10 -0000 1.33.2.1
@@ -76,8 +76,20 @@
import org.apache.tools.ant.util.CollectionUtils;
/**
- * Class to manage Manifest information
*
+ * Creates a manifest file for inclusion in a JAR.
+ * This task can be used to write a Manifest file, optionally
+ * replacing or updating an existing file.
+ * Manifests are processed according to the
+ * [EMAIL PROTECTED] <a
href="http://java.sun.com/j2se/1.4/docs/guide/jar/jar.html">Jar
+ * file specification.</a>}.
+ * Specifically, a manifest element consists of
+ * a set of attributes and sections. These sections in turn may contain
+ * attributes. Note in particular that this may result in manifest lines
+ * greater than 72 bytes being wrapped and continued on the next
+ * line. If an application can not handle the continuation mechanism, it
+ * is a defect in the application, not this task.
+
* @author Conor MacNeill
* @author <a href="mailto:[EMAIL PROTECTED]">Stefan Bodewig</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jose Alberto Fernandez</a>
@@ -88,11 +100,11 @@
*/
public class Manifest extends Task {
/** The standard manifest version header */
- public static final String ATTRIBUTE_MANIFEST_VERSION
+ public static final String ATTRIBUTE_MANIFEST_VERSION
= "Manifest-Version";
/** The standard Signature Version header */
- public static final String ATTRIBUTE_SIGNATURE_VERSION
+ public static final String ATTRIBUTE_SIGNATURE_VERSION
= "Signature-Version";
/** The Name Attribute is the first in a named section */
@@ -109,21 +121,21 @@
/** The max length of a line in a Manifest */
public static final int MAX_LINE_LENGTH = 72;
-
- /**
- * Max length of a line section which is continued. Need to allow
+
+ /**
+ * Max length of a line section which is continued. Need to allow
* for the CRLF.
*/
public static final int MAX_SECTION_LENGTH = MAX_LINE_LENGTH - 2;
/** The End-Of-Line marker in manifests */
public static final String EOL = "\r\n";
-
+
/**
* Helper class for Manifest's mode attribute.
*/
public static class Mode extends EnumeratedAttribute {
- /**
+ /**
* Get Allowed values for the mode attribute.
*
* @return a String array of the allowed values.
@@ -134,7 +146,8 @@
}
/**
- * Class to hold manifest attributes
+ * An attribute for the manifest.
+ * Those attributes that are not nested into a section will be added to
the "Main" section.
*/
public static class Attribute {
/** The attribute's name */
@@ -148,7 +161,7 @@
* currently being defined.
*/
private int currentIndex = 0;
-
+
/**
* Construct an empty attribute */
public Attribute() {
@@ -181,11 +194,11 @@
*/
public int hashCode() {
int hashCode = 0;
-
+
if (name != null) {
hashCode += name.hashCode();
}
-
+
hashCode += values.hashCode();
return hashCode;
}
@@ -197,7 +210,7 @@
if (rhs == null || rhs.getClass() != getClass()) {
return false;
}
-
+
if (rhs == this) {
return true;
}
@@ -205,12 +218,12 @@
Attribute rhsAttribute = (Attribute) rhs;
String lhsKey = getKey();
String rhsKey = rhsAttribute.getKey();
- if ((lhsKey == null && rhsKey != null)
+ if ((lhsKey == null && rhsKey != null)
|| (lhsKey != null && rhsKey == null)
|| !lhsKey.equals(rhsKey)) {
return false;
}
-
+
return CollectionUtils.equals(values, rhsAttribute.values);
}
@@ -225,8 +238,8 @@
public void parse(String line) throws ManifestException {
int index = line.indexOf(": ");
if (index == -1) {
- throw new ManifestException("Manifest line \"" + line
- + "\" is not valid as it does not "
+ throw new ManifestException("Manifest line \"" + line
+ + "\" is not valid as it does not "
+ "contain a name and a value separated by ': ' ");
}
name = line.substring(0, index);
@@ -234,7 +247,7 @@
}
/**
- * Set the Attribute's name
+ * Set the Attribute's name; required
*
* @param name the attribute's name
*/
@@ -262,9 +275,9 @@
}
return name.toLowerCase();
}
-
+
/**
- * Set the Attribute's value
+ * Set the Attribute's value; required
*
* @param value the attribute's value
*/
@@ -278,7 +291,7 @@
}
/**
- * Get the Attribute's value
+ * Get the Attribute's value.
*
* @return the attribute's value.
*/
@@ -286,7 +299,7 @@
if (values.size() == 0) {
return null;
}
-
+
String fullValue = "";
for (Enumeration e = getValues(); e.hasMoreElements();) {
String value = (String) e.nextElement();
@@ -296,7 +309,7 @@
}
/**
- * Add a new value to this attribute - making it multivalued
+ * Add a new value to this attribute - making it multivalued.
*
* @param value the attribute's additional value
*/
@@ -304,18 +317,18 @@
currentIndex++;
setValue(value);
}
-
- /**
- * Get all the attribute's values
+
+ /**
+ * Get all the attribute's values.
*
* @return an enumeration of the attributes values
*/
public Enumeration getValues() {
return values.elements();
}
-
+
/**
- * Add a continuation line from the Manifest file
+ * Add a continuation line from the Manifest file.
*
* When lines are too long in a manifest, they are continued on the
* next line by starting with a space. This method adds the
continuation
@@ -340,7 +353,7 @@
writeValue(writer, (String) e.nextElement());
}
}
-
+
/**
* Write a single attribute value out
*
@@ -349,20 +362,20 @@
*
* @throws IOException if the attribte value cannot be written
*/
- private void writeValue(PrintWriter writer, String value)
+ private void writeValue(PrintWriter writer, String value)
throws IOException {
String line = name + ": " + value;
while (line.getBytes().length > MAX_LINE_LENGTH) {
// try to find a MAX_LINE_LENGTH byte section
int breakIndex = MAX_SECTION_LENGTH;
String section = line.substring(0, breakIndex);
- while (section.getBytes().length > MAX_SECTION_LENGTH
+ while (section.getBytes().length > MAX_SECTION_LENGTH
&& breakIndex > 0) {
breakIndex--;
section = line.substring(0, breakIndex);
}
if (breakIndex == 0) {
- throw new IOException("Unable to write manifest line "
+ throw new IOException("Unable to write manifest line "
+ name + ": " + value);
}
writer.print(section + EOL);
@@ -371,18 +384,18 @@
writer.print(line + EOL);
}
}
-
+
/**
- * Class to represent an individual section in the
- * Manifest. A section consists of a set of attribute values,
+ * A manifest section - you can nest attribute elements into sections.
+ * A section consists of a set of attribute values,
* separated from other sections by a blank line.
*/
public static class Section {
/** Warnings for this section */
private Vector warnings = new Vector();
- /**
- * The section's name if any. The main section in a
+ /**
+ * The section's name if any. The main section in a
* manifest is unnamed.
*/
private String name = null;
@@ -392,10 +405,9 @@
/** Index used to retain the attribute ordering */
private Vector attributeIndex = new Vector();
-
+
/**
- * Set the Section's name
- *
+ * The name of the section; optional -default is the main section.
* @param name the section's name
*/
public void setName(String name) {
@@ -403,7 +415,7 @@
}
/**
- * Get the Section's name
+ * Get the Section's name.
*
* @return the section's name.
*/
@@ -412,19 +424,19 @@
}
/**
- * Read a section through a reader
+ * Read a section through a reader.
*
* @param reader the reader from which the section is read
*
- * @return the name of the next section if it has been read as
- * part of this section - This only happens if the
+ * @return the name of the next section if it has been read as
+ * part of this section - This only happens if the
* Manifest is malformed.
*
- * @throws ManifestException if the section is not valid according
+ * @throws ManifestException if the section is not valid according
* to the JAR spec
* @throws IOException if the section cannot be read from the reader.
*/
- public String read(BufferedReader reader)
+ public String read(BufferedReader reader)
throws ManifestException, IOException {
Attribute attribute = null;
while (true) {
@@ -436,12 +448,12 @@
// continuation line
if (attribute == null) {
if (name != null) {
- // a continuation on the first line is a
- // continuation of the name - concatenate this
+ // a continuation on the first line is a
+ // continuation of the name - concatenate this
// line and the name
name += line.substring(1);
} else {
- throw new ManifestException("Can't start an "
+ throw new ManifestException("Can't start an "
+ "attribute with a continuation line " +
line);
}
} else {
@@ -465,10 +477,10 @@
* @throws ManifestException if the sections cannot be merged.
*/
public void merge(Section section) throws ManifestException {
- if (name == null && section.getName() != null
- || name != null
+ if (name == null && section.getName() != null
+ || name != null
&& !(name.equalsIgnoreCase(section.getName()))) {
- throw new ManifestException("Unable to merge sections "
+ throw new ManifestException("Unable to merge sections "
+ "with different names");
}
@@ -539,7 +551,7 @@
public Enumeration getAttributeKeys() {
return attributeIndex.elements();
}
-
+
/**
* Get the value of the attribute with the name given.
*
@@ -574,11 +586,11 @@
*
* @exception ManifestException if the attribute is not valid.
*/
- public void addConfiguredAttribute(Attribute attribute)
+ public void addConfiguredAttribute(Attribute attribute)
throws ManifestException {
String check = addAttributeAndCheck(attribute);
if (check != null) {
- throw new BuildException("Specify the section name using "
+ throw new BuildException("Specify the section name using "
+ "the \"name\" attribute of the <section> element
rather "
+ "than using a \"Name\" manifest attribute");
}
@@ -589,36 +601,36 @@
*
* @param attribute the attribute to be added.
*
- * @return the value of the attribute if it is a name
+ * @return the value of the attribute if it is a name
* attribute - null other wise
*
- * @exception ManifestException if the attribute already
+ * @exception ManifestException if the attribute already
* exists in this section.
*/
- public String addAttributeAndCheck(Attribute attribute)
+ public String addAttributeAndCheck(Attribute attribute)
throws ManifestException {
if (attribute.getName() == null || attribute.getValue() == null)
{
throw new BuildException("Attributes must have name and
value");
}
if (attribute.getKey().equalsIgnoreCase(ATTRIBUTE_NAME)) {
- warnings.addElement("\"" + ATTRIBUTE_NAME + "\" attributes "
+ warnings.addElement("\"" + ATTRIBUTE_NAME + "\" attributes "
+ "should not occur in the main section and must be the "
- + "first element in all other sections: \""
+ + "first element in all other sections: \""
+ attribute.getName() + ": " + attribute.getValue() +
"\"");
return attribute.getValue();
}
if (attribute.getKey().startsWith(ATTRIBUTE_FROM.toLowerCase()))
{
- warnings.addElement("Manifest attributes should not start "
- + "with \"" + ATTRIBUTE_FROM + "\" in \""
+ warnings.addElement("Manifest attributes should not start "
+ + "with \"" + ATTRIBUTE_FROM + "\" in \""
+ attribute.getName() + ": " + attribute.getValue() +
"\"");
} else {
// classpath attributes go into a vector
String attributeKey = attribute.getKey();
if (attributeKey.equals(ATTRIBUTE_CLASSPATH)) {
- Attribute classpathAttribute =
+ Attribute classpathAttribute =
(Attribute) attributes.get(attributeKey);
-
+
if (classpathAttribute == null) {
storeAttribute(attribute);
} else {
@@ -629,8 +641,8 @@
}
}
} else if (attributes.containsKey(attributeKey)) {
- throw new ManifestException("The attribute \""
- + attribute.getName() + "\" may not occur more "
+ throw new ManifestException("The attribute \""
+ + attribute.getName() + "\" may not occur more "
+ "than once in the same section");
} else {
storeAttribute(attribute);
@@ -638,7 +650,7 @@
}
return null;
}
-
+
/**
* Store an attribute and update the index.
*
@@ -669,11 +681,11 @@
*/
public int hashCode() {
int hashCode = 0;
-
+
if (name != null) {
hashCode += name.hashCode();
}
-
+
hashCode += attributes.hashCode();
return hashCode;
}
@@ -685,13 +697,13 @@
if (rhs == null || rhs.getClass() != getClass()) {
return false;
}
-
+
if (rhs == this) {
return true;
}
Section rhsSection = (Section) rhs;
-
+
return attributes.equals(rhsSection.attributes);
}
}
@@ -715,7 +727,7 @@
private File manifestFile;
/**
- * The mode with which the manifest file is written
+ * The mode with which the manifest file is written
*/
private Mode mode;
@@ -723,7 +735,7 @@
* Construct a manifest from Ant's default manifest file.
*
* @return the default manifest.
- * @exception BuildException if there is a problem loading the
+ * @exception BuildException if there is a problem loading the
* default manifest
*/
public static Manifest getDefaultManifest() throws BuildException {
@@ -731,7 +743,7 @@
String defManifest = "/org/apache/tools/ant/defaultManifest.mf";
InputStream in = Manifest.class.getResourceAsStream(defManifest);
if (in == null) {
- throw new BuildException("Could not find default manifest: "
+ throw new BuildException("Could not find default manifest: "
+ defManifest);
}
try {
@@ -758,7 +770,7 @@
*
* @param r is the reader from which the Manifest is read
*
- * @throws ManifestException if the manifest is not valid according
+ * @throws ManifestException if the manifest is not valid according
* to the JAR spec
* @throws IOException if the manifest cannot be read from the reader.
*/
@@ -766,7 +778,7 @@
BufferedReader reader = new BufferedReader(r);
// This should be the manifest version
String nextSectionName = mainSection.read(reader);
- String readManifestVersion
+ String readManifestVersion
= mainSection.getAttributeValue(ATTRIBUTE_MANIFEST_VERSION);
if (readManifestVersion != null) {
manifestVersion = readManifestVersion;
@@ -783,15 +795,15 @@
if (nextSectionName == null) {
Attribute sectionName = new Attribute(line);
if (!sectionName.getName().equalsIgnoreCase(ATTRIBUTE_NAME))
{
- throw new ManifestException("Manifest sections should "
- + "start with a \"" + ATTRIBUTE_NAME
- + "\" attribute and not \""
+ throw new ManifestException("Manifest sections should "
+ + "start with a \"" + ATTRIBUTE_NAME
+ + "\" attribute and not \""
+ sectionName.getName() + "\"");
}
nextSectionName = sectionName.getValue();
} else {
// we have already started reading this section
- // this line is the first attribute. set it and then
+ // this line is the first attribute. set it and then
// let the normal read handle the rest
Attribute firstAttribute = new Attribute(line);
section.addAttributeAndCheck(firstAttribute);
@@ -810,7 +822,7 @@
*
* @exception ManifestException if the secti0on is not valid.
*/
- public void addConfiguredSection(Section section)
+ public void addConfiguredSection(Section section)
throws ManifestException {
String sectionName = section.getName();
if (sectionName == null) {
@@ -829,7 +841,7 @@
*
* @exception ManifestException if the attribute is not valid.
*/
- public void addConfiguredAttribute(Attribute attribute)
+ public void addConfiguredAttribute(Attribute attribute)
throws ManifestException {
mainSection.addConfiguredAttribute(attribute);
}
@@ -839,7 +851,7 @@
*
* @param other the Manifest to be merged with this one.
*
- * @throws ManifestException if there is a problem merging the
+ * @throws ManifestException if there is a problem merging the
* manfest according to the Manifest spec.
*/
public void merge(Manifest other) throws ManifestException {
@@ -850,13 +862,13 @@
* Merge the contents of the given manifest into this manifest
*
* @param other the Manifest to be merged with this one.
- * @param overwriteMain whether to overwrite the main section
+ * @param overwriteMain whether to overwrite the main section
* of the current manifest
*
- * @throws ManifestException if there is a problem merging the
+ * @throws ManifestException if there is a problem merging the
* manfest according to the Manifest spec.
*/
- public void merge(Manifest other, boolean overwriteMain)
+ public void merge(Manifest other, boolean overwriteMain)
throws ManifestException {
if (other != null) {
if (overwriteMain) {
@@ -873,7 +885,7 @@
while (e.hasMoreElements()) {
String sectionName = (String) e.nextElement();
Section ourSection = (Section) sections.get(sectionName);
- Section otherSection
+ Section otherSection
= (Section) other.sections.get(sectionName);
if (ourSection == null) {
if (otherSection != null) {
@@ -895,19 +907,19 @@
*/
public void write(PrintWriter writer) throws IOException {
writer.print(ATTRIBUTE_MANIFEST_VERSION + ": " + manifestVersion +
EOL);
- String signatureVersion
+ String signatureVersion
= mainSection.getAttributeValue(ATTRIBUTE_SIGNATURE_VERSION);
if (signatureVersion != null) {
- writer.print(ATTRIBUTE_SIGNATURE_VERSION + ": "
+ writer.print(ATTRIBUTE_SIGNATURE_VERSION + ": "
+ signatureVersion + EOL);
mainSection.removeAttribute(ATTRIBUTE_SIGNATURE_VERSION);
}
mainSection.write(writer);
-
+
// add it back
if (signatureVersion != null) {
try {
- Attribute svAttr = new
Attribute(ATTRIBUTE_SIGNATURE_VERSION,
+ Attribute svAttr = new Attribute(ATTRIBUTE_SIGNATURE_VERSION,
signatureVersion);
mainSection.addConfiguredAttribute(svAttr);
} catch (ManifestException e) {
@@ -926,7 +938,7 @@
/**
* Convert the manifest to its string representation
*
- * @return a multiline string with the Manifest as it
+ * @return a multiline string with the Manifest as it
* appears in a Manifest file.
*/
public String toString() {
@@ -947,16 +959,16 @@
public Enumeration getWarnings() {
Vector warnings = new Vector();
- Enumeration warnEnum = mainSection.getWarnings();
+ Enumeration warnEnum = mainSection.getWarnings();
while (warnEnum.hasMoreElements()) {
warnings.addElement(warnEnum.nextElement());
}
// create a vector and add in the warnings for all the sections
- Enumeration e = sections.elements();
+ Enumeration e = sections.elements();
while (e.hasMoreElements()) {
Section section = (Section) e.nextElement();
- Enumeration e2 = section.getWarnings();
+ Enumeration e2 = section.getWarnings();
while (e2.hasMoreElements()) {
warnings.addElement(e2.nextElement());
}
@@ -970,16 +982,16 @@
*/
public int hashCode() {
int hashCode = 0;
-
+
if (manifestVersion != null) {
hashCode += manifestVersion.hashCode();
}
hashCode += mainSection.hashCode();
hashCode += sections.hashCode();
-
+
return hashCode;
}
-
+
/**
* @see java.lang.Object#equals
*/
@@ -991,7 +1003,7 @@
if (rhs == this) {
return true;
}
-
+
Manifest rhsManifest = (Manifest) rhs;
if (manifestVersion == null) {
if (rhsManifest.manifestVersion != null) {
@@ -1009,8 +1021,8 @@
}
/**
- * The name of the manifest file to write (if used as a task).
- *
+ * The name of the manifest file to create/update.
+ * Required if used as a task.
* @param f the Manifest file to be written
*/
public void setFile(File f) {
@@ -1018,8 +1030,7 @@
}
/**
- * Shall we update or replace an existing manifest?
- *
+ * Update policy: either "update" or "replace"; default is "replace".
* @param m the mode value - update or replace.
*/
public void setMode(Mode m) {
@@ -1113,7 +1124,7 @@
}
if (toWrite.equals(current)) {
- log("Manifest has not changed, do not recreate",
+ log("Manifest has not changed, do not recreate",
Project.MSG_VERBOSE);
return;
}
1.18.2.1 +13 -0
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Mkdir.java
Index: Mkdir.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Mkdir.java,v
retrieving revision 1.18
retrieving revision 1.18.2.1
diff -u -r1.18 -r1.18.2.1
--- Mkdir.java 12 Apr 2002 08:12:54 -0000 1.18
+++ Mkdir.java 18 Jun 2002 05:51:10 -0000 1.18.2.1
@@ -60,6 +60,8 @@
/**
* Creates a given directory.
+ * Creates a directory and any non-existent parent directories, when
+ * necessary
*
* @author [EMAIL PROTECTED]
* @since Ant 1.1
@@ -69,8 +71,15 @@
public class Mkdir extends Task {
+ /**
+ * our little directory
+ */
private File dir;
+ /**
+ * create the directory and all parents
+ * @throws BuildException if dir is somehow invalid, or creation failed.
+ */
public void execute() throws BuildException {
if (dir == null) {
throw new BuildException("dir attribute is required", location);
@@ -93,6 +102,10 @@
}
}
+ /**
+ * the directory to create; required.
+ * @param dir
+ */
public void setDir(File dir) {
this.dir = dir;
}
1.25.2.2 +7 -4
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Move.java
Index: Move.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Move.java,v
retrieving revision 1.25.2.1
retrieving revision 1.25.2.2
diff -u -r1.25.2.1 -r1.25.2.2
--- Move.java 31 May 2002 20:53:23 -0000 1.25.2.1
+++ Move.java 18 Jun 2002 05:51:10 -0000 1.25.2.2
@@ -65,11 +65,13 @@
import java.util.Enumeration;
/**
- * Moves a file or directory to a new file or directory. By default,
- * the destination is overwriten when existing. When overwrite is
+ * Moves a file or directory to a new file or directory.
+ * By default, the
+ * destination file is overwritten if it already exists.
+ * When <i>overwrite</i> is
* turned off, then files are only moved if the source file is
* newer than the destination file, or when the destination file does
- * not exist.</p>
+ * not exist.
*
* <p>Source files and directories are only deleted when the file or
* directory has been copied to the destination successfully. Filtering
@@ -227,6 +229,7 @@
/**
* Its only ok to delete a directory tree if there are
* no files in it.
+ * @return true if a deletion can go ahead
*/
protected boolean okToDelete(File d) {
String[] list = d.list();
1.8.2.1 +33 -1
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Pack.java
Index: Pack.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Pack.java,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -u -r1.8 -r1.8.2.1
--- Pack.java 15 Apr 2002 13:36:17 -0000 1.8
+++ Pack.java 18 Jun 2002 05:51:10 -0000 1.8.2.1
@@ -76,15 +76,28 @@
protected File zipFile;
protected File source;
+ /**
+ * the required destination file.
+ * @param zipFile
+ */
public void setZipfile(File zipFile) {
this.zipFile = zipFile;
}
+ /**
+ * the file to compress; required.
+ * @param src
+ */
public void setSrc(File src) {
source = src;
}
- private void validate() {
+
+ /**
+ * validation routine
+ * @throws BuildException if anything is invalid
+ */
+ private void validate() throws BuildException {
if (zipFile == null) {
throw new BuildException("zipfile attribute is required",
location);
}
@@ -104,6 +117,10 @@
}
}
+ /**
+ * validate, then hand off to the subclass
+ * @throws BuildException
+ */
public void execute() throws BuildException {
validate();
@@ -116,6 +133,12 @@
}
}
+ /**
+ * zip a stream to an output stream
+ * @param in
+ * @param zOut
+ * @throws IOException
+ */
private void zipFile(InputStream in, OutputStream zOut)
throws IOException {
byte[] buffer = new byte[8 * 1024];
@@ -126,6 +149,12 @@
} while (count != -1);
}
+ /**
+ * zip a file to an output stream
+ * @param file
+ * @param zOut
+ * @throws IOException
+ */
protected void zipFile(File file, OutputStream zOut)
throws IOException {
FileInputStream fIn = new FileInputStream(file);
@@ -136,5 +165,8 @@
}
}
+ /**
+ * subclasses must implement this method to do their compression
+ */
protected abstract void pack();
}
1.10.2.1 +12 -5
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Parallel.java
Index: Parallel.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Parallel.java,v
retrieving revision 1.10
retrieving revision 1.10.2.1
diff -u -r1.10 -r1.10.2.1
--- Parallel.java 15 Apr 2002 13:36:17 -0000 1.10
+++ Parallel.java 18 Jun 2002 05:51:10 -0000 1.10.2.1
@@ -65,7 +65,8 @@
/**
- * Implements a multi threaded task execution.
+ * Executes the contained tasks in separate threads, continuing
+ * once all are completed.
* <p>
* @author Thomas Christen <a href="mailto:[EMAIL PROTECTED]">[EMAIL
PROTECTED]</a>
* @author Conor MacNeill
@@ -81,8 +82,7 @@
/**
- * Add a nested task to execute parallel (asynchron).
- * <p>
+ * Add a nested task to execute in parallel.
* @param nestedTask Nested task to be executed in parallel
*/
public void addTask(Task nestedTask) throws BuildException {
@@ -150,6 +150,9 @@
}
}
+ /**
+ * thread that execs a task
+ */
class TaskThread extends Thread {
private Throwable exception;
private Task task;
@@ -176,8 +179,12 @@
exception = t;
}
}
-
- public Throwable getException() {
+
+ /**
+ * get any exception that got thrown during execution;
+ * @return an exception or null for no exception/not yet finished
+ */
+ public Throwable getException() {
return exception;
}
}
1.15.2.2 +15 -8
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Patch.java
Index: Patch.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Patch.java,v
retrieving revision 1.15.2.1
retrieving revision 1.15.2.2
diff -u -r1.15.2.1 -r1.15.2.2
--- Patch.java 15 May 2002 13:48:49 -0000 1.15.2.1
+++ Patch.java 18 Jun 2002 05:51:10 -0000 1.15.2.2
@@ -62,8 +62,8 @@
import java.io.IOException;
/**
- * Task as a layer on top of patch. Patch applies a diff file to an original.
- *
+ * Patches a file by applying a 'diff' file to it; requires "patch" to be
+ * on the execution path.
* @author <a href="mailto:[EMAIL PROTECTED]">Stefan Bodewig</a>
*
* @since Ant 1.1
@@ -78,14 +78,15 @@
private Commandline cmd = new Commandline();
/**
- * The file to patch.
+ * The file to patch; optional if it can be inferred from
+ * the diff file
*/
public void setOriginalfile(File file) {
originalFile = file;
}
/**
- * The file containing the diff output.
+ * The file containing the diff output; required.
*/
public void setPatchfile(File file) {
if (!file.exists()) {
@@ -98,7 +99,7 @@
}
/**
- * Shall patch write backups.
+ * flag to create backups; optional, default=false
*/
public void setBackups(boolean backups) {
if (backups) {
@@ -107,7 +108,7 @@
}
/**
- * Ignore whitespace differences.
+ * flag to ignore whitespace differences; default=false
*/
public void setIgnorewhitespace(boolean ignore) {
if (ignore) {
@@ -120,6 +121,7 @@
* from filenames.
*
* <p>patch's <i>-p</i> option.
+ * @param num number of lines to strip
*/
public void setStrip(int num) throws BuildException {
if (num < 0) {
@@ -129,7 +131,7 @@
}
/**
- * Work silently unless an error occurs.
+ * Work silently unless an error occurs; optional, default=false
*/
public void setQuiet(boolean q) {
if (q) {
@@ -138,7 +140,8 @@
}
/**
- * Assume patch was created with old and new files swapped.
+ * Assume patch was created with old and new files swapped; optional,
+ * default=false
*/
public void setReverse(boolean r) {
if (r) {
@@ -156,6 +159,10 @@
this.directory = directory;
}
+ /**
+ * execute patch
+ * @throws BuildException when it all goes a bit pear shaped
+ */
public void execute() throws BuildException {
if (!havePatchfile) {
throw new BuildException("patchfile argument is required",
1.18.2.1 +85 -27
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/PathConvert.java
Index: PathConvert.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/PathConvert.java,v
retrieving revision 1.18
retrieving revision 1.18.2.1
diff -u -r1.18 -r1.18.2.1
--- PathConvert.java 30 Apr 2002 05:03:04 -0000 1.18
+++ PathConvert.java 18 Jun 2002 05:51:10 -0000 1.18.2.1
@@ -70,7 +70,7 @@
/**
* This task converts path and classpath information to a specific target OS
- * format. The resulting formatted path is placed into a specified property.
+ * format. The resulting formatted path is placed into the specified
property.
*
* @author Larry Streepy <a href="mailto:[EMAIL PROTECTED]">
* [EMAIL PROTECTED]</a>
@@ -80,27 +80,54 @@
public class PathConvert extends Task {
// Members
- private Path path = null;// Path to be converted
- private Reference refid = null;// Reference to path/fileset to
- // convert
- private String targetOS = null;// The target OS type
- private boolean targetWindows = false;// Set when targetOS is set
- private boolean onWindows = false;// Set if we're running on windows
- private String property = null;// The property to receive the
- //results
- private Vector prefixMap = new Vector();// Path prefix map
- private String pathSep = null;// User override on path sep char
- private String dirSep = null;// User override on directory sep
- // char
+ /**
+ * Path to be converted
+ */
+ private Path path = null;
+ /**
+ * Reference to path/fileset to convert
+ */
+ private Reference refid = null;
+ /**
+ * The target OS type
+ */
+ private String targetOS = null;
+ /**
+ * Set when targetOS is set to windows
+ */
+ private boolean targetWindows = false;
+ /**
+ * Set if we're running on windows
+ */
+ private boolean onWindows = false;
+ /**
+ * The property to receive the conversion
+ */
+ private String property = null;//
+ /**
+ * Path prefix map
+ */
+ private Vector prefixMap = new Vector();
+ /**
+ * User override on path sep char
+ */
+ private String pathSep = null;
+ /**
+ * User override on directory sep char
+ */
+ private String dirSep = null;
+ /**
+ * constructor
+ */
public PathConvert() {
onWindows = Os.isFamily("dos");
}
/**
- * Helper class, holds the nested <map> values. Elements will look like
- * this: <map from="d:" to="/foo"/> <p>
+ * Helper class, holds the nested <map> values. Elements will look
like
+ * this: <map from="d:" to="/foo"/>
*
* When running on windows, the prefix comparison will be case
* insensitive.
@@ -108,12 +135,21 @@
public class MapEntry {
/** Set the "from" attribute of the map entry */
+ /**
+ * the prefix string to search for; required.
+ * Note that this value is case-insensitive when the build is
+ * running on a Windows platform and case-sensitive when running on
+ * a Unix platform.
+ * @param from
+ */
public void setFrom(String from) {
this.from = from;
}
-
- /** Set the "to" attribute of the map entry */
+ /**
+ * The replacement text to use when from is matched; required.
+ * @param to new prefix
+ */
public void setTo(String to) {
this.to = to;
}
@@ -157,6 +193,10 @@
}
+ /**
+ * an enumeration of supported targets:
+ * windows", "unix", "netware", and "os/2".
+ */
public static class TargetOs extends EnumeratedAttribute {
public String[] getValues() {
return new String[]{"windows", "unix", "netware", "os/2"};
@@ -178,7 +218,10 @@
}
- /** Create a nested MAP element */
+ /**
+ * Create a nested MAP element
+ * @return a Map to configure
+ */
public MapEntry createMap() {
MapEntry entry = new MapEntry();
@@ -189,10 +232,12 @@
/**
- * Set the value of the targetos attribute
+ * Set targetos to a platform to one of
+ * "windows", "unix", "netware", or "os/2"; required unless
+ * unless pathsep and/or dirsep are specified.
*
* @deprecated use the method taking a TargetOs argument instead
- * @see setTargetos(TargetOs)
+ * @see #setTargetos(TargetOs)
*/
public void setTargetos(String target) {
TargetOs to = new TargetOs();
@@ -203,7 +248,9 @@
/**
- * Set the value of the targetos attribute
+ * Set targetos to a platform to one of
+ * "windows", "unix", "netware", or "os/2"; required unless
+ * unless pathsep and/or dirsep are specified.
*
* @since Ant 1.5
*/
@@ -223,8 +270,7 @@
/**
- * Set the value of the property attribute - this is the property into
- * which our converted path will be placed.
+ * The property into which the converted path will be placed.
*/
public void setProperty(String p) {
property = p;
@@ -244,27 +290,39 @@
}
- /** Override the default path separator string for the target os */
+ /**
+ * Set the default path separator string;
+ * defaults to current JVM
+ * [EMAIL PROTECTED] java.io.File#pathSeparator File.pathSeparator}
+ * @param sep path separator string
+ */
public void setPathSep(String sep) {
pathSep = sep;
}
/**
- * Override the default directory separator string for the target os
+ * Set the default directory separator string;
+ * defaults to current JVM [EMAIL PROTECTED] java.io.File#separator
File.separator}
+ * @param sep directory separator string
*/
public void setDirSep(String sep) {
dirSep = sep;
}
- /** Has the refid attribute of this element been set? */
+ /**
+ * Has the refid attribute of this element been set?
+ * @return true if refid is valid
+ */
public boolean isReference() {
return refid != null;
}
- /** Do the execution. */
+ /** Do the execution.
+ * @throws BuildException if something is invalid
+ */
public void execute() throws BuildException {
Path savedPath = path;
String savedPathSep = pathSep;// may be altered in validateSetup
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>