Helper method which takes the given bucket config and applies it to the cluster config.

This method also sends out an update to the subject afterwards, so that observers are notified.

@param newConfig the configuration of the bucket.
978061
private void upsertBucketConfig(final BucketConfig newConfig) {
        ClusterConfig cluster = currentConfig;
        BucketConfig oldConfig = cluster.bucketConfig(newConfig.name());

        if (newConfig.rev() > 0 && oldConfig != null && newConfig.rev() <= oldConfig.rev()) {
            LOGGER.trace("Not applying new configuration, older or same rev ID.");
            return;
        }

        // If the current password of the config is empty and an old config exists
        // make sure to transfer the password over to the new config. Otherwise it
        // is possible that authentication errors because of a null password arise.
        // See JVMCBC-185
        if (newConfig.password() == null && oldConfig != null) {
            newConfig.password(oldConfig.password());
        }

        //copy the username as well
        if (oldConfig != null) {
            newConfig.username(oldConfig.username());
        }

        // this is the first config, decide on external networking
        if (oldConfig == null) {
            externalNetwork = determineNetworkResolution(newConfig, environment.networkResolution(), seedHosts);
            LOGGER.info("Selected network configuration: {}", externalNetwork != null ? externalNetwork : "default");
        }

        if (externalNetwork != null) {
            newConfig.useAlternateNetwork(externalNetwork);
        }

        cluster.setBucketConfig(newConfig.name(), newConfig);
        LOGGER.debug("Applying new configuration {}", newConfig);

        currentConfig = cluster;

        boolean tainted = newConfig.tainted();
        for (Refresher refresher : refreshers.values()) {
            if (tainted) {
                refresher.markTainted(newConfig);
            } else {
                refresher.markUntainted(newConfig);
            }
        }

        configObservable.onNext(currentConfig);
    }
949646
@Override
	public void applyConfig(final ConfigSettings config)
	{

		Object o = config
				.getConfigParameter(ConfigurationKeys.LOGGING_PATH_DIFFTOOL);
		if (o != null) {
			this.diffToolField.setText((String) o);
		}
		else {
			this.diffToolField.setText("");
		}

		o = config
				.getConfigParameter(ConfigurationKeys.LOGGING_LOGLEVEL_DIFFTOOL);
		if (o != null) {
			this.diffToolLogLevelComboBox.setSelectedItem(o);
		}

	}
108392
public void applyConfigurations(Swarm swarm) throws IOException {
        if (get(SERVER_CONFIG) != null) {
            swarm.withXmlConfig(get(SERVER_CONFIG));
        }
        if (get(CONFIG) != null) {
            List<URL> configs = get(CONFIG);
            for (URL config : configs) {
                swarm.withConfig(config);
            }
        }
        if (get(PROFILES) != null) {
            List<String> profiles = get(PROFILES);
            for (String profile : profiles) {
                swarm.withProfile(profile);
            }
        }
    }
211701
public static synchronized void updateLog(Map<String, Object> newConfig) {
        if (newConfig == null)
            throw new NullPointerException("Updated config must not be null");

        HpelTraceServiceConfig config = loggingConfig.get();
        if (config != null) {
            config.updateLog(newConfig);
            config.getTrDelegate().update(config);
        }
    }
1323174
public void setConfig(Config config) {
        if (mapperHelper == null) {
            mapperHelper = new MapperHelper();
        }
        mapperHelper.setConfig(config);
    }
446658
public RollingSink<T> setFSConfig(Configuration config) {
		this.fsConfig = new Configuration();
		fsConfig.addAll(config);
		return this;
	}
892452
@RequestMapping(value = "configurations/create", method = RequestMethod.POST)
    public SVNConfiguration newConfiguration(@RequestBody SVNConfiguration configuration) {
        return svnConfigurationService.newConfiguration(configuration);
    }
612297
public void init(String name, Map<String,Object> config) {
        if(config==null)
            config = Objects.newSOHashMap();
        this.name = name;
        this.config = config;
    }
1015448
public void setSpaceLifecycle(String bucketName,
                                  BucketLifecycleConfiguration config) {
        boolean success = false;
        int maxLoops = 6;
        for (int loops = 0; !success && loops < maxLoops; loops++) {
            try {
                s3Client.deleteBucketLifecycleConfiguration(bucketName);
                s3Client.setBucketLifecycleConfiguration(bucketName, config);
                success = true;
            } catch (NotFoundException e) {
                success = false;
                wait(loops);
            }
        }

        if (!success) {
            throw new StorageException(
                "Lifecycle policy for bucket " + bucketName +
                " could not be applied. The space cannot be found.");
        }
    }
342653
protected void pushConfig(final ProposedBucketConfigContext ctx) {
        try {
            configStream.onNext(ctx);
        } catch (Exception e) {
            LOGGER.warn("Exception while pushing new configuration - ignoring.", e);
        }
    }
959164
public void configurationUpdated(Object emailConfig) {
      EmailConfiguration config = (EmailConfiguration) emailConfig;
      if(config != null && (this.config == null || !config.equals(this.config))) {
        log.info("Updating configuration for email.");
        this.config = config;
      
        //Set the captcha validator up.
        if(!StringUtils.isEmptyOrNull(config.getCaptchaPrivateKey())) {
          log.info("Setting up captcha validation: "+config.getCaptchaPrivateKey());
          captchaValidator = new CaptchaValidator(config.getCaptchaPrivateKey());
        } else {
          log.info("Unsetting captcha validation.");
          captchaValidator = null;
        }
        // Need to get the Session Strategy and Transform class names out of the 
        // Dictionary, and then use reflection to use them
        Dictionary<String,Object> props = new Hashtable<String,Object>();
        if(!StringUtils.isEmptyOrNull(config.getJndiName())) {
          props.put("com.meltmedia.email.jndi",config.getJndiName());
          log.debug("Using jndiName: "+config.getJndiName());
        }
        log.debug("Using {} as the default from address.", config.getDefaultFromAddress());
        if(StringUtils.isEmptyOrNull(config.getSessionStrategy())) {
          config.setSessionStrategy(null);
        }
        log.debug("Using mail session strategy: " + config.getSessionStrategy());
        if(StringUtils.isEmptyOrNull(config.getMessageTransformer())) {
          config.setMessageTransformer(DEFAULT_MESSAGE_TRANSFORMER);
        }
        log.debug("Using message transformer: " + config.getMessageTransformer());
        EmailSetup newSetup = new EmailSetup();
        SessionStrategy strategy = null;
        MessageTransformer transformer = null;
        try {
          if(config.getSessionStrategy() != null) {
            strategy = setSessionStrategy(config, props, newSetup);
          }
        } catch (Exception e) {
          log.error("Error Registering Mail Session Strategy "+config.getSessionStrategy(), e);
          config.setSessionStrategy(null);
        }
        try {  
          transformer = setMessageTransformer(config, newSetup);
        } catch(Exception e) {
          log.error("Error Registering Mail Session Strategy "+config.getSessionStrategy(), e);
          config.setMessageTransformer(DEFAULT_MESSAGE_TRANSFORMER);
          try {
            transformer = setMessageTransformer(config, newSetup);
          } catch(Exception e1) {
            log.error("Failed to fall back to default message transformer.", e1);
          }
        }
        
        this.setup = newSetup;
        
        log.debug("Using new config jndi {}, strategy {}, transformer {}", new Object[] {config.getJndiName(), strategy, transformer});
      }
  }
81074
public void setConfig(Map<String, ? extends CacheConfig> config) {
        this.configMap = (Map<String, CacheConfig>) config;
    }
508479
@Override
	public void applyConfig(final ConfigSettings config)
	{

		Object o = config
				.getConfigParameter(ConfigurationKeys.PATH_OUTPUT_SQL_FILES);
		if (o != null) {
			this.outputPathField.setText((String) o);
		}
		else {
			this.outputPathField.setText("");
		}

		o = config
				.getConfigParameter(ConfigurationKeys.MODE_ZIP_COMPRESSION_ENABLED);
		if (o != null) {
			controller.setEnableZipCompression((Boolean) o);
		}
		else {
			controller.setEnableZipCompression(false);
		}

		o = config
				.getConfigParameter(ConfigurationKeys.MODE_DATAFILE_OUTPUT);
		if (o != null) {
			controller.setEnableDataFileOutput((Boolean) o);
		}
		else {
			controller.setEnableDataFileOutput(false);
		}

		o = config.getConfigParameter(ConfigurationKeys.MODE_OUTPUT);
		if (o != null) {
			switch ((OutputType) o) {
			case UNCOMPRESSED:
				controller.setEnableSQLDatabaseOutput(false);
				controller.setOutputCompression(OutputCompressionEnum.None);

				o = config
						.getConfigParameter(ConfigurationKeys.LIMIT_SQL_FILE_SIZE);
				break;
			case SEVENZIP:
				controller.setEnableSQLDatabaseOutput(false);
				controller.setOutputCompression(OutputCompressionEnum.SevenZip);

				o = config
						.getConfigParameter(ConfigurationKeys.LIMIT_SQL_ARCHIVE_SIZE);
				break;
			case BZIP2:
				controller.setEnableSQLDatabaseOutput(false);
				controller.setOutputCompression(OutputCompressionEnum.BZip2);

				o = config
						.getConfigParameter(ConfigurationKeys.LIMIT_SQL_ARCHIVE_SIZE);
				break;
			case DATABASE:
				controller.setEnableSQLDatabaseOutput(true);
				controller.setOutputCompression(OutputCompressionEnum.None);

				o = null;
				break;
			}
		}

		if (o != null) {
			controller.setMultipleOutputFiles(true);
			this.outputSizeLimitField.setText(Long.toString((Long) o));
		}
		else {
			controller.setMultipleOutputFiles(false);
			this.outputSizeLimitField.setText("");
		}
	}
302735
public static void addConfig(Config config) {
		if (config == null) {
			throw new IllegalArgumentException("Config can not be null");
		}
		if (configNameToConfig.containsKey(config.getName())) {
			throw new IllegalArgumentException("Config already exists: " + config.getName());
		}
		
		configNameToConfig.put(config.getName(), config);
		
		/** 
		 * Replace the main config if current config name is MAIN_CONFIG_NAME
		 */
		if (MAIN_CONFIG_NAME.equals(config.getName())) {
			DbKit.config = config;
			Db.init(DbKit.config.getName());
		}
		
		/**
		 * The configName may not be MAIN_CONFIG_NAME,
		 * the main config have to set the first comming Config if it is null
		 */
		if (DbKit.config == null) {
			DbKit.config = config;
			Db.init(DbKit.config.getName());
		}
	}
764370
public OperationFuture<LoadBalancerPool> update(LoadBalancerPool loadBalancerPool, LoadBalancerPoolConfig config) {
        LoadBalancerPoolMetadata loadBalancerPoolMetadata = findByRef(loadBalancerPool);

        loadBalancerPoolClient.update(
            loadBalancerPoolMetadata.getDataCenterId(),
            loadBalancerPoolMetadata.getLoadBalancerId(),
            loadBalancerPoolMetadata.getId(),
            new LoadBalancerPoolRequest()
                .method(config.getMethod())
                .persistence(config.getPersistence())
        );

        return new OperationFuture<>(
            loadBalancerPool,
            addLoadBalancerNodes(config, loadBalancerPool)
        );
    }
227468
public void setConfig(LWMConfig config) 
    {
    	// Store away the custom groups associated with the ME
    	
    	HashSet <String> customGrps = new HashSet <String>();
    	List l = new ArrayList<String>();
    	String str =((JsMEConfig) config).getMessagingEngine().getName();
     	l.add(str);
    	customGrps.addAll(l);
    	CUSTOM_GROUPS.put(_messagingEngine.getUuid().toString(), customGrps);
    	_messagingEngine.getName();
    }
885278
MultimapWithProtoValuesFluentAssertion<M> usingConfig(FluentEqualityConfig newConfig) {
    Subject.Factory<MultimapWithMessageValuesSubject<K, M>, Multimap<K, M>> factory =
        multimapWithMessageValues(newConfig);
    MultimapWithMessageValuesSubject<K, M> newSubject = check().about(factory).that(actual());
    if (internalCustomName() != null) {
      newSubject = newSubject.named(internalCustomName());
    }
    return new MultimapWithProtoValuesFluentAssertionImpl<>(newSubject);
  }