From e2aa2b359216750af87ec64a9448a1555901b647 Mon Sep 17 00:00:00 2001 From: Matthew Jason Benson Date: Fri, 28 Jan 2005 16:12:37 +0000 Subject: [PATCH] More javadoc git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277548 13f79535-47bb-0310-9956-ffa450edef68 --- .../ant/taskdefs/optional/unix/Symlink.java | 81 ++++++++++--------- 1 file changed, 42 insertions(+), 39 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java b/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java index 3dbefcc96..ebe5623e3 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java @@ -66,29 +66,31 @@ import org.apache.tools.ant.taskdefs.Execute; * *

Examples of use: * - *

Make a link named "foo" to a resource named "bar.foo" in subdir: + *

Make a link named "foo" to a resource named + * "bar.foo" in subdir: *

- * <symlink link="${dir.top}/foo" resource="${dir.top}/subdir/bar.foo"/>
+ * <symlink link="${dir.top}/foo" resource="${dir.top}/subdir/bar.foo"/>
  * 
* - *

Record all links in subdir and it's descendants in files named - * "dir.links" + *

Record all links in subdir and its descendants in files named + * "dir.links" *

- * <symlink action="record" linkfilename="dir.links">
- *    <fileset dir="${dir.top}" includes="subdir/**" />
+ * <symlink action="record" linkfilename="dir.links">
+ *    <fileset dir="${dir.top}" includes="subdir/**" />
  * </symlink>
  * 
* *

Recreate the links recorded in the previous example: *

- * <symlink action="recreate">
- *    <fileset dir="${dir.top}" includes="subdir/**/dir.links" />
+ * <symlink action="recreate">
+ *    <fileset dir="${dir.top}" includes="subdir/**/dir.links" />
  * </symlink>
  * 
* - *

Delete a link named "foo" to a resource named "bar.foo" in subdir: + *

Delete a link named "foo" to a resource named + * "bar.foo" in subdir: *

- * <symlink action="delete" link="${dir.top}/foo"/>
+ * <symlink action="delete" link="${dir.top}/foo"/>
  * 
* *

LIMITATIONS: Because Java has no direct support for @@ -96,17 +98,16 @@ import org.apache.tools.ant.taskdefs.Execute; * absolute paths. On non-unix systems this may cause false positives. * Furthermore, any operating system on which the command * ln -s link resource is not a valid command on the command line - * will not be able to use action= "delete", action="single" or - * action="recreate", but action="record" should still work. Finally, the - * lack of support for symlinks in Java means that all links are recorded - * as links to the canonical resource name. Therefore - * the link: link --> subdir/dir/../foo.bar will be recorded - * as link=subdir/foo.bar and restored as - * link --> subdir/foo.bar + * will not be able to use action= "delete", action="single" + * or action="recreate", but action="record" should still + * work. Finally, the lack of support for symlinks in Java means that all links + * are recorded as links to the canonical resource name. + * Therefore the link: link --> subdir/dir/../foo.bar will be + * recorded as link=subdir/foo.bar and restored as + * link --> subdir/foo.bar. * * @version $Revision$ */ - public class Symlink extends Task { // Attributes with setter methods: @@ -120,8 +121,10 @@ public class Symlink extends Task { private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); - /** Initialize the task. */ - + /** + * Initialize the task. + * @throws BuildException on error. + */ public void init() throws BuildException { super.init(); failonerror = true; // default behavior is to fail on an error @@ -285,17 +288,18 @@ public class Symlink extends Task { } /** - * The setter for the "action" attribute. May be "single", "multi" - * or "record" + * Set the action to be performed. May be + * "single", "multi" or "record". * - * @param typ The action of action to perform. + * @param typ The action to perform. */ public void setAction(String typ) { this.action = typ; } /** - * The setter for the "link" attribute. Only used for action = single. + * Set the same of the link. + * Only used when action = "single". * * @param lnk The name for the link. */ @@ -304,16 +308,18 @@ public class Symlink extends Task { } /** - * The setter for the "resource" attribute. Only used for action = single. + * Set the name of the resource to which a link should be created. + * Only used when action = "single". * - * @param src The source of the resource to be linked. + * @param src The resource to be linked. */ public void setResource(String src) { this.resource = src; } /** - * The setter for the "linkfilename" attribute. Only used for action=record. + * Set the name of the file to which links will be written. + * Only used when action = "record". * * @param lf The name of the file to write links to. */ @@ -322,7 +328,7 @@ public class Symlink extends Task { } /** - * Adds a fileset to this task. + * Add a fileset to this task. * * @param set The fileset to add. */ @@ -335,7 +341,7 @@ public class Symlink extends Task { * ********************************************************** */ /** - * Deletes a symlink without deleteing the resource it points to. + * Deletes a symlink without deleting the resource it points to. * *

This is a convenience method that simply invokes * deleteSymlink(java.io.File). @@ -427,8 +433,6 @@ public class Symlink extends Task { * This method use Properties.store * and thus report exceptions that occur while writing the file. * - * This is not jdk 1.1 compatible, but Ant 1.6 is not anymore. - * * @param properties The properties object to be written. * @param propertyfile The File to write to. * @param comment The comment to place at the head of the file. @@ -443,7 +447,6 @@ public class Symlink extends Task { try { fos = new FileOutputStream(propertyfile); properties.store(fos, comment); - } catch (IOException ioe) { throw new BuildException(ioe, getLocation()); } finally { @@ -528,11 +531,11 @@ public class Symlink extends Task { /** * Finds all the links in all supplied filesets. * - *

This method is invoked when the action attribute is is "record". - * This means that filesets are interpreted as the directories in - * which links may be found. + *

This method is invoked when the action attribute is + * "record". This means that filesets are interpreted + * as the directories in which links may be found. * - *

The basic method follwed here is, for each file set: + *

The basic method followed here is, for each fileset: *

    *
  1. Compile a list of all matches
  2. *
  3. Convert matches to File objects
  4. @@ -545,7 +548,7 @@ public class Symlink extends Task { *
* * @param fileSets The filesets specified by the user. - * @return A vector of File objects containing the + * @return A Vector of File objects containing the * links (with canonical parent directories). */ @@ -647,8 +650,8 @@ public class Symlink extends Task { * Load the links from a properties file. * *

This method is only invoked when the action attribute is set to - * "multi". The filesets passed in are assumed to specify the names - * of the property files with the link information and the + * "multi". The filesets passed in are assumed to specify the + * names of the property files with the link information and the * subdirectories in which to look for them. * *

The basic method follwed here is, for each file set: