Example #1
0
 /** static block to load configuration. */
 static {
   jdbcUrl = PropertiesUtil.getValue("jdbcUrl");
   checkParameter("jdbcUrl", jdbcUrl);
   user = PropertiesUtil.getValue("user");
   checkParameter("user", user);
   password = PropertiesUtil.getValue("password");
   checkParameter("password", password);
   String size = PropertiesUtil.getValue("initialPoolSize");
   if (StringUtil.isNotEmpty(size)) {
     initialPoolSize = Integer.valueOf(size);
   }
   String bean = PropertiesUtil.getValue("beanPackage");
   if (StringUtil.isNotEmpty(bean)) {
     beanPackage = bean;
   }
 }
Example #2
0
 /**
  * Determine whether the parameter is defined in the file conf.properties.
  *
  * @param parameter The parameter which needs checking.
  */
 public static void checkParameter(String parameter, String value) {
   if (StringUtil.isEmpty(value)) {
     try {
       throw new ConfigException("The parameter:" + parameter + " is not defined.");
     } catch (ConfigException e) {
       e.printStackTrace();
     }
   }
 }