| %line | %branch | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| nl.toolforge.karma.core.cmd.impl.CleanModule |
|
|
| 1 | /* |
|
| 2 | Karma core - Core of the Karma application |
|
| 3 | Copyright (C) 2004 Toolforge <www.toolforge.nl> |
|
| 4 | ||
| 5 | This library is free software; you can redistribute it and/or |
|
| 6 | modify it under the terms of the GNU Lesser General Public |
|
| 7 | License as published by the Free Software Foundation; either |
|
| 8 | version 2.1 of the License, or (at your option) any later version. |
|
| 9 | ||
| 10 | This library is distributed in the hope that it will be useful, |
|
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
| 13 | Lesser General Public License for more details. |
|
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public |
|
| 16 | License along with this library; if not, write to the Free Software |
|
| 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 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 modules' build directory. |
|
| 32 | * |
|
| 33 | * @author W.H. Schraal |
|
| 34 | * @author D.A. Smedes |
|
| 35 | * |
|
| 36 | * @version $Id: CleanModule.java,v 1.9 2004/10/09 21:24:25 asmedes Exp $ |
|
| 37 | */ |
|
| 38 | public class CleanModule extends AbstractBuildCommand { |
|
| 39 | ||
| 40 | 0 | private CommandResponse commandResponse = new CommandResponse(); |
| 41 | ||
| 42 | public CleanModule(CommandDescriptor descriptor) { |
|
| 43 | 0 | super(descriptor); |
| 44 | 0 | } |
| 45 | ||
| 46 | public void execute() throws CommandException { |
|
| 47 | ||
| 48 | 0 | super.execute(); // To initialize the BuildEnvironment |
| 49 | ||
| 50 | try { |
|
| 51 | ||
| 52 | 0 | FileUtils.deleteDirectory(getBuildEnvironment().getModuleBuildRootDirectory()); |
| 53 | ||
| 54 | 0 | SimpleMessage message = new SimpleMessage(getFrontendMessages().getString("message.CLEAN_MODULE_SUCCESSFULL"), new Object[]{getCurrentModule()}); |
| 55 | 0 | commandResponse.addEvent(new MessageEvent(this, message)); |
| 56 | ||
| 57 | 0 | } catch (IOException e) { |
| 58 | 0 | throw new CommandException(CommandException.CLEAN_MODULE_FAILED, class="keyword">new Object[]{e.getLocalizedMessage()}); |
| 59 | 0 | } |
| 60 | 0 | } |
| 61 | ||
| 62 | public CommandResponse getCommandResponse() { |
|
| 63 | 0 | return this.commandResponse; |
| 64 | } |
|
| 65 | } |
| This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |