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

CCUpdate

public class CCUpdate extends ClearCase
Performs a ClearCase Update 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
graphical Displays a graphical dialog during the update No
log Specifies a log file for ClearCase to write to No
overwrite Specifies whether to overwrite hijacked files or not No
rename Specifies that hijacked files should be renamed with a .keep extension No
currenttime Specifies that modification time should be written as the current time. Either currenttime or preservetime can be specified. No
preservetime Specifies that modification time should preserved from the VOB time. Either currenttime or preservetime can be specified. No
failonerr Throw an exception if the command fails. Default is true No

Fields Summary
private boolean
mGraphical
private boolean
mOverwrite
private boolean
mRename
private boolean
mCtime
private boolean
mPtime
private String
mLog
public static final String
FLAG_GRAPHICAL
-graphical flag -- display graphical dialog during update operation
public static final String
FLAG_LOG
-log flag -- file to log status to
public static final String
FLAG_OVERWRITE
-overwrite flag -- overwrite hijacked files
public static final String
FLAG_NOVERWRITE
-noverwrite flag -- do not overwrite hijacked files
public static final String
FLAG_RENAME
-rename flag -- rename hijacked files with .keep extension
public static final String
FLAG_CURRENTTIME
-ctime flag -- modified time is written as the current time
public static final String
FLAG_PRESERVETIME
-ptime flag -- modified time is written as the VOB time
Constructors Summary
Methods Summary
private voidcheckOptions(org.apache.tools.ant.types.Commandline cmd)
Check the command line options.

        // ClearCase items
        if (getGraphical()) {
            // -graphical
            cmd.createArgument().setValue(FLAG_GRAPHICAL);
        } else {
            if (getOverwrite()) {
                // -overwrite
                cmd.createArgument().setValue(FLAG_OVERWRITE);
            } else {
                if (getRename()) {
                    // -rename
                    cmd.createArgument().setValue(FLAG_RENAME);
                } else {
                    // -noverwrite
                    cmd.createArgument().setValue(FLAG_NOVERWRITE);
                }
            }

            if (getCurrentTime()) {
                // -ctime
                cmd.createArgument().setValue(FLAG_CURRENTTIME);
            } else {
                if (getPreserveTime()) {
                    // -ptime
                    cmd.createArgument().setValue(FLAG_PRESERVETIME);
                }
            }

            // -log logname
            getLogCommand(cmd);
        }

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

        // Check the command line options
        checkOptions(commandLine);

        // For debugging
        getProject().log(commandLine.toString(), Project.MSG_DEBUG);

        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 booleangetCurrentTime()
Get current time status

return
boolean containing status of current time flag

        return mCtime;
    
public booleangetGraphical()
Get graphical flag status

return
boolean containing status of graphical flag

        return mGraphical;
    
public java.lang.StringgetLog()
Get log file

return
String containing the path to the log file

        return mLog;
    
private voidgetLogCommand(org.apache.tools.ant.types.Commandline cmd)
Get the 'log' command

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

        if (getLog() == null) {
            return;
        } else {
            /* 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_LOG);
            cmd.createArgument().setValue(getLog());
        }
    
public booleangetOverwrite()
Get overwrite hijacked files status

return
boolean containing status of overwrite flag

        return mOverwrite;
    
public booleangetPreserveTime()
Get preserve time status

return
boolean containing status of preserve time flag

        return mPtime;
    
public booleangetRename()
Get rename hijacked files status

return
boolean containing status of rename flag

        return mRename;
    
public voidsetCurrentTime(boolean ct)
If true, modification time should be written as the current time. Either currenttime or preservetime can be specified.

param
ct the status to set the flag to

        mCtime = ct;
    
public voidsetGraphical(boolean graphical)
If true, displays a graphical dialog during the update.

param
graphical the status to set the flag to

        mGraphical = graphical;
    
public voidsetLog(java.lang.String log)
Sets the log file where cleartool records the status of the command.

param
log the path to the log file

        mLog = log;
    
public voidsetOverwrite(boolean ow)
If true, overwrite hijacked files.

param
ow the status to set the flag to

        mOverwrite = ow;
    
public voidsetPreserveTime(boolean pt)
If true, modification time should be preserved from the VOB time. Either currenttime or preservetime can be specified.

param
pt the status to set the flag to

        mPtime = pt;
    
public voidsetRename(boolean ren)
If true, hijacked files are renamed with a .keep extension.

param
ren the status to set the flag to

        mRename = ren;