diff --git a/src_tenwa/com/tenwa/httpclient/resources/VouchersPropertiesUtil.java b/src_tenwa/com/tenwa/httpclient/resources/VouchersPropertiesUtil.java new file mode 100644 index 000000000..ac980a4a7 --- /dev/null +++ b/src_tenwa/com/tenwa/httpclient/resources/VouchersPropertiesUtil.java @@ -0,0 +1,40 @@ +package com.tenwa.httpclient.resources; + +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 VouchersPropertiesUtil { + private static Map attributes; + + public static void load() { + attributes = new ConcurrentHashMap(); + Properties prop = new Properties(); + try { + prop.load(VouchersPropertiesUtil.class.getResourceAsStream("/vouchers.properties")); + for(Entry 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); + } +}