1 37 package net.sourceforge.cruisecontrol.bootstrappers; 38 39 import net.sourceforge.cruisecontrol.Bootstrapper; 40 import net.sourceforge.cruisecontrol.CruiseControlException; 41 import net.sourceforge.cruisecontrol.builders.AntBuilder; 42 import net.sourceforge.cruisecontrol.builders.Property; 43 import net.sourceforge.cruisecontrol.sourcecontrols.accurev.AccurevCommand; 44 import net.sourceforge.cruisecontrol.sourcecontrols.accurev.AccurevCommandline; 45 import net.sourceforge.cruisecontrol.sourcecontrols.accurev.Runner; 46 47 54 public class AccurevBootstrapper implements Bootstrapper { 55 private boolean verbose; 56 private boolean keep; 57 private boolean synctime; 58 private String workspace; 59 private Runner runner; 60 private AntBuilder delegate = new AntBuilder(); 61 62 68 public void setVerbose(boolean verbose) { 69 this.verbose = verbose; 70 } 71 77 public void setKeep(boolean keep) { 78 this.keep = keep; 79 } 80 87 public void setSynctime(boolean synctime) { 88 this.synctime = synctime; 89 } 90 96 public void setWorkspace(String workspace) { 97 this.workspace = workspace; 98 } 99 private void runAccurev(AccurevCommandline cmd) throws CruiseControlException { 100 if (runner != null) { 101 cmd.setRunner(runner); 102 } 103 cmd.setWorkspaceLocalPath(workspace); 104 cmd.setVerbose(verbose); 105 cmd.run(); 106 cmd.assertSuccess(); 107 } 108 112 public void bootstrap() throws CruiseControlException { 113 if (synctime) { 114 runAccurev(AccurevCommand.SYNCTIME.create()); 115 } 116 if (keep) { 117 AccurevCommandline cmdKeep = AccurevCommand.KEEP.create(); 118 cmdKeep.selectModified(); 119 cmdKeep.setComment("CruiseControl automatic keep"); 120 runAccurev(cmdKeep); 121 } 122 runAccurev(AccurevCommand.UPDATE.create()); 123 } 124 public void setRunner(Runner runner) { 125 this.runner = runner; 126 } 127 128 public void validate() throws CruiseControlException { 129 delegate.validate(); 130 } 131 132 135 public void setSaveLogDir(String dir) { 136 delegate.setSaveLogDir(dir); 137 } 138 139 142 public void setAntWorkingDir(String dir) { 143 delegate.setAntWorkingDir(dir); 144 } 145 146 149 public void setAntScript(String antScript) { 150 delegate.setAntScript(antScript); 151 } 152 153 156 public void setAntHome(String antHome) { 157 delegate.setAntHome(antHome); 158 } 159 160 163 public void setTempFile(String tempFileName) { 164 delegate.setTempFile(tempFileName); 165 } 166 167 170 public void setTarget(String target) { 171 delegate.setTarget(target); 172 } 173 174 177 public void setBuildFile(String buildFile) { 178 delegate.setBuildFile(buildFile); 179 } 180 181 184 public void setUseLogger(boolean useLogger) { 185 delegate.setUseLogger(useLogger); 186 } 187 188 191 public Object createJVMArg() { 192 return delegate.createJVMArg(); 193 } 194 195 198 public Property createProperty() { 199 return delegate.createProperty(); 200 } 201 202 205 public void setUseDebug(boolean debug) { 206 delegate.setUseDebug(debug); 207 } 208 209 212 public void setUseQuiet(boolean quiet) { 213 delegate.setUseQuiet(quiet); 214 } 215 216 219 public String getLoggerClassName() { 220 return delegate.getLoggerClassName(); 221 } 222 223 226 public void setLoggerClassName(String string) { 227 delegate.setLoggerClassName(string); 228 } 229 230 233 public void setTimeout(long timeout) { 234 delegate.setTimeout(timeout); 235 } 236 } 237 | Popular Tags |