001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.util.service;
016    
017    import com.liferay.portal.kernel.configuration.Configuration;
018    import com.liferay.portal.kernel.configuration.ConfigurationFactoryUtil;
019    import com.liferay.portal.kernel.configuration.Filter;
020    
021    import java.util.Properties;
022    
023    /**
024     * @author Brian Wing Shun Chan
025     */
026    public class ServiceProps {
027    
028            public static void addProperties(Properties properties) {
029                    _instance._configuration.addProperties(properties);
030            }
031    
032            public static boolean contains(String key) {
033                    return _instance._configuration.contains(key);
034            }
035    
036            public static String get(String key) {
037                    return _instance._configuration.get(key);
038            }
039    
040            public static String get(String key, Filter filter) {
041                    return _instance._configuration.get(key, filter);
042            }
043    
044            public static String[] getArray(String key) {
045                    return _instance._configuration.getArray(key);
046            }
047    
048            public static String[] getArray(String key, Filter filter) {
049                    return _instance._configuration.getArray(key, filter);
050            }
051    
052            public static Properties getProperties() {
053                    return _instance._configuration.getProperties();
054            }
055    
056            public static void removeProperties(Properties properties) {
057                    _instance._configuration.removeProperties(properties);
058            }
059    
060            public static void set(String key, String value) {
061                    _instance._configuration.set(key, value);
062            }
063    
064            private ServiceProps() {
065                    _configuration = ConfigurationFactoryUtil.getConfiguration(
066                            ServiceProps.class.getClassLoader(), "service");
067            }
068    
069            private static ServiceProps _instance = new ServiceProps();
070    
071            private Configuration _configuration;
072    
073    }