PR: 21319 Submitted by: Patrick G. Heck (gus dot heck at olin dot edu) git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274753 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -73,12 +73,14 @@ import org.apache.tools.ant.types.Commandline; | |||||
| import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
| /** | /** | ||||
| * @author Patrick G. Heck <a href="mailto:gus.heck@olin.edu">gus.heck@olin.edu</a> | |||||
| * @author Patrick G. Heck | |||||
| * <a href="mailto:gus.heck@olin.edu">gus.heck@olin.edu</a> | |||||
| * @since Ant 1.6 | * @since Ant 1.6 | ||||
| * | * | ||||
| * @ant.task category="filesystem" | * @ant.task category="filesystem" | ||||
| */ | */ | ||||
| public abstract class AbstractAccessTask | |||||
| public abstract class AbstractAccessTask | |||||
| extends org.apache.tools.ant.taskdefs.ExecuteOn { | extends org.apache.tools.ant.taskdefs.ExecuteOn { | ||||
| /** | /** | ||||
| @@ -89,6 +91,9 @@ public abstract class AbstractAccessTask | |||||
| super.setSkipEmptyFilesets(true); | super.setSkipEmptyFilesets(true); | ||||
| } | } | ||||
| /** | |||||
| * Set the file which should have its access attributes modified. | |||||
| */ | |||||
| public void setFile(File src) { | public void setFile(File src) { | ||||
| FileSet fs = new FileSet(); | FileSet fs = new FileSet(); | ||||
| fs.setFile(src); | fs.setFile(src); | ||||
| @@ -96,16 +101,22 @@ public abstract class AbstractAccessTask | |||||
| } | } | ||||
| /** | /** | ||||
| * Prevent the user from specifying a different command. | |||||
| * | |||||
| * @ant.attribute ignore="true" | * @ant.attribute ignore="true" | ||||
| * @param cmdl A user supplied command line that we won't accept. | |||||
| */ | */ | ||||
| public void setCommand(Commandline cmdl) { | public void setCommand(Commandline cmdl) { | ||||
| throw new BuildException(taskType + | |||||
| " doesn\'t support the command attribute", | |||||
| throw new BuildException(taskType | |||||
| + " doesn\'t support the command attribute", | |||||
| getLocation()); | getLocation()); | ||||
| } | } | ||||
| /** | /** | ||||
| * Prevent the skipping of empty filesets | |||||
| * | |||||
| * @ant.attribute ignore="true" | * @ant.attribute ignore="true" | ||||
| * @param skip A user supplied boolean we won't accept. | |||||
| */ | */ | ||||
| public void setSkipEmptyFilesets(boolean skip) { | public void setSkipEmptyFilesets(boolean skip) { | ||||
| throw new BuildException(taskType + " doesn\'t support the " | throw new BuildException(taskType + " doesn\'t support the " | ||||
| @@ -114,13 +125,19 @@ public abstract class AbstractAccessTask | |||||
| } | } | ||||
| /** | /** | ||||
| * Prevent the use of the addsourcefile atribute. | |||||
| * | |||||
| * @ant.attribute ignore="true" | * @ant.attribute ignore="true" | ||||
| * @param b A user supplied boolean we won't accept. | |||||
| */ | */ | ||||
| public void setAddsourcefile(boolean b) { | public void setAddsourcefile(boolean b) { | ||||
| throw new BuildException(getTaskType() | throw new BuildException(getTaskType() | ||||
| + " doesn\'t support the addsourcefile attribute", getLocation()); | + " doesn\'t support the addsourcefile attribute", getLocation()); | ||||
| } | } | ||||
| /** | |||||
| * Automatically approve Unix OS's. | |||||
| */ | |||||
| protected boolean isValidOs() { | protected boolean isValidOs() { | ||||
| return Os.isFamily("unix") && super.isValidOs(); | return Os.isFamily("unix") && super.isValidOs(); | ||||
| } | } | ||||
| @@ -70,7 +70,7 @@ import org.apache.tools.ant.BuildException; | |||||
| /** | /** | ||||
| * Chgrp equivalent for unix-like environments. | * Chgrp equivalent for unix-like environments. | ||||
| * | * | ||||
| * @author Patrick G. Heck | |||||
| * @author Patrick G. Heck | |||||
| * <a href="mailto:gus.heck@olin.edu">gus.heck@olin.edu</a> | * <a href="mailto:gus.heck@olin.edu">gus.heck@olin.edu</a> | ||||
| * | * | ||||
| * @since Ant 1.6 | * @since Ant 1.6 | ||||
| @@ -98,20 +98,26 @@ public class Chgrp extends AbstractAccessTask { | |||||
| haveGroup = true; | haveGroup = true; | ||||
| } | } | ||||
| /** | |||||
| * Ensure that all the required arguments and other conditions have | |||||
| * been set. | |||||
| */ | |||||
| protected void checkConfiguration() { | protected void checkConfiguration() { | ||||
| if (!haveGroup) { | if (!haveGroup) { | ||||
| throw new BuildException("Required attribute group not set in "+ | |||||
| "chgrp", getLocation()); | |||||
| throw new BuildException("Required attribute group not set in " | |||||
| + "chgrp", getLocation()); | |||||
| } | } | ||||
| super.checkConfiguration(); | super.checkConfiguration(); | ||||
| } | } | ||||
| /** | /** | ||||
| * We don't want to expose the executable atribute, so overide it. | * We don't want to expose the executable atribute, so overide it. | ||||
| * | |||||
| * @param e User supplied executable that we won't accept. | |||||
| */ | */ | ||||
| public void setExecutable(String e) { | public void setExecutable(String e) { | ||||
| throw new BuildException(taskType + | |||||
| " doesn\'t support the executable attribute", | |||||
| getLocation()); | |||||
| throw new BuildException(taskType | |||||
| + " doesn\'t support the executable" | |||||
| + " attribute", getLocation()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -70,7 +70,7 @@ import org.apache.tools.ant.BuildException; | |||||
| /** | /** | ||||
| * Chown equivalent for unix-like environments. | * Chown equivalent for unix-like environments. | ||||
| * | * | ||||
| * @author Patrick G. Heck | |||||
| * @author Patrick G. Heck | |||||
| * <a href="mailto:gus.heck@olin.edu">gus.heck@olin.edu</a> | * <a href="mailto:gus.heck@olin.edu">gus.heck@olin.edu</a> | ||||
| * | * | ||||
| * @since Ant 1.6 | * @since Ant 1.6 | ||||
| @@ -98,20 +98,26 @@ public class Chown extends AbstractAccessTask { | |||||
| haveOwner = true; | haveOwner = true; | ||||
| } | } | ||||
| /** | |||||
| * Ensure that all the required arguments and other conditions have | |||||
| * been set. | |||||
| */ | |||||
| protected void checkConfiguration() { | protected void checkConfiguration() { | ||||
| if (!haveOwner) { | if (!haveOwner) { | ||||
| throw new BuildException("Required attribute owner not set in" + | |||||
| " chown", getLocation()); | |||||
| throw new BuildException("Required attribute owner not set in" | |||||
| + " chown", getLocation()); | |||||
| } | } | ||||
| super.checkConfiguration(); | super.checkConfiguration(); | ||||
| } | } | ||||
| /** | /** | ||||
| * We don't want to expose the executable atribute, so overide it. | * We don't want to expose the executable atribute, so overide it. | ||||
| * | |||||
| * @param e User supplied executable that we won't accept. | |||||
| */ | */ | ||||
| public void setExecutable(String e) { | public void setExecutable(String e) { | ||||
| throw new BuildException(taskType + | |||||
| " doesn\'t support the executable attribute", | |||||
| getLocation()); | |||||
| throw new BuildException(taskType | |||||
| + " doesn\'t support the executable" | |||||
| + " attribute", getLocation()); | |||||
| } | } | ||||
| } | } | ||||