Ejemplo n.º 1
0
 /**
  * Return active instance of configuration
  *
  * @throws java.io.IOException if any.
  * @return a {@link pl.prv.rrrekin.pbi.Configuration} object.
  */
 public static Configuration getInstance() throws IOException {
   if (instance == null) {
     instance = new Configuration();
     try {
       instance.read();
     } catch (Exception ex) {
       return new Configuration();
     }
   }
   return instance;
 }
Ejemplo n.º 2
0
 /**
  * updateConfiguration.
  *
  * @param newConfig a {@link pl.prv.rrrekin.pbi.Configuration} object.
  */
 public static void updateConfiguration(Configuration newConfig) {
   if (!instance.serverBaseUrl.toString().equals(newConfig.serverBaseUrl.toString())) {
     instance.serverBaseUrl = newConfig.serverBaseUrl;
     instance.propertyChangeSupport.firePropertyChange(
         PROP_SERVERBASEURL, instance.serverBaseUrl, newConfig.serverBaseUrl);
   }
   if (!instance.timeout.equals(newConfig.timeout)) {
     instance.timeout = newConfig.timeout;
     instance.propertyChangeSupport.firePropertyChange(
         PROP_TIMEOUT, instance.timeout, newConfig.timeout);
   }
   if (!instance.threads.equals(newConfig.threads)) {
     instance.threads = newConfig.threads;
     instance.propertyChangeSupport.firePropertyChange(
         PROP_THREADS, instance.threads, newConfig.threads);
   }
   if (!instance.threads.equals(newConfig.maxCacheDays)) {
     instance.maxCacheDays = newConfig.maxCacheDays;
     instance.propertyChangeSupport.firePropertyChange(
         PROP_MAXCACHEDAYS, instance.maxCacheDays, newConfig.maxCacheDays);
   }
 }