Package org.apache.tools.ant.taskdefs
Class Chmod
- java.lang.Object
-
- org.apache.tools.ant.ProjectComponent
-
- org.apache.tools.ant.Task
-
- org.apache.tools.ant.taskdefs.ExecTask
-
- org.apache.tools.ant.taskdefs.ExecuteOn
-
- org.apache.tools.ant.taskdefs.Chmod
-
- All Implemented Interfaces:
java.lang.Cloneable
public class Chmod extends ExecuteOn
Chmod equivalent for unix-like environments.- Since:
- Ant 1.1
- To do:
- Refactor so it does not extend from ExecuteOn and then turn around and unsupport several attributes.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.tools.ant.taskdefs.ExecuteOn
ExecuteOn.FileDirBoth
-
-
Field Summary
-
Fields inherited from class org.apache.tools.ant.taskdefs.ExecuteOn
destDir, filesets, mapper, mapperElement, srcFilePos, srcIsFirst, targetFilePos, type
-
Fields inherited from class org.apache.tools.ant.taskdefs.ExecTask
cmdl, failOnError, newEnvironment, redirector, redirectorElement
-
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
-
-
Constructor Summary
Constructors Constructor Description Chmod()Chmod task for setting file and directory permissions.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckConfiguration()Check the attributes and nested elements.PatternSet.NameEntrycreateExclude()Add a name entry on the exclude list.PatternSet.NameEntrycreateInclude()Add a name entry on the include list.PatternSetcreatePatternSet()Add a set of patterns.voidexecute()Carry out the chmoding.protected booleanisValidOs()Check if the os is valid.voidsetAddsourcefile(boolean b)This is not allowed for Chmod.voidsetCommand(Commandline cmdl)Set the command.voidsetDefaultexcludes(boolean useDefaultExcludes)Sets whether default exclusions should be used or not.voidsetDir(java.io.File src)The directory which holds the files whose permissions must be changed.voidsetExcludes(java.lang.String excludes)Sets the set of exclude patterns.voidsetExecutable(java.lang.String e)Set the executable.voidsetFile(java.io.File src)The file or single directory of which the permissions must be changed.voidsetIncludes(java.lang.String includes)Sets the set of include patterns.voidsetPerm(java.lang.String perm)Set the new permissions.voidsetProject(Project project)Set the project of this task.voidsetSkipEmptyFilesets(boolean skip)This is not allowed for Chmod.-
Methods inherited from class org.apache.tools.ant.taskdefs.ExecuteOn
add, add, addDirset, addFilelist, addFileset, createHandler, createMapper, createSrcfile, createTargetfile, getCommandline, getCommandline, getDirs, getFiles, getFilesAndDirs, runExec, runParallel, setDest, setForce, setForwardslash, setIgnoremissing, setMaxParallel, setParallel, setRelative, setType, setupRedirector, setVerbose
-
Methods inherited from class org.apache.tools.ant.taskdefs.ExecTask
addConfiguredRedirector, addEnv, createArg, createWatchdog, getOs, getOsFamily, getResolveExecutable, logFlush, maybeSetResultPropertyValue, prepareExec, resolveExecutable, runExecute, setAppend, setError, setErrorProperty, setFailIfExecutionFails, setFailonerror, setInput, setInputString, setLogError, setNewenvironment, setOs, setOsFamily, setOutput, setOutputproperty, setResolveExecutable, setResultProperty, setSearchPath, setSpawn, setTimeout, setTimeout, setVMLauncher
-
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
-
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation
-
-
-
-
Method Detail
-
setProject
public void setProject(Project project)
Set the project of this task. Calls the super class and sets the project on dhe default FileSet.- Overrides:
setProjectin classProjectComponent- Parameters:
project- the project for this task.- See Also:
ProjectComponent.setProject(org.apache.tools.ant.Project)
-
setFile
public void setFile(java.io.File src)
The file or single directory of which the permissions must be changed.- Parameters:
src- the source file or directory.
-
setDir
public void setDir(java.io.File src)
The directory which holds the files whose permissions must be changed.
-
setPerm
public void setPerm(java.lang.String perm)
Set the new permissions.- Parameters:
perm- the new permissions.
-
createInclude
public PatternSet.NameEntry createInclude()
Add a name entry on the include list.- Returns:
- a NameEntry to be configured.
-
createExclude
public PatternSet.NameEntry createExclude()
Add a name entry on the exclude list.- Returns:
- a nameentry to be configured.
-
createPatternSet
public PatternSet createPatternSet()
Add a set of patterns.- Returns:
- a patternset to be configured.
-
setIncludes
public void setIncludes(java.lang.String includes)
Sets the set of include patterns. Patterns may be separated by a comma or a space.- Parameters:
includes- the string containing the include patterns.
-
setExcludes
public void setExcludes(java.lang.String excludes)
Sets the set of exclude patterns. Patterns may be separated by a comma or a space.- Parameters:
excludes- the string containing the exclude patterns.
-
setDefaultexcludes
public void setDefaultexcludes(boolean useDefaultExcludes)
Sets whether default exclusions should be used or not.- Parameters:
useDefaultExcludes- "true"|"on"|"yes" when default exclusions should be used, "false"|"off"|"no" when they shouldn't be used.
-
checkConfiguration
protected void checkConfiguration()
Check the attributes and nested elements.- Overrides:
checkConfigurationin classExecuteOn
-
execute
public void execute() throws BuildExceptionCarry out the chmoding.- Overrides:
executein classExecTask- Throws:
BuildException- on error.
-
setExecutable
public void setExecutable(java.lang.String e)
Set the executable. This is not allowed for Chmod.- Overrides:
setExecutablein classExecTask- Parameters:
e- ignored.- Throws:
BuildException- always.
-
setCommand
public void setCommand(Commandline cmdl)
Set the command. This is not allowed for Chmod.- Overrides:
setCommandin classExecTask- Parameters:
cmdl- ignored.- Throws:
BuildException- always.
-
setSkipEmptyFilesets
public void setSkipEmptyFilesets(boolean skip)
This is not allowed for Chmod.- Overrides:
setSkipEmptyFilesetsin classExecuteOn- Parameters:
skip- ignored.- Throws:
BuildException- always.
-
setAddsourcefile
public void setAddsourcefile(boolean b)
This is not allowed for Chmod.- Overrides:
setAddsourcefilein classExecuteOn- Parameters:
b- ignored.- Throws:
BuildException- always.
-
-