1 18 19 package org.apache.tools.ant.taskdefs.optional.ccm; 20 21 22 import org.apache.tools.ant.BuildException; 23 import org.apache.tools.ant.taskdefs.Execute; 24 import org.apache.tools.ant.types.Commandline; 25 26 27 30 public class CCMReconfigure extends Continuus { 31 32 private String ccmProject = null; 33 private boolean recurse = false; 34 private boolean verbose = false; 35 36 37 public CCMReconfigure() { 38 super(); 39 setCcmAction(COMMAND_RECONFIGURE); 40 } 41 42 43 51 public void execute() throws BuildException { 52 Commandline commandLine = new Commandline(); 53 int result = 0; 54 55 commandLine.setExecutable(getCcmCommand()); 58 commandLine.createArgument().setValue(getCcmAction()); 59 60 checkOptions(commandLine); 61 62 result = run(commandLine); 63 if (Execute.isFailure(result)) { 64 String msg = "Failed executing: " + commandLine.toString(); 65 throw new BuildException(msg, getLocation()); 66 } 67 } 68 69 70 73 private void checkOptions(Commandline cmd) { 74 75 if (isRecurse()) { 76 cmd.createArgument().setValue(FLAG_RECURSE); 77 } 79 if (isVerbose()) { 80 cmd.createArgument().setValue(FLAG_VERBOSE); 81 } 83 if (getCcmProject() != null) { 84 cmd.createArgument().setValue(FLAG_PROJECT); 85 cmd.createArgument().setValue(getCcmProject()); 86 } 87 88 } 89 90 94 public String getCcmProject() { 95 return ccmProject; 96 } 97 98 102 public void setCcmProject(String v) { 103 this.ccmProject = v; 104 } 105 106 107 111 public boolean isRecurse() { 112 return recurse; 113 } 114 115 120 public void setRecurse(boolean v) { 121 this.recurse = v; 122 } 123 124 125 129 public boolean isVerbose() { 130 return verbose; 131 } 132 133 137 public void setVerbose(boolean v) { 138 this.verbose = v; 139 } 140 141 142 145 public static final String FLAG_RECURSE = "/recurse"; 146 147 150 public static final String FLAG_VERBOSE = "/verbose"; 151 152 153 156 public static final String FLAG_PROJECT = "/project"; 157 158 } 159 160 | Popular Tags |