1/*2 * Licensed to the Apache Software Foundation (ASF) under one or more3 * contributor license agreements. See the NOTICE file distributed with4 * this work for additional information regarding copyright ownership.5 * The ASF licenses this file to You under the Apache License, Version 2.06 * (the "License"); you may not use this file except in compliance with7 * the License. You may obtain a copy of the License at8 * 9 * http://www.apache.org/licenses/LICENSE-2.010 * 11 * Unless required by applicable law or agreed to in writing, software12 * distributed under the License is distributed on an "AS IS" BASIS,13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.14 * See the License for the specific language governing permissions and15 * limitations under the License.16 */17packageorg.apache.jetspeed.administration;
1819import java.util.Iterator;
20import java.util.List;
2122import org.apache.commons.configuration.Configuration;
232425/***26 * Portal Configuration27 * 28 * Retrieve basic data types from the jetspeed.properties configuration29 * This is a subset of Commons Configuration functionality30 * Not the best solution wrappering commons configuration, but it does continue 31 * with the requirements of interface-driven development and zero dependencies in API32 *33 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>34 * @version $Id: $35 */36publicclassPortalConfigurationImpl implements PortalConfiguration
37 {
38 Configuration configuration;
3940publicPortalConfigurationImpl(Configuration configuration)
41 {
42this.configuration = configuration;
43 }
4445publicboolean getBoolean(String key, boolean defaultValue)
46 {
47return configuration.getBoolean(key, defaultValue);
48 }
4950publicboolean getBoolean(String key)
51 {
52return configuration.getBoolean(key);
53 }
5455publicdouble getDouble(String key, double defaultValue)
56 {
57return configuration.getDouble(key, defaultValue);
58 }
5960publicdouble getDouble(String key)
61 {
62return configuration.getDouble(key);
63 }
6465publicfloat getFloat(String key, float defaultValue)
66 {
67return configuration.getFloat(key, defaultValue);
68 }
6970publicfloat getFloat(String key)
71 {
72return configuration.getFloat(key);
73 }
7475publicint getInt(String key, int defaultValue)
76 {
77return configuration.getInt(key, defaultValue);
78 }
7980publicint getInt(String key)
81 {
82return configuration.getInt(key);
83 }
8485public List getList(String key)
86 {
87return configuration.getList(key);
88 }
8990publiclong getLong(String key, long defaultValue)
91 {
92return configuration.getLong(key, defaultValue);
93 }
9495publiclong getLong(String key)
96 {
97return configuration.getLong(key);
98 }
99100public String getString(String key, String defaultValue)
101 {
102return configuration.getString(key, defaultValue);
103 }
104105public String getString(String key)
106 {
107return configuration.getString(key);
108 }
109110public String[] getStringArray(String key)
111 {
112return configuration.getStringArray(key);
113 }
114115public Iterator getKeys()
116 {
117return configuration.getKeys();
118 }
119120publicvoid setString(String key, String value)
121 {
122 configuration.setProperty(key, value);
123 }
124 }