1 package com.mjh.switchrmi;
2
3 import java.io.*;
4
5 import java.util.*;
6
7 public class TestSystemProperties
8 {
9 private final static String PROPS_FILE_NAME_KEY =
10 "switchrmi.system.properties";
11 private final static String DEFAULT_PROPS_FILE =
12 "etc/test.properties";
13
14 static
15 {
16 try
17 {
18 String name = System.getProperty(PROPS_FILE_NAME_KEY,
19 DEFAULT_PROPS_FILE);
20
21 if (name != null)
22 {
23 File file = new File(name);
24
25
26 if (file != null)
27 {
28 FileInputStream in = new FileInputStream(file);
29
30 if (in != null)
31 {
32
33 Properties props = new Properties();
34
35 props.load(in);
36
37 Enumeration e = props.propertyNames();
38
39 while (e.hasMoreElements())
40 {
41 String key = (String) e.nextElement();
42
43 System.setProperty(key, props.getProperty(key));
44 }
45 }
46 }
47 }
48 }
49 catch (Throwable t)
50 {
51 t.printStackTrace();
52 }
53 }
54
55 public static void setup()
56 {
57 }
58 }