View Javadoc

1   /*
2    * Copyright 2010 James Pether Sörling
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   *	$Id: ApplicationProperties.java 5463 2011-05-10 20:43:14Z pether $
17   *  $HeadURL: https://cia.svn.sourceforge.net/svnroot/cia/trunk/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/common/ApplicationProperties.java $
18  */
19  package com.hack23.cia.web.impl.ui.common;
20  
21  import java.io.IOException;
22  import java.util.Properties;
23  
24  import org.slf4j.Logger;
25  import org.slf4j.LoggerFactory;
26  
27  /**
28   * The Class ApplicationProperties.
29   */
30  public final class ApplicationProperties {
31  
32  	private ApplicationProperties() {
33  		super();
34  	}
35  
36  	private final static Logger LOGGER = LoggerFactory
37  	.getLogger(ApplicationProperties.class);
38  
39  	/** The properties. */
40  	private static Properties properties = new Properties();
41  
42  	static {
43  		try {
44  			properties.load(ApplicationProperties.class
45  					.getResourceAsStream("/application.properties"));
46  		} catch (final IOException e) {
47  			LOGGER.warn("Add msg",e);
48  		}
49  	}
50  
51  	/**
52  	 * Gets the name.
53  	 *
54  	 * @return the name
55  	 */
56  	public static String getName() {
57  		return properties.getProperty("application.name");
58  	}
59  
60  	/**
61  	 * Gets the url.
62  	 *
63  	 * @return the url
64  	 */
65  	public static String getUrl() {
66  		return properties.getProperty("application.url");
67  	}
68  
69  	/**
70  	 * Gets the version.
71  	 *
72  	 * @return the version
73  	 */
74  	public static String getVersion() {
75  		return properties.getProperty("application.version");
76  	}
77  
78  }