## 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

public class Chmod
extends ExecuteOn

Chmod equivalent for unix-like environments.

Since:
  Ant 1.1
Author:
  costin@eng.sun.com, Mariusz Nowostawski (Marni) mnowostawski@infoscience.otago.ac.nz, Stefan Bodewig
To do:
  Refactor so it does not extend from ExecuteOn and then turn around and unsupport several attributes.

Nested Class Summary

Nested classes 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`

Fields inherited from class org.apache.tools.ant.Task
`description, location, target, taskName, taskType, wrapper`

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

Constructor Summary
`Chmod()` Chmod task for setting file and directory permissions.

Method Summary
`protected void` `checkConfiguration()` Has the user set all necessary attributes?
`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()` Do the work.
`protected boolean` `isValidOs()` Is this the OS the user wanted?
`void` `setCommand(Commandline cmdl)`
`void` `setDefaultexcludes(boolean useDefaultExcludes)` Sets whether default exclusions should be used or not.
`void` `setDir(java.io.File src)` The directory which holds the files whose permissions must be changed.
`void` `setExcludes(java.lang.String excludes)` Sets the set of exclude patterns.
`void` `setExecutable(java.lang.String e)` The command to execute.
`void` `setFile(java.io.File src)` The file or single directory of which the permissions must be changed.
`void` `setIncludes(java.lang.String includes)` Sets the set of include patterns.
`void` `setPerm(java.lang.String perm)` The new permissions.
`void` `setProject(Project project)` Sets the project object of this component.
`void` `setSkipEmptyFilesets(boolean skip)` If no source files have been found or are newer than their corresponding target files, do not run the command.

Methods inherited from class org.apache.tools.ant.taskdefs.ExecuteOn
`addFileset, createMapper, createSrcfile, createTargetfile, getCommandline, getCommandline, getDirs, getFiles, runExec, setDest, setParallel, setRelative, setType`

Methods inherited from class org.apache.tools.ant.taskdefs.ExecTask
`addEnv, createArg, createHandler, createWatchdog, logFlush, maybeSetResultPropertyValue, prepareExec, runExecute, setAppend, setFailIfExecutionFails, setFailonerror, setNewenvironment, setOs, setOutput, setOutputproperty, setResultProperty, setTimeout, setTimeout, setVMLauncher`

Methods inherited from class org.apache.tools.ant.Task
`getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorFlush, handleErrorOutput, handleFlush, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName`

Methods inherited from class org.apache.tools.ant.ProjectComponent
`getProject`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Chmod

    public Chmod()

  Chmod task for setting file and directory permissions.

Method Detail

### setProject

    public void setProject(Project project)

  Description copied from class: `ProjectComponent`
  Sets the project object of this component. This method is used by Project when a component is added to it so that the component has access to the functions of the project. It should not be used for any other purpose.

  Overrides:
    `setProject` in class `ProjectComponent`
  Parameters:
    `project` - Project in whose scope this component belongs. Must not be `null`.
  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` -

### setDir

    public void setDir(java.io.File src)

  The directory which holds the files whose permissions must be changed.

  Overrides:
    `setDir` in class `ExecTask`
  Parameters:
    `src` -

### setPerm

    public void setPerm(java.lang.String perm)

  The new permissions.

  Parameters:
    `perm` -

### createInclude

    public PatternSet.NameEntry createInclude()

  Add a name entry on the include list.

### createExclude

    public PatternSet.NameEntry createExclude()

  Add a name entry on the exclude list.

### createPatternSet

    public PatternSet createPatternSet()

  Add a set of patterns.

### 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()

  Description copied from class: `ExecTask`
  Has the user set all necessary attributes?

  Overrides:
    `checkConfiguration` in class `ExecuteOn`

### execute

    public void execute()
                 throws BuildException

  Description copied from class: `ExecTask`
  Do the work.

  Overrides:
    `execute` in class `ExecTask`
  Throws:
    `BuildException` - if something goes wrong with the build

### setExecutable

    public void setExecutable(java.lang.String e)

  Description copied from class: `ExecTask`
  The command to execute.

  Overrides:
    `setExecutable` in class `ExecTask`

### setCommand

    public void setCommand(Commandline cmdl)

  Overrides:
    `setCommand` in class `ExecTask`

### setSkipEmptyFilesets

    public void setSkipEmptyFilesets(boolean skip)

  Description copied from class: `ExecuteOn`
  If no source files have been found or are newer than their corresponding target files, do not run the command.

  Overrides:
    `setSkipEmptyFilesets` in class `ExecuteOn`

### isValidOs

    protected boolean isValidOs()

  Description copied from class: `ExecTask`
  Is this the OS the user wanted?

  Overrides:
    `isValidOs` in class `ExecTask`

Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.