org.apache.tools.ant.taskdefs
Class AbstractCvsTask

java.lang.Object
  extended byorg.apache.tools.ant.ProjectComponent
      extended byorg.apache.tools.ant.Task
          extended byorg.apache.tools.ant.taskdefs.AbstractCvsTask
Direct Known Subclasses:
Cvs, CvsTagDiff

public abstract class AbstractCvsTask
extends Task

original Cvs.java 1.20 NOTE: 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
Author:
costin@dnt.ro, stefano@apache.org, Wolfgang Werner wwerner@picturesafe.de, Kevin Ross kevin.ross@bredex.com

Field Summary
static int DEFAULT_COMPRESSION_LEVEL
          Default compression level to use, if compression is enabled via setCompression( true ).
 
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
AbstractCvsTask()
          empty no-arg constructor
 
Method Summary
 void addCommandArgument(Commandline c, java.lang.String arg)
           
 void addCommandArgument(java.lang.String arg)
          This needs to be public to allow configuration of commands externally.
 void addConfiguredCommandline(Commandline c)
          Adds direct command-line to execute.
 void addConfiguredCommandline(Commandline c, boolean insertAtStart)
          Configures and adds the given Commandline.
protected  void configureCommandline(Commandline c)
          Configure a commandline element for things like cvsRoot, quiet, etc.
 void execute()
          Called by the project to let the task do its work.
 java.lang.String getCommand()
           
 java.lang.String getCvsRoot()
           
 java.lang.String getCvsRsh()
           
 java.io.File getDest()
           
protected  java.io.OutputStream getErrorStream()
           
protected  ExecuteStreamHandler getExecuteStreamHandler()
           
protected  java.io.OutputStream getOutputStream()
           
 java.lang.String getPackage()
           
 java.io.File getPassFile()
           
 int getPort()
           
protected  void removeCommandline(Commandline c)
           
protected  void runCommand(Commandline toExecute)
          Sets up the environment for toExecute and then runs it.
 void setAppend(boolean value)
          Whether to append output/error when redirecting to a file.
 void setCommand(java.lang.String c)
          The CVS command to execute.
 void setCompression(boolean usecomp)
          If true, this is the same as compressionlevel="3".
 void setCompressionLevel(int level)
          If set to a value 1-9 it adds -zN to the cvs command line, else it disables compression.
 void setCvsRoot(java.lang.String root)
          The CVSROOT variable.
 void setCvsRsh(java.lang.String rsh)
          The CVS_RSH variable.
 void setDate(java.lang.String p)
          Use the most recent revision no later than the given date.
 void setDest(java.io.File dest)
          The directory where the checked out files should be placed.
 void setError(java.io.File error)
          The file to direct standard error from the command.
protected  void setErrorStream(java.io.OutputStream errorStream)
           
 void setExecuteStreamHandler(ExecuteStreamHandler handler)
           
 void setFailOnError(boolean failOnError)
          Stop the build process if the command exits with a return code other than 0.
 void setNoexec(boolean ne)
          If true, report only and don't change any files.
 void setOutput(java.io.File output)
          The file to direct standard output from the command.
protected  void setOutputStream(java.io.OutputStream outputStream)
           
 void setPackage(java.lang.String p)
          The package/module to operate upon.
 void setPassfile(java.io.File passFile)
          Password file to read passwords from.
 void setPort(int port)
          Port used by CVS to communicate with the server.
 void setQuiet(boolean q)
          If true, suppress informational messages.
 void setTag(java.lang.String p)
          The tag of the package/module to operate upon.
 
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

DEFAULT_COMPRESSION_LEVEL

public static final int DEFAULT_COMPRESSION_LEVEL
Default compression level to use, if compression is enabled via setCompression( true ).

See Also:
Constant Field Values
Constructor Detail

AbstractCvsTask

public AbstractCvsTask()
empty no-arg constructor

Method Detail

setExecuteStreamHandler

public void setExecuteStreamHandler(ExecuteStreamHandler handler)

getExecuteStreamHandler

protected ExecuteStreamHandler getExecuteStreamHandler()

setOutputStream

protected void setOutputStream(java.io.OutputStream outputStream)

getOutputStream

protected java.io.OutputStream getOutputStream()

setErrorStream

protected void setErrorStream(java.io.OutputStream errorStream)

getErrorStream

protected java.io.OutputStream getErrorStream()

runCommand

protected void runCommand(Commandline toExecute)
                   throws BuildException
Sets up the environment for toExecute and then runs it.

Throws:
BuildException

execute

public void execute()
             throws BuildException
Description copied from class: Task
Called by the project to let the task do its work. This method may be called more than once, if the task is invoked more than once. For example, if target1 and target2 both depend on target3, then running "ant target1 target2" will run all tasks in target3 twice.

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

setCvsRoot

public void setCvsRoot(java.lang.String root)
The CVSROOT variable.

Parameters:
root -

getCvsRoot

public java.lang.String getCvsRoot()

setCvsRsh

public void setCvsRsh(java.lang.String rsh)
The CVS_RSH variable.

Parameters:
rsh -

getCvsRsh

public java.lang.String getCvsRsh()

setPort

public void setPort(int port)
Port used by CVS to communicate with the server.

Parameters:
port -

getPort

public int getPort()

setPassfile

public void setPassfile(java.io.File passFile)
Password file to read passwords from.

Parameters:
passFile -

getPassFile

public java.io.File getPassFile()

setDest

public void setDest(java.io.File dest)
The directory where the checked out files should be placed.

Parameters:
dest -

getDest

public java.io.File getDest()

setPackage

public void setPackage(java.lang.String p)
The package/module to operate upon.

Parameters:
p -

getPackage

public java.lang.String getPackage()

setTag

public void setTag(java.lang.String p)
The tag of the package/module to operate upon.

Parameters:
p -

addCommandArgument

public void addCommandArgument(java.lang.String arg)
This needs to be public to allow configuration of commands externally.


addCommandArgument

public void addCommandArgument(Commandline c,
                               java.lang.String arg)

setDate

public void setDate(java.lang.String p)
Use the most recent revision no later than the given date.

Parameters:
p -

setCommand

public void setCommand(java.lang.String c)
The CVS command to execute.

Parameters:
c -

getCommand

public java.lang.String getCommand()

setQuiet

public void setQuiet(boolean q)
If true, suppress informational messages.

Parameters:
q -

setNoexec

public void setNoexec(boolean ne)
If true, report only and don't change any files.

Parameters:
ne -

setOutput

public void setOutput(java.io.File output)
The file to direct standard output from the command.

Parameters:
output -

setError

public void setError(java.io.File error)
The file to direct standard error from the command.

Parameters:
error -

setAppend

public void setAppend(boolean value)
Whether to append output/error when redirecting to a file.

Parameters:
value -

setFailOnError

public void setFailOnError(boolean failOnError)
Stop the build process if the command exits with a return code other than 0. Defaults to false.

Parameters:
failOnError -

configureCommandline

protected void configureCommandline(Commandline c)
Configure a commandline element for things like cvsRoot, quiet, etc.


removeCommandline

protected void removeCommandline(Commandline c)

addConfiguredCommandline

public void addConfiguredCommandline(Commandline c)
Adds direct command-line to execute.

Parameters:
c -

addConfiguredCommandline

public void addConfiguredCommandline(Commandline c,
                                     boolean insertAtStart)
Configures and adds the given Commandline.

Parameters:
insertAtStart - If true, c is

setCompressionLevel

public void setCompressionLevel(int level)
If set to a value 1-9 it adds -zN to the cvs command line, else it disables compression.


setCompression

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


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