1 | /* |
2 | * Copyright 2005-2006 The RbUtils Project |
3 | * |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | * you may not use this file except in compliance with the License. |
6 | * You may obtain a copy of the License at |
7 | * |
8 | * http://www.apache.org/licenses/LICENSE-2.0 |
9 | * |
10 | * Unless required by applicable law or agreed to in writing, software |
11 | * distributed under the License is distributed on an "AS IS" BASIS, |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. |
15 | * |
16 | */ |
17 | |
18 | // $Id: CommonProps.java,v 1.4 2007/07/06 04:52:16 moishi Exp $ |
19 | |
20 | package org.ktc.rbutils.rb; |
21 | |
22 | import java.util.Date; |
23 | |
24 | import org.ktc.rbutils.RbUtilsHelper; |
25 | |
26 | /** |
27 | * Provides common properties for RbChecker and RbGenerator. |
28 | * @since RbUtils 0.9.3.3 |
29 | * @version $Revision: 1.4 $ |
30 | * @author redfish |
31 | */ |
32 | public class CommonProps { |
33 | // TODO refactor - tasknames must be stored in a enum type |
34 | // TODO duplication - taskname should be always accessed with this class |
35 | |
36 | /** |
37 | * Name of the rbchecker task to be displayed. |
38 | */ |
39 | public static final String RBCHECKER_TASKNAME = "RbChecker"; |
40 | /** |
41 | * Name of the rbgenerator task to be displayed. |
42 | */ |
43 | public static final String RBGENERATOR_TASKNAME = "RbGenerator"; |
44 | /** |
45 | * Name of an unknown rbutils task to be displayed. |
46 | */ |
47 | public static final String UNKNONWN_TASKNAME = "Unknown RbUtils Task"; |
48 | |
49 | /** |
50 | * Dummy constructor. This <b>MUST NOT</b> be instanciated. |
51 | * @throws UnsupportedOperationException if this class is instanciated. |
52 | */ |
53 | protected CommonProps() { |
54 | // prevents calls from subclass |
55 | throw new UnsupportedOperationException(); |
56 | } |
57 | |
58 | /** |
59 | * Returns a displayable message that indicates the task is running. |
60 | * @param taskType the type of the current task. |
61 | * @return the full task name of the object. |
62 | */ |
63 | public static String getRunningTask(final TaskType taskType) { |
64 | return "Running " + getFullTaskName(taskType) + " on " + new Date(); |
65 | } |
66 | |
67 | /** |
68 | * Returns the full task name of the object. It means the taskname of the object and the full |
69 | * version of RbUtils. |
70 | * @param taskType the type of the current task. |
71 | * @return the full task name of the object. |
72 | * @since RbUtils 0.9.3.3 |
73 | */ |
74 | public static String getFullTaskName(final TaskType taskType) { |
75 | return taskType.getDisplay() + " " + RbUtilsHelper.getFullVersion(); |
76 | } |
77 | |
78 | } |