|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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
Executes a given command, supplying a set of files as arguments.
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 |
protected java.util.Vector filesets
protected java.lang.String type
protected Commandline.Marker srcFilePos
protected Commandline.Marker targetFilePos
protected Mapper mapperElement
protected FileNameMapper mapper
protected java.io.File destDir
protected boolean srcIsFirst
Constructor Detail |
public ExecuteOn()
Method Detail |
public void addFileset(FileSet set)
public void addDirset(DirSet set)
set
- the DirSet to add.public void addFilelist(FileList list)
public void setRelative(boolean relative)
public void setParallel(boolean parallel)
public void setType(ExecuteOn.FileDirBoth type)
public void setSkipEmptyFilesets(boolean skip)
public void setDest(java.io.File destDir)
public void setForwardslash(boolean forwardSlash)
public void setMaxParallel(int max)
Set to <= 0 for unlimited - this is the default.
public void setAddsourcefile(boolean b)
Defaults to true
.
public void setVerbose(boolean b)
public void setIgnoremissing(boolean b)
public Commandline.Marker createSrcfile()
public Commandline.Marker createTargetfile()
public Mapper createMapper() throws BuildException
BuildException
protected void checkConfiguration()
ExecTask
checkConfiguration
in class ExecTask
protected ExecuteStreamHandler createHandler() throws BuildException
ExecTask
createHandler
in class ExecTask
BuildException
- under unknown circumstancesprotected void setupRedirector()
ExecTask
setupRedirector
in class ExecTask
protected void runExec(Execute exe) throws BuildException
ExecTask
runExec
in class ExecTask
exe
- instance of Execute to run
BuildException
- if the new process could not be started
only if failIfExecFails is set to true (the default)protected java.lang.String[] getCommandline(java.lang.String[] srcFiles, java.io.File[] baseDirs)
srcFiles
- The filenames to add to the commandlinebaseDirs
- filenames are relative to this dirprotected java.lang.String[] getCommandline(java.lang.String srcFile, java.io.File baseDir)
srcFile
- The filename to add to the commandlinebaseDir
- filename is relative to this dirprotected java.lang.String[] getFiles(java.io.File baseDir, DirectoryScanner ds)
protected java.lang.String[] getDirs(java.io.File baseDir, DirectoryScanner ds)
protected java.lang.String[] getFilesAndDirs(FileList list)
protected void runParallel(Execute exe, java.util.Vector fileNames, java.util.Vector baseDirs) throws java.io.IOException, BuildException
java.io.IOException
BuildException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |