kmworks.dsltools.util.PropertiesManager.java Source code

Java tutorial

Introduction

Here is the source code for kmworks.dsltools.util.PropertiesManager.java

Source

/*
 *   Copyright (C) 2012-2017 Christian P. Lerch, Vienna, Austria.
 *
 *   This file is part of DSLtools - a suite of software tools for effective
 *   DSL implementations.
 *
 *   DSLtools is free software: you can use, modify and redistribute it under
 *   the terms of the GNU General Public License version 3 as published by
 *   the Free Software Foundation, Inc. <http://fsf.org/>
 *
 *   DSLtools is distributed in the hope that it will be useful, but WITHOUT
 *   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 *   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
 *   version 3 for details.
 *
 *   You should have received a copy of the GNU General Public License along
 *   with this distribution. If not, see <http://km-works.eu/res/GPL.txt> or
 *   <http://www.gnu.org/licenses/gpl-3.0.html>.
 */
package kmworks.dsltools.util;

import com.google.common.io.Resources;
import java.io.InputStream;
import java.util.Properties;
import kmworks.util.config.PropertyMap;
import kmworks.util.config.PropertyMapConverter;

/**
 *
 * @author Christian P. Lerch
 * @version 1.0.0
 * @since 1.0
 */
public class PropertiesManager {

    private static final PropertiesManager INSTANCE = new PropertiesManager();

    private PropertyMap rrdOptions;

    private PropertiesManager() {
        try (final InputStream stream = Resources.getResource("rrd.properties").openStream()) {
            Properties properties = new Properties();
            properties.load(stream);
            rrdOptions = PropertyMapConverter.fromProperties(properties);
        } catch (Exception ex) {
        }
    }

    public static PropertyMap getOptions() {
        return INSTANCE.rrdOptions;
    }

}