diff --git a/docs/manual/OptionalTasks/clearcase.html b/docs/manual/OptionalTasks/clearcase.html index 9bc26f042..164c52ffe 100644 --- a/docs/manual/OptionalTasks/clearcase.html +++ b/docs/manual/OptionalTasks/clearcase.html @@ -6,19 +6,45 @@ +

Ant ClearCase Tasks

+

by:
+Curtis White (cwhite at aracnet dot com),
+Sean P. Kane (spkane at genomatica dot com), and
+Rob Anderson (Anderson.Rob at vectorscm dot com)

+ +

Version 1.6 - 02/25/2003

ClearCase Support

+

Table of Contents

+
+

Introduction

+

Ant provides several optional tasks for working with ClearCase. These tasks correspond to various +ClearCase commands using the Cleartool program. The current tasks avaliable for Ant correspond to only +a few of the significant ClearCase commands.

+ +

More tasks can be easily added by deriving from the ClearCase class and then adding +functionality that is specific to that ClearCase command.

+ +

CCCheckin

Description

-Task to perform a Checkin command to ClearCase. +Task to perform a "cleartool checkin" command to ClearCase.

Parameters

@@ -28,7 +54,7 @@ Task to perform a Checkin command to ClearCase. - @@ -39,7 +65,7 @@ Task to perform a Checkin command to ClearCase. - @@ -60,7 +86,7 @@ Task to perform a Checkin command to ClearCase. - @@ -68,20 +94,20 @@ Task to perform a Checkin command to ClearCase.

Examples

-<cccheckin viewpath="c:/views/viewdir/afile"
-        commentfile="acomment.txt"
-        nowarn="true"
-        identical="true"/>
+<cccheckin viewpath="c:/views/viewdir/afile"
+        commentfile="acomment.txt"
+        nowarn="true"
+        identical="true"/>
 
-

Does a ClearCase checkin on the file c:/views/viewdir/afile. +

Does a ClearCase checkin on the file c:/views/viewdir/afile. Comment text from the file acomment.txt is added to ClearCase as a comment. All warning messages are suppressed. The file is checked in even if it is identical to the original.


CCCheckout

Description

-Task to perform a Checkout command to ClearCase. +Task to perform a "cleartool checkout" command to ClearCase.

Parameters

viewpathPath to the ClearCase view file or directory that the command + Path to the ClearCase view file or directory that the command will operate on No
commentfileSpecify a file containing a comment. Only one of comment or commentfile + Specify a file containing a comment. Only one of comment or commentfile may be used. No
identicalAllows the file to be checked in even if it is identical + Allows the file to be checked in even if it is identical to the original No
@@ -91,7 +117,7 @@ Task to perform a Checkout command to ClearCase. - @@ -107,7 +133,7 @@ Task to perform a Checkout command to ClearCase. - @@ -133,7 +159,7 @@ Task to perform a Checkout command to ClearCase. - @@ -141,16 +167,16 @@ Task to perform a Checkout command to ClearCase.

Examples

-<cccheckout viewpath="c:/views/viewdir/afile"
-        reserved="true" 
-        branch="abranch"
-        nowarn="true"
-        comment="Some comment text"/>
+<cccheckout viewpath="c:/views/viewdir/afile"
+        reserved="true"
+        branch="abranch"
+        nowarn="true"
+        comment="Some comment text"/>
 
-

Does a ClearCase checkout on the file c:/views/viewdir/afile. -It is checked out as reserved on branch called abranch. All -warning messages are suppressed. A Some comment text is added to +

Does a ClearCase checkout on the file c:/views/viewdir/afile. +It is checked out as reserved on branch called abranch. All +warning messages are suppressed. A Some comment text is added to ClearCase as a comment.


CCUnCheckout

@@ -165,13 +191,13 @@ Task to perform a UnCheckout command to ClearCase. - - @@ -179,16 +205,16 @@ Task to perform a UnCheckout command to ClearCase.

Examples

-<ccuncheckout viewpath="c:/views/viewdir/afile"
-        keepcopy="true"/>
+<ccuncheckout viewpath="c:/views/viewdir/afile"
+        keepcopy="true"/>
 
-

Does a ClearCase uncheckout on the file c:/views/viewdir/afile. +

Does a ClearCase uncheckout on the file c:/views/viewdir/afile. A copy of the file called c:/views/viewdir/afile.keep is kept.


CCUpdate

Description

-Task to perform an Update command to ClearCase. +Task to perform an "cleartool update" command to ClearCase.

Parameters

viewpathPath to the ClearCase view file or directory that the command + Path to the ClearCase view file or directory that the command will operate on No
nodataChecks out the file but does not create an editable file + Checks out the file but does not create an editable file containing its data No
commentfileSpecify a file containing a comment. Only one of comment or + Specify a file containing a comment. Only one of comment or commentfile may be used. No
viewpathPath to the ClearCase view file or directory that the command + Path to the ClearCase view file or directory that the command will operate on No
keepcopySpecifies whether to keep a copy of the file with a .keep + Specifies whether to keep a copy of the file with a .keep extension or not No
@@ -198,7 +224,7 @@ Task to perform an Update command to ClearCase. - @@ -224,15 +250,15 @@ Task to perform an Update command to ClearCase. - - @@ -240,22 +266,399 @@ Task to perform an Update command to ClearCase.

Examples

-<ccupdate viewpath="c:/views/viewdir"
-        graphical="false" 
-        log="log.log"
-        overwrite="true"
-        currenttime="true"
-        rename="false"/>
+<ccupdate viewpath="c:/views/viewdir"
+        graphical="false"
+        log="log.log"
+        overwrite="true"
+        currenttime="true"
+        rename="false"/>
 
-

Does a ClearCase update on the directory c:/views/viewdir. -A graphical dialog will be displayed. The output will be logged to -log.log and it will overwrite any hijacked files. The modified +

Does a ClearCase update on the snapshot view directory c:/views/viewdir. +A graphical dialog will be displayed. The output will be logged to +log.log and it will overwrite any hijacked files. The modified time will be set to the current time.

+ +
-

Copyright © 2000-2002 Apache Software Foundation. All rights -Reserved.

- +

CCMklbtype

+

Description

+Task to perform a "mklbtype" command to ClearCase. +

Parameters

+
viewpathPath to the ClearCase view file or directory that the command + Path to the ClearCase snapshot view file or directory that the command will operate on No
currenttimeSpecifies that modification time should be written as the - current time. Either currenttime or preservetime can be + Specifies that modification time should be written as the + current time. Either currenttime or preservetime can be specified. No
preservetimeSpecifies that modification time should preserved from the - VOB time. Either currenttime or preservetime can be + Specifies that modification time should preserved from the + VOB time. Either currenttime or preservetime can be specified. No
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AttributeValuesRequired
typenameName of the label type to createYes
vobName of the VOBNo
replaceReplace an existing label definition of the same typeNo
globalEither global or ordinary can be specified, not both. Creates a label type that is global to the VOB or to VOBs that use this VOBNo
ordinaryEither global or ordinary can be specified, not both. Creates a label type that can be used only in the current VOB. DefaultNo
pbranchAllows the label type to be used once per branch in a given element's version treeNo
sharedSets the way mastership is checked by ClearCase. See ClearCase documentation for detailsNo
commentSpecify a comment. Only one of comment or cfile may be used.No
commentfileSpecify a file containing a comment. Only one of comment or cfile may be used.No
+ +

Examples

+
+
+<ccmklbtype typename="VERSION_1"
+        ordinary="true"
+        comment="Development version 1"/>
+
+
+

Does a ClearCase mklbtype to create a label type named VERSION_1. +It is created as ordinary so it is available only to the current VOB. +The text Development version 1 is added as a comment.

+ + +
+

CCMklabel

+

Description

+Task to perform a "mklabel" command to ClearCase. +

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AttributeValuesRequired
typenameName of the label typeYes
viewpathPath to the ClearCase view file or directory that the command will operate onNo
replaceReplace a label of the same type on the same branchNo
recurseProcess each subdirectory under viewpathNo
versionIdentify a specific version to attach the label toNo
vobName of the VOBNo
commentSpecify a comment. Only one of comment or cfile may be used.No
commentfileSpecify a file containing a comment. Only one of comment or cfile may be used.No
+

Examples

+
+
+<ccmklabel viewpath="c:/views/viewdir/afile"
+        comment="Some comment text"
+        recurse="true"
+        version="\main\2"
+        typename="VERSION_1"/>
+
+
+

Does a ClearCase mklabel on the file c:/views/viewdir/afile under +the main branch for version 2 (\main\2). Text Some comment text is added +as a comment. It will recurse all subdirectories. + + +


+

CCRmtype

+

Description

+Task to perform a "rmtype" command to ClearCase. +

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AttributeValuesRequired
typekindThe kind of type to create. Valid types are: + + + + + + + +
attype
+ brtype
+ eltype
+ hltype
+ lbtype
+ trtype +
-
+ -
+ -
+ -
+ -
+ - +
attribute type
+ branch type
+ element type
+ hyperlink type
+ label type
+ trigger type +
+
Yes
typenameThe name of the type to removeYes
ignoreUsed with trigger types only. Forces removal of trigger type even if a pre-operation trigger would prevent its removalNo
rmallRemoves all instances of a type and the type object itselfNo
commentSpecify a comment. Only one of comment or cfile may be used.No
commentfileSpecify a file containing a comment. Only one of comment or cfile may be used.No
+ +

Examples

+
+
+<ccrmtype typekind="lbtype"
+        typename="VERSION_1"
+        commentfile="acomment.txt"
+        rmall="true"/>
+
+
+

Does a ClearCase rmtype to remove a label type (lbtype) named VERSION_1. +Comment text from the file acomment.txt is added as a comment. All instances of the type +are removed, including the type object itself.

+
+ +

CCLock

+

Description

+Task to perform a "cleartool lock" command to ClearCase. +

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AttributeValuesRequired
replaceSpecifies replacing an existing lockNo
nusersSpecifies user(s) who can still modify the objectNo
obsoleteSpecifies that the object should be marked obsoleteNo
commentSpecifies how to populate comments fieldsNo
pnameSpecifies the object pathname to be locked.Yes
objselectSpecifies the object(s) to be locked.Yes
+

Examples

+
+
+<cclock
+    objselect="stream:Application_Integration@\MyProject_PVOB"
+    />
+
+
+

Does a ClearCase lock on the object stream:Application_Integration@\MyProject_PVOB.

+
+ +

CCUnlock

+

Description

+Task to perform a "cleartool unlock" command to ClearCase. +

Parameters

+ + + + + + + + + + + + + + + + + + + + + +
AttributeValuesRequired
commentSpecifies how to populate comments fieldsNo
pnameSpecifies the object pathname to be unlocked.Yes
objselectSpecifies the object(s) to be unlocked.Yes
+

Examples

+
+
+<ccunlock
+    objselect="stream:Application_Integration@\MyProject_PVOB"
+    />
+
+
+

Does a ClearCase unlock on the object stream:Application_Integration@\MyProject_PVOB.

+
+ +

CCMkbl

+

Description

+Task to perform a "cleartool mkbl" command to ClearCase. +

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AttributeValuesRequired
commentSpecify a comment. Only one of comment or cfile may be +used.No
commentfileSpecify a file containing a comment. Only one of comment or +cfile may be used.No
baselinerootnameSpecify the name to be associated with the baseline.Yes
nowarnSuppress warning messagesNo
identicalAllows the baseline to be created even if it is identical to the +previous baseline.No
fullCreates a full baseline.No
nlabelAllows the baseline to be created without a label.No
+

Examples

+
+
+<ccmkbl
+    baselinerootname="Application_Baseline_AUTO"
+    identical="yes"
+    full="no"
+    viewpath="v:\ApplicationCC"
+    />
+
+
+

Does a ClearCase mkbl on the Integration view at v:\ApplicationCC +even if it is identical to a previous baseline. The new baseline with be +incremental and named "Application_Baseline_AUTO".

+
+ +

Copyright © 2000-2003 Apache Software Foundation. All rights +reserved.

+ diff --git a/docs/manual/tasksoverview.html b/docs/manual/tasksoverview.html index aeb740a03..040ae4171 100644 --- a/docs/manual/tasksoverview.html +++ b/docs/manual/tasksoverview.html @@ -1085,8 +1085,8 @@ documentation.

ClearCase -

Tasks to perform the ClearCase cccheckin, cccheckout, - ccuncheckout, and ccupdate commands.

+

Tasks to perform the ClearCase cleartool checkin, checkout, + uncheckout, update, lock, unlock, mklbtype, rmtype, mklabel, and mkbl commands.

diff --git a/src/main/org/apache/tools/ant/taskdefs/defaults.properties b/src/main/org/apache/tools/ant/taskdefs/defaults.properties index 7e384bebb..e93269d7b 100644 --- a/src/main/org/apache/tools/ant/taskdefs/defaults.properties +++ b/src/main/org/apache/tools/ant/taskdefs/defaults.properties @@ -142,6 +142,12 @@ ccupdate=org.apache.tools.ant.taskdefs.optional.clearcase.CCUpdate cccheckout=org.apache.tools.ant.taskdefs.optional.clearcase.CCCheckout cccheckin=org.apache.tools.ant.taskdefs.optional.clearcase.CCCheckin ccuncheckout=org.apache.tools.ant.taskdefs.optional.clearcase.CCUnCheckout +ccmklbtype=org.apache.tools.ant.taskdefs.optional.clearcase.CCMklbtype +ccmklabel=org.apache.tools.ant.taskdefs.optional.clearcase.CCMklabel +ccrmtype=org.apache.tools.ant.taskdefs.optional.clearcase.CCRmtype +cclock=org.apache.tools.ant.taskdefs.optional.clearcase.CCLock +ccunlock=org.apache.tools.ant.taskdefs.optional.clearcase.CCUnlock +ccmkbl=org.apache.tools.ant.taskdefs.optional.clearcase.CCMkbl sound=org.apache.tools.ant.taskdefs.optional.sound.SoundTask junitreport=org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator vsslabel=org.apache.tools.ant.taskdefs.optional.vss.MSVSSLABEL diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCLock.java b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCLock.java new file mode 100644 index 000000000..d6cf040a1 --- /dev/null +++ b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCLock.java @@ -0,0 +1,389 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2003 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "Ant" and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + */ + +package org.apache.tools.ant.taskdefs.optional.clearcase; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.types.Commandline; + + +/** + * TODO: + * comment field doesn't include all options yet + */ + + + +/** + * Performs a ClearCase Lock command. + * + *

+ * The following attributes are interpretted: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
AttributeValuesRequired
replaceSpecifies replacing an existing lockNo
nusersSpecifies user(s) who can still modify the objectNo
obsoleteSpecifies that the object should be marked obsoleteNo
commentSpecifies how to populate comments fieldsNo
pnameSpecifies the object pathname to be locked.Yes
objselectSpecifies the object(s) to be locked.Yes
+ * + * @author Sean P. Kane (Based on work by: Curtis White) + */ +public class CCLock extends ClearCase { + private boolean m_Replace = false; + private boolean m_Obsolete = false; + private String m_Comment = null; + private String m_Nusers = null; + private String m_Pname = null; + private String m_Objselect = null; + + /** + * Executes the task. + *

+ * Builds a command line to execute cleartool and then calls Exec's run method + * to execute the command line. + */ + public void execute() throws BuildException { + 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 lock [options...] + // as specified in the CLEARTOOL.EXE help + commandLine.setExecutable(getClearToolCommand()); + commandLine.createArgument().setValue(COMMAND_LOCK); + + // Check the command line options + checkOptions(commandLine); + + // For debugging + System.out.println(commandLine.toString()); + + result = run(commandLine); + if (result != 0) { + String msg = "Failed executing: " + commandLine.toString(); + throw new BuildException(msg, location); + } + } + + /** + * Check the command line options. + */ +private void checkOptions(Commandline cmd) { + // ClearCase items + if (getReplace()) { + // -replace + cmd.createArgument().setValue(FLAG_REPLACE); + } + if (getObsolete()) { + // -obsolete + cmd.createArgument().setValue(FLAG_OBSOLETE); + } else { + getNusersCommand(cmd); + } + getCommentCommand(cmd); + getPnameCommand(cmd); + // object selector + cmd.createArgument().setValue(getObjselect()); +} + + /** + * If true, replace an existing lock. + * + * @param replace the status to set the flag to + */ + public void setReplace(boolean replace) { + m_Replace = replace; + } + + /** + * Get replace flag status + * + * @return boolean containing status of replace flag + */ + public boolean getReplace() { + return m_Replace; + } + + /** + * If true, mark object as obsolete. + * + * @param obsolete the status to set the flag to + */ + public void setObsolete(boolean obsolete) { + m_Obsolete = obsolete; + } + + /** + * Get obsolete flag status + * + * @return boolean containing status of obsolete flag + */ + public boolean getObsolete() { + return m_Obsolete; + } + + /** + * Sets the users who may continue to + * edit the object while it is locked. + * + * @param nusers users excluded from lock + */ + public void setNusers(String nusers) { + m_Nusers = nusers; + } + + /** + * Get nusers list + * + * @return String containing the list of users excluded from lock + */ + public String getNusers() { + return m_Nusers; + } + + /** + * Sets how comments should be written + * for the event record(s) + * + * @param comment comment method to use + */ + public void setComment(String comment) { + m_Comment = comment; + } + + /** + * Get comment method + * + * @return String containing the desired comment method + */ + public String getComment() { + return m_Comment; + } + + /** + * Sets the pathname to be locked + * + * @param pname pathname to be locked + */ + public void setPname(String pname) { + m_Pname = pname; + } + + /** + * Get the pathname to be locked + * + * @return String containing the pathname to be locked + */ + public String getPname() { + return m_Pname; + } + + /** + * Sets the object(s) to be locked + * + * @param objselect objects to be locked + */ + public void setObjselect(String objselect) { + m_Objselect = objselect; + } + + /** + * Get list of objects to be locked + * + * @return String containing the objects to be locked + */ + public String getObjselect() { + return m_Objselect; + } + + /** + * Get the 'nusers' command + * + * @param cmd containing the command line string with or without the nusers flag and value appended + */ + private void getNusersCommand(Commandline cmd) { + if (getNusers() == 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_NUSERS); + cmd.createArgument().setValue(getNusers()); + } + } + + /** + * Get the 'comment' command + * + * @param cmd containing the command line string with or without the comment flag and value appended + */ + private void getCommentCommand(Commandline cmd) { + if (getComment() == 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_COMMENT); + cmd.createArgument().setValue(getComment()); + } + } + + /** + * Get the 'pname' command + * + * @param cmd containing the command line string with or without the pname flag and value appended + */ + private void getPnameCommand(Commandline cmd) { + if (getPname() == 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_PNAME); + cmd.createArgument().setValue(getPname()); + } + } + + /** + * Get the 'pname' command + * + * @param cmd containing the command line string with or without the pname flag and value appended + */ + private void getObjselectCommand(Commandline cmd) { + if (getObjselect() == 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_OBJSELECT); + cmd.createArgument().setValue(getPname()); + } + } + + /** + * -replace flag -- replace existing lock on object(s) + */ + public static final String FLAG_REPLACE = "-replace"; + /** + * -nusers flag -- list of users to exclude from lock + */ + public static final String FLAG_NUSERS = "-nusers"; + /** + * -obsolete flag -- mark locked object as obsolete + */ + public static final String FLAG_OBSOLETE = "-obsolete"; + /** + * -comment flag -- method to use for commenting events + */ + public static final String FLAG_COMMENT = "-comment"; + /** + * -pname flag -- pathname to lock + */ + public static final String FLAG_PNAME = "-pname"; + /** + * object-selector option -- list of objects to lock + */ + public static final String FLAG_OBJSELECT = ""; +} + diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMkbl.java b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMkbl.java new file mode 100644 index 000000000..239aa9c0e --- /dev/null +++ b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMkbl.java @@ -0,0 +1,396 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2003 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "Ant" and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + */ + +package org.apache.tools.ant.taskdefs.optional.clearcase; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.types.Commandline; +import org.apache.tools.ant.taskdefs.optional.clearcase.*; + + + + +/** + * Task to CreateBaseline command to ClearCase. + *

+ * The following attributes are interpreted: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
AttributeValuesRequired
commentSpecify a comment. Only one of comment or cfile may be +used.No
commentfileSpecify a file containing a comment. Only one of comment or +cfile may be used.No
baselinerootnameSpecify the name to be associated with the baseline.Yes
nowarnSuppress warning messagesNo
identicalAllows the baseline to be created even if it is identical to the +previous baseline.No
fullCreates a full baseline.No
nlabelAllows the baseline to be created without a label.No
+ * + * @author Robert Anderson + */ +public class CCMkbl extends ClearCase { + private String m_Comment = null; + private String m_Cfile = null; + private String m_BaselineRootName = null; + private boolean m_Nwarn = false; + private boolean m_Identical = true; + private boolean m_Full = false; + private boolean m_Nlabel = false; + + + /** + * Executes the task. + *

+ * Builds a command line to execute cleartool and then calls Exec's run method + * to execute the command line. + */ + public void execute() throws BuildException { + 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); + + result = run(commandLine); + if (result != 0) { + String msg = "Failed executing: " + commandLine.toString(); + throw new BuildException(msg, location); + } + } + + + /** + * Check the command line options. + */ + private void checkOptions(Commandline cmd) { + 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()); + + } + + + /** + * Set comment string + * + * @param comment the comment string + */ + public void setComment(String comment) { + m_Comment = comment; + } + + /** + * Get comment string + * + * @return String containing the comment + */ + public String getComment() { + return m_Comment; + } + + /** + * Set comment file + * + * @param cfile the path to the comment file + */ + public void setCommentFile(String cfile) { + m_Cfile = cfile; + } + + /** + * Get comment file + * + * @return String containing the path to the comment file + */ + public String getCommentFile() { + return m_Cfile; + } + + /** + * Set baseline_root_name + * + * @param baseline_root_name the name of the baseline + */ + public void setBaselineRootName(String baseline_root_name) { + m_BaselineRootName = baseline_root_name; + } + + /** + * Get baseline_root_name + * + * @return String containing the name of the baseline + */ + public String getBaselineRootName() { + return m_BaselineRootName; + } + + /** + + /** + * Set the nowarn flag + * + * @param nwarn the status to set the flag to + */ + public void setNoWarn(boolean nwarn) { + m_Nwarn = nwarn; + } + + /** + * Get nowarn flag status + * + * @return boolean containing status of nwarn flag + */ + public boolean getNoWarn() { + return m_Nwarn; + } + + /** + * Set the identical flag + * + * @param identical the status to set the flag to + */ + public void setIdentical(boolean identical) { + m_Identical = identical; + } + + /** + * Get identical flag status + * + * @return boolean containing status of identical flag + */ + public boolean getIdentical() { + return m_Identical; + } + + /** + * Set the full flag + * + * @param full the status to set the flag to + */ + public void setFull(boolean full) { + m_Full = full; + } + + /** + * Get full flag status + * + * @return boolean containing status of full flag + */ + public boolean getFull() { + return m_Full; + } + + /** + * Set the nlabel flag + * + * @param nlabel the status to set the flag to + */ + public void setNlabel(boolean nlabel) { + m_Nlabel = nlabel; + } + + /** + * Get nlabel status + * + * @return boolean containing status of nlabel flag + */ + public boolean getNlabel() { + return m_Nlabel; + } + + /** + * Get the 'comment' command + * + * @return the 'comment' command if the attribute was specified, otherwise an empty string + * + * @param CommandLine containing the command line string with or without the comment flag and string appended + */ + private void getCommentCommand(Commandline cmd) { + 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()); + } + } + + /** + * Get the 'commentfile' command + * + * @return the 'commentfile' command if the attribute was specified, otherwise an empty string + * + * @param CommandLine containing the command line string with or without the commentfile flag and file appended + */ + private void getCommentFileCommand(Commandline cmd) { + 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()); + } + } + + + /** + * -c flag -- comment to attach to the file + */ + public static final String FLAG_COMMENT = "-c"; + /** + * -cfile flag -- file containing a comment to attach to the file + */ + public static final String FLAG_COMMENTFILE = "-cfile"; + /** + * -nc flag -- no comment is specified + */ + public static final String FLAG_NOCOMMENT = "-nc"; + /** + * -identical flag -- allows the file to be checked in even if it is identical to the original + */ + public static final String FLAG_IDENTICAL = "-identical"; + /** + * -incremental flag -- baseline to be created is incremental + */ + public static final String FLAG_INCREMENTAL = "-incremental"; + /** + * -full flag -- baseline to be created is full + */ + public static final String FLAG_FULL = "-full"; + /** + * -nlabel -- baseline to be created without a label + */ + public static final String FLAG_NLABEL = "-nlabel"; + + +} \ No newline at end of file diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMklabel.java b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMklabel.java new file mode 100644 index 000000000..b84e55e05 --- /dev/null +++ b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMklabel.java @@ -0,0 +1,433 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2003 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "Ant" and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + */ + +package org.apache.tools.ant.taskdefs.optional.clearcase; + +import org.apache.tools.ant.*; +import org.apache.tools.ant.types.Commandline; +import org.apache.tools.ant.types.Path; + +import java.io.File; + +/** + * Task to perform mklabel command to ClearCase. + *

+ * The following attributes are interpreted: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
AttributeValuesRequired
viewpathPath to the ClearCase view file or directory that the command will operate onNo
replaceReplace a label of the same type on the same branchNo
recurseProcess each subdirectory under viewpathNo
versionIdentify a specific version to attach the label toNo
typenameName of the label typeYes
vobName of the VOBNo
commentSpecify a comment. Only one of comment or cfile may be used.No
commentfileSpecify a file containing a comment. Only one of comment or cfile may be used.No
+ * + * @author Curtis White + */ +public class CCMklabel extends ClearCase { + private boolean m_Replace = false; + private boolean m_Recurse = false; + private String m_Version = null; + private String m_TypeName = null; + private String m_VOB = null; + private String m_Comment = null; + private String m_Cfile = null; + + /** + * Executes the task. + *

+ * Builds a command line to execute cleartool and then calls Exec's run method + * to execute the command line. + */ + public void execute() throws BuildException { + Commandline commandLine = new Commandline(); + Project aProj = getProject(); + int result = 0; + + // Check for required attributes + if (getTypeName() == null) { + throw new BuildException("Required attribute TypeName not specified"); + } + + // 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 mklabel [options...] [viewpath ...] + // as specified in the CLEARTOOL help + commandLine.setExecutable(getClearToolCommand()); + commandLine.createArgument().setValue(COMMAND_MKLABEL); + + checkOptions(commandLine); + + result = run(commandLine); + if ( result != 0 ) { + String msg = "Failed executing: " + commandLine.toString(); + throw new BuildException(msg, location); + } + } + + + /** + * Check the command line options. + */ + private void checkOptions(Commandline cmd) { + if (getReplace()) { + // -replace + cmd.createArgument().setValue(FLAG_REPLACE); + } + + if (getRecurse()) { + // -recurse + cmd.createArgument().setValue(FLAG_RECURSE); + } + + if (getVersion() != null) { + // -version + getVersionCommand(cmd); + } + + if (getComment() != null) { + // -c + getCommentCommand(cmd); + } else { + if (getCommentFile() != null) { + // -cfile + getCommentFileCommand(cmd); + } else { + cmd.createArgument().setValue(FLAG_NOCOMMENT); + } + } + + if (getTypeName() != null) { + // type + getTypeCommand(cmd); + } + + // viewpath + cmd.createArgument().setValue(getViewPath()); + } + + + /** + * Set the replace flag + * + * @param replace the status to set the flag to + */ + public void setReplace(boolean repl) { + m_Replace = repl; + } + + /** + * Get replace flag status + * + * @return boolean containing status of replace flag + */ + public boolean getReplace() { + return m_Replace; + } + + /** + * Set recurse flag + * + * @param recurse the status to set the flag to + */ + public void setRecurse(boolean recurse) { + m_Recurse = recurse; + } + + /** + * Get recurse flag status + * + * @return boolean containing status of recurse flag + */ + public boolean getRecurse() { + return m_Recurse; + } + + /** + * Set the version flag + * + * @param version the status to set the flag to + */ + public void setVersion(String ver) { + m_Version = ver; + } + + /** + * Get version flag status + * + * @return boolean containing status of version flag + */ + public String getVersion() { + return m_Version; + } + + /** + * Set comment string + * + * @param comment the comment string + */ + public void setComment(String comment) { + m_Comment = comment; + } + + /** + * Get comment string + * + * @return String containing the comment + */ + public String getComment() { + return m_Comment; + } + + /** + * Set comment file + * + * @param cfile the path to the comment file + */ + public void setCommentFile(String cfile) { + m_Cfile = cfile; + } + + /** + * Get comment file + * + * @return String containing the path to the comment file + */ + public String getCommentFile() { + return m_Cfile; + } + + /** + * Set the type-name + * + * @param tn the type name + */ + public void setTypeName(String tn) { + m_TypeName = tn; + } + + /** + * Get type-name + * + * @return String containing type name + */ + public String getTypeName() { + return m_TypeName; + } + + /** + * Set the VOB name + * + * @param vob the VOB name + */ + public void setVOB(String vob) { + m_VOB = vob; + } + + /** + * Get VOB name + * + * @return String containing VOB name + */ + public String getVOB() { + return m_VOB; + } + + /** + * Get the 'version' command + * + * @return the 'version' command if the attribute was specified, otherwise an empty string + * + * @param CommandLine containing the command line string with or without the version flag and string appended + */ + private void getVersionCommand(Commandline cmd) { + if (getVersion() != 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_VERSION); + cmd.createArgument().setValue(getVersion()); + } + } + + /** + * Get the 'comment' command + * + * @return the 'comment' command if the attribute was specified, otherwise an empty string + * + * @param CommandLine containing the command line string with or without the comment flag and string appended + */ + private void getCommentCommand(Commandline cmd) { + 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()); + } + } + + /** + * Get the 'commentfile' command + * + * @return the 'commentfile' command if the attribute was specified, otherwise an empty string + * + * @param CommandLine containing the command line string with or without the commentfile flag and file appended + */ + private void getCommentFileCommand(Commandline cmd) { + 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()); + } + } + + /** + * Get the type-name + * + * @return the 'type-name-specifier' command if the attribute was specified, otherwise an empty string + * + * @param CommandLine containing the command line string with or without the type-name + */ + private void getTypeCommand(Commandline cmd) { + String typenm = null; + + if (getTypeName() != null) { + typenm = getTypeName(); + if (getVOB() != null) { + typenm += "@" + getVOB(); + } + cmd.createArgument().setValue(typenm); + } + } + + + /** + * -replace flag -- replace another label of the same type + */ + public static final String FLAG_REPLACE = "-replace"; + /** + * -recurse flag -- process all subdirectories + */ + public static final String FLAG_RECURSE = "-recurse"; + /** + * -version flag -- attach label to specified version + */ + public static final String FLAG_VERSION = "-version"; + /** + * -c flag -- comment to attach to the file + */ + public static final String FLAG_COMMENT = "-c"; + /** + * -cfile flag -- file containing a comment to attach to the file + */ + public static final String FLAG_COMMENTFILE = "-cfile"; + /** + * -nc flag -- no comment is specified + */ + public static final String FLAG_NOCOMMENT = "-nc"; + +} + diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMklbtype.java b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMklbtype.java new file mode 100644 index 000000000..6129df760 --- /dev/null +++ b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMklbtype.java @@ -0,0 +1,465 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2003 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "Ant" and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + */ + +package org.apache.tools.ant.taskdefs.optional.clearcase; + +import org.apache.tools.ant.*; +import org.apache.tools.ant.types.Commandline; +import org.apache.tools.ant.types.Path; + +import java.io.File; + +/** + * Task to perform mklbtype command to ClearCase. + *

+ * The following attributes are interpreted: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
AttributeValuesRequired
typenameName of the label type to createYes
vobName of the VOBNo
replaceReplace an existing label definition of the same typeNo
globalEither global or ordinary can be specified, not both. Creates a label type that is global to the VOB or to VOBs that use this VOBNo
ordinaryEither global or ordinary can be specified, not both. Creates a label type that can be used only in the current VOB. DefaultNo
pbranchAllows the label type to be used once per branch in a given element's version treeNo
sharedSets the way mastership is checked by ClearCase. See ClearCase documentation for detailsNo
commentSpecify a comment. Only one of comment or cfile may be used.No
commentfileSpecify a file containing a comment. Only one of comment or cfile may be used.No
+ * + * @author Curtis White + */ +public class CCMklbtype extends ClearCase { + private String m_TypeName = null; + private String m_VOB = null; + private String m_Comment = null; + private String m_Cfile = null; + private boolean m_Replace = false; + private boolean m_Global = false; + private boolean m_Ordinary = true; + private boolean m_Pbranch = false; + private boolean m_Shared = false; + + /** + * Executes the task. + *

+ * Builds a command line to execute cleartool and then calls Exec's run method + * to execute the command line. + */ + public void execute() throws BuildException { + Commandline commandLine = new Commandline(); + Project aProj = getProject(); + int result = 0; + + // Check for required attributes + if (getTypeName() == null) { + throw new BuildException("Required attribute TypeName not specified"); + } + + // build the command line from what we got. the format is + // cleartool mklbtype [options...] type-selector... + // as specified in the CLEARTOOL help + commandLine.setExecutable(getClearToolCommand()); + commandLine.createArgument().setValue(COMMAND_MKLBTYPE); + + checkOptions(commandLine); + + result = run(commandLine); + if ( result != 0 ) { + String msg = "Failed executing: " + commandLine.toString(); + throw new BuildException(msg, location); + } + } + + + /** + * Check the command line options. + */ + private void checkOptions(Commandline cmd) { + if (getReplace()) { + // -replace + cmd.createArgument().setValue(FLAG_REPLACE); + } + + if (getOrdinary()) { + // -ordinary + cmd.createArgument().setValue(FLAG_ORDINARY); + } else { + if (getGlobal()) { + // -global + cmd.createArgument().setValue(FLAG_GLOBAL); + } + } + + if (getPbranch()) { + // -pbranch + cmd.createArgument().setValue(FLAG_PBRANCH); + } + + if (getShared()) { + // -shared + cmd.createArgument().setValue(FLAG_SHARED); + } + + if (getComment() != null) { + // -c + getCommentCommand(cmd); + } else { + if (getCommentFile() != null) { + // -cfile + getCommentFileCommand(cmd); + } else { + cmd.createArgument().setValue(FLAG_NOCOMMENT); + } + } + + // type-name@vob + cmd.createArgument().setValue(getTypeSpecifier()); + } + + + /** + * Set type-name string + * + * @param tn the type-name string + */ + public void setTypeName(String tn) { + m_TypeName = tn; + } + + /** + * Get type-name string + * + * @return String containing the type-name + */ + public String getTypeName() { + return m_TypeName; + } + + /** + * Set the VOB name + * + * @param vob the VOB name + */ + public void setVOB(String vob) { + m_VOB = vob; + } + + /** + * Get VOB name + * + * @return String containing VOB name + */ + public String getVOB() { + return m_VOB; + } + + /** + * Set the replace flag + * + * @param repl the status to set the flag to + */ + public void setReplace(boolean repl) { + m_Replace = repl; + } + + /** + * Get replace flag status + * + * @return boolean containing status of replace flag + */ + public boolean getReplace() { + return m_Replace; + } + + /** + * Set the global flag + * + * @param glob the status to set the flag to + */ + public void setGlobal(boolean glob) { + m_Global = glob; + } + + /** + * Get global flag status + * + * @return boolean containing status of global flag + */ + public boolean getGlobal() { + return m_Global; + } + + /** + * Set the ordinary flag + * + * @param ordinary the status to set the flag to + */ + public void setOrdinary(boolean ordinary) { + m_Ordinary = ordinary; + } + + /** + * Get ordinary flag status + * + * @return boolean containing status of ordinary flag + */ + public boolean getOrdinary() { + return m_Ordinary; + } + + /** + * Set the pbranch flag + * + * @param pbranch the status to set the flag to + */ + public void setPbranch(boolean pbranch) { + m_Pbranch = pbranch; + } + + /** + * Get pbranch flag status + * + * @return boolean containing status of pbranch flag + */ + public boolean getPbranch() { + return m_Pbranch; + } + + /** + * Set the shared flag + * + * @param shared the status to set the flag to + */ + public void setShared(boolean shar) { + m_Shared = shar; + } + + /** + * Get shared flag status + * + * @return boolean containing status of shared flag + */ + public boolean getShared() { + return m_Shared; + } + + /** + * Set comment string + * + * @param comment the comment string + */ + public void setComment(String comment) { + m_Comment = comment; + } + + /** + * Get comment string + * + * @return String containing the comment + */ + public String getComment() { + return m_Comment; + } + + /** + * Set comment file + * + * @param cfile the path to the comment file + */ + public void setCommentFile(String cfile) { + m_Cfile = cfile; + } + + /** + * Get comment file + * + * @return String containing the path to the comment file + */ + public String getCommentFile() { + return m_Cfile; + } + + + /** + * Get the 'comment' command + * + * @return the 'comment' command if the attribute was specified, otherwise an empty string + * + * @param CommandLine containing the command line string with or without the comment flag and string appended + */ + private void getCommentCommand(Commandline cmd) { + 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()); + } + } + + /** + * Get the 'commentfile' command + * + * @return the 'commentfile' command if the attribute was specified, otherwise an empty string + * + * @param CommandLine containing the command line string with or without the commentfile flag and file appended + */ + private void getCommentFileCommand(Commandline cmd) { + 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()); + } + } + + /** + * Get the type-name specifier + * + * @return the 'type-name-specifier' command if the attribute was specified, otherwise an empty string + * + * @param CommandLine containing the command line string with or without the type-name + */ + private String getTypeSpecifier() { + String typenm = null; + + typenm = getTypeName(); + if (getVOB() != null) { + typenm += "@" + getVOB(); + } + + return typenm; + } + + + /** + * -replace flag -- replace existing label definition of the same type + */ + public static final String FLAG_REPLACE = "-replace"; + /** + * -global flag -- creates a label type that is global to the VOB or to VOBs that use this VOB + */ + public static final String FLAG_GLOBAL = "-global"; + /** + * -ordinary flag -- creates a label type that can be used only in the current VOB + */ + public static final String FLAG_ORDINARY = "-ordinary"; + /** + * -pbranch flag -- allows label type to be used once per branch + */ + public static final String FLAG_PBRANCH = "-pbranch"; + /** + * -shared flag -- sets the way mastership is checked by ClearCase + */ + public static final String FLAG_SHARED = "-shared"; + /** + * -c flag -- comment to attach to the file + */ + public static final String FLAG_COMMENT = "-c"; + /** + * -cfile flag -- file containing a comment to attach to the file + */ + public static final String FLAG_COMMENTFILE = "-cfile"; + /** + * -nc flag -- no comment is specified + */ + public static final String FLAG_NOCOMMENT = "-nc"; + +} + diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCRmtype.java b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCRmtype.java new file mode 100644 index 000000000..dafc5ed3a --- /dev/null +++ b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCRmtype.java @@ -0,0 +1,403 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2003 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "Ant" and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + */ + +package org.apache.tools.ant.taskdefs.optional.clearcase; + +import org.apache.tools.ant.*; +import org.apache.tools.ant.types.Commandline; +import org.apache.tools.ant.types.Path; + +import java.io.File; + +/** + * Task to perform rmtype command to ClearCase. + *

+ * The following attributes are interpreted: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
AttributeValuesRequired
typekindThe kind of type to create. Valid types are:
+ * attype attribute type
+ * brtype branch type
+ * eltype element type
+ * hltype hyperlink type
+ * lbtype label type
+ * trtype trigger type
+ *
Yes
typenameThe name of the type to removeYes
vobName of the VOBNo
ignoreUsed with trigger types only. Forces removal of trigger type even if a pre-operation trigger would prevent its removalNo
rmallRemoves all instances of a type and the type object itselfNo
commentSpecify a comment. Only one of comment or cfile may be used.No
commentfileSpecify a file containing a comment. Only one of comment or cfile may be used.No
+ * + * @author Curtis White + */ +public class CCRmtype extends ClearCase { + private String m_TypeKind = null; + private String m_TypeName = null; + private String m_VOB = null; + private String m_Comment = null; + private String m_Cfile = null; + private boolean m_Rmall = false; + private boolean m_Ignore = false; + + /** + * Executes the task. + *

+ * Builds a command line to execute cleartool and then calls Exec's run method + * to execute the command line. + */ + public void execute() throws BuildException { + Commandline commandLine = new Commandline(); + Project aProj = getProject(); + int result = 0; + + // Check for required attributes + if (getTypeKind() == null) { + throw new BuildException("Required attribute TypeKind not specified"); + } + if (getTypeName() == null) { + throw new BuildException("Required attribute TypeName not specified"); + } + + // build the command line from what we got. the format is + // cleartool rmtype [options...] type-selector... + // as specified in the CLEARTOOL help + commandLine.setExecutable(getClearToolCommand()); + commandLine.createArgument().setValue(COMMAND_RMTYPE); + + checkOptions(commandLine); + + result = run(commandLine); + if ( result != 0 ) { + String msg = "Failed executing: " + commandLine.toString(); + throw new BuildException(msg, location); + } + } + + + /** + * Check the command line options. + */ + private void checkOptions(Commandline cmd) { + if (getIgnore()) { + // -ignore + cmd.createArgument().setValue(FLAG_IGNORE); + } + if (getRmAll()) { + // -rmall -force + cmd.createArgument().setValue(FLAG_RMALL); + cmd.createArgument().setValue(FLAG_FORCE); + } + if (getComment() != null) { + // -c + getCommentCommand(cmd); + } else { + if (getCommentFile() != null) { + // -cfile + getCommentFileCommand(cmd); + } else { + cmd.createArgument().setValue(FLAG_NOCOMMENT); + } + } + + // type-kind:type-name + cmd.createArgument().setValue(getTypeSpecifier()); + } + + /** + * Set the ignore flag + * + * @param ignore the status to set the flag to + */ + public void setIgnore(boolean ignore) { + m_Ignore = ignore; + } + + /** + * Get ignore flag status + * + * @return boolean containing status of ignore flag + */ + public boolean getIgnore() { + return m_Ignore; + } + + /** + * Set rmall flag + * + * @param rmall the status to set the flag to + */ + public void setRmAll(boolean rmall) { + m_Rmall = rmall; + } + + /** + * Get rmall flag status + * + * @return boolean containing status of rmall flag + */ + public boolean getRmAll() { + return m_Rmall; + } + + /** + * Set comment string + * + * @param comment the comment string + */ + public void setComment(String comment) { + m_Comment = comment; + } + + /** + * Get comment string + * + * @return String containing the comment + */ + public String getComment() { + return m_Comment; + } + + /** + * Set comment file + * + * @param cfile the path to the comment file + */ + public void setCommentFile(String cfile) { + m_Cfile = cfile; + } + + /** + * Get comment file + * + * @return String containing the path to the comment file + */ + public String getCommentFile() { + return m_Cfile; + } + + /** + * Set type-kind string + * + * @param tk the type-kind string + */ + public void setTypeKind(String tk) { + m_TypeKind = tk; + } + + /** + * Get type-kind string + * + * @return String containing the type-kind + */ + public String getTypeKind() { + return m_TypeKind; + } + + /** + * Set type-name string + * + * @param tn the type-name string + */ + public void setTypeName(String tn) { + m_TypeName = tn; + } + + /** + * Get type-name string + * + * @return String containing the type-name + */ + public String getTypeName() { + return m_TypeName; + } + + /** + * Set the VOB name + * + * @param vob the VOB name + */ + public void setVOB(String vob) { + m_VOB = vob; + } + + /** + * Get VOB name + * + * @return String containing VOB name + */ + public String getVOB() { + return m_VOB; + } + + /** + * Get the 'type-specifier' string + * + * @return the 'type-kind:type-name@vob' specifier + * + * @param CommandLine containing the command line string + */ + private String getTypeSpecifier() { + String tkind = getTypeKind(); + String tname = getTypeName(); + String typeSpec = null; + + // Return the type-selector + typeSpec = tkind + ":" + tname; + if (getVOB() != null) { + typeSpec += "@" + getVOB(); + } + return typeSpec; + } + + /** + * Get the 'comment' command + * + * @return the 'comment' command if the attribute was specified, otherwise an empty string + * + * @param CommandLine containing the command line string with or without the comment flag and string appended + */ + private void getCommentCommand(Commandline cmd) { + 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()); + } + } + + /** + * Get the 'commentfile' command + * + * @return the 'commentfile' command if the attribute was specified, otherwise an empty string + * + * @param CommandLine containing the command line string with or without the commentfile flag and file appended + */ + private void getCommentFileCommand(Commandline cmd) { + 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()); + } + } + + + /** + * -ignore flag -- ignore pre-trigger operations when removing a trigger type + */ + public static final String FLAG_IGNORE = "-ignore"; + /** + * -rmall flag -- removes all instances of a type and the type object itself + */ + public static final String FLAG_RMALL = "-rmall"; + /** + * -force flag -- suppresses confirmation prompts + */ + public static final String FLAG_FORCE = "-force"; + /** + * -c flag -- comment to attach to the file + */ + public static final String FLAG_COMMENT = "-c"; + /** + * -cfile flag -- file containing a comment to attach to the file + */ + public static final String FLAG_COMMENTFILE = "-cfile"; + /** + * -nc flag -- no comment is specified + */ + public static final String FLAG_NOCOMMENT = "-nc"; + +} + diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUnlock.java b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUnlock.java new file mode 100644 index 000000000..f3f47a4b1 --- /dev/null +++ b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUnlock.java @@ -0,0 +1,273 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2003 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "Ant" and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + */ + +package org.apache.tools.ant.taskdefs.optional.clearcase; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.types.Commandline; + +/** + * TODO: + * comment field doesn't include all options yet + */ + + +/** + * Performs a ClearCase Unlock command. + * + *

+ * The following attributes are interpretted: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
AttributeValuesRequired
commentSpecifies how to populate comments fieldsNo
pnameSpecifies the object pathname to be unlocked.Yes
objselectSpecifies the object(s) to be unlocked.Yes
+ * + * @author Sean P. Kane (Based on work by: Curtis White) + */ +public class CCUnlock extends ClearCase { + private String m_Comment = null; + private String m_Pname = null; + private String m_Objselect = null; + + /** + * Executes the task. + *

+ * Builds a command line to execute cleartool and then calls Exec's run method + * to execute the command line. + */ + public void execute() throws BuildException { + 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 lock [options...] + // as specified in the CLEARTOOL.EXE help + commandLine.setExecutable(getClearToolCommand()); + commandLine.createArgument().setValue(COMMAND_UNLOCK); + + // Check the command line options + checkOptions(commandLine); + + // For debugging + System.out.println(commandLine.toString()); + + result = run(commandLine); + if (result != 0) { + String msg = "Failed executing: " + commandLine.toString(); + throw new BuildException(msg, location); + } + } + + /** + * Check the command line options. + */ +private void checkOptions(Commandline cmd) { + // ClearCase items + getCommentCommand(cmd); + getPnameCommand(cmd); + // object selector + cmd.createArgument().setValue(getObjselect()); +} + + /** + * Sets how comments should be written + * for the event record(s) + * + * @param comment comment method to use + */ + public void setComment(String comment) { + m_Comment = comment; + } + + /** + * Get comment method + * + * @return String containing the desired comment method + */ + public String getComment() { + return m_Comment; + } + + /** + * Sets the pathname to be locked + * + * @param pname pathname to be locked + */ + public void setPname(String pname) { + m_Pname = pname; + } + + /** + * Get the pathname to be locked + * + * @return String containing the pathname to be locked + */ + public String getPname() { + return m_Pname; + } + + /** + * Sets the object(s) to be locked + * + * @param objselect objects to be locked + */ + public void setObjselect(String objselect) { + m_Objselect = objselect; + } + + /** + * Get list of objects to be locked + * + * @return String containing the objects to be locked + */ + public String getObjselect() { + return m_Objselect; + } + + /** + * Get the 'comment' command + * + * @param cmd containing the command line string with or without the comment flag and value appended + */ + private void getCommentCommand(Commandline cmd) { + if (getComment() == 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_COMMENT); + cmd.createArgument().setValue(getComment()); + } + } + + /** + * Get the 'pname' command + * + * @param cmd containing the command line string with or without the pname flag and value appended + */ + private void getPnameCommand(Commandline cmd) { + if (getPname() == 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_PNAME); + cmd.createArgument().setValue(getPname()); + } + } + + /** + * Get the 'pname' command + * + * @param cmd containing the command line string with or without the pname flag and value appended + */ + private void getObjselectCommand(Commandline cmd) { + if (getObjselect() == 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_OBJSELECT); + cmd.createArgument().setValue(getPname()); + } + } + + /** + * -comment flag -- method to use for commenting events + */ + public static final String FLAG_COMMENT = "-comment"; + /** + * -pname flag -- pathname to lock + */ + public static final String FLAG_PNAME = "-pname"; + /** + * object-selector option -- list of objects to lock + */ + public static final String FLAG_OBJSELECT = ""; +} + diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java index 05af6a1d0..c39192fe9 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2000,2002 The Apache Software Foundation. All rights + * Copyright (c) 2000,2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -71,15 +71,17 @@ import org.apache.tools.ant.types.Commandline; * in the path, * you can override this be specifying the cleartooldir attribute. *

*

- * This class provides set and get methods for the 'viewpath' attribute. It - * also contains constants for the flags that can be passed to cleartool. + * 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. *

* - * @author Curtis White + * @author Curtis White (Exteneded by Sean P. Kane) */ public abstract class ClearCase extends Task { private String m_ClearToolDir = ""; private String m_viewPath = null; + private String m_objSelect = null; /** * Set the directory where the cleartool executable is located. @@ -124,6 +126,23 @@ public abstract class ClearCase extends Task { return m_viewPath; } + /** + * Set the object to operate on. + * + * @param objSelect object to operate on + */ + public final void setObjSelect(String objSelect) { + m_objSelect = objSelect; + } + + /** + * Get the object to operate on + * + * @return m_objSelect + */ + public String getObjSelect() { + return m_objSelect; + } protected int run(Commandline cmd) { try { @@ -159,6 +178,30 @@ public abstract class ClearCase extends Task { * The 'UndoCheckout' command */ public static final String COMMAND_UNCHECKOUT = "uncheckout"; + /** + * The 'Lock' command + */ + public static final String COMMAND_LOCK = "lock"; + /** + * The 'Unlock' command + */ + public static final String COMMAND_UNLOCK = "unlock"; + /** + * The 'Mkbl' command + */ + public static final String COMMAND_MKBL = "mkbl"; + /** + * The 'Mklabel' command + */ + public static final String COMMAND_MKLABEL = "mklabel"; + /** + * The 'Mklbtype' command + */ + public static final String COMMAND_MKLBTYPE = "mklbtype"; + /** + * The 'Rmtype' command + */ + public static final String COMMAND_RMTYPE = "rmtype"; }