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

java.lang.Object
  |
  +--org.apache.tools.ant.ProjectComponent
        |
        +--org.apache.tools.ant.Task
              |
              +--org.apache.tools.ant.taskdefs.optional.vss.MSVSS
All Implemented Interfaces:
MSVSSConstants
Direct Known Subclasses:
MSVSSADD, MSVSSCHECKIN, MSVSSCHECKOUT, MSVSSCP, MSVSSCREATE, MSVSSGET, MSVSSHISTORY, MSVSSLABEL

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 class MSVSS.CurrentModUpdated
          Extention of EnumeratedAttribute to hold the values for file time stamp.
static class MSVSS.WritableFiles
          Extention of EnumeratedAttribute to hold the values for writable filess.
 
Field Summary
 
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
 
Fields inherited from interface org.apache.tools.ant.taskdefs.optional.vss.MSVSSConstants
COMMAND_ADD, COMMAND_CHECKIN, COMMAND_CHECKOUT, COMMAND_CP, COMMAND_CREATE, COMMAND_GET, COMMAND_HISTORY, COMMAND_LABEL, FLAG_AUTORESPONSE_DEF, FLAG_AUTORESPONSE_NO, FLAG_AUTORESPONSE_YES, FLAG_BRIEF, FLAG_CODEDIFF, FLAG_COMMENT, FLAG_FILETIME_DEF, FLAG_FILETIME_MODIFIED, FLAG_FILETIME_UPDATED, FLAG_LABEL, FLAG_LOGIN, FLAG_NO_FILE, FLAG_NO_GET, FLAG_OUTPUT, FLAG_OVERRIDE_WORKING_DIR, FLAG_QUIET, FLAG_RECURSION, FLAG_REPLACE_WRITABLE, FLAG_SKIP_WRITABLE, FLAG_USER, FLAG_VERSION, FLAG_VERSION_DATE, FLAG_VERSION_LABEL, FLAG_WRITABLE, PROJECT_PREFIX, SS_EXE, STYLE_BRIEF, STYLE_CODEDIFF, STYLE_DEFAULT, STYLE_NOFILE, TIME_CURRENT, TIME_MODIFIED, TIME_UPDATED, VALUE_FROMDATE, VALUE_FROMLABEL, VALUE_NO, VALUE_YES, WRITABLE_FAIL, WRITABLE_REPLACE, WRITABLE_SKIP
 
Constructor Summary
MSVSS()
           
 
Method Summary
 void execute()
          Executes the task.
protected  java.lang.String getAutoresponse()
          Gets the auto response string.
protected  java.lang.String getComment()
          Gets the comment string.
 java.lang.String getFileTimeStamp()
          Gets the value set for the FileTimeStamp.
protected  java.lang.String getGetLocalCopy()
          Builds and returns the -G- flag if required.
protected  java.lang.String getLabel()
          Gets the label string.
protected  java.lang.String getLocalpath()
          Gets the localpath string.
protected  java.lang.String getLogin()
          Gets the login string.
protected  java.lang.String getOutput()
          Gets the output file string.
protected  java.lang.String getQuiet()
          Gets the quiet string.
protected  java.lang.String getRecursive()
          Gets the recursive string.
protected  java.lang.String getSSCommand()
          Gets the sscommand string.
protected  java.lang.String getStyle()
          Gets the style string.
protected  java.lang.String getUser()
          Gets the user string.
protected  java.lang.String getVersion()
          Gets the version string.
protected  java.lang.String getVersionDate()
          Gets the Version date string.
protected  java.lang.String getVersionDateLabel()
          Gets the version string.
protected  java.lang.String getVersionLabel()
          Gets the version string.
protected  java.lang.String getVsspath()
          Gets the vssserverpath string.
protected  java.lang.String getWritable()
          Gets the writable string.
 java.lang.String getWritableFiles()
          Gets the value to determine the behaviour when encountering writable files.
 void setFailOnError(boolean failOnError)
          Indicates if the build should fail if the Sourcesafe command does.
protected  void setInternalAutoResponse(java.lang.String text)
           
protected  void setInternalComment(java.lang.String text)
           
protected  void setInternalDate(java.lang.String text)
           
protected  void setInternalDateFormat(java.text.DateFormat date)
           
protected  void setInternalFailOnError(boolean fail)
           
protected  void setInternalFileTimeStamp(MSVSS.CurrentModUpdated timestamp)
           
protected  void setInternalFromDate(java.lang.String text)
           
protected  void setInternalFromLabel(java.lang.String text)
           
protected  void setInternalGetLocalCopy(boolean get)
           
protected  void setInternalLabel(java.lang.String text)
           
protected  void setInternalLocalPath(java.lang.String text)
           
protected  void setInternalNumDays(int days)
           
protected  void setInternalOutputFilename(java.lang.String text)
           
protected  void setInternalQuiet(boolean quiet)
           
protected  void setInternalRecursive(boolean recursive)
           
protected  void setInternalStyle(java.lang.String style)
           
protected  void setInternalToDate(java.lang.String text)
           
protected  void setInternalToLabel(java.lang.String text)
           
protected  void setInternalUser(java.lang.String user)
           
protected  void setInternalVersion(java.lang.String text)
           
protected  void setInternalWritable(boolean writable)
           
protected  void setInternalWritableFiles(MSVSS.WritableFiles files)
           
 void setLogin(java.lang.String login)
          Login to use when accessing VSS, formatted as "username,password".
 void setServerpath(java.lang.String serverPath)
          Directory where srssafe.ini resides.
 void setSsdir(java.lang.String dir)
          Directory where ss.exe resides.
 void setVsspath(java.lang.String vssPath)
          SourceSafe path which specifies the project/file(s) you wish to perform the action on.
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
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
 

Constructor Detail

MSVSS

public MSVSS()
Method Detail

setSsdir

public final void setSsdir(java.lang.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.

setLogin

public final void setLogin(java.lang.String login)
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:
login - The login string to use.

setVsspath

public final void setVsspath(java.lang.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.

setServerpath

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

Parameters:
serverPath - The path to the VSS server.

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.

execute

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

Overrides:
execute in class Task
Throws:
BuildException - if the command cannot execute.

setInternalComment

protected void setInternalComment(java.lang.String text)

setInternalAutoResponse

protected void setInternalAutoResponse(java.lang.String text)

setInternalDate

protected void setInternalDate(java.lang.String text)

setInternalDateFormat

protected void setInternalDateFormat(java.text.DateFormat date)

setInternalFailOnError

protected void setInternalFailOnError(boolean fail)

setInternalFromDate

protected void setInternalFromDate(java.lang.String text)

setInternalFromLabel

protected void setInternalFromLabel(java.lang.String text)

setInternalLabel

protected void setInternalLabel(java.lang.String text)

setInternalLocalPath

protected void setInternalLocalPath(java.lang.String text)

setInternalNumDays

protected void setInternalNumDays(int days)

setInternalOutputFilename

protected void setInternalOutputFilename(java.lang.String text)

setInternalQuiet

protected void setInternalQuiet(boolean quiet)

setInternalRecursive

protected void setInternalRecursive(boolean recursive)

setInternalStyle

protected void setInternalStyle(java.lang.String style)

setInternalToDate

protected void setInternalToDate(java.lang.String text)

setInternalToLabel

protected void setInternalToLabel(java.lang.String text)

setInternalUser

protected void setInternalUser(java.lang.String user)

setInternalVersion

protected void setInternalVersion(java.lang.String text)

setInternalWritable

protected void setInternalWritable(boolean writable)

setInternalFileTimeStamp

protected void setInternalFileTimeStamp(MSVSS.CurrentModUpdated timestamp)

setInternalWritableFiles

protected void setInternalWritableFiles(MSVSS.WritableFiles files)

setInternalGetLocalCopy

protected void setInternalGetLocalCopy(boolean get)

getSSCommand

protected java.lang.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.

getVsspath

protected java.lang.String getVsspath()
Gets the vssserverpath string.

Returns:
null if vssserverpath is not set.

getQuiet

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

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

getRecursive

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

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

getWritable

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

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

getLabel

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

Returns:
An empty string if label is not set.

getStyle

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

Returns:
An empty string if label is not set.

getVersionDateLabel

protected java.lang.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.

getVersion

protected java.lang.String getVersion()
Gets the version string.

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

getLocalpath

protected java.lang.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.

getComment

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

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

getAutoresponse

protected java.lang.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.

getLogin

protected java.lang.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 java.lang.String getOutput()
Gets the output file string. "-Ooutput.file"

Returns:
An empty string if user is not set.

getUser

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

Returns:
An empty string if user is not set.

getVersionLabel

protected java.lang.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.

getVersionDate

protected java.lang.String getVersionDate()
                                   throws BuildException
Gets the Version date string.

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

getGetLocalCopy

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

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

getFileTimeStamp

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

getWritableFiles

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

Returns:
An empty String, if not set.


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