org.apache.tools.ant.taskdefs.optional.vss

Class MSVSS

public abstract class MSVSS extends Task implements MSVSSConstants

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 Class Summary
static classMSVSS.CurrentModUpdated
Extention of EnumeratedAttribute to hold the values for file time stamp.
static classMSVSS.WritableFiles
Extention of EnumeratedAttribute to hold the values for writable filess.
Method Summary
voidexecute()
Executes the task.
protected StringgetAutoresponse()
Gets the auto response string.
protected StringgetComment()
Gets the comment string.
StringgetFileTimeStamp()
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
protected StringgetGetLocalCopy()
Builds and returns the -G- flag if required.
protected StringgetLabel()
Gets the label string.
protected StringgetLocalpath()
Gets the localpath string.
protected StringgetLogin()
Gets the login string.
protected StringgetOutput()
Gets the output file string.
protected StringgetQuiet()
Gets the quiet string.
protected StringgetRecursive()
Gets the recursive string.
protected StringgetSSCommand()
Gets the sscommand string.
protected StringgetStyle()
Gets the style string.
protected StringgetUser()
Gets the user string.
protected StringgetVersion()
Gets the version string.
protected StringgetVersionDate()
Gets the Version date string.
protected StringgetVersionDateLabel()
Gets the version string.
protected StringgetVersionLabel()
Gets the version string.
protected StringgetVsspath()
Gets the vssserverpath string.
protected StringgetWritable()
Gets the writable string.
StringgetWritableFiles()
Gets the value to determine the behaviour when encountering writable files.
voidsetFailOnError(boolean failOnError)
Indicates if the build should fail if the Sourcesafe command does.
protected voidsetInternalAutoResponse(String autoResponse)
Set the auto response attribute.
protected voidsetInternalComment(String comment)
Set the internal comment attribute.
protected voidsetInternalDate(String date)
Set the date attribute.
protected voidsetInternalDateFormat(DateFormat dateFormat)
Set the date format attribute.
protected voidsetInternalFailOnError(boolean failOnError)
Set the failOnError attribute.
protected voidsetInternalFileTimeStamp(MSVSS.CurrentModUpdated timestamp)
Set the timestamp attribute.
protected voidsetInternalFromDate(String fromDate)
Set the from date attribute.
protected voidsetInternalFromLabel(String fromLabel)
Set the from label attribute.
protected voidsetInternalGetLocalCopy(boolean getLocalCopy)
Set the getLocalCopy attribute.
protected voidsetInternalLabel(String label)
Set the label attribute.
protected voidsetInternalLocalPath(String localPath)
Set the local path comment attribute.
protected voidsetInternalNumDays(int numDays)
Set the num days attribute.
protected voidsetInternalOutputFilename(String outputFileName)
Set the outputFileName comment attribute.
protected voidsetInternalQuiet(boolean quiet)
Set the quiet attribute.
protected voidsetInternalRecursive(boolean recursive)
Set the recursive attribute.
protected voidsetInternalStyle(String style)
Set the style attribute.
protected voidsetInternalToDate(String toDate)
Set the to date attribute.
protected voidsetInternalToLabel(String toLabel)
Set the to label attribute.
protected voidsetInternalUser(String user)
Set the user attribute.
protected voidsetInternalVersion(String version)
Set the version attribute.
protected voidsetInternalWritable(boolean writable)
Set the writable attribute.
protected voidsetInternalWritableFiles(MSVSS.WritableFiles writableFiles)
Set the writableFiles attribute.
voidsetLogin(String vssLogin)
Login to use when accessing VSS, formatted as "username,password".
voidsetServerpath(String serverPath)
Directory where srssafe.ini resides.
voidsetSsdir(String dir)
Directory where ss.exe resides.
voidsetVsspath(String vssPath)
SourceSafe path which specifies the project/file(s) you wish to perform the action on.

Method Detail

execute

public void execute()
Executes the task.
Builds a command line to execute ss.exe and then calls Exec's run method to execute the command line.

Throws: BuildException if the command cannot execute.

getAutoresponse

protected String getAutoresponse()
Gets the auto response string. This can be Y "-I-Y" or N "-I-N".

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

getComment

protected String getComment()
Gets the comment string. "-Ccomment text"

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

getFileTimeStamp

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: The default file time flag, if not set.

getGetLocalCopy

protected String getGetLocalCopy()
Builds and returns the -G- flag if required.

Returns: An empty string if get local copy is true.

getLabel

protected String getLabel()
Gets the label string. "-Lbuild1" Max label length is 32 chars

Returns: An empty string if label is not set.

getLocalpath

protected String getLocalpath()
Gets the localpath string. "-GLc:\source"

The localpath is created if it didn't exist.

Returns: An empty string if localpath is not set.

getLogin

protected String getLogin()
Gets the login string. This can be user and password, "-Yuser,password" or just user "-Yuser".

Returns: An empty string if login is not set.

getOutput

protected String getOutput()
Gets the output file string. "-Ooutput.file"

Returns: An empty string if user is not set.

getQuiet

protected String getQuiet()
Gets the quiet string. -O-

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

getRecursive

protected String getRecursive()
Gets the recursive string. "-R"

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

getSSCommand

protected String getSSCommand()
Gets the sscommand string. "ss" or "c:\path\to\ss"

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

getStyle

protected String getStyle()
Gets the style string. "-Lbuild1"

Returns: An empty string if label is not set.

getUser

protected String getUser()
Gets the user string. "-Uusername"

Returns: An empty string if user is not set.

getVersion

protected String getVersion()
Gets the version string.

Returns: An empty string if a version is not set.

getVersionDate

protected String getVersionDate()
Gets the Version date string.

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

Throws: BuildException if there is an error.

getVersionDateLabel

protected String getVersionDateLabel()
Gets the version string. Returns the first specified of version "-V1.0", date "-Vd01.01.01", label "-Vlbuild1".

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

getVersionLabel

protected String getVersionLabel()
Gets the version string. This can be to-from "-VLbuild2~Lbuild1", from "~Lbuild1" or to "-VLbuild2".

Returns: An empty string if neither tolabel or fromlabel are set.

getVsspath

protected String getVsspath()
Gets the vssserverpath string.

Returns: null if vssserverpath is not set.

getWritable

protected String getWritable()
Gets the writable string. "-W"

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

getWritableFiles

public String getWritableFiles()
Gets the value to determine the behaviour when encountering writable files.

Returns: An empty String, if not set.

setFailOnError

public final void setFailOnError(boolean failOnError)
Indicates if the build should fail if the Sourcesafe command does. Defaults to true.

Parameters: failOnError True if task should fail on any error.

setInternalAutoResponse

protected void setInternalAutoResponse(String autoResponse)
Set the auto response attribute.

Parameters: autoResponse the value to use.

setInternalComment

protected void setInternalComment(String comment)
Set the internal comment attribute.

Parameters: comment the value to use.

setInternalDate

protected void setInternalDate(String date)
Set the date attribute.

Parameters: date the value to use.

setInternalDateFormat

protected void setInternalDateFormat(DateFormat dateFormat)
Set the date format attribute.

Parameters: dateFormat the value to use.

setInternalFailOnError

protected void setInternalFailOnError(boolean failOnError)
Set the failOnError attribute.

Parameters: failOnError the value to use.

setInternalFileTimeStamp

protected void setInternalFileTimeStamp(MSVSS.CurrentModUpdated timestamp)
Set the timestamp attribute.

Parameters: timestamp the value to use.

setInternalFromDate

protected void setInternalFromDate(String fromDate)
Set the from date attribute.

Parameters: fromDate the value to use.

setInternalFromLabel

protected void setInternalFromLabel(String fromLabel)
Set the from label attribute.

Parameters: fromLabel the value to use.

setInternalGetLocalCopy

protected void setInternalGetLocalCopy(boolean getLocalCopy)
Set the getLocalCopy attribute.

Parameters: getLocalCopy the value to use.

setInternalLabel

protected void setInternalLabel(String label)
Set the label attribute.

Parameters: label the value to use.

setInternalLocalPath

protected void setInternalLocalPath(String localPath)
Set the local path comment attribute.

Parameters: localPath the value to use.

setInternalNumDays

protected void setInternalNumDays(int numDays)
Set the num days attribute.

Parameters: numDays the value to use.

setInternalOutputFilename

protected void setInternalOutputFilename(String outputFileName)
Set the outputFileName comment attribute.

Parameters: outputFileName the value to use.

setInternalQuiet

protected void setInternalQuiet(boolean quiet)
Set the quiet attribute.

Parameters: quiet the value to use.

setInternalRecursive

protected void setInternalRecursive(boolean recursive)
Set the recursive attribute.

Parameters: recursive the value to use.

setInternalStyle

protected void setInternalStyle(String style)
Set the style attribute.

Parameters: style the value to use.

setInternalToDate

protected void setInternalToDate(String toDate)
Set the to date attribute.

Parameters: toDate the value to use.

setInternalToLabel

protected void setInternalToLabel(String toLabel)
Set the to label attribute.

Parameters: toLabel the value to use.

setInternalUser

protected void setInternalUser(String user)
Set the user attribute.

Parameters: user the value to use.

setInternalVersion

protected void setInternalVersion(String version)
Set the version attribute.

Parameters: version the value to use.

setInternalWritable

protected void setInternalWritable(boolean writable)
Set the writable attribute.

Parameters: writable the value to use.

setInternalWritableFiles

protected void setInternalWritableFiles(MSVSS.WritableFiles writableFiles)
Set the writableFiles attribute.

Parameters: writableFiles the value to use.

setLogin

public final void setLogin(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 The login string to use.

setServerpath

public final void setServerpath(String serverPath)
Directory where srssafe.ini resides.

Parameters: serverPath The path to the VSS server.

setSsdir

public final void setSsdir(String dir)
Directory where ss.exe resides. By default the task expects it to be in the PATH.

Parameters: dir The directory containing ss.exe.

setVsspath

public final void setVsspath(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 The VSS project path.

UNKNOWN: group="required"