@@ -0,0 +1,2892 @@
+/**%0A* Copyright (c) Acroquest Technology Co, Ltd. All Rights Reserved.%0A* Please read the associated COPYRIGHTS file for more details.%0A*%0A* THE SOFTWARE IS PROVIDED BY Acroquest Technolog Co., Ltd.,%0A* WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING%0A* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,%0A* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.%0A* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDER BE LIABLE FOR ANY%0A* CLAIM, DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING%0A* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.%0A*/%0Apackage acromusashi.stream.config;%0A%0Aimport java.io.InputStream;%0Aimport java.io.InputStreamReader;%0Aimport java.io.Reader;%0Aimport java.text.MessageFormat;%0Aimport java.util.Map;%0Aimport java.util.Properties;%0A%0Aimport org.apache.storm.guava.collect.Maps;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0A/**%0A * Load configs from property files.%0A * %0A * @author kimura%0A */%0Apublic class PropertyConfigLoader%0A%7B%0A    /** Default charset */%0A    private static final String            DEFAULT_CHARSET = %22UTF-8%22;%0A%0A    /** logger */%0A    private static final Logger            logger          = LoggerFactory.getLogger(PropertyConfigLoader.class);%0A%0A    /** Map has configs loaded from property files */%0A    private static Map%3CString, Properties%3E propertiesMap   = Maps.newHashMap();%0A%0A    /**%0A     * Constructor for prevent create instance.%0A     */%0A    private PropertyConfigLoader()%0A    %7B%7D%0A%0A    /**%0A    * Get from config defined property files in classpath.%0A    * %0A    * @param filePath property file path in classpath%0A    * @param configKey configkey%0A    * @return config value defined in property file%0A    */%0A    public static Object get(String filePath, String configKey)%0A    %7B%0A        if (propertiesMap.containsKey(filePath) == false)%0A        %7B%0A            loadProperty(filePath);%0A        %7D%0A%0A        Properties properties = propertiesMap.get(filePath);%0A        if (properties == null)%0A        %7B%0A            return null;%0A        %7D%0A%0A        Object resultConfig = properties.getProperty(configKey);%0A        return resultConfig;%0A    %7D%0A%0A    /**%0A     * Load property file.%0A     * %0A     * @param filePath property file path in classpath%0A     */%0A    private static void loadProperty(String filePath)%0A    %7B%0A        try (InputStream propertyStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(%0A                filePath);%0A                Reader propertyReader = new InputStreamReader(propertyStream, DEFAULT_CHARSET);)%0A        %7B%0A            Properties properties = new Properties();%0A            properties.load(propertyReader);%0A            propertiesMap.put(filePath, properties);%0A        %7D%0A        catch (Exception ex)%0A        %7B%0A            String errorPattern = %22Property file load failed. Skip load. : PropertyFile=%7B0%7D%22;%0A            logger.warn(MessageFormat.format(errorPattern, filePath), ex);%0A        %7D%0A    %7D%0A%7D%0A

Add property load utility