FileDocCategorySizeDatePackage
CCMkbl.javaAPI DocApache Ant 1.709947Wed Dec 13 06:16:18 GMT 2006org.apache.tools.ant.taskdefs.optional.clearcase

CCMkbl

public class CCMkbl extends ClearCase
Task to CreateBaseline command to ClearCase.

The following attributes are interpreted:
Attribute Values Required
comment Specify a comment. Only one of comment or cfile may be used. No
commentfile Specify a file containing a comment. Only one of comment or cfile may be used. No
baselinerootname Specify the name to be associated with the baseline. Yes
nowarn Suppress warning messages No
identical Allows the baseline to be created even if it is identical to the previous baseline. No
full Creates a full baseline. No
nlabel Allows the baseline to be created without a label. No
failonerr Throw an exception if the command fails. Default is true No

Fields Summary
private String
mComment
private String
mCfile
private String
mBaselineRootName
private boolean
mNwarn
private boolean
mIdentical
private boolean
mFull
private boolean
mNlabel
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_IDENTICAL
-identical flag -- allows the file to be checked in even if it is identical to the original
public static final String
FLAG_INCREMENTAL
-incremental flag -- baseline to be created is incremental
public static final String
FLAG_FULL
-full flag -- baseline to be created is full
public static final String
FLAG_NLABEL
-nlabel -- baseline to be created without a label
Constructors Summary
Methods Summary
private voidcheckOptions(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 (getIdentical()) {
            // -identical
            cmd.createArgument().setValue(FLAG_IDENTICAL);
        }

       if (getFull()) {
           // -full
           cmd.createArgument().setValue(FLAG_FULL);
       } else {
           // -incremental
           cmd.createArgument().setValue(FLAG_INCREMENTAL);
       }

       if (getNlabel()) {
           // -nlabel
           cmd.createArgument().setValue(FLAG_NLABEL);
       }

       // baseline_root_name
        cmd.createArgument().setValue(getBaselineRootName());

    
public voidexecute()
Executes the task.

Builds a command line to execute cleartool and then calls Exec's run method to execute the command line.

throws
BuildException if the command fails and failonerr is set to true



                                           
         
        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 checkin [options...] [viewpath ...]
        // as specified in the CLEARTOOL.EXE help
        commandLine.setExecutable(getClearToolCommand());
        commandLine.createArgument().setValue(COMMAND_MKBL);

        checkOptions(commandLine);

        if (!getFailOnErr()) {
            getProject().log("Ignoring any errors that occur for: "
                    + getBaselineRootName(), Project.MSG_VERBOSE);
        }
        result = run(commandLine);
        if (Execute.isFailure(result) && getFailOnErr()) {
            String msg = "Failed executing: " + commandLine.toString();
            throw new BuildException(msg, getLocation());
        }
    
public java.lang.StringgetBaselineRootName()
Get baseline_root_name

return
String containing the name of the baseline

        return mBaselineRootName;
    
public java.lang.StringgetComment()
Get comment string

return
String containing the comment

        return mComment;
    
private voidgetCommentCommand(org.apache.tools.ant.types.Commandline cmd)
Get the 'comment' command

param
cmd containing the command line string with or without the comment flag and string appended

        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.StringgetCommentFile()
Get comment file

return
String containing the path to the comment file

        return mCfile;
    
private voidgetCommentFileCommand(org.apache.tools.ant.types.Commandline cmd)
Get the 'commentfile' command

param
cmd CommandLine containing the command line string with or without the commentfile flag and file appended

        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 booleangetFull()
Get full flag status

return
boolean containing status of full flag

        return mFull;
    
public booleangetIdentical()
Get identical flag status

return
boolean containing status of identical flag

        return mIdentical;
    
public booleangetNlabel()
Get nlabel status

return
boolean containing status of nlabel flag

        return mNlabel;
    
public booleangetNoWarn()
Get nowarn flag status

return
boolean containing status of nwarn flag

        return mNwarn;
    
public voidsetBaselineRootName(java.lang.String baselineRootName)
Set baseline_root_name

param
baselineRootName the name of the baseline

        mBaselineRootName = baselineRootName;
    
public voidsetComment(java.lang.String comment)
Set comment string

param
comment the comment string

        mComment = comment;
    
public voidsetCommentFile(java.lang.String cfile)
Set comment file

param
cfile the path to the comment file

        mCfile = cfile;
    
public voidsetFull(boolean full)
Set the full flag

param
full the status to set the flag to

        mFull = full;
    
public voidsetIdentical(boolean identical)
Set the identical flag

param
identical the status to set the flag to

        mIdentical = identical;
    
public voidsetNlabel(boolean nlabel)
Set the nlabel flag

param
nlabel the status to set the flag to

        mNlabel = nlabel;
    
public voidsetNoWarn(boolean nwarn)
/** Set the nowarn flag

param
nwarn the status to set the flag to

        mNwarn = nwarn;