1 package com.atlassian.mail.config;
2
3 import com.atlassian.core.util.ClassLoaderUtils;
4 import org.apache.log4j.Category;
5
6 import java.io.IOException;
7 import java.io.InputStream;
8 import java.util.Properties;
9
10
11
12
13 public class PropertiesLoader
14 {
15 private static final Category log = Category.getInstance(PropertiesLoader.class);
16
17 public static final String MAIL_PROPERTIES_FILE = "atlassian-mail.properties";
18 public static Properties ATLASSIAN_MAIL_PROPERTIES;
19
20 static
21 {
22 InputStream is = ClassLoaderUtils.getResourceAsStream(MAIL_PROPERTIES_FILE, PropertiesLoader.class);
23 ATLASSIAN_MAIL_PROPERTIES = new Properties();
24 try
25 {
26 ATLASSIAN_MAIL_PROPERTIES.load(is);
27 log.debug(ATLASSIAN_MAIL_PROPERTIES);
28
29 Properties systemProperties = System.getProperties();
30 synchronized(systemProperties)
31 {
32 ATLASSIAN_MAIL_PROPERTIES.putAll(systemProperties);
33 }
34
35 }
36 catch (IOException e)
37 {
38 log.error("Unable to load atlassian mail properties from file: " + MAIL_PROPERTIES_FILE, e);
39 }
40 }
41 }