Methods Summary |
---|
abstract org.apache.tools.ant.types.Commandline | buildCmdLine()Subclasses implement the logic required to construct the command line.
|
public void | execute()Execute the created command line.
int result = 0;
buildCmdLine();
result = run(commandLine);
if (result == 255) { // This is the exit status
String msg = "Failed executing: " + commandLine.toString();
throw new BuildException(msg, getLocation());
}
|
protected java.lang.String | getComment()Get the comment
return comment;
|
protected java.lang.String | getFilename()Get the filename to be acted upon.
return filename;
|
protected java.lang.String | getLabel()Get the label
return label;
|
protected java.lang.String | getLocalPath()Builds and returns the working directory.
The localpath is created if it didn't exist.
if (localPath == null) {
return getProject().getBaseDir().getAbsolutePath();
} else {
// make sure localDir exists, create it if it doesn't
File dir = getProject().resolveFile(localPath);
if (!dir.exists()) {
boolean done = dir.mkdirs();
if (!done) {
String msg = "Directory " + localPath + " creation was not "
+ "successful for an unknown reason";
throw new BuildException(msg, getLocation());
}
getProject().log("Created dir: " + dir.getAbsolutePath());
}
return dir.getAbsolutePath();
}
|
protected java.lang.String | getNoCache()Get the NoCache flag.
return noCache ? FLAG_NO_CACHE : "";
|
protected java.lang.String | getNoCompress()Get the NoCompress flag.
return noCompress ? FLAG_NO_COMPRESSION : "";
|
protected void | getOptionalAttributes()Adds the optional attributes to the command line.
// -verbose
commandLine.createArgument().setValue(getVerbose());
// Disable Compression
commandLine.createArgument().setValue(getNoCompress());
// Path to the SourceOffSite home directory /home/user/.sos
if (getSosHome() == null) {
// If -soshome was not specified then we can look for nocache
commandLine.createArgument().setValue(getNoCache());
} else {
commandLine.createArgument().setValue(FLAG_SOS_HOME);
commandLine.createArgument().setValue(getSosHome());
}
//If a working directory was specified then add it to the command line
if (getLocalPath() != null) {
commandLine.createArgument().setValue(FLAG_WORKING_DIR);
commandLine.createArgument().setValue(getLocalPath());
}
|
protected java.lang.String | getPassword()Get the password
return sosPassword;
|
protected java.lang.String | getProjectPath()Get the project path
return projectPath;
|
protected java.lang.String | getRecursive()Get the 'recursive' Flag.
return recursive ? FLAG_RECURSION : "";
|
protected void | getRequiredAttributes()Sets the executable and add the required attributes to the command line.
// Get the path to the soscmd(.exe)
commandLine.setExecutable(getSosCommand());
// SOS server address is required
if (getSosServerPath() == null) {
throw new BuildException("sosserverpath attribute must be set!", getLocation());
}
commandLine.createArgument().setValue(FLAG_SOS_SERVER);
commandLine.createArgument().setValue(getSosServerPath());
// Login info is required
if (getUsername() == null) {
throw new BuildException("username attribute must be set!", getLocation());
}
commandLine.createArgument().setValue(FLAG_USERNAME);
commandLine.createArgument().setValue(getUsername());
// The SOS class knows that the SOS server needs the password flag,
// even if there is no password ,so we send a " "
commandLine.createArgument().setValue(FLAG_PASSWORD);
commandLine.createArgument().setValue(getPassword());
// VSS Info is required
if (getVssServerPath() == null) {
throw new BuildException("vssserverpath attribute must be set!", getLocation());
}
commandLine.createArgument().setValue(FLAG_VSS_SERVER);
commandLine.createArgument().setValue(getVssServerPath());
// VSS project is required
if (getProjectPath() == null) {
throw new BuildException("projectpath attribute must be set!", getLocation());
}
commandLine.createArgument().setValue(FLAG_PROJECT);
commandLine.createArgument().setValue(getProjectPath());
|
protected java.lang.String | getSosCommand()Get the executable to run. Add the path if it was specifed in the build file
if (sosCmdDir == null) {
return COMMAND_SOS_EXE;
} else {
return sosCmdDir + File.separator + COMMAND_SOS_EXE;
}
|
protected java.lang.String | getSosHome()Get the SOS home directory.
return sosHome;
|
protected java.lang.String | getSosServerPath()Get the SOS serve path.
return sosServerPath;
|
protected java.lang.String | getUsername()Get the username
return sosUsername;
|
protected java.lang.String | getVerbose()Get the 'verbose' Flag.
return verbose ? FLAG_VERBOSE : "";
|
protected java.lang.String | getVersion()Get the version
return version;
|
protected java.lang.String | getVssServerPath()Get the VSS server path
return vssServerPath;
|
protected int | run(org.apache.tools.ant.types.Commandline cmd)Execute the created command line.
try {
Execute exe = new Execute(new LogStreamHandler(this,
Project.MSG_INFO,
Project.MSG_WARN));
exe.setAntRun(getProject());
exe.setWorkingDirectory(getProject().getBaseDir());
exe.setCommandline(cmd.getCommandline());
exe.setVMLauncher(false); // Use the OS VM launcher so we get environment variables
return exe.execute();
} catch (java.io.IOException e) {
throw new BuildException(e, getLocation());
}
|
protected void | setInternalComment(java.lang.String text)Set the comment text.
comment = text;
|
protected void | setInternalFilename(java.lang.String file)Set the file name.
filename = file;
|
protected void | setInternalLabel(java.lang.String text)Set the label.
label = text;
|
protected void | setInternalRecursive(boolean recurse)Set the recursive flag.
recursive = recurse;
|
protected void | setInternalVersion(java.lang.String text)Set the version.
version = text;
|
public final void | setLocalPath(org.apache.tools.ant.types.Path path)Override the working directory and get to the specified path.
localPath = path.toString();
|
public final void | setNoCache(boolean nocache)Flag to disable the cache when set.
Required if SOSHOME is set as an environment variable.
Defaults to false.
// CheckStyle:VisibilityModifier ON
noCache = nocache;
|
public final void | setNoCompress(boolean nocompress)Flag to disable compression when set. Defaults to false.
noCompress = nocompress;
|
public final void | setPassword(java.lang.String password)The SourceSafe password.
sosPassword = password;
|
public final void | setProjectPath(java.lang.String projectpath)The SourceSafe project path.
if (projectpath.startsWith(SOSCmd.PROJECT_PREFIX)) {
projectPath = projectpath;
} else {
projectPath = SOSCmd.PROJECT_PREFIX + projectpath;
}
|
public final void | setSosCmd(java.lang.String dir)The directory where soscmd(.exe) is located.
soscmd must be on the path if omitted.
sosCmdDir = FileUtils.translatePath(dir);
|
public final void | setSosHome(java.lang.String sosHome)Path to the SourceOffSite home directory.
this.sosHome = sosHome;
|
public final void | setSosServerPath(java.lang.String sosServerPath)The address and port of SourceOffSite Server,
for example 192.168.0.1:8888.
this.sosServerPath = sosServerPath;
|
public final void | setUsername(java.lang.String username)The SourceSafe username.
sosUsername = username;
|
public void | setVerbose(boolean verbose)Enable verbose output. Defaults to false.
this.verbose = verbose;
|
public final void | setVssServerPath(java.lang.String vssServerPath)The path to the location of the ss.ini file.
this.vssServerPath = vssServerPath;
|