Package org.apache.tools.ant.taskdefs
Class AbstractCvsTask
- java.lang.Object
- 
- org.apache.tools.ant.ProjectComponent
- 
- org.apache.tools.ant.Task
- 
- org.apache.tools.ant.taskdefs.AbstractCvsTask
 
 
 
- 
- All Implemented Interfaces:
- java.lang.Cloneable
 - Direct Known Subclasses:
- ChangeLogTask,- Cvs,- CvsTagDiff,- CvsVersion
 
 public abstract class AbstractCvsTask extends Task original Cvs.java 1.20NOTE: This implementation has been moved here from Cvs.java with the addition of some accessors for extensibility. Another task can extend this with some customized output processing. - Since:
- Ant 1.5
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classAbstractCvsTask.Module
 - 
Field SummaryFields Modifier and Type Field Description static intDEFAULT_COMPRESSION_LEVELDefault compression level to use, if compression is enabled via setCompression(true).- 
Fields inherited from class org.apache.tools.ant.ProjectComponentdescription, location, project
 
- 
 - 
Constructor SummaryConstructors Constructor Description AbstractCvsTask()
 - 
Method SummaryModifier and Type Method Description voidaddCommandArgument(java.lang.String arg)This needs to be public to allow configuration of commands externally.voidaddCommandArgument(Commandline c, java.lang.String arg)This method adds a command line argument to an external command.voidaddConfiguredCommandline(Commandline c)Adds direct command-line to execute.voidaddConfiguredCommandline(Commandline c, boolean insertAtStart)Configures and adds the given Commandline.voidaddModule(AbstractCvsTask.Module m)add a named module/package.protected voidconfigureCommandline(Commandline c)Configure a commandline element for things like cvsRoot, quiet, etc.voidexecute()do the workjava.lang.StringgetCommand()accessor to a command line as string This should be deprecated AntoineLL July 23d 2003java.lang.StringgetCvsRoot()access the CVSROOT variablejava.lang.StringgetCvsRsh()access the CVS_RSH variablejava.io.FilegetDest()get the file where the checked out files should be placedprotected java.io.OutputStreamgetErrorStream()access the stream to which the stderr from cvs should go if this stream has already been set, it will be returned if the stream has not yet been set, if the attribute error has been set, the output stream will go to the file denoted by the error attribute otherwise the stderr output will go to ant's logging systemprotected ExecuteStreamHandlergetExecuteStreamHandler()find the handler and instantiate it if it does not exist yetprotected java.util.List<AbstractCvsTask.Module>getModules()protected java.io.OutputStreamgetOutputStream()access the stream to which the stdout from cvs should go if this stream has already been set, it will be returned if the stream has not yet been set, if the attribute output has been set, the output stream will go to the output file otherwise the output will go to ant's logging systemjava.lang.StringgetPackage()access the package or module to operate uponjava.io.FilegetPassFile()find the password fileintgetPort()access the port of CVSjava.lang.StringgetTag()tag or branchprotected voidremoveCommandline(Commandline c)remove a particular command from a vector of command linesprotected voidrunCommand(Commandline toExecute)Sets up the environment for toExecute and then runs it.voidsetAppend(boolean value)Whether to append output/error when redirecting to a file.voidsetCommand(java.lang.String c)The CVS command to execute.voidsetCompression(boolean usecomp)If true, this is the same as compressionlevel="3".voidsetCompressionLevel(int level)If set to a value 1-9 it adds -zN to the cvs command line, else it disables compression.voidsetCvsRoot(java.lang.String root)The CVSROOT variable.voidsetCvsRsh(java.lang.String rsh)The CVS_RSH variable.voidsetDate(java.lang.String p)Use the most recent revision no later than the given date.voidsetDest(java.io.File dest)The directory where the checked out files should be placed.voidsetError(java.io.File error)The file to direct standard error from the command.protected voidsetErrorStream(java.io.OutputStream errorStream)sets a stream to which the stderr from the cvs exe should govoidsetExecuteStreamHandler(ExecuteStreamHandler handler)sets the handlervoidsetFailOnError(boolean failOnError)Stop the build process if the command exits with a return code other than 0.voidsetNoexec(boolean ne)If true, report only and don't change any files.voidsetOutput(java.io.File output)The file to direct standard output from the command.protected voidsetOutputStream(java.io.OutputStream outputStream)sets a stream to which the output from the cvs executable should be sentvoidsetPackage(java.lang.String p)The package/module to operate upon.voidsetPassfile(java.io.File passFile)Password file to read passwords from.voidsetPort(int port)Port used by CVS to communicate with the server.voidsetQuiet(boolean q)If true, suppress informational messages.voidsetReallyquiet(boolean q)If true, suppress all messages.voidsetTag(java.lang.String p)The tag of the package/module to operate upon.- 
Methods inherited from class org.apache.tools.ant.TaskbindToOwner, 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.ProjectComponentclone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
 
- 
 
- 
- 
- 
Field Detail- 
DEFAULT_COMPRESSION_LEVELpublic static final int DEFAULT_COMPRESSION_LEVEL Default compression level to use, if compression is enabled via setCompression(true).- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
setExecuteStreamHandlerpublic void setExecuteStreamHandler(ExecuteStreamHandler handler) sets the handler- Parameters:
- handler- a handler able of processing the output and error streams from the cvs exe
 
 - 
getExecuteStreamHandlerprotected ExecuteStreamHandler getExecuteStreamHandler() find the handler and instantiate it if it does not exist yet- Returns:
- handler for output and error streams
 
 - 
setOutputStreamprotected void setOutputStream(java.io.OutputStream outputStream) sets a stream to which the output from the cvs executable should be sent- Parameters:
- outputStream- stream to which the stdout from cvs should go
 
 - 
getOutputStreamprotected java.io.OutputStream getOutputStream() access the stream to which the stdout from cvs should go if this stream has already been set, it will be returned if the stream has not yet been set, if the attribute output has been set, the output stream will go to the output file otherwise the output will go to ant's logging system- Returns:
- output stream to which cvs' stdout should go to
 
 - 
setErrorStreamprotected void setErrorStream(java.io.OutputStream errorStream) sets a stream to which the stderr from the cvs exe should go- Parameters:
- errorStream- an output stream willing to process stderr
 
 - 
getErrorStreamprotected java.io.OutputStream getErrorStream() access the stream to which the stderr from cvs should go if this stream has already been set, it will be returned if the stream has not yet been set, if the attribute error has been set, the output stream will go to the file denoted by the error attribute otherwise the stderr output will go to ant's logging system- Returns:
- output stream to which cvs' stderr should go to
 
 - 
runCommandprotected void runCommand(Commandline toExecute) throws BuildException Sets up the environment for toExecute and then runs it.- Parameters:
- toExecute- the command line to execute
- Throws:
- BuildException- if failonError is set to true and the cvs command fails
 
 - 
executepublic void execute() throws BuildExceptiondo the work- Overrides:
- executein class- Task
- Throws:
- BuildException- if failonerror is set to true and the cvs command fails.
 
 - 
setCvsRootpublic void setCvsRoot(java.lang.String root) The CVSROOT variable.- Parameters:
- root- the CVSROOT variable
 
 - 
getCvsRootpublic java.lang.String getCvsRoot() access the CVSROOT variable- Returns:
- CVSROOT
 
 - 
setCvsRshpublic void setCvsRsh(java.lang.String rsh) The CVS_RSH variable.- Parameters:
- rsh- the CVS_RSH variable
 
 - 
getCvsRshpublic java.lang.String getCvsRsh() access the CVS_RSH variable- Returns:
- the CVS_RSH variable
 
 - 
setPortpublic void setPort(int port) Port used by CVS to communicate with the server.- Parameters:
- port- port of CVS
 
 - 
getPortpublic int getPort() access the port of CVS- Returns:
- the port of CVS
 
 - 
setPassfilepublic void setPassfile(java.io.File passFile) Password file to read passwords from.- Parameters:
- passFile- password file to read passwords from
 
 - 
getPassFilepublic java.io.File getPassFile() find the password file- Returns:
- password file
 
 - 
setDestpublic void setDest(java.io.File dest) The directory where the checked out files should be placed.Note that this is different from CVS's -d command line switch as Ant will never shorten pathnames to avoid empty directories. - Parameters:
- dest- directory where the checked out files should be placed
 
 - 
getDestpublic java.io.File getDest() get the file where the checked out files should be placed- Returns:
- directory where the checked out files should be placed
 
 - 
setPackagepublic void setPackage(java.lang.String p) The package/module to operate upon.- Parameters:
- p- package or module to operate upon
 
 - 
getPackagepublic java.lang.String getPackage() access the package or module to operate upon- Returns:
- package/module
 
 - 
getTagpublic java.lang.String getTag() tag or branch- Returns:
- tag or branch
- Since:
- ant 1.6.1
 
 - 
setTagpublic void setTag(java.lang.String p) The tag of the package/module to operate upon.- Parameters:
- p- tag
 
 - 
addCommandArgumentpublic void addCommandArgument(java.lang.String arg) This needs to be public to allow configuration of commands externally.- Parameters:
- arg- command argument
 
 - 
addCommandArgumentpublic void addCommandArgument(Commandline c, java.lang.String arg) This method adds a command line argument to an external command. I do not understand what this method does in this class ??? particularly not why it is public ???? AntoineLL July 23d 2003- Parameters:
- c- command line to which one argument should be added
- arg- argument to add
 
 - 
setDatepublic void setDate(java.lang.String p) Use the most recent revision no later than the given date.- Parameters:
- p- a date as string in a format that the CVS executable can understand see man cvs
 
 - 
setCommandpublic void setCommand(java.lang.String c) The CVS command to execute. This should be deprecated, it is better to use the Commandline class ? AntoineLL July 23d 2003- Parameters:
- c- a command as string
 
 - 
getCommandpublic java.lang.String getCommand() accessor to a command line as string This should be deprecated AntoineLL July 23d 2003- Returns:
- command line as string
 
 - 
setQuietpublic void setQuiet(boolean q) If true, suppress informational messages.- Parameters:
- q- if true, suppress informational messages
 
 - 
setReallyquietpublic void setReallyquiet(boolean q) If true, suppress all messages.- Parameters:
- q- if true, suppress all messages
- Since:
- Ant 1.6
 
 - 
setNoexecpublic void setNoexec(boolean ne) If true, report only and don't change any files.- Parameters:
- ne- if true, report only and do not change any files.
 
 - 
setOutputpublic void setOutput(java.io.File output) The file to direct standard output from the command.- Parameters:
- output- a file to which stdout should go
 
 - 
setErrorpublic void setError(java.io.File error) The file to direct standard error from the command.- Parameters:
- error- a file to which stderr should go
 
 - 
setAppendpublic void setAppend(boolean value) Whether to append output/error when redirecting to a file.- Parameters:
- value- true indicated you want to append
 
 - 
setFailOnErrorpublic void setFailOnError(boolean failOnError) Stop the build process if the command exits with a return code other than 0. Defaults to false.- Parameters:
- failOnError- stop the build process if the command exits with a return code other than 0
 
 - 
configureCommandlineprotected void configureCommandline(Commandline c) Configure a commandline element for things like cvsRoot, quiet, etc.- Parameters:
- c- the command line which will be configured if the commandline is initially null, the function is a noop otherwise the function append to the commandline arguments concerning- cvs package
- compression
- quiet or reallyquiet
- cvsroot
- noexec
 
 
 - 
removeCommandlineprotected void removeCommandline(Commandline c) remove a particular command from a vector of command lines- Parameters:
- c- command line which should be removed
 
 - 
addConfiguredCommandlinepublic void addConfiguredCommandline(Commandline c) Adds direct command-line to execute.- Parameters:
- c- command line to execute
 
 - 
addConfiguredCommandlinepublic void addConfiguredCommandline(Commandline c, boolean insertAtStart) Configures and adds the given Commandline.- Parameters:
- c- commandline to insert
- insertAtStart- If true, c is inserted at the beginning of the vector of command lines
 
 - 
setCompressionLevelpublic void setCompressionLevel(int level) If set to a value 1-9 it adds -zN to the cvs command line, else it disables compression.- Parameters:
- level- compression level 1 to 9
 
 - 
setCompressionpublic void setCompression(boolean usecomp) If true, this is the same as compressionlevel="3".- Parameters:
- usecomp- If true, turns on compression using default level, AbstractCvsTask.DEFAULT_COMPRESSION_LEVEL.
 
 - 
addModulepublic void addModule(AbstractCvsTask.Module m) add a named module/package.- Parameters:
- m- Module
- Since:
- Ant 1.8.0
 
 - 
getModulesprotected java.util.List<AbstractCvsTask.Module> getModules() 
 
- 
 
-