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:
  AbstractAccessTask, Attrib, Chmod, Transform

public class ExecuteOn
extends ExecTask

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

Since:
  Ant 1.2

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, redirector, redirectorElement`

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` | `addDirset(DirSet set)` Adds directories to operate on.
`void` | `addFilelist(FileList list)` Source files to operate upon.
`void` | `addFileset(FileSet set)` Source files to operate upon.
`protected void` | `checkConfiguration()` Has the user set all necessary attributes?
`protected ExecuteStreamHandler` | `createHandler()` Create the StreamHandler to use with our Execute instance.
`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 java.lang.String[]` | `getFilesAndDirs(FileList list)` Return the list of files or directories from this FileList that should be included on the command line.
`protected void` | `runExec(Execute exe)` Run the command using the given Execute instance.
`protected void` | `runParallel(Execute exe, java.util.Vector fileNames, java.util.Vector baseDirs)` Runs the command in "parallel" mode, making sure that at most maxParallel sourcefiles get passed on the command line.
`void` | `setAddsourcefile(boolean b)` Whether to send the source file name on the command line.
`void` | `setDest(java.io.File destDir)` The directory where target files are to be placed.
`void` | `setForwardslash(boolean forwardSlash)` The source and target file names on Windows and OS/2 must use forward slash as file separator.
`void` | `setIgnoremissing(boolean b)` Whether to ignore nonexistent files from filelists.
`void` | `setMaxParallel(int max)` Limit the command line length by passing at maximum this many sourcefiles at once to the command.
`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?
`protected void` | `setupRedirector()` Set up properties on the redirector that we needed to store locally.
`void` | `setVerbose(boolean b)` Whether to print a verbose summary after execution.

Methods inherited from class org.apache.tools.ant.taskdefs.ExecTask
`addConfiguredRedirector, addEnv, createArg, createWatchdog, execute, getResolveExecutable, isValidOs, logFlush, maybeSetResultPropertyValue, prepareExec, resolveExecutable, runExecute, setAppend, setCommand, setDir, setError, setErrorProperty, setExecutable, setFailIfExecutionFails, setFailonerror, setInput, setInputString, setLogError, setNewenvironment, setOs, setOutput, setOutputproperty, setResolveExecutable, setResultProperty, setSpawn, setTimeout, setTimeout, setVMLauncher`

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

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.

### addDirset

    public void addDirset(DirSet set)

  Adds directories to operate on.

  Parameters:
    `set` - the DirSet to add.
  Since:
    Ant 1.6

### addFilelist

    public void addFilelist(FileList list)

  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.

### setForwardslash

    public void setForwardslash(boolean forwardSlash)

  The source and target file names on Windows and OS/2 must use forward slash as file separator.

### setMaxParallel

    public void setMaxParallel(int max)

  Limit the command line length by passing at maximum this many sourcefiles at once to the command.

  Set to <= 0 for unlimited - this is the default.

  Since:
    Ant 1.6

### setAddsourcefile

    public void setAddsourcefile(boolean b)

  Whether to send the source file name on the command line.

  Defaults to `true`.

  Since:
    Ant 1.6

### setVerbose

    public void setVerbose(boolean b)

  Whether to print a verbose summary after execution.

  Since:
    Ant 1.6

### setIgnoremissing

    public void setIgnoremissing(boolean b)

  Whether to ignore nonexistent files from filelists.

  Since:
    Ant 1.6.2

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

    `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.

### createHandler

    protected ExecuteStreamHandler createHandler()
                                          throws BuildException

  Description copied from class: `ExecTask`
  Create the StreamHandler to use with our Execute instance.

  Overrides:
    `createHandler` in class `ExecTask`
  Returns:
    instance of ExecuteStreamHandler
  Throws:
    `BuildException` - under unknown circumstances

### setupRedirector

    protected void setupRedirector()

  Description copied from class: `ExecTask`
  Set up properties on the redirector that we needed to store locally.

  Overrides:
    `setupRedirector` in class `ExecTask`

### runExec

    protected void runExec(Execute exe)
                    throws BuildException

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

  Overrides:
    `runExec` in class `ExecTask`
  Parameters:
    `exe` - instance of Execute to run
  Throws:
    `BuildException` - if the new process could not be started only if failIfExecFails is set to true (the default)

### 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
    `baseDirs` - filenames are relative to this dir

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

### getFilesAndDirs

    protected java.lang.String[] getFilesAndDirs(FileList list)

  Return the list of files or directories from this FileList that should be included on the command line.

  Since:
    Ant 1.6.2

### runParallel

    protected void runParallel(Execute exe,
                               java.util.Vector fileNames,
                               java.util.Vector baseDirs)
                        throws java.io.IOException,
                               BuildException

  Runs the command in "parallel" mode, making sure that at most maxParallel sourcefiles get passed on the command line.

    `java.io.IOException`
    `BuildException`
  Since:
    Ant 1.6

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-2004 Apache Software Foundation. All Rights Reserved.