/*
* Copyright (c) 2014 HFY. All Rights Reserved.
*/
package com.bond.spider.cnjy.common;

import com.google.common.collect.Maps;


import java.util.Map;
/**
 * 全局配置及常量类
 *
 * @author: PXMWJCH  Date: 2016/7/20 Time: 15:48
 */

public class Global {
    /**
     * 保存全局属性值
     */
    private static Map<String, String> map = Maps.newHashMap();



    /**
     * 属性文件加载对象
     */
    private static PropertiesLoader propertiesLoader = new PropertiesLoader("application.properties");
    private static String webViewFiledPath;

    /**
     * 获取配置
     */
    public static String getConfig(String key) {
        String value = map.get(key);
        if (value == null) {
            value = propertiesLoader.getProperty(key);
            map.put(key, value);
        }
        return value;
    }

//    public static boolean getBoolConfig(String key) {
//        String value = getConfig(key);
//
//
//
//    }


    public static String getUploadPath() {
        return getConfig("uploadPath");
    }

    public static int getMaxSession() {
        return Integer.valueOf(getConfig("maxSession"));
    }

    public static String getHomePath() {
        return "/home";
    }

    public static String getWebFiledPath() {
        return "/fileupload/file/";
    }

    public static String getWebViewFiledPath() {
        return "/fileupload/view/";
    }
}


