%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
nl.toolforge.karma.core.cmd.event.CommandStartedEvent |
|
|
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.event; |
|
20 | ||
21 | import nl.toolforge.karma.core.cmd.Command; |
|
22 | ||
23 | /** |
|
24 | * Generated before a command is executed. This event has the default priority {@link CommandResponseEvent#LEVEL_DEBUG}. |
|
25 | * |
|
26 | * @author D.A. Smedes |
|
27 | * @version $Id: CommandStartedEvent.java,v 1.2 2004/10/26 22:47:58 hippe Exp $ |
|
28 | */ |
|
29 | public final class CommandStartedEvent extends CommandResponseEvent { |
|
30 | ||
31 | 0 | private long start = 0L; |
32 | ||
33 | /** |
|
34 | * Creates the event for <code>command</code>. |
|
35 | * |
|
36 | * @param command The command that has started. |
|
37 | */ |
|
38 | public CommandStartedEvent(Command command) { |
|
39 | 0 | super(command, LEVEL_DEBUG); |
40 | 0 | start = System.currentTimeMillis();; |
41 | 0 | } |
42 | ||
43 | /** |
|
44 | * Returns the time this event was generated, effectively, the time the command was started. |
|
45 | * |
|
46 | * @return Start time of the command. |
|
47 | */ |
|
48 | public long getTime() { |
|
49 | 0 | return start; |
50 | } |
|
51 | ||
52 | /** |
|
53 | * Returns a SimpleMessage formatted as <code>[ <command-name> ] Started.</code>. |
|
54 | */ |
|
55 | public Message getEventMessage() { |
|
56 | 0 | return new SimpleMessage(MessageHelper.format(getCommand().getName(), "Started.")); |
57 | } |
|
58 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |