001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.jetspeed.administration;
018:
019: import java.util.Iterator;
020: import java.util.List;
021:
022: import org.apache.commons.configuration.Configuration;
023:
024: /**
025: * Portal Configuration
026: *
027: * Retrieve basic data types from the jetspeed.properties configuration
028: * This is a subset of Commons Configuration functionality
029: * Not the best solution wrappering commons configuration, but it does continue
030: * with the requirements of interface-driven development and zero dependencies in API
031: *
032: * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
033: * @version $Id: $
034: */
035: public class PortalConfigurationImpl implements PortalConfiguration {
036: Configuration configuration;
037:
038: public PortalConfigurationImpl(Configuration configuration) {
039: this .configuration = configuration;
040: }
041:
042: public boolean getBoolean(String key, boolean defaultValue) {
043: return configuration.getBoolean(key, defaultValue);
044: }
045:
046: public boolean getBoolean(String key) {
047: return configuration.getBoolean(key);
048: }
049:
050: public double getDouble(String key, double defaultValue) {
051: return configuration.getDouble(key, defaultValue);
052: }
053:
054: public double getDouble(String key) {
055: return configuration.getDouble(key);
056: }
057:
058: public float getFloat(String key, float defaultValue) {
059: return configuration.getFloat(key, defaultValue);
060: }
061:
062: public float getFloat(String key) {
063: return configuration.getFloat(key);
064: }
065:
066: public int getInt(String key, int defaultValue) {
067: return configuration.getInt(key, defaultValue);
068: }
069:
070: public int getInt(String key) {
071: return configuration.getInt(key);
072: }
073:
074: public List getList(String key) {
075: return configuration.getList(key);
076: }
077:
078: public long getLong(String key, long defaultValue) {
079: return configuration.getLong(key, defaultValue);
080: }
081:
082: public long getLong(String key) {
083: return configuration.getLong(key);
084: }
085:
086: public String getString(String key, String defaultValue) {
087: return configuration.getString(key, defaultValue);
088: }
089:
090: public String getString(String key) {
091: return configuration.getString(key);
092: }
093:
094: public String[] getStringArray(String key) {
095: return configuration.getStringArray(key);
096: }
097:
098: public Iterator getKeys() {
099: return configuration.getKeys();
100: }
101:
102: public void setString(String key, String value) {
103: configuration.setProperty(key, value);
104: }
105: }
|