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

CCUnCheckout

public class CCUnCheckout extends ClearCase
Performs ClearCase UnCheckout command.

The following attributes are interpreted:
Attribute Values Required
viewpath Path to the ClearCase view file or directory that the command will operate on No
keepcopy Specifies whether to keep a copy of the file with a .keep extension or not No
failonerr Throw an exception if the command fails. Default is true No

Fields Summary
private boolean
mKeep
public static final String
FLAG_KEEPCOPY
-keep flag -- keep a copy of the file with .keep extension
public static final String
FLAG_RM
-rm flag -- remove the copy of the file
Constructors Summary
Methods Summary
private voidcheckOptions(org.apache.tools.ant.types.Commandline cmd)
Check the command line options.

        // ClearCase items
        if (getKeepCopy()) {
            // -keep
            cmd.createArgument().setValue(FLAG_KEEPCOPY);
        } else {
            // -rm
            cmd.createArgument().setValue(FLAG_RM);
        }

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

        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 booleangetKeepCopy()
Get keepcopy flag status

return
boolean containing status of keep flag

        return mKeep;
    
public voidsetKeepCopy(boolean keep)
If true, keep a copy of the file with a .keep extension.

param
keep the status to set the flag to

        mKeep = keep;