1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.administration;
18
19 import java.util.Iterator;
20 import java.util.List;
21
22 import org.apache.commons.configuration.Configuration;
23
24
25 /***
26 * Portal Configuration
27 *
28 * Retrieve basic data types from the jetspeed.properties configuration
29 * This is a subset of Commons Configuration functionality
30 * Not the best solution wrappering commons configuration, but it does continue
31 * with the requirements of interface-driven development and zero dependencies in API
32 *
33 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
34 * @version $Id: $
35 */
36 public class PortalConfigurationImpl implements PortalConfiguration
37 {
38 Configuration configuration;
39
40 public PortalConfigurationImpl(Configuration configuration)
41 {
42 this.configuration = configuration;
43 }
44
45 public boolean getBoolean(String key, boolean defaultValue)
46 {
47 return configuration.getBoolean(key, defaultValue);
48 }
49
50 public boolean getBoolean(String key)
51 {
52 return configuration.getBoolean(key);
53 }
54
55 public double getDouble(String key, double defaultValue)
56 {
57 return configuration.getDouble(key, defaultValue);
58 }
59
60 public double getDouble(String key)
61 {
62 return configuration.getDouble(key);
63 }
64
65 public float getFloat(String key, float defaultValue)
66 {
67 return configuration.getFloat(key, defaultValue);
68 }
69
70 public float getFloat(String key)
71 {
72 return configuration.getFloat(key);
73 }
74
75 public int getInt(String key, int defaultValue)
76 {
77 return configuration.getInt(key, defaultValue);
78 }
79
80 public int getInt(String key)
81 {
82 return configuration.getInt(key);
83 }
84
85 public List getList(String key)
86 {
87 return configuration.getList(key);
88 }
89
90 public long getLong(String key, long defaultValue)
91 {
92 return configuration.getLong(key, defaultValue);
93 }
94
95 public long getLong(String key)
96 {
97 return configuration.getLong(key);
98 }
99
100 public String getString(String key, String defaultValue)
101 {
102 return configuration.getString(key, defaultValue);
103 }
104
105 public String getString(String key)
106 {
107 return configuration.getString(key);
108 }
109
110 public String[] getStringArray(String key)
111 {
112 return configuration.getStringArray(key);
113 }
114
115 public Iterator getKeys()
116 {
117 return configuration.getKeys();
118 }
119
120 public void setString(String key, String value)
121 {
122 configuration.setProperty(key, value);
123 }
124 }