1
2
3
4
5
6
7
8
9
10
11
12
13
14 package org.eclipse.jetty.deploy;
15
16 import java.io.FileNotFoundException;
17 import java.io.IOException;
18 import java.net.MalformedURLException;
19 import java.util.Map;
20 import java.util.Properties;
21
22 import org.eclipse.jetty.util.resource.Resource;
23
24
25
26
27
28
29 public class FileConfigurationManager implements ConfigurationManager
30 {
31 private Resource _file;
32 private Properties _properties = new Properties();
33
34 public FileConfigurationManager()
35 {
36 }
37
38
39 public void setFile (String filename)
40 throws MalformedURLException, IOException
41 {
42 _file = Resource.newResource(filename);
43 }
44
45
46
47
48
49 public Map getProperties()
50 {
51 try
52 {
53 loadProperties();
54 return _properties;
55 }
56 catch (Exception e)
57 {
58 throw new RuntimeException(e);
59 }
60 }
61
62
63 private void loadProperties ()
64 throws FileNotFoundException, IOException
65 {
66 if (_properties.isEmpty())
67 _properties.load(_file.getInputStream());
68 }
69 }