41 lines
1.1 KiB
Java
41 lines
1.1 KiB
Java
package com.tenwa.util;
|
|
|
|
import java.io.IOException;
|
|
import java.util.Map;
|
|
import java.util.Map.Entry;
|
|
import java.util.Properties;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
import com.amarsoft.are.ARE;
|
|
|
|
public class QuartzPropertiesUtil {
|
|
private static Map<String, String> attributes;
|
|
|
|
public static void load() {
|
|
attributes = new ConcurrentHashMap<String, String>();
|
|
Properties prop = new Properties();
|
|
try {
|
|
prop.load(QuartzPropertiesUtil.class.getResourceAsStream("/quartz.properties"));
|
|
for(Entry<Object, Object> entry : prop.entrySet()) {
|
|
if(entry.getKey() == null || entry.getValue() == null) {
|
|
continue;
|
|
}
|
|
attributes.put(entry.getKey().toString(), entry.getValue().toString());
|
|
}
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
ARE.getLog().error("init QuartzPropertiesUtil info failed");
|
|
}
|
|
ARE.getLog().info("init QuartzPropertiesUtil info success");
|
|
}
|
|
|
|
public static void destroy() {
|
|
if(attributes != null) attributes.clear();
|
|
}
|
|
|
|
public static String get(String propName) {
|
|
if(attributes == null) load();
|
|
return attributes.get(propName);
|
|
}
|
|
}
|