org.apache.tools.ant.taskdefs

Class Chmod

Implemented Interfaces:
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.Task

target, taskName, taskType, wrapper

Fields inherited from class org.apache.tools.ant.ProjectComponent

description, location, project

Constructor Summary

Chmod()
Chmod task for setting file and directory permissions.

Method Summary

protected void
checkConfiguration()
Check the attributes and nested elements.
PatternSet.NameEntry
createExclude()
Add a name entry on the exclude list.
PatternSet.NameEntry
createInclude()
Add a name entry on the include list.
PatternSet
createPatternSet()
Add a set of patterns.
void
execute()
Carry out the chmoding.
protected boolean
isValidOs()
Check if the os is valid.
void
setAddsourcefile(boolean b)
This is not allowed for Chmod.
void
setCommand(Commandline cmdl)
Set the command.
void
setDefaultexcludes(boolean useDefaultExcludes)
Sets whether default exclusions should be used or not.
void
setDir(File src)
The directory which holds the files whose permissions must be changed.
void
setExcludes(String excludes)
Sets the set of exclude patterns.
void
setExecutable(String e)
Set the executable.
void
setFile(File src)
The file or single directory of which the permissions must be changed.
void
setIncludes(String includes)
Sets the set of include patterns.
void
setPerm(String perm)
Set the new permissions.
void
setProject(Project project)
Set the project of this task.
void
setSkipEmptyFilesets(boolean skip)
This is not allowed for Chmod.

Methods inherited from class org.apache.tools.ant.taskdefs.ExecuteOn

add, add, addDirset, addFilelist, addFileset, checkConfiguration, createHandler, createMapper, createSrcfile, createTargetfile, getCommandline, getCommandline, getDirs, getFiles, getFilesAndDirs, runExec, runParallel, setAddsourcefile, setDest, setForce, setForwardslash, setIgnoremissing, setMaxParallel, setParallel, setRelative, setSkipEmptyFilesets, setType, setVerbose, setupRedirector

Methods inherited from class org.apache.tools.ant.taskdefs.ExecTask

addConfiguredRedirector, addEnv, checkConfiguration, createArg, createHandler, createWatchdog, execute, getResolveExecutable, isValidOs, logFlush, maybeSetResultPropertyValue, prepareExec, resolveExecutable, runExec, runExecute, setAppend, setCommand, setDir, setError, setErrorProperty, setExecutable, setFailIfExecutionFails, setFailonerror, setInput, setInputString, setLogError, setNewenvironment, setOs, setOsFamily, setOutput, setOutputproperty, setResolveExecutable, setResultProperty, setSearchPath, setSpawn, setTimeout, setTimeout, setVMLauncher, setupRedirector

Methods inherited from class org.apache.tools.ant.Task

bindToOwner, execute, 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, log, log, setDescription, setLocation, setProject

Constructor Details

Chmod

public Chmod()
Chmod task for setting file and directory permissions.

Method Details

checkConfiguration

protected void checkConfiguration()
Check the attributes and nested elements.
Overrides:
checkConfiguration in interface ExecuteOn

createExclude

public PatternSet.NameEntry createExclude()
Add a name entry on the exclude list.
Returns:
a nameentry to be configured.

createInclude

public PatternSet.NameEntry createInclude()
Add a name entry on the include list.
Returns:
a NameEntry to be configured.

createPatternSet

public PatternSet createPatternSet()
Add a set of patterns.
Returns:
a patternset to be configured.

execute

public void execute()
            throws BuildException
Carry out the chmoding.
Overrides:
execute in interface ExecTask
Throws:
BuildException - on error.

isValidOs

protected boolean isValidOs()
Check if the os is valid. Always include unix.
Overrides:
isValidOs in interface ExecTask
Returns:
true if the os is valid.

setAddsourcefile

public void setAddsourcefile(boolean b)
This is not allowed for Chmod.
Overrides:
setAddsourcefile in interface ExecuteOn
Parameters:
b - ignored.

setCommand

public void setCommand(Commandline cmdl)
Set the command. This is not allowed for Chmod.
Overrides:
setCommand in interface ExecTask
Parameters:
cmdl - ignored.

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.

setDir

public void setDir(File src)
The directory which holds the files whose permissions must be changed.
Overrides:
setDir in interface ExecTask
Parameters:
src - the directory.

setExcludes

public void setExcludes(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.

setExecutable

public void setExecutable(String e)
Set the executable. This is not allowed for Chmod.
Overrides:
setExecutable in interface ExecTask
Parameters:
e - ignored.

setFile

public void setFile(File src)
The file or single directory of which the permissions must be changed.
Parameters:
src - the source file or directory.

setIncludes

public void setIncludes(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.

setPerm

public void setPerm(String perm)
Set the new permissions.
Parameters:
perm - the new permissions.

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:
setProject in interface ProjectComponent
Parameters:
project - the project for this task.

setSkipEmptyFilesets

public void setSkipEmptyFilesets(boolean skip)
This is not allowed for Chmod.
Overrides:
setSkipEmptyFilesets in interface ExecuteOn
Parameters:
skip - ignored.