Google

SOS (Apache Ant API)

org.apache.tools.ant.taskdefs.optional.sos
Class SOS


java.lang.Object

  |

  +--org.apache.tools.ant.ProjectComponent

        |

        +--org.apache.tools.ant.Task

              |

              +--org.apache.tools.ant.taskdefs.optional.sos.SOS

Direct Known Subclasses:
SOSCheckin, SOSCheckout, SOSGet, SOSLabel

public abstract class SOS
extends Task

A base class for creating tasks for executing commands on SourceOffSite.

The class extends the 'exec' task as it operates by executing the soscmd(.exe) program supplied with SOS. By default the task expects soscmd(.exe) to be in the path, you can override this be specifying the sosdir attribute.

This class provides set and get methods for the following attributes
'vssserverpath'
'sosserverpath'
'vsspath'
'projectpath'
'username'
'password'
'soscmddir'
'file'
'soshome'
'localpath"
'comment'
'label'
'version'
'recursive'
'verbose'
'nocache'
'nocompression'
It also contains constants for the flags that can be passed to SOS.

These tasks were inspired by the VSS tasks

Author:
Jesse Stockall

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
 
Constructor Summary
SOS()
           
 
Method Summary
 java.lang.String getComment()
          Get the comment
 java.lang.String getFilename()
          Get the filename to be acted upon
 java.lang.String getLabel()
          Get the label
 java.lang.String getLocalPath()
          Builds and returns the working directory.
 java.lang.String getNoCache()
          Get the NoCache flag
 java.lang.String getNoCompress()
          Get the NoCompress flag
 java.lang.String getPassword()
          Get the password
 java.lang.String getProjectPath()
          Get the project path
 java.lang.String getRecursive()
          Get the 'recursive' Flag
 java.lang.String getSosCommand()
          Get the executable to run.
 java.lang.String getSosHome()
          Get the SOS home directory
 java.lang.String getSosServerPath()
          Get the SOS serve path
 java.lang.String getUsername()
          Get the username
 java.lang.String getVerbose()
          Get the 'verbose' Flag
 java.lang.String getVersion()
          Get the version
 java.lang.String getVssServerPath()
          Get the VSS server path
protected  int run(Commandline cmd)
          Execute the created command line
 void setComment(java.lang.String comment)
          Set the comment to apply to all files being labelled; optional, only valid in SOSLabel
 void setFile(java.lang.String filename)
          Set the Filename to act upon; optional.
 void setLabel(java.lang.String label)
          Set the labeled version to operate on in SourceSafe
 void setLocalPath(Path path)
          Override the working directory and get to the specified path; optional.
 void setNoCache(boolean nocache)
          flag to disable the cache when set; optional needed if SOSHOME is set as an environment variable.
 void setNoCompress(boolean nocompress)
          Flag that disables compression when set; optional, default
 void setPassword(java.lang.String password)
          Set the SourceSafe password; optional.
 void setProjectPath(java.lang.String projectpath)
          Set the SourceSafe project path without the "$" prefix; required
 void setRecursive(boolean recursive)
          Flag to recursively apply the action (not valid on all SOS tasks ); optional, default false
 void setSosCmd(java.lang.String dir)
          Set the directory where soscmd(.exe) is located; optional, soscmd must be on the path if omitted.
 void setSosHome(java.lang.String sosHome)
          The path to the SourceOffSite home directory
 void setSosServerPath(java.lang.String sosServerPath)
          Set the address and port of SourceOffSite Server, eg.
 void setUsername(java.lang.String username)
          Set the SourceSafe username; required.
 void setVerbose(boolean verbose)
          Enable verbose output; optional, default false
 void setVersion(java.lang.String version)
          Set the a version number to get - only works with the SOSGet on a file; optional.
 void setVssServerPath(java.lang.String vssServerPath)
          Set the path to the location of the ss.ini file; required.
 
Methods inherited from class org.apache.tools.ant.Task
execute, getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorOutput, 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
 

Constructor Detail

SOS


public SOS()
Method Detail

setNoCache


public void setNoCache(boolean nocache)
flag to disable the cache when set; optional needed if SOSHOME is set as an environment variable.

Parameters:
nocache - The new noCache value

setNoCompress


public void setNoCompress(boolean nocompress)
Flag that disables compression when set; optional, default

Parameters:
nocompress - true to disable compression

setSosCmd


public final void setSosCmd(java.lang.String dir)
Set the directory where soscmd(.exe) is located; optional, soscmd must be on the path if omitted.

Parameters:
dir - The new sosCmd value

setUsername


public final void setUsername(java.lang.String username)
Set the SourceSafe username; required.

Parameters:
username - The new username value

setPassword


public final void setPassword(java.lang.String password)
Set the SourceSafe password; optional.

Parameters:
password - The new password value

setProjectPath


public final void setProjectPath(java.lang.String projectpath)
Set the SourceSafe project path without the "$" prefix; required

Parameters:
projectpath - The new projectPath value

setVssServerPath


public final void setVssServerPath(java.lang.String vssServerPath)
Set the path to the location of the ss.ini file; required.

Parameters:
vssServerPath - The new vssServerPath value

setSosHome


public final void setSosHome(java.lang.String sosHome)
The path to the SourceOffSite home directory

Parameters:
sosHome - The new sosHome value

setSosServerPath


public final void setSosServerPath(java.lang.String sosServerPath)
Set the address and port of SourceOffSite Server, eg. 192.168.0.1:8888 ; required.

Parameters:
sosServerPath - The new sosServerPath value

setLocalPath


public void setLocalPath(Path path)
Override the working directory and get to the specified path; optional.

Parameters:
path - The new localPath value

setFile


public final void setFile(java.lang.String filename)
Set the Filename to act upon; optional. If no file is specified then the tasks act upon the project

Parameters:
filename - The new file value

setVerbose


public void setVerbose(boolean verbose)
Enable verbose output; optional, default false

Parameters:
verbose - The new verbose value

setRecursive


public void setRecursive(boolean recursive)
Flag to recursively apply the action (not valid on all SOS tasks ); optional, default false

Parameters:
recursive - The new recursive value

setVersion


public void setVersion(java.lang.String version)
Set the a version number to get - only works with the SOSGet on a file; optional.

Parameters:
version - The new version value

setLabel


public void setLabel(java.lang.String label)
Set the labeled version to operate on in SourceSafe

Parameters:
label - The new label value

setComment


public void setComment(java.lang.String comment)
Set the comment to apply to all files being labelled; optional, only valid in SOSLabel

Parameters:
comment - The new comment value

getSosCommand


public java.lang.String getSosCommand()
Get the executable to run. Add the path if it was specifed in the build file

Returns:
String the executable to run

getComment


public java.lang.String getComment()
Get the comment

Returns:
String if it was set, null if not

getVersion


public java.lang.String getVersion()
Get the version

Returns:
String if it was set, null if not

getLabel


public java.lang.String getLabel()
Get the label

Returns:
String if it was set, null if not

getUsername


public java.lang.String getUsername()
Get the username

Returns:
String if it was set, null if not

getPassword


public java.lang.String getPassword()
Get the password

Returns:
String empty string if it wans't set

getProjectPath


public java.lang.String getProjectPath()
Get the project path

Returns:
String if it was set, null if not

getVssServerPath


public java.lang.String getVssServerPath()
Get the VSS server path

Returns:
String if it was set, null if not

getSosHome


public java.lang.String getSosHome()
Get the SOS home directory

Returns:
String if it was set, null if not

getSosServerPath


public java.lang.String getSosServerPath()
Get the SOS serve path

Returns:
String if it was set, null if not

getFilename


public java.lang.String getFilename()
Get the filename to be acted upon

Returns:
String if it was set, null if not

getNoCompress


public java.lang.String getNoCompress()
Get the NoCompress flag

Returns:
String the 'nocompress' Flag if the attribute was 'true', otherwise an empty string

getNoCache


public java.lang.String getNoCache()
Get the NoCache flag

Returns:
String the 'nocache' Flag if the attribute was 'true', otherwise an empty string

getVerbose


public java.lang.String getVerbose()
Get the 'verbose' Flag

Returns:
String the 'verbose' Flag if the attribute was 'true', otherwise an empty string

getRecursive


public java.lang.String getRecursive()
Get the 'recursive' Flag

Returns:
String the 'recursive' Flag if the attribute was 'true', otherwise an empty string

getLocalPath


public java.lang.String getLocalPath()
Builds and returns the working directory.

The localpath is created if it didn't exist

Returns:
String the absolute path of the working directory

run


protected int run(Commandline cmd)
Execute the created command line

Parameters:
cmd - Description of Parameter
Returns:
int the exit code
Throws:
BuildException


Copyright 2000-2002 Apache Software Foundation. All Rights Reserved.