public final class Environment {

    /**
     * Deny direct instantiation.
     */
    private Environment() {
    }

    public static boolean isDev() {
        return ServerMode.DEV.toString().equalsIgnoreCase(System.getProperty(SYS_PROP_SERVER_MODE));
    }

    public static Path getServerConfPath() {
        return Paths.get(USER_DIR, DIR_ADEPTJ_RUNTIME, DIR_DEPLOYMENT, SERVER_CONF_FILE);
    }

    public static Path getFrameworkConfPath() {
        return Paths.get(USER_DIR, DIR_ADEPTJ_RUNTIME, DIR_DEPLOYMENT, FRAMEWORK_CONF_FILE);
    }
} public static final String COMMON_CONF_SECTION = "common"; public static final String FELIX_CONF_SECTION = "felix"; public static final String LOGGING_CONF_SECTION = "logging"; public static final String MAIN_CONF_SECTION = "main"; public static final String RESTEASY_CONF_SECTION = "resteasy"; public static final String SERVER_CONF_FILE = "server.conf"; public static final String SYS_PROP_OVERWRITE_SERVER_CONF = "overwrite.server.conf.file"; public static final String TRIMOU_CONF_SECTION = "trimou"; public static final String UNDERTOW_CONF_SECTION = "undertow";
import static com.adeptj.runtime.common.Constants.RESTEASY_CONF_SECTION;
import static com.adeptj.runtime.common.Constants.SERVER_CONF_FILE;
import static com.adeptj.runtime.common.Constants.SYS_PROP_OVERWRITE_SERVER_CONF;
import static com.adeptj.runtime.common.Constants.TRIMOU_CONF_SECTION;
import static com.adeptj.runtime.common.Constants.UNDERTOW_CONF_SECTION;
import com.adeptj.runtime.common.Environment;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import java.io.File;
import static com.adeptj.runtime.common.Constants.COMMON_CONF_SECTION;
import static com.adeptj.runtime.common.Constants.FELIX_CONF_SECTION;
import static com.adeptj.runtime.common.Constants.LOGGING_CONF_SECTION;
import static com.adeptj.runtime.common.Constants.MAIN_CONF_SECTION;
/*
###############################################################################
#                                                                             # 
#    Copyright 2016, AdeptJ (http://www.adeptj.com)                           #
#                                                                             #
#    Licensed under the Apache License, Version 2.0 (the "License");          #
#    you may not use this file except in compliance with the License.         #
#    You may obtain a copy of the License at                                  #
#                                                                             #
#        http://www.apache.org/licenses/LICENSE-2.0                           #
#                                                                             #
#    Unless required by applicable law or agreed to in writing, software      #
#    distributed under the License is distributed on an "AS IS" BASIS,        #
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
#    See the License for the specific language governing permissions and      #
#    limitations under the License.                                           #
#                                                                             #
###############################################################################
*/

package com.adeptj.runtime.config;




/**
 * Initializes the application configurations.
 *
 * @author Rakesh.Kumar, AdeptJ
 */
public enum Configs {

    INSTANCE;

    /**
     * This will include system properties as well.
     */
    private final Config root;

    Configs() {
        this.root = this.loadConf();
    }

    public Config root() {
        return this.root;
    }

    public Config main() {
        return this.root.getConfig(MAIN_CONF_SECTION);
    }

    public Config undertow() {
        return this.main().getConfig(UNDERTOW_CONF_SECTION);
    }

    public Config felix() {
        return this.main().getConfig(FELIX_CONF_SECTION);
    }

    public Config common() {
        return this.main().getConfig(COMMON_CONF_SECTION);
    }

    public Config logging() {
        return this.main().getConfig(LOGGING_CONF_SECTION);
    }

    public Config trimou() {
        return this.main().getConfig(TRIMOU_CONF_SECTION);
    }

    public Config resteasy() {
        return this.main().getConfig(RESTEASY_CONF_SECTION);
    }

    private Config loadConf() {
        Config config;
        File configFile = Environment.getServerConfPath().toFile();