private void storeConfig() { try { rootConfig.saveConfig(); // todo: should we call AppConfig.updateLastModified()? See FE-123. } catch (IOException e) { throw new RuntimeException(e); } }
private void storeConfig() { try { rootConfig.saveConfig(); // todo: should we call AppConfig.updateLastModified()? See FE-123. } catch (IOException e) { throw new RuntimeException(e); } }
public void addSysadminGroup(final String groupname) throws FisheyeAccessorException { try { final AdminUserConfig adminUserManager = AppConfig.getsConfig().getAdminUserManager(); adminUserManager.addGroup(groupname); AppConfig.getsConfig().saveConfig(); } catch (final IOException e) { throw new FisheyeAccessorException("IOException occured while trying to add sysadmin group: " + groupname, e); } }
public void enableAnonymousAccess(final boolean enable) throws FisheyeAccessorException { try { final ConfigDocument.Config cfg = AppConfig.getsConfig().getConfig(); final RepSecurityType security = cfg.getRepositoryDefaults().getSecurity(); security.setAllowAnon(enable); AppConfig.getsConfig().saveConfig(); } catch (final IOException e) { throw new FisheyeAccessorException( "Error " + (enable ? "enabling" : "disabling") + " anonymous access to fisheye repositories. " + e, e); } }
public Collection<Message> doUpgrade() throws Exception { final SecurityType sec = AppConfig.getsConfig().getConfig().getSecurity(); // Let's just be anal if (sec.isSetCrowd()) { final CrowdAuthConfigType crowdAuth = sec.getCrowd(); final Properties props = PropertiesUtil.loadFromString(crowdAuth.getCrowdProperties()); final String crowdUrl = props.getProperty(PROPERTIES_FILE_SECURITY_SERVER_URL); if (crowdUrl.startsWith("https")) { props.setProperty(PROPERTIES_FILE_SECURITY_SERVER_URL, crowdUrl.replaceFirst("https", "http")); crowdAuth.setCrowdProperties(PropertiesUtil.saveToString(props)); sec.setCrowd(crowdAuth); AppConfig.getsConfig().saveConfig(); AppConfig.getsConfig().getUserManager().reload(AppConfig.getsConfig().getConfig()); } } return null; }
public void updateRepositories(Set<String> repositoriesToUpdate) { try { for (String name : repositoriesToUpdate) { RepositoryType repositoryType = getRepositoryType(name); // set up linkers setupLinkers(name, repositoryType); // some extra magic for linkers to work final RepositoryHandle repositoryHandle = AppConfig.getsConfig().getRepositoryManager().getRepository(name); repositoryHandle.getCfg().setupLinker(); } // save the config AppConfig.getsConfig().saveConfig(); // refresh config final RepositoryManager rm = AppConfig.getsConfig().getRepositoryManager(); rm.reloadList(); } catch (IOException e) { throw new RuntimeException(e); } catch (ConfigException e) { throw new RuntimeException(e); } } /**
/** * Set the base URL of this application */ @Override protected void setBaseUrl(final String url) throws Exception { // Only update the site url if it is actually set final WebServerType ws = AppConfig.getsConfig().getConfig().getWebServer(); if (ws.isSetSiteUrl()) { ws.setSiteUrl(url); AppConfig.getsConfig().saveConfig(); AppConfig.getsConfig().reload(); } }
public Collection<Message> doUpgrade() throws Exception { final SecurityType sec = AppConfig.getsConfig().getConfig().getSecurity(); // Let's just be anal if (sec.isSetCrowd()) { final CrowdAuthConfigType crowdAuth = sec.getCrowd(); final Properties props = PropertiesUtil.loadFromString(crowdAuth.getCrowdProperties()); final String crowdTokenKey = props.getProperty(PROPERTIES_FILE_CROWD_TOKEN_KEY); // If it's already something else, maybe we shouldn't change it? if (crowdTokenKey == null) { props.setProperty(PROPERTIES_FILE_CROWD_TOKEN_KEY, CROWD_TOKEN_KEY); crowdAuth.setCrowdProperties(PropertiesUtil.saveToString(props)); sec.setCrowd(crowdAuth); AppConfig.getsConfig().saveConfig(); AppConfig.getsConfig().getUserManager().reload(AppConfig.getsConfig().getConfig()); } } return null; }
public void setLicense(final String license) throws FisheyeAccessorException { final RootConfig rootConfig = AppConfig.getsConfig(); final LicenseType licenses = AppConfig.getsConfig().getConfig().getLicense(); licenses.setCrucible(license); licenses.setFisheye(license); try { rootConfig.saveConfig(); rootConfig.refreshLicenses(); } catch (final IOException ioe) { throw new FisheyeAccessorException("Error saving configuration while reloading license", ioe); } catch (final LicenseException le) { throw new FisheyeAccessorException("Error loading license", le); } }
public void updateRepositories(final Collection<String> repositoriesToUpdate) throws ConfigException, IOException { for (final String name : repositoriesToUpdate) { final RepositoryType repositoryType = getRepositoryType(name); if (repositoryType!=null && repositoryType.isSetSvn()) { final SvnRepType svn = repositoryType.getSvn(); if (svn!=null && !svn.isSetCharset()) { svn.setCharset("UTF-8"); } } } // save the config AppConfig.getsConfig().saveConfig(); // refresh config final RepositoryManager rm = AppConfig.getsConfig().getRepositoryManager(); rm.reloadList(); }
public void deleteRepository(final String repName) throws FisheyeAccessorException { AppConfig.getsConfig().getRepositoryManager().getRepository(repName).stop(); final int id = getRepositoryId(repName); try { AppConfig.getsConfig().getConfig().removeRepository(id); AppConfig.getsConfig().saveConfig(); AppConfig.getsConfig().getRepositoryManager().reloadList(); } catch (final IndexOutOfBoundsException e) { throw new FisheyeAccessorException( "Error retrieving repository '" + repName + "' for id '" + id + "'. Unable to delete.", e); } catch (final IOException e) { throw new FisheyeAccessorException( "Error saving fisheye config when deleting repository '" + repName + "'."); } catch (final ConfigException e) { throw new FisheyeAccessorException( "Error reloading fisheye config when deleting repository '" + repName + "'."); } }
AppConfig.getsConfig().saveConfig();
AppConfig.getsConfig().saveConfig();