All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.premiumminds.billy.core.Config Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (C) 2017 Premium Minds.
 *
 * This file is part of billy core.
 *
 * billy core is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your option) any
 * later version.
 *
 * billy core 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 Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with billy core. If not, see .
 */
package com.premiumminds.billy.core;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import javax.inject.Singleton;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Singleton
public class Config {

    private static final Logger log = LoggerFactory.getLogger(Config.class);

    public static final long SERIAL_VERSION = -4303676531780572465L;
    public static final String TABLE_PREFIX = "BILLY_CORE_";

    private static final String CONFIGURATIONS_FILE_NAME = "";

    private Properties properties;

    public Config() {
        this.properties = this.load();
        this.validateProperties(this.properties);
    }

    private Properties load() {
        InputStream stream =
                Thread.currentThread().getContextClassLoader().getResourceAsStream(Config.CONFIGURATIONS_FILE_NAME);
        Properties properties = new Properties();
        try {
            properties.load(stream);
            stream.close();
        } catch (IOException e) {
            Config.log.error(e.getMessage(), e);
            throw new RuntimeException(e);
        }
        return properties;
    };

    private void validateProperties(Properties properties) {
        // TODO
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy