Blame | Last modification | View Log | RSS feed
package com.erggroup.mass.ant.taskdefs;import net.sourceforge.clearcase.api.IClearcase;import net.sourceforge.clearcase.simple.ClearcaseCLI;import org.apache.tools.ant.BuildException;import org.apache.tools.ant.Project;/****/public class CCRemoveView extends org.apache.tools.ant.Task{/*** The view name to remove*/private String viewname;/*** Drive letter to unmap (optional)*/private String unmap;public void setViewname( String value ){this.viewname = value;}public void setUnmap( String value ){this.unmap = value;}public void execute() throws BuildException{// Remove network drive mapping (if any)try{if ( unmap != null ){Process p = Runtime.getRuntime().exec("subst " + unmap + " /D");int rv = p.waitFor();}}catch ( Exception x ){project.log(x.getMessage(),Project.MSG_ERR);}IClearcase clearcase = new ClearcaseCLI();IClearcase.Status rmview = clearcase.cleartool( "rmview -tag \"" + viewname + "\"");if ( ! rmview.status ){project.log("The view \'" + viewname + "\' could not be removed; you should remove this view manually.",Project.MSG_WARN);throw new BuildException("Could not remove view \'" + viewname + "\'.\nThe view may not exist.");}else{project.log("Successfully removed view '" + viewname + "'.",Project.MSG_INFO);}}}