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

public abstract Class MSVSS

extends Task
implements MSVSSConstants
Class Inheritance
All Implemented Interfaces
org.apache.tools.ant.taskdefs.optional.vss.MSVSSConstants
Known Direct Subclasses
org.apache.tools.ant.taskdefs.optional.vss.MSVSSADD, org.apache.tools.ant.taskdefs.optional.vss.MSVSSCHECKIN, org.apache.tools.ant.taskdefs.optional.vss.MSVSSCHECKOUT, org.apache.tools.ant.taskdefs.optional.vss.MSVSSCP, org.apache.tools.ant.taskdefs.optional.vss.MSVSSCREATE, org.apache.tools.ant.taskdefs.optional.vss.MSVSSGET, org.apache.tools.ant.taskdefs.optional.vss.MSVSSHISTORY, org.apache.tools.ant.taskdefs.optional.vss.MSVSSLABEL
Imports
java.io.File, .IOException, java.text.DateFormat, .ParseException, java.util.Calendar, .Date, .GregorianCalendar, org.apache.tools.ant.BuildException, .Project, .Task, org.apache.tools.ant.taskdefs.Execute, .LogStreamHandler, org.apache.tools.ant.types.Commandline, .EnumeratedAttribute, org.apache.tools.ant.util.FileUtils

A base class for creating tasks for executing commands on Visual SourceSafe.

The class extends the 'exec' task as it operates by executing the ss.exe program supplied with SourceSafe. By default the task expects ss.exe to be in the path, you can override this be specifying the ssdir attribute.

This class provides set and get methods for 'login' and 'vsspath' attributes. It also contains constants for the flags that can be passed to SS.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
MSVSS.CurrentModUpdated

Extension of EnumeratedAttribute to hold the values for file time stamp.

public static class
MSVSS.WritableFiles

Extension of EnumeratedAttribute to hold the values for writable filess.

Field Summary

Modifier and TypeField and Description
private String
autoResponse

Auto response

private String
comment

Comment

private String
date

Date

private DateFormat
dateFormat

Date format for History

private boolean
failOnError

Fail on error defaults to true

private String
fromDate

From date

private String
fromLabel

From label

private boolean
getLocalCopy

Get local copy for checkout defaults to true

private String
label

Label

private String
localPath

Local path

private int
numDays

Number of days offset for History

private String
outputFileName

Output file name

private boolean
quiet

Quiet defaults to false

private boolean
recursive

Recursive defaults to false

private String
private String
private String
style

History style

private MSVSS.CurrentModUpdated
timestamp

Timestamp for retrieved files

private String
toDate

To date

private String
toLabel

To label

private String
user

User

private String
version

Version

private String
private String
private boolean
writable

Writable defaults to false

private MSVSS.WritableFiles
writableFiles

Behaviour for writable files

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

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv abstract Commandline

Returns:

The Constructed command line.
buildCmdLine
()

Each sub-class must implement this method and return the constructed command line to be executed.

private String

Returns:

The calculated date.
calcDate
(String
The start date.
startDate
,
int
The number of days to add.
daysToAdd
)

Calculates the start date for version comparison.

public void
execute()

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

Executes the task.
private String

Returns:

The command line as a string with out the password
formatCommandLine
(Commandline
The command line to clean
cmd
)

Changes the password to '***' so it isn't displayed on screen if the build fails

protected String

Returns:

The default value "-I-" if autoresponse is not set.
getAutoresponse
()

Gets the auto response string.

protected String

Returns:

A comment of "-" if comment is not set.
getComment
()

Gets the comment string.

private boolean

Returns:

True if the FailOnError flag has been set or if 'writablefiles=skip'.
getFailOnError
()

Gets the value of the fail on error flag.

public String

Returns:

The default file time flag, if not set.
getFileTimeStamp
()

Gets the value set for the FileTimeStamp.

protected String

Returns:

An empty string if get local copy is true.
getGetLocalCopy
()

Builds and returns the -G- flag if required.

protected String

Returns:

An empty string if label is not set.
getLabel
()

Gets the label string.

protected String

Returns:

An empty string if localpath is not set.
getLocalpath
()

Gets the localpath string.

protected String

Returns:

An empty string if login is not set.
getLogin
()

Gets the login string.

protected String

Returns:

An empty string if user is not set.
getOutput
()

Gets the output file string.

protected String

Returns:

An empty string if quiet is not set or is false.
getQuiet
()

Gets the quiet string.

protected String

Returns:

An empty string if recursive is not set or is false.
getRecursive
()

Gets the recursive string.

private String

Returns:

at most the 30 first chars of the label
getShortLabel
()

Return at most the 30 first chars of the label, logging a warning message about the truncation

protected String

Returns:

The path to ss.exe or just ss if sscommand is not set.
getSSCommand
()

Gets the sscommand string.

protected String

Returns:

An empty string if label is not set.
getStyle
()

Gets the style string.

protected String

Returns:

An empty string if user is not set.
getUser
()

Gets the user string.

protected String

Returns:

An empty string if a version is not set.
getVersion
()

Gets the version string.

protected String

Returns:

An empty string if neither Todate or from date are set.
getVersionDate
()

Gets the Version date string.

protected String

Returns:

An empty string if a version, date and label are not set.
getVersionDateLabel
()

Gets the version string.

protected String

Returns:

An empty string if neither tolabel or fromlabel are set.
getVersionLabel
()

Gets the version string.

protected String

Returns:

null if vssserverpath is not set.
getVsspath
()

Gets the vssserverpath string.

protected String

Returns:

An empty string if writable is not set or is false.
getWritable
()

Gets the writable string.

public String

Returns:

An empty String, if not set.
getWritableFiles
()

Gets the value to determine the behaviour when encountering writable files.

private int

Returns:

The return code from the exec'd process.
run
(Commandline
The command line to execute.
cmd
)

Sets up the required environment and executes the command line.

public final void
setFailOnError(final boolean
True if task should fail on any error.
failOnError
)

Indicates if the build should fail if the Sourcesafe command does.

protected void
setInternalAutoResponse(final String
the value to use.
autoResponse
)

Set the auto response attribute.

protected void
setInternalComment(final String
the value to use.
comment
)

Set the internal comment attribute.

protected void
setInternalDate(final String
the value to use.
date
)

Set the date attribute.

protected void
setInternalDateFormat(final DateFormat
the value to use.
dateFormat
)

Set the date format attribute.

protected void
setInternalFailOnError(final boolean
the value to use.
failOnError
)

Set the failOnError attribute.

protected void
setInternalFileTimeStamp(final MSVSS.CurrentModUpdated
the value to use.
timestamp
)

Set the timestamp attribute.

protected void
setInternalFromDate(final String
the value to use.
fromDate
)

Set the from date attribute.

protected void
setInternalFromLabel(final String
the value to use.
fromLabel
)

Set the from label attribute.

protected void
setInternalGetLocalCopy(final boolean
the value to use.
getLocalCopy
)

Set the getLocalCopy attribute.

protected void
setInternalLabel(final String
the value to use.
label
)

Set the label attribute.

protected void
setInternalLocalPath(final String
the value to use.
localPath
)

Set the local path comment attribute.

protected void
setInternalNumDays(final int
the value to use.
numDays
)

Set the num days attribute.

protected void
setInternalOutputFilename(final String
the value to use.
outputFileName
)

Set the outputFileName comment attribute.

protected void
setInternalQuiet(final boolean
the value to use.
quiet
)

Set the quiet attribute.

protected void
setInternalRecursive(final boolean
the value to use.
recursive
)

Set the recursive attribute.

protected void
setInternalStyle(final String
the value to use.
style
)

Set the style attribute.

protected void
setInternalToDate(final String
the value to use.
toDate
)

Set the to date attribute.

protected void
setInternalToLabel(final String
the value to use.
toLabel
)

Set the to label attribute.

protected void
setInternalUser(final String
the value to use.
user
)

Set the user attribute.

protected void
setInternalVersion(final String
the value to use.
version
)

Set the version attribute.

protected void
setInternalWritable(final boolean
the value to use.
writable
)

Set the writable attribute.

protected void
setInternalWritableFiles(final MSVSS.WritableFiles
the value to use.
writableFiles
)

Set the writableFiles attribute.

public final void
setLogin(final String
The login string to use.
vssLogin
)

Login to use when accessing VSS, formatted as "username,password".

public final void
setServerpath(final String
The path to the VSS server.
serverPath
)

Directory where srssafe.ini resides.

public final void
setSsdir(String
The directory containing ss.exe.
dir
)

Directory where ss.exe resides.

public final void
setVsspath(final String
The VSS project path.
vssPath
)

SourceSafe path which specifies the project/file(s) you wish to perform the action on.

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

Field Detail

autoResponseback to summary
private String autoResponse

Auto response

commentback to summary
private String comment

Comment

dateback to summary
private String date

Date

dateFormatback to summary
private DateFormat dateFormat

Date format for History

failOnErrorback to summary
private boolean failOnError

Fail on error defaults to true

fromDateback to summary
private String fromDate

From date

fromLabelback to summary
private String fromLabel

From label

getLocalCopyback to summary
private boolean getLocalCopy

Get local copy for checkout defaults to true

labelback to summary
private String label

Label

localPathback to summary
private String localPath

Local path

numDaysback to summary
private int numDays

Number of days offset for History

outputFileNameback to summary
private String outputFileName

Output file name

quietback to summary
private boolean quiet

Quiet defaults to false

recursiveback to summary
private boolean recursive

Recursive defaults to false

serverPathback to summary
private String serverPath
ssDirback to summary
private String ssDir
styleback to summary
private String style

History style

timestampback to summary
private MSVSS.CurrentModUpdated timestamp

Timestamp for retrieved files

toDateback to summary
private String toDate

To date

toLabelback to summary
private String toLabel

To label

userback to summary
private String user

User

versionback to summary
private String version

Version

vssLoginback to summary
private String vssLogin
vssPathback to summary
private String vssPath
writableback to summary
private boolean writable

Writable defaults to false

writableFilesback to summary
private MSVSS.WritableFiles writableFiles

Behaviour for writable files

Constructor Detail

MSVSSback to summary
public MSVSS()

Method Detail

buildCmdLineback to summary
pack-priv abstract Commandline buildCmdLine()

Each sub-class must implement this method and return the constructed command line to be executed. It is up to the sub-task to determine the required attributes and their order.

Returns:Commandline

The Constructed command line.

calcDateback to summary
private String calcDate(String startDate, int daysToAdd) throws ParseException

Calculates the start date for version comparison.

Calculates the date numDay days earlier than startdate.

Parameters
startDate:String

The start date.

daysToAdd:int

The number of days to add.

Returns:String

The calculated date.

executeback to summary
public void execute() throws BuildException

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

Executes the task.

Builds a command line to execute ss.exe and then calls Exec's run method to execute the command line.

Exceptions
BuildException:
if the command cannot execute.
formatCommandLineback to summary
private String formatCommandLine(Commandline cmd)

Changes the password to '***' so it isn't displayed on screen if the build fails

Parameters
cmd:Commandline

The command line to clean

Returns:String

The command line as a string with out the password

getAutoresponseback to summary
protected String getAutoresponse()

Gets the auto response string. This can be Y "-I-Y" or N "-I-N".

Returns:String

The default value "-I-" if autoresponse is not set.

getCommentback to summary
protected String getComment()

Gets the comment string. "-Ccomment text"

Returns:String

A comment of "-" if comment is not set.

getFailOnErrorback to summary
private boolean getFailOnError()

Gets the value of the fail on error flag.

Returns:boolean

True if the FailOnError flag has been set or if 'writablefiles=skip'.

getFileTimeStampback to summary
public String getFileTimeStamp()

Gets the value set for the FileTimeStamp. if it equals "current" then we return -GTC if it equals "modified" then we return -GTM if it equals "updated" then we return -GTU otherwise we return -GTC

Returns:String

The default file time flag, if not set.

getGetLocalCopyback to summary
protected String getGetLocalCopy()

Builds and returns the -G- flag if required.

Returns:String

An empty string if get local copy is true.

getLabelback to summary
protected String getLabel()

Gets the label string. "-Lbuild1" Max label length is 32 chars

Returns:String

An empty string if label is not set.

getLocalpathback to summary
protected String getLocalpath()

Gets the localpath string. "-GLc:\source"

The localpath is created if it didn't exist.

Returns:String

An empty string if localpath is not set.

getLoginback to summary
protected String getLogin()

Gets the login string. This can be user and password, "-Yuser,password" or just user "-Yuser".

Returns:String

An empty string if login is not set.

getOutputback to summary
protected String getOutput()

Gets the output file string. "-Ooutput.file"

Returns:String

An empty string if user is not set.

getQuietback to summary
protected String getQuiet()

Gets the quiet string. -O-

Returns:String

An empty string if quiet is not set or is false.

getRecursiveback to summary
protected String getRecursive()

Gets the recursive string. "-R"

Returns:String

An empty string if recursive is not set or is false.

getShortLabelback to summary
private String getShortLabel()

Return at most the 30 first chars of the label, logging a warning message about the truncation

Returns:String

at most the 30 first chars of the label

getSSCommandback to summary
protected String getSSCommand()

Gets the sscommand string. "ss" or "c:\path\to\ss"

Returns:String

The path to ss.exe or just ss if sscommand is not set.

getStyleback to summary
protected String getStyle()

Gets the style string. "-Lbuild1"

Returns:String

An empty string if label is not set.

getUserback to summary
protected String getUser()

Gets the user string. "-Uusername"

Returns:String

An empty string if user is not set.

getVersionback to summary
protected String getVersion()

Gets the version string.

Returns:String

An empty string if a version is not set.

getVersionDateback to summary
protected String getVersionDate() throws BuildException

Gets the Version date string.

Returns:String

An empty string if neither Todate or from date are set.

Exceptions
BuildException:
if there is an error.
getVersionDateLabelback to summary
protected String getVersionDateLabel()

Gets the version string. Returns the first specified of version "-V1.0", date "-Vd01.01.01", label "-Vlbuild1".

Returns:String

An empty string if a version, date and label are not set.

getVersionLabelback to summary
protected String getVersionLabel()

Gets the version string. This can be to-from "-VLbuild2~Lbuild1", from "~Lbuild1" or to "-VLbuild2".

Returns:String

An empty string if neither tolabel or fromlabel are set.

getVsspathback to summary
protected String getVsspath()

Gets the vssserverpath string.

Returns:String

null if vssserverpath is not set.

getWritableback to summary
protected String getWritable()

Gets the writable string. "-W"

Returns:String

An empty string if writable is not set or is false.

getWritableFilesback to summary
public String getWritableFiles()

Gets the value to determine the behaviour when encountering writable files.

Returns:String

An empty String, if not set.

runback to summary
private int run(Commandline cmd)

Sets up the required environment and executes the command line.

Parameters
cmd:Commandline

The command line to execute.

Returns:int

The return code from the exec'd process.

setFailOnErrorback to summary
public final void setFailOnError(final boolean failOnError)

Indicates if the build should fail if the Sourcesafe command does. Defaults to true.

Parameters
failOnError:boolean

True if task should fail on any error.

setInternalAutoResponseback to summary
protected void setInternalAutoResponse(final String autoResponse)

Set the auto response attribute.

Parameters
autoResponse:String

the value to use.

setInternalCommentback to summary
protected void setInternalComment(final String comment)

Set the internal comment attribute.

Parameters
comment:String

the value to use.

setInternalDateback to summary
protected void setInternalDate(final String date)

Set the date attribute.

Parameters
date:String

the value to use.

setInternalDateFormatback to summary
protected void setInternalDateFormat(final DateFormat dateFormat)

Set the date format attribute.

Parameters
dateFormat:DateFormat

the value to use.

setInternalFailOnErrorback to summary
protected void setInternalFailOnError(final boolean failOnError)

Set the failOnError attribute.

Parameters
failOnError:boolean

the value to use.

setInternalFileTimeStampback to summary
protected void setInternalFileTimeStamp(final MSVSS.CurrentModUpdated timestamp)

Set the timestamp attribute.

Parameters
timestamp:MSVSS.CurrentModUpdated

the value to use.

setInternalFromDateback to summary
protected void setInternalFromDate(final String fromDate)

Set the from date attribute.

Parameters
fromDate:String

the value to use.

setInternalFromLabelback to summary
protected void setInternalFromLabel(final String fromLabel)

Set the from label attribute.

Parameters
fromLabel:String

the value to use.

setInternalGetLocalCopyback to summary
protected void setInternalGetLocalCopy(final boolean getLocalCopy)

Set the getLocalCopy attribute.

Parameters
getLocalCopy:boolean

the value to use.

setInternalLabelback to summary
protected void setInternalLabel(final String label)

Set the label attribute.

Parameters
label:String

the value to use.

setInternalLocalPathback to summary
protected void setInternalLocalPath(final String localPath)

Set the local path comment attribute.

Parameters
localPath:String

the value to use.

setInternalNumDaysback to summary
protected void setInternalNumDays(final int numDays)

Set the num days attribute.

Parameters
numDays:int

the value to use.

setInternalOutputFilenameback to summary
protected void setInternalOutputFilename(final String outputFileName)

Set the outputFileName comment attribute.

Parameters
outputFileName:String

the value to use.

setInternalQuietback to summary
protected void setInternalQuiet(final boolean quiet)

Set the quiet attribute.

Parameters
quiet:boolean

the value to use.

setInternalRecursiveback to summary
protected void setInternalRecursive(final boolean recursive)

Set the recursive attribute.

Parameters
recursive:boolean

the value to use.

setInternalStyleback to summary
protected void setInternalStyle(final String style)

Set the style attribute.

Parameters
style:String

the value to use.

setInternalToDateback to summary
protected void setInternalToDate(final String toDate)

Set the to date attribute.

Parameters
toDate:String

the value to use.

setInternalToLabelback to summary
protected void setInternalToLabel(final String toLabel)

Set the to label attribute.

Parameters
toLabel:String

the value to use.

setInternalUserback to summary
protected void setInternalUser(final String user)

Set the user attribute.

Parameters
user:String

the value to use.

setInternalVersionback to summary
protected void setInternalVersion(final String version)

Set the version attribute.

Parameters
version:String

the value to use.

setInternalWritableback to summary
protected void setInternalWritable(final boolean writable)

Set the writable attribute.

Parameters
writable:boolean

the value to use.

setInternalWritableFilesback to summary
protected void setInternalWritableFiles(final MSVSS.WritableFiles writableFiles)

Set the writableFiles attribute.

Parameters
writableFiles:MSVSS.WritableFiles

the value to use.

setLoginback to summary
public final void setLogin(final String vssLogin)

Login to use when accessing VSS, formatted as "username,password".

You can omit the password if your database is not password protected. If you have a password and omit it, Ant will hang.

Parameters
vssLogin:String

The login string to use.

setServerpathback to summary
public final void setServerpath(final String serverPath)

Directory where srssafe.ini resides.

Parameters
serverPath:String

The path to the VSS server.

setSsdirback to summary
public final void setSsdir(String dir)

Directory where ss.exe resides. By default the task expects it to be in the PATH.

Parameters
dir:String

The directory containing ss.exe.

setVsspathback to summary
public final void setVsspath(final String vssPath)

SourceSafe path which specifies the project/file(s) you wish to perform the action on.

A prefix of 'vss://' will be removed if specified.

Parameters
vssPath:String

The VSS project path.

org.apache.tools.ant.taskdefs.optional.vss back to summary

public Class MSVSS.CurrentModUpdated

extends EnumeratedAttribute
Class Inheritance

Extension of EnumeratedAttribute to hold the values for file time stamp.

Field Summary

Inherited from org.apache.tools.ant.types.EnumeratedAttribute:
value

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String[]

Returns:

The values.
getValues
()

Implements abstract org.apache.tools.ant.types.EnumeratedAttribute.getValues.

Gets the list of allowable values.
Inherited from org.apache.tools.ant.types.EnumeratedAttribute:
containsValuegetIndexgetInstancegetValueindexOfValuesetValuetoString

Constructor Detail

CurrentModUpdatedback to summary
public CurrentModUpdated()

Method Detail

getValuesback to summary
public String[] getValues()

Implements abstract org.apache.tools.ant.types.EnumeratedAttribute.getValues.

Gets the list of allowable values.

Returns:String[]

The values.

org.apache.tools.ant.taskdefs.optional.vss back to summary

public Class MSVSS.WritableFiles

extends EnumeratedAttribute
Class Inheritance

Extension of EnumeratedAttribute to hold the values for writable filess.

Field Summary

Inherited from org.apache.tools.ant.types.EnumeratedAttribute:
value

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String[]

Returns:

The values.
getValues
()

Implements abstract org.apache.tools.ant.types.EnumeratedAttribute.getValues.

Gets the list of allowable values.
Inherited from org.apache.tools.ant.types.EnumeratedAttribute:
containsValuegetIndexgetInstancegetValueindexOfValuesetValuetoString

Constructor Detail

WritableFilesback to summary
public WritableFiles()

Method Detail

getValuesback to summary
public String[] getValues()

Implements abstract org.apache.tools.ant.types.EnumeratedAttribute.getValues.

Gets the list of allowable values.

Returns:String[]

The values.