1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package nl.toolforge.karma.core.cmd.impl;
20
21 import nl.toolforge.karma.core.cmd.CommandDescriptor;
22 import nl.toolforge.karma.core.cmd.CommandException;
23 import nl.toolforge.karma.core.cmd.CommandResponse;
24 import nl.toolforge.karma.core.cmd.event.MessageEvent;
25 import nl.toolforge.karma.core.cmd.event.SimpleMessage;
26 import org.apache.commons.io.FileUtils;
27
28 import java.io.IOException;
29
30 /***
31 * Removes the build directory to create a totally clean environment.
32 *
33 * @author W.H. Schraal
34 * @author D.A. Smedes
35 * @version $Id: CleanAll.java,v 1.10 2004/11/02 23:57:06 asmedes Exp $
36 */
37 public class CleanAll extends AbstractBuildCommand {
38
39 private CommandResponse commandResponse = new CommandResponse();
40
41 public CleanAll(CommandDescriptor descriptor) {
42 super(descriptor);
43 }
44
45 /***
46 * Removes the <code>build</code> directory.
47 *
48 * @throws CommandException
49 */
50 public void execute() throws CommandException {
51
52 try {
53
54
55 FileUtils.deleteDirectory(getCurrentManifest().getBuildBaseDirectory());
56
57
58
59 commandResponse.addEvent(new MessageEvent(this, new SimpleMessage("Manifest has been cleaned.")));
60
61 } catch (IOException e) {
62 throw new CommandException(CommandException.CLEAN_ALL_FAILED, new Object[]{e.getLocalizedMessage()});
63 }
64 }
65
66 public CommandResponse getCommandResponse() {
67 return this.commandResponse;
68 }
69 }