Fields Summary |
---|
private String | mComment |
private String | mCfile |
private boolean | mNwarn |
private boolean | mPtime |
private boolean | mNoco |
private boolean | mCheckin |
private boolean | mMaster |
private String | mEltype |
public static final String | FLAG_COMMENT-c flag -- comment to attach to the file |
public static final String | FLAG_COMMENTFILE-cfile flag -- file containing a comment to attach to the file |
public static final String | FLAG_NOCOMMENT-nc flag -- no comment is specified |
public static final String | FLAG_NOWARN-nwarn flag -- suppresses warning messages |
public static final String | FLAG_PRESERVETIME-ptime flag -- preserves the modification time on checkin |
public static final String | FLAG_NOCHECKOUT-nco flag -- do not checkout element after creation |
public static final String | FLAG_CHECKIN-ci flag -- checkin element after creation |
public static final String | FLAG_MASTER-master flag -- change mastership of main branch to current site |
public static final String | FLAG_ELTYPE-eltype flag -- element type to use during creation |
Methods Summary |
---|
private void | checkOptions(org.apache.tools.ant.types.Commandline cmd)Check the command line options.
if (getComment() != null) {
// -c
getCommentCommand(cmd);
} else {
if (getCommentFile() != null) {
// -cfile
getCommentFileCommand(cmd);
} else {
cmd.createArgument().setValue(FLAG_NOCOMMENT);
}
}
if (getNoWarn()) {
// -nwarn
cmd.createArgument().setValue(FLAG_NOWARN);
}
/*
* Should choose either -ci or -nco.
*/
if (getNoCheckout() && getCheckin()) {
throw new BuildException("Should choose either [nocheckout | checkin]");
}
if (getNoCheckout()) {
// -nco
cmd.createArgument().setValue(FLAG_NOCHECKOUT);
}
if (getCheckin()) {
// -ci
cmd.createArgument().setValue(FLAG_CHECKIN);
if (getPreserveTime()) {
// -ptime
cmd.createArgument().setValue(FLAG_PRESERVETIME);
}
}
if (getMaster()) {
// -master
cmd.createArgument().setValue(FLAG_MASTER);
}
if (getEltype() != null) {
// -eltype
getEltypeCommand(cmd);
}
// viewpath
cmd.createArgument().setValue(getViewPath());
|
public void | execute()Executes the task.
Builds a command line to execute cleartool and then calls Exec's run method
to execute the command line.
Commandline commandLine = new Commandline();
Project aProj = getProject();
int result = 0;
// Default the viewpath to basedir if it is not specified
if (getViewPath() == null) {
setViewPath(aProj.getBaseDir().getPath());
}
// build the command line from what we got. the format is
// cleartool mkelem [options...] [viewpath ...]
// as specified in the CLEARTOOL.EXE help
commandLine.setExecutable(getClearToolCommand());
commandLine.createArgument().setValue(COMMAND_MKELEM);
checkOptions(commandLine);
if (!getFailOnErr()) {
getProject().log("Ignoring any errors that occur for: "
+ getViewPathBasename(), Project.MSG_VERBOSE);
}
result = run(commandLine);
if (Execute.isFailure(result) && getFailOnErr()) {
String msg = "Failed executing: " + commandLine.toString();
throw new BuildException(msg, getLocation());
}
|
public boolean | getCheckin()Get ci flag status
return mCheckin;
|
public java.lang.String | getComment()Get comment string
return mComment;
|
private void | getCommentCommand(org.apache.tools.ant.types.Commandline cmd)Get the 'comment' command
if (getComment() != null) {
/* Had to make two separate commands here because if a space is
inserted between the flag and the value, it is treated as a
Windows filename with a space and it is enclosed in double
quotes ("). This breaks clearcase.
*/
cmd.createArgument().setValue(FLAG_COMMENT);
cmd.createArgument().setValue(getComment());
}
|
public java.lang.String | getCommentFile()Get comment file
return mCfile;
|
private void | getCommentFileCommand(org.apache.tools.ant.types.Commandline cmd)Get the 'commentfile' command
if (getCommentFile() != null) {
/* Had to make two separate commands here because if a space is
inserted between the flag and the value, it is treated as a
Windows filename with a space and it is enclosed in double
quotes ("). This breaks clearcase.
*/
cmd.createArgument().setValue(FLAG_COMMENTFILE);
cmd.createArgument().setValue(getCommentFile());
}
|
public java.lang.String | getEltype()Get element type
return mEltype;
|
private void | getEltypeCommand(org.apache.tools.ant.types.Commandline cmd)Get the 'element type' command
if (getEltype() != null) {
/* Had to make two separate commands here because if a space is
inserted between the flag and the value, it is treated as a
Windows filename with a space and it is enclosed in double
quotes ("). This breaks clearcase.
*/
cmd.createArgument().setValue(FLAG_ELTYPE);
cmd.createArgument().setValue(getEltype());
}
|
public boolean | getMaster()Get master flag status
return mMaster;
|
public boolean | getNoCheckout()Get no checkout flag status
return mNoco;
|
public boolean | getNoWarn()Get nowarn flag status
return mNwarn;
|
public boolean | getPreserveTime()Get preservetime flag status
return mPtime;
|
public void | setCheckin(boolean ci)If true, checkin the element after creation
mCheckin = ci;
|
public void | setComment(java.lang.String comment)Sets the comment string.
mComment = comment;
|
public void | setCommentFile(java.lang.String cfile)Specifies a file containing a comment.
mCfile = cfile;
|
public void | setEltype(java.lang.String eltype)Specifies the element type to use.
mEltype = eltype;
|
public void | setMaster(boolean master)If true, changes mastership of the main branch
to the current site
mMaster = master;
|
public void | setNoCheckout(boolean co)If true, do not checkout element after creation.
mNoco = co;
|
public void | setNoWarn(boolean nwarn)If true, suppress warning messages.
mNwarn = nwarn;
|
public void | setPreserveTime(boolean ptime)If true, preserve the modification time.
mPtime = ptime;
|