import java.io.IOException; import java.util.Properties; /** * Created by liuhai.lh on 17/01/12. */ public class BaseSample { protected static String accessKeyId = "123"; protected static String accessKeySecret = "456"; protected static String regionId = "cn-shanghai"; static { Properties properties = new Properties(); try { properties.load(BaseSample.class.getResourceAsStream("bootstrap.yml")); accessKeyId = properties.getProperty("aliyun.green.accessKeyId"); accessKeySecret = properties.getProperty("aliyun.green.accessKeySecret"); regionId = properties.getProperty("aliyun.green.url"); } catch(IOException e) { e.printStackTrace(); } } protected static String getDomain(){ if("cn-shanghai".equals(regionId)){ return "green.cn-shanghai.aliyuncs.com"; } if ("cn-beijing".equals(regionId)) { return "green.cn-beijing.aliyuncs.com"; } if ("ap-southeast-1".equals(regionId)) { return "green.ap-southeast-1.aliyuncs.com"; } if ("us-west-1".equals(regionId)) { return "green.us-west-1.aliyuncs.com"; } return "green.cn-shanghai.aliyuncs.com"; } protected static String getEndPointName(){ return regionId; } }