package io.mycat.server.config;
import io.mycat.server.config.node.SystemConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
/**
*
* @author yanglixue
*
*/
public class DnPropertyUtil {
private static final Logger LOGGER = LoggerFactory.getLogger("DnPropertyUtil");
/**
* 加载dnindex.properties属性文件
* @return 属性文件
*/
public static Properties loadDnIndexProps() {
Properties prop = new Properties();
File file = new File(SystemConfig.getHomePath(), "conf"
+ File.separator + "dnindex.properties");
if (!file.exists()) {
return prop;
}
FileInputStream filein = null;
try {
filein = new FileInputStream(file);
prop.load(filein);
} catch (Exception e) {
LOGGER.warn("load DataNodeIndex err:" + e);
} finally {
if (filein != null) {
try {
filein.close();
} catch (IOException e) {
}
}
}
return prop;
}
}