1 | /* |
---|
2 | * This program is free software; you can redistribute it and/or modify |
---|
3 | * it under the terms of the GNU General Public License as published by |
---|
4 | * the Free Software Foundation; either version 2 of the License, or |
---|
5 | * (at your option) any later version. |
---|
6 | * |
---|
7 | * This program is distributed in the hope that it will be useful, |
---|
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
10 | * GNU General Public License for more details. |
---|
11 | * |
---|
12 | * You should have received a copy of the GNU General Public License |
---|
13 | * along with this program; if not, write to the Free Software |
---|
14 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
15 | */ |
---|
16 | |
---|
17 | /* |
---|
18 | * Copyright.java |
---|
19 | * Copyright (C) 2007 University of Waikato, Hamilton, New Zealand |
---|
20 | */ |
---|
21 | |
---|
22 | package weka.core; |
---|
23 | |
---|
24 | import java.util.Calendar; |
---|
25 | import java.util.Properties; |
---|
26 | |
---|
27 | /** |
---|
28 | * A class for providing centralized Copyright information. |
---|
29 | * |
---|
30 | * @author fracpete (fracpete at waikato dot ac dot nz) |
---|
31 | * @version $Revision: 5953 $ |
---|
32 | */ |
---|
33 | public class Copyright { |
---|
34 | |
---|
35 | /** the copyright file */ |
---|
36 | public final static String PROPERTY_FILE = "weka/core/Copyright.props"; |
---|
37 | |
---|
38 | /** Contains the properties */ |
---|
39 | protected static Properties PROPERTIES; |
---|
40 | |
---|
41 | static { |
---|
42 | PROPERTIES = new Properties(); |
---|
43 | |
---|
44 | try { |
---|
45 | // PROPERTIES.load(ClassLoader.getSystemResourceAsStream(PROPERTY_FILE)); |
---|
46 | PROPERTIES. |
---|
47 | load((new Copyright()).getClass().getClassLoader().getResourceAsStream(PROPERTY_FILE)); |
---|
48 | } |
---|
49 | catch (Exception e) { |
---|
50 | System.err.println( |
---|
51 | "Could not read configuration file for the copyright " |
---|
52 | + "information - using default."); |
---|
53 | } |
---|
54 | } |
---|
55 | |
---|
56 | /** |
---|
57 | * returns the start year of the copyright |
---|
58 | * |
---|
59 | * @return the start year |
---|
60 | */ |
---|
61 | public static String getFromYear() { |
---|
62 | return PROPERTIES.getProperty("FromYear", "1999"); |
---|
63 | } |
---|
64 | |
---|
65 | /** |
---|
66 | * returns the end year of the copyright (i.e., current year) |
---|
67 | * |
---|
68 | * @return the end/current year |
---|
69 | */ |
---|
70 | public static String getToYear() { |
---|
71 | return PROPERTIES.getProperty("ToYear", "" + Calendar.getInstance().get(Calendar.YEAR)); |
---|
72 | } |
---|
73 | |
---|
74 | /** |
---|
75 | * returns the entity owning the copyright |
---|
76 | * |
---|
77 | * @return the owner |
---|
78 | */ |
---|
79 | public static String getOwner() { |
---|
80 | return PROPERTIES.getProperty("Owner", "The University of Waikato"); |
---|
81 | } |
---|
82 | |
---|
83 | /** |
---|
84 | * returns the address of the owner |
---|
85 | * |
---|
86 | * @return the address |
---|
87 | */ |
---|
88 | public static String getAddress() { |
---|
89 | return PROPERTIES.getProperty("Address", "Hamilton, New Zealand"); |
---|
90 | } |
---|
91 | |
---|
92 | /** |
---|
93 | * returns the URL of the owner |
---|
94 | * |
---|
95 | * @return the URL |
---|
96 | */ |
---|
97 | public static String getURL() { |
---|
98 | return PROPERTIES.getProperty("URL", "http://www.cs.waikato.ac.nz/~ml/"); |
---|
99 | } |
---|
100 | |
---|
101 | /** |
---|
102 | * Only for testing |
---|
103 | * |
---|
104 | * @param args ignored |
---|
105 | */ |
---|
106 | public static void main(String[] args) { |
---|
107 | System.out.println(PROPERTIES); |
---|
108 | } |
---|
109 | } |
---|