ExecuteOn (Apache Ant API)
Keywords: org.apache.tools.ant.taskdefs.ExecuteOn class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tools.ant.taskdefs
Class ExecuteOn

    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

Direct Known Subclasses:
  Chmod, Transform

public class ExecuteOn
extends ExecTask

Executes a given command, supplying a set of files as arguments.

Since:
  Ant 1.2
Author:
  Stefan Bodewig, Mariusz Nowostawski

Nested Class Summary
`static class` | `ExecuteOn.FileDirBoth` Enumerated attribute with the values "file", "dir" and "both" for the type attribute.

Field Summary
`protected java.io.File` | `destDir`
`protected java.util.Vector` | `filesets`
`protected FileNameMapper` | `mapper`
`protected Mapper` | `mapperElement`
`protected Commandline.Marker` | `srcFilePos`
`protected boolean` | `srcIsFirst` Has <srcfile> been specified before <targetfile>
`protected Commandline.Marker` | `targetFilePos`
`protected java.lang.String` | `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
`ExecuteOn()`

Method Summary
`void` | `addFileset(FileSet set)` Source files to operate upon.
`protected void` | `checkConfiguration()` Has the user set all necessary attributes?
`Mapper` | `createMapper()` Mapper to use for mapping source files to target files.
`Commandline.Marker` | `createSrcfile()` Marker that indicates where the name of the source file should be put on the command line.
`Commandline.Marker` | `createTargetfile()` Marker that indicates where the name of the target file should be put on the command line.
`protected java.lang.String[]` | `getCommandline(java.lang.String[] srcFiles, java.io.File[] baseDirs)` Construct the command line for parallel execution.
`protected java.lang.String[]` | `getCommandline(java.lang.String srcFile, java.io.File baseDir)` Construct the command line for serial execution.
`protected java.lang.String[]` | `getDirs(java.io.File baseDir, DirectoryScanner ds)` Return the list of Directories from this DirectoryScanner that should be included on the command line.
`protected java.lang.String[]` | `getFiles(java.io.File baseDir, DirectoryScanner ds)` Return the list of files from this DirectoryScanner that should be included on the command line.
`protected void` | `runExec(Execute exe)` Run the command using the given Execute instance.
`void` | `setDest(java.io.File destDir)` The directory where target files are to be placed.
`void` | `setParallel(boolean parallel)` If true, run the command only once, appending all files as arguments.
`void` | `setRelative(boolean relative)` Whether the filenames should be passed on the command line as absolute or relative pathnames.
`void` | `setSkipEmptyFilesets(boolean skip)` If no source files have been found or are newer than their corresponding target files, do not run the command.
`void` | `setType(ExecuteOn.FileDirBoth type)` Whether the command works only on files, directories or both?

Methods inherited from class org.apache.tools.ant.taskdefs.ExecTask
`addEnv, createArg, createHandler, createWatchdog, execute, isValidOs, logFlush, maybeSetResultPropertyValue, prepareExec, runExecute, setAppend, setCommand, setDir, setExecutable, 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, setProject`

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

Field Detail

### filesets

    protected java.util.Vector filesets

### type

    protected java.lang.String type

### srcFilePos

    protected Commandline.Marker srcFilePos

### targetFilePos

    protected Commandline.Marker targetFilePos

### mapperElement

    protected Mapper mapperElement

### mapper

    protected FileNameMapper mapper

### destDir

    protected java.io.File destDir

### srcIsFirst

    protected boolean srcIsFirst

  Has <srcfile> been specified before <targetfile>

Constructor Detail

### ExecuteOn

    public ExecuteOn()

Method Detail

### addFileset

    public void addFileset(FileSet set)

  Source files to operate upon.

### setRelative

    public void setRelative(boolean relative)

  Whether the filenames should be passed on the command line as absolute or relative pathnames. Paths are relative to the base directory of the corresponding fileset for source files or the dest attribute for target files.

### setParallel

    public void setParallel(boolean parallel)

  If true, run the command only once, appending all files as arguments. If false, command will be executed once for every file. Defaults to false.

### setType

    public void setType(ExecuteOn.FileDirBoth type)

  Whether the command works only on files, directories or both?

### setSkipEmptyFilesets

    public void setSkipEmptyFilesets(boolean skip)

  If no source files have been found or are newer than their corresponding target files, do not run the command.

### setDest

    public void setDest(java.io.File destDir)

  The directory where target files are to be placed.

### createSrcfile

    public Commandline.Marker createSrcfile()

  Marker that indicates where the name of the source file should be put on the command line.

### createTargetfile

    public Commandline.Marker createTargetfile()

  Marker that indicates where the name of the target file should be put on the command line.

### createMapper

    public Mapper createMapper()
                        throws BuildException

  Mapper to use for mapping source files to target files.

  Throws:
    `BuildException`

### checkConfiguration

    protected void checkConfiguration()

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

  Overrides:
    `checkConfiguration` in class `ExecTask`
  To do:
    using taskName here is brittle, as a user could override it. this should probably be modified to use the classname instead.

### runExec

    protected void runExec(Execute exe)
                    throws BuildException

  Description copied from class: `ExecTask`
  Run the command using the given Execute instance. This may be overidden by subclasses

  Overrides:
    `runExec` in class `ExecTask`
  Throws:
    `BuildException`

### getCommandline

    protected java.lang.String[] getCommandline(java.lang.String[] srcFiles,
                                                java.io.File[] baseDirs)

  Construct the command line for parallel execution.

  Parameters:
    `srcFiles` - The filenames to add to the commandline

### getCommandline

    protected java.lang.String[] getCommandline(java.lang.String srcFile,
                                                java.io.File baseDir)

  Construct the command line for serial execution.

  Parameters:
    `srcFile` - The filename to add to the commandline
    `baseDir` - filename is relative to this dir

### getFiles

    protected java.lang.String[] getFiles(java.io.File baseDir,
                                          DirectoryScanner ds)

  Return the list of files from this DirectoryScanner that should be included on the command line.

### getDirs

    protected java.lang.String[] getDirs(java.io.File baseDir,
                                         DirectoryScanner ds)

  Return the list of Directories from this DirectoryScanner that should be included on the command line.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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