@Override public String save(){
  log.info("Changing the IPT configuration");
  boolean baseUrlChanged=false;
  if (!stringEquals(baseUrl,cfg.getBaseUrl())) {
    log.info("Changing the installation baseURL from [" + cfg.getBaseUrl() + "] to ["+ baseUrl+ "]");
    try {
      URL burl=new URL(baseUrl);
      configManager.setBaseUrl(burl);
      updateAllAlternateIdentifiersForIPTURLToResource();
      log.info("Installation baseURL successfully changed to[" + baseUrl + "]");
      addActionMessage(getText("admin.config.baseUrl.changed"));
      addActionMessage(getText("admin.user.login"));
      addActionMessage(getText("admin.config.baseUrl.changed.reminder"));
      session.remove(Constants.SESSION_USER);
      if (URLUtils.isLocalhost(burl)) {
        addActionWarning(getText("admin.config.error.localhostURL"));
      }
 else       if (URLUtils.isHostName(burl)) {
        log.info("Machine name used in base URL");
        addActionWarning(getText("admin.config.baseUrl.sameHostName"));
      }
      baseUrlChanged=true;
    }
 catch (    MalformedURLException e) {
      addActionError(getText("admin.config.error.invalidBaseURL"));
      return INPUT;
    }
catch (    InvalidConfigException e) {
      if (e.getType() == InvalidConfigException.TYPE.INVALID_BASE_URL) {
        addActionError(getText("admin.config.baseUrl.invalidBaseURL") + " " + baseUrl);
      }
 else       if (e.getType() == InvalidConfigException.TYPE.INACCESSIBLE_BASE_URL) {
        addActionError(getText("admin.config.baseUrl.inaccessible") + " " + baseUrl);
      }
 else {
        addActionError(getText("admin.error.invalidConfiguration",new String[]{e.getMessage()}));
      }
      return INPUT;
    }
  }
  try {
    configManager.setProxy(proxy);
  }
 catch (  InvalidConfigException e) {
    addActionError(getText(e.getMessage()) + " " + proxy);
    return INPUT;
  }
  if (debug != null) {
    try {
      configManager.setDebugMode(debug);
    }
 catch (    InvalidConfigException e) {
      addActionError(getText("admin.config.debug.error"));
      return INPUT;
    }
  }
  if (archivalMode != null) {
    try {
      configManager.setArchivalMode(archivalMode);
    }
 catch (    InvalidConfigException e) {
      if (e.getType() == InvalidConfigException.TYPE.DOI_REGISTRATION_ALREADY_ACTIVATED) {
        addActionError(getText("admin.error.invalidConfiguration.doiAccount.activated"));
      }
 else {
        addActionError(getText("admin.config.archival.error"));
      }
      return INPUT;
    }
  }
  if (analyticsGbif != null) {
    try {
      configManager.setGbifAnalytics(analyticsGbif);
    }
 catch (    InvalidConfigException e) {
      addActionError(getText("admin.config.analyticsGbif.error"));
      return INPUT;
    }
  }
  if (analyticsKey != null) {
    try {
      configManager.setAnalyticsKey(analyticsKey);
    }
 catch (    InvalidConfigException e) {
      addActionError(getText("admin.config.analyticsKey.error"));
      return INPUT;
    }
  }
  try {
    configManager.setIptLocation(latitude,longitude);
  }
 catch (  InvalidConfigException e) {
    addActionError(getText("admin.config.server.location.error"));
    return INPUT;
  }
  try {
    configManager.saveConfig();
  }
 catch (  InvalidConfigException e) {
    log.error("couldnt write config settings",e);
    addActionError(getText("admin.config.save.error"));
    return INPUT;
  }
  if (baseUrlChanged) {
    return HOME;
  }
  return SUCCESS;
}

@ Override public String save ( ) { log . info ( "Changing the IPT configuration" ) ; boolean baseUrlChanged = false ; if ( ! stringEquals ( baseUrl , cfg . getBaseUrl ( ) ) ) { log . info ( "Changing the installation baseURL from [" + cfg . getBaseUrl ( ) + "] to [" + baseUrl + "]" ) ; try { URL burl = new URL ( baseUrl ) ; configManager . setBaseUrl ( burl ) ; updateAllAlternateIdentifiersForIPTURLToResource ( ) ; log . info ( "Installation baseURL successfully changed to[" + baseUrl + "]" ) ; addActionMessage ( getText ( "admin.config.baseUrl.changed" ) ) ; addActionMessage ( getText ( "admin.user.login" ) ) ; addActionMessage ( getText ( "admin.config.baseUrl.changed.reminder" ) ) ; session . remove ( Constants . SESSION_USER ) ; if ( URLUtils . isLocalhost ( burl ) ) { addActionWarning ( getText ( "admin.config.error.localhostURL" ) ) ; } else if ( URLUtils . isHostName ( burl ) ) { log . info ( "Machine name used in base URL" ) ; addActionWarning ( getText ( "admin.config.baseUrl.sameHostName" ) ) ; } baseUrlChanged = true ; } catch ( MalformedURLException e ) { addActionError ( getText ( "admin.config.error.invalidBaseURL" ) ) ; return INPUT ; } catch ( InvalidConfigException e ) { if ( e . getType ( ) == InvalidConfigException . TYPE . INVALID_BASE_URL ) { addActionError ( getText ( "admin.config.baseUrl.invalidBaseURL" ) + " " + baseUrl ) ; } else if ( e . getType ( ) == InvalidConfigException . TYPE . INACCESSIBLE_BASE_URL ) { addActionError ( getText ( "admin.config.baseUrl.inaccessible" ) + " " + baseUrl ) ; } else { addActionError ( getText ( "admin.error.invalidConfiguration" , new String [ ] { e . getMessage ( ) } ) ) ; } return INPUT ; } } try { configManager . setProxy ( proxy ) ; } catch ( InvalidConfigException e ) { addActionError ( getText ( e . getMessage ( ) ) + " " + proxy ) ; return INPUT ; } if ( debug != null ) { try { configManager . setDebugMode ( debug ) ; } catch ( InvalidConfigException e ) { addActionError ( getText ( "admin.config.debug.error" ) ) ; return INPUT ; } } if ( archivalMode != null ) { try { configManager . setArchivalMode ( archivalMode ) ; } catch ( InvalidConfigException e ) { if ( e . getType ( ) == InvalidConfigException . TYPE . DOI_REGISTRATION_ALREADY_ACTIVATED ) { addActionError ( getText ( "admin.error.invalidConfiguration.doiAccount.activated" ) ) ; } else { addActionError ( getText ( "admin.config.archival.error" ) ) ; } return INPUT ; } } if ( analyticsGbif != null ) { try { configManager . setGbifAnalytics ( analyticsGbif ) ; } catch ( InvalidConfigException e ) { addActionError ( getText ( "admin.config.analyticsGbif.error" ) ) ; return INPUT ; } } if ( analyticsKey != null ) { try { configManager . setAnalyticsKey ( analyticsKey ) ; } catch ( InvalidConfigException e ) { addActionError ( getText ( "admin.config.analyticsKey.error" ) ) ; return INPUT ; } } try { configManager . setIptLocation ( latitude , longitude ) ; } catch ( InvalidConfigException e ) { addActionError ( getText ( "admin.config.server.location.error" ) ) ; return INPUT ; } try { configManager . saveConfig ( ) ; } catch ( InvalidConfigException e ) { log . error ( "couldnt write config settings" , e ) ; addActionError ( getText ( "admin.config.save.error" ) ) ; return INPUT ; } if ( baseUrlChanged ) { return HOME ; } return SUCCESS ; }
this is called when the new configuration is submitted .
