org.apache.tools.ant.taskdefs.optional.clearcase
abstract public class: ClearCase [javadoc |
source]
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.tools.ant.taskdefs.optional.clearcase.ClearCase
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
CCCheckin, CCCheckout, CCMklbtype, CCMkattr, CCRmtype, CCLock, CCMkbl, CCMkdir, CCUnlock, CCUnCheckout, CCMkelem, CCMklabel, CCUpdate
A base class for creating tasks for executing commands on ClearCase.
The class extends the 'exec' task as it operates by executing the cleartool program
supplied with ClearCase. By default the task expects the cleartool executable to be
in the path, * you can override this be specifying the cleartooldir attribute.
This class provides set and get methods for the 'viewpath' and 'objselect'
attribute. It also contains constants for the flags that can be passed to
cleartool.
| Field Summary |
|---|
| public static final String | COMMAND_UPDATE | The 'Update' command |
| public static final String | COMMAND_CHECKOUT | The 'Checkout' command |
| public static final String | COMMAND_CHECKIN | The 'Checkin' command |
| public static final String | COMMAND_UNCHECKOUT | The 'UndoCheckout' command |
| public static final String | COMMAND_LOCK | The 'Lock' command |
| public static final String | COMMAND_UNLOCK | The 'Unlock' command |
| public static final String | COMMAND_MKBL | The 'Mkbl' command |
| public static final String | COMMAND_MKLABEL | The 'Mklabel' command |
| public static final String | COMMAND_MKLBTYPE | The 'Mklbtype' command |
| public static final String | COMMAND_RMTYPE | The 'Rmtype' command |
| public static final String | COMMAND_LSCO | The 'LsCheckout' command |
| public static final String | COMMAND_MKELEM | The 'Mkelem' command |
| public static final String | COMMAND_MKATTR | The 'Mkattr' command |
| public static final String | COMMAND_MKDIR | The 'Mkdir' command |
| Method from org.apache.tools.ant.taskdefs.optional.clearcase.ClearCase Summary: |
|---|
|
getClearToolCommand, getFailOnErr, getObjSelect, getViewPath, getViewPathBasename, run, runS, setClearToolDir, setFailOnErr, setObjSelect, setViewPath |
| Methods from org.apache.tools.ant.Task: |
|---|
|
bindToOwner, execute, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, markInvalid, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType |
| Method from org.apache.tools.ant.taskdefs.optional.clearcase.ClearCase Detail: |
protected final String getClearToolCommand() {
String toReturn = mClearToolDir;
if (!toReturn.equals("") && !toReturn.endsWith("/")) {
toReturn += "/";
}
toReturn += CLEARTOOL_EXE;
return toReturn;
}
Builds and returns the command string to execute cleartool |
public boolean getFailOnErr() {
return mFailonerr;
}
Get failonerr flag status |
public String getObjSelect() {
return mobjSelect;
}
Get the object to operate on |
public String getViewPath() {
return mviewPath;
}
Get the path to the item in a clearcase view |
public String getViewPathBasename() {
return (new File(mviewPath)).getName();
}
Get the basename path of the item in a clearcase view |
protected int run(Commandline cmd) {
try {
Project aProj = getProject();
Execute exe
= new Execute(new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN));
exe.setAntRun(aProj);
exe.setWorkingDirectory(aProj.getBaseDir());
exe.setCommandline(cmd.getCommandline());
return exe.execute();
} catch (java.io.IOException e) {
throw new BuildException(e, getLocation());
}
}
Execute the given command are return success or failure |
protected String runS(Commandline cmdline) {
String outV = "opts.cc.runS.output" + pcnt++;
ExecTask exe = new ExecTask(this);
Commandline.Argument arg = exe.createArg();
exe.setExecutable(cmdline.getExecutable());
arg.setLine(Commandline.toString(cmdline.getArguments()));
exe.setOutputproperty(outV);
exe.execute();
return getProject().getProperty(outV);
}
Execute the given command, and return it's output |
public final void setClearToolDir(String dir) {
mClearToolDir = FileUtils.translatePath(dir);
}
Set the directory where the cleartool executable is located. |
public void setFailOnErr(boolean failonerr) {
mFailonerr = failonerr;
}
If true, command will throw an exception on failure. |
public final void setObjSelect(String objSelect) {
mobjSelect = objSelect;
}
Set the object to operate on. |
public final void setViewPath(String viewPath) {
mviewPath = viewPath;
}
Set the path to the item in a ClearCase view to operate on. |