Exemplo n.º 1
0
 /**
  * Loads the application configuration from the given properties
  *
  * @param properties application configuration properties
  * @throws Exception
  */
 public void load(final Properties properties) throws Exception {
   if (!isConfigLoaded) {
     LOG.info("Loading application configuration");
     LOG.debug(
         "Loading application configuration through properties. Given properties are :"
             + properties);
     this.applicationProperties = properties;
     registerProviders();
     loadProvidersConfig();
     setProxy();
     String timeout = null;
     if (applicationProperties.containsKey(Constants.HTTP_CONNECTION_TIMEOUT)) {
       timeout = applicationProperties.getProperty(Constants.HTTP_CONNECTION_TIMEOUT).trim();
     }
     if (timeout != null && !timeout.isEmpty()) {
       int time = 0;
       try {
         time = Integer.parseInt(timeout);
       } catch (NumberFormatException ne) {
         LOG.warn("Http connection timout is not an integer in configuration");
       }
       HttpUtil.setConnectionTimeout(time);
     }
     isConfigLoaded = true;
   }
 }