Top Description Fields Constructors Methods
org.apache.tools.ant.taskdefs.optional.pvcs

public Class Pvcs

extends Task
Class Inheritance
Imports
java.io.BufferedReader, .BufferedWriter, .File, .FileReader, .FileWriter, .IOException, .OutputStream, java.nio.file.Files, java.text.MessageFormat, .ParseException, java.util.Random, .Vector, org.apache.tools.ant.BuildException, .Project, .Task, org.apache.tools.ant.taskdefs.Execute, .ExecuteStreamHandler, .LogOutputStream, .LogStreamHandler, .PumpStreamHandler, org.apache.tools.ant.types.Commandline, org.apache.tools.ant.util.FileUtils

Extracts the latest edition of the source code from a PVCS repository. PVCS is a version control system developed by Merant.

Before using this tag, the user running ant must have access to the commands of PVCS (get and pcli) and must have access to the repository. Note that the way to specify the repository is platform dependent so use property to specify location of repository.

This version has been tested against PVCS version 6.5 and 6.6 under Windows and Solaris. 19-04-2001

The task now has a more robust parser. It allows for platform independent file paths and supports file names with (). Thanks to Erik Husby for bringing the bug to my attention. 27-04-2001

UNC paths are now handled properly. Fix provided by Don Jeffery. He also added an UpdateOnly flag that, when true, conditions the PVCS get using the -U option to only update those files that have a modification time (in PVCS) that is newer than the existing workfile. 25-10-2002

Added a revision attribute that currently is a synonym for label, but in a future release the behavior of the label attribute will change to use the -v option of GET. See bug #13847 for discussion.

Field Summary

Modifier and TypeField and Description
private String
private String
private String
private static final String
GET_EXE

Constant for the thing to execute

private boolean
private String
private String
private static final String
PCLI_EXE

Constant for the thing to execute

private static final int
private static final int
private static final int
private String
private String
private String
private Vector<PvcsProject>
private String
private String
private boolean
private String
private String
Inherited from org.apache.tools.ant.Task:
targettaskNametaskTypewrapper

Constructor Summary

AccessConstructor and Description
public
Pvcs()

Creates a Pvcs object

Method Summary

Modifier and TypeMethod and Description
public void
addPvcsproject(PvcsProject
the pvcs project to use.
p
)

Specify a project within the PVCS repository to extract files from.

private void
createFolders(File file)

Parses the file and creates the folders specified in the output section

public void
execute()

Overrides org.apache.tools.ant.Task.execute.

Called by the project to let the task do its work.
public String

Returns:

the path of the config file
getConfig
()

returns the path of the configuration file to be used

private String
public String

Returns:

the filename format attribute.
getFilenameFormat
()

The filenameFormat attribute defines a MessageFormat string used to parse the output of the pcli command.

public String

Returns:

String
getForce
()

Get value of force

public boolean

Returns:

String
getIgnoreReturnCode
()

Get value of ignorereturncode

public String

Returns:

String
getLabel
()

Get value of label

public String

Returns:

the lineStart attribute.
getLineStart
()

The lineStart attribute is used to parse the output of the pcli command.

public String

Returns:

String
getPromotiongroup
()

Get value of promotiongroup

public String

Returns:

String
getPvcsbin
()

Get name of the PVCS bin directory

public String

Returns:

String
getPvcsproject
()

Get name of the project in the PVCS repository

public Vector<PvcsProject>

Returns:

Vector
getPvcsprojects
()

Get name of the project in the PVCS repository

public String

Returns:

String
getRepository
()

Get network name of the PVCS repository

public String

Returns:

String
getRevision
()

Get value of revision

public boolean

Returns:

the updateOnly attribute.
getUpdateOnly
()

get the updateOnly attribute.

public String

Returns:

the userid.
getUserId
()

Get the userid.

public String

Returns:

String
getWorkspace
()

Get name of the workspace to store the retrieved files

private void
massagePCLI(File in, File out)

Simple hack to handle the PVCS command-line tools botch when handling UNC notation.

protected int

Returns:

the exit code of the command.
runCmd
(Commandline
the command line to use.
cmd
,
ExecuteStreamHandler
the output stream handler to use.
out
)

Run the command.

public void
setConfig(File
config file - can be given absolute or relative to ant basedir
f
)

Sets a configuration file other than the default to be used.

public void
setFilenameFormat(String
the format to use.
f
)

The format of the folder names; optional.

public void
setForce(String
String (yes/no)
f
)

Specifies the value of the force argument; optional.

public void
setIgnoreReturnCode(boolean
a boolean value.
b
)

If set to true the return value from executing the pvcs commands are ignored; optional, default false.

public void
setLabel(String
String
l
)

Only files marked with this label are extracted; optional.

public void
setLineStart(String
the value to use.
l
)

What a valid return value from PVCS looks like when it describes a file.

public void
setPromotiongroup(String
String
w
)

Specifies the name of the promotiongroup argument

public void
setPvcsbin(String
PVCS bin directory
bin
)

Specifies the location of the PVCS bin directory; optional if on the PATH.

public void
setPvcsproject(String
String
prj
)

The project within the PVCS repository to extract files from; optional, default "/"

public void
setRepository(String
String
repo
)

The network name of the PVCS repository; required.

public void
setRevision(String
String
r
)

Only files with this revision are extract; optional.

public void
setUpdateOnly(boolean
a boolean value.
l
)

If set to true files are fetched only if newer than existing local files; optional, default false.

public void
setUserId(String
the value to use.
u
)

User ID

public void
setWorkspace(String
String
ws
)

Workspace to use; optional.

Inherited from org.apache.tools.ant.Task:
bindToOwnergetOwningTargetgetRuntimeConfigurableWrappergetTaskNamegetTaskTypegetWrapperhandleErrorFlushhandleErrorOutputhandleFlushhandleInputhandleOutputinitisInvalidloglogloglogmaybeConfigureperformreconfiguresetOwningTargetsetRuntimeConfigurableWrappersetTaskNamesetTaskType

Field Detail

configback to summary
private String config
filenameFormatback to summary
private String filenameFormat
forceback to summary
private String force
GET_EXEback to summary
private static final String GET_EXE

Constant for the thing to execute

ignorercback to summary
private boolean ignorerc
labelback to summary
private String label
lineStartback to summary
private String lineStart
PCLI_EXEback to summary
private static final String PCLI_EXE

Constant for the thing to execute

POS_1back to summary
private static final int POS_1
POS_2back to summary
private static final int POS_2
POS_3back to summary
private static final int POS_3
promotiongroupback to summary
private String promotiongroup
pvcsbinback to summary
private String pvcsbin
pvcsProjectback to summary
private String pvcsProject
pvcsProjectsback to summary
private Vector<PvcsProject> pvcsProjects
repositoryback to summary
private String repository
revisionback to summary
private String revision
updateOnlyback to summary
private boolean updateOnly
userIdback to summary
private String userId
workspaceback to summary
private String workspace

Constructor Detail

Pvcsback to summary
public Pvcs()

Creates a Pvcs object

Method Detail

addPvcsprojectback to summary
public void addPvcsproject(PvcsProject p)

Specify a project within the PVCS repository to extract files from.

Parameters
p:PvcsProject

the pvcs project to use.

createFoldersback to summary
private void createFolders(File file) throws IOException, ParseException

Parses the file and creates the folders specified in the output section

executeback to summary
public void execute() throws BuildException

Overrides org.apache.tools.ant.Task.execute.

Doc from org.apache.tools.ant.Task.execute.

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.

Annotations
@Override
Exceptions
BuildException:
Something is stopping the build...
getConfigback to summary
public String getConfig()

returns the path of the configuration file to be used

Returns:String

the path of the config file

getExecutableback to summary
private String getExecutable(String exe)
getFilenameFormatback to summary
public String getFilenameFormat()

The filenameFormat attribute defines a MessageFormat string used to parse the output of the pcli command. It defaults to {0}-arc({1}). Repositories where the archive extension is not -arc should set this.

Returns:String

the filename format attribute.

getForceback to summary
public String getForce()

Get value of force

Returns:String

String

getIgnoreReturnCodeback to summary
public boolean getIgnoreReturnCode()

Get value of ignorereturncode

Returns:boolean

String

getLabelback to summary
public String getLabel()

Get value of label

Returns:String

String

getLineStartback to summary
public String getLineStart()

The lineStart attribute is used to parse the output of the pcli command. It defaults to "P:. The parser already knows about / and \\, this property is useful in cases where the repository is accessed on a Windows platform via a drive letter mapping.

Returns:String

the lineStart attribute.

getPromotiongroupback to summary
public String getPromotiongroup()

Get value of promotiongroup

Returns:String

String

getPvcsbinback to summary
public String getPvcsbin()

Get name of the PVCS bin directory

Returns:String

String

getPvcsprojectback to summary
public String getPvcsproject()

Get name of the project in the PVCS repository

Returns:String

String

getPvcsprojectsback to summary
public Vector<PvcsProject> getPvcsprojects()

Get name of the project in the PVCS repository

Returns:Vector<PvcsProject>

Vector

getRepositoryback to summary
public String getRepository()

Get network name of the PVCS repository

Returns:String

String

getRevisionback to summary
public String getRevision()

Get value of revision

Returns:String

String

getUpdateOnlyback to summary
public boolean getUpdateOnly()

get the updateOnly attribute.

Returns:boolean

the updateOnly attribute.

getUserIdback to summary
public String getUserId()

Get the userid.

Returns:String

the userid.

getWorkspaceback to summary
public String getWorkspace()

Get name of the workspace to store the retrieved files

Returns:String

String

massagePCLIback to summary
private void massagePCLI(File in, File out) throws IOException

Simple hack to handle the PVCS command-line tools botch when handling UNC notation.

Exceptions
IOException:
if there is an error.
runCmdback to summary
protected int runCmd(Commandline cmd, ExecuteStreamHandler out)

Run the command.

Parameters
cmd:Commandline

the command line to use.

out:ExecuteStreamHandler

the output stream handler to use.

Returns:int

the exit code of the command.

setConfigback to summary
public void setConfig(File f)

Sets a configuration file other than the default to be used. These files have a .cfg extension and are often found in archive or pvcsprop folders.

Parameters
f:File

config file - can be given absolute or relative to ant basedir

setFilenameFormatback to summary
public void setFilenameFormat(String f)

The format of the folder names; optional. This must be in a format suitable for java.text.MessageFormat. Index 1 of the format will be used as the file name. Defaults to {0}-arc({1})

Parameters
f:String

the format to use.

setForceback to summary
public void setForce(String f)

Specifies the value of the force argument; optional. If set to yes all files that exists and are writable are overwritten. Default no causes the files that are writable to be ignored. This stops the PVCS command get to stop asking questions!

Parameters
f:String

String (yes/no)

setIgnoreReturnCodeback to summary
public void setIgnoreReturnCode(boolean b)

If set to true the return value from executing the pvcs commands are ignored; optional, default false.

Parameters
b:boolean

a boolean value.

setLabelback to summary
public void setLabel(String l)

Only files marked with this label are extracted; optional.

Parameters
l:String

String

setLineStartback to summary
public void setLineStart(String l)

What a valid return value from PVCS looks like when it describes a file. Defaults to "P:. If you are not using an UNC name for your repository and the drive letter P is incorrect for your setup, you may need to change this value, UNC names will always be accepted.

Parameters
l:String

the value to use.

setPromotiongroupback to summary
public void setPromotiongroup(String w)

Specifies the name of the promotiongroup argument

Parameters
w:String

String

setPvcsbinback to summary
public void setPvcsbin(String bin)

Specifies the location of the PVCS bin directory; optional if on the PATH. On some systems the PVCS executables pcli and get are not found in the PATH. In such cases this attribute should be set to the bin directory of the PVCS installation containing the executables mentioned before. If this attribute isn't specified the tag expects the executables to be found using the PATH environment variable.

Parameters
bin:String

PVCS bin directory

setPvcsprojectback to summary
public void setPvcsproject(String prj)

The project within the PVCS repository to extract files from; optional, default "/"

Parameters
prj:String

String

setRepositoryback to summary
public void setRepository(String repo)

The network name of the PVCS repository; required.

Parameters
repo:String

String

setRevisionback to summary
public void setRevision(String r)

Only files with this revision are extract; optional.

Parameters
r:String

String

setUpdateOnlyback to summary
public void setUpdateOnly(boolean l)

If set to true files are fetched only if newer than existing local files; optional, default false.

Parameters
l:boolean

a boolean value.

setUserIdback to summary
public void setUserId(String u)

User ID

Parameters
u:String

the value to use.

setWorkspaceback to summary
public void setWorkspace(String ws)

Workspace to use; optional. By specifying a workspace, the files are extracted to that location. A PVCS workspace is a name for a location of the workfiles and isn't as such the location itself. You define the location for a workspace using the PVCS GUI clients. If this isn't specified the default workspace for the current user is used.

Parameters
ws:String

String