code: void apply( Changes changes ) throws Exception {
          try {
              stateLock.lock();
              logger.debug("Applying changes to '{0}' repository configuration: {1} --> {2}", repositoryName, changes, config);
              // Get the configuration and apply the same changes ...
              final RepositoryConfiguration oldConfiguration = this.config.get();
              Editor copy = oldConfiguration.edit();
              ConfigurationChange configChanges = new ConfigurationChange();
              copy.apply(changes, configChanges);
  
              // Always update the configuration ...
              RunningState oldState = this.runningState.get();
              this.config.set(new RepositoryConfiguration(copy.unwrap(), copy.getString(FieldName.NAME),
                                                          oldConfiguration.environment()));
              if (oldState != null) {
                  assert state.get() == State.RUNNING;
                  // Repository is running, so create a new running state ...
                  RunningState newState = new RunningState(oldState, configChanges);
                  this.runningState.set(newState);
  
                  // Handle a few special cases that the running state doesn't really handle itself ...
                  if (!configChanges.storageChanged && configChanges.predefinedWorkspacesChanged) refreshWorkspaces();
                  if (configChanges.nameChanged) repositoryNameChanged();
                  if (configChanges.connectorsChanged) {
                      newState.connectors.restart(config.get().getFederation());
                  }
              }
              logger.debug("Applied changes to '{0}' repository configuration: {1} --> {2}", repositoryName, changes, config);
          } finally {
              stateLock.unlock();
          }
      }
docs: Apply the supplied changes to this repository's configuration, and if running change the services to reflect the updated
  configuration. Note that this method assumes the proposed changes have already been validated; see
  {@link RepositoryConfiguration#validate(Changes)}.
  
  @param changes the changes for the configuration
  @throws Exception if there is a problem with underlying resources
  @see ModeShapeEngine#update(String, Changes)