private int findPropertyType(String key) { for (int x=0; x<propertiesType.sizeOfPropertyArray(); x++) { if (key.equals(propertiesType.getPropertyArray(x).getName())) return x; } return -1; }
private void addSourceControlProperties(PropertyStore store) { PropertyStore sourceProps = store.addCategory(SOURCE_CONTROL); if (this.cfg.isSetSvnConfig()) { SvnConfigType svnCfg = this.cfg.getSvnConfig(); if (svnCfg.isSetJar()) { sourceProps.setValue(SVN_CLIENT_JAR, svnCfg.getJar()); } if (svnCfg.isSetJnilib()) { sourceProps.setValue(SVN_CLIENT_LIB, svnCfg.getJnilib()); } } if (this.cfg.isSetP4Config()) { sourceProps.setValue(P4_CLIENT, this.cfg.getP4Config().getP4Location()); } }
private void addResourceLimitsProperties(PropertyStore store) { PropertyStore resourceProps = store.addCategory(RESOURCE_LIMITS); if (this.cfg.isSetResources()) { ResourcesType resourceCfg = this.cfg.getResources(); if (resourceCfg.isSetInitialIndexThreads()) { if (resourceCfg.getInitialIndexThreads().isSetMax()) { resourceProps.setValue(INITIAL_THREADS_MAX, String.valueOf(resourceCfg.getInitialIndexThreads().getMax())); } if (resourceCfg.getInitialIndexThreads().isSetMin()) { resourceProps.setValue(INITIAL_THREADS_MIN, String.valueOf(resourceCfg.getInitialIndexThreads().getMin())); } } if (resourceCfg.isSetIncrementalIndexThreads()) { if (resourceCfg.getIncrementalIndexThreads().isSetMax()) { resourceProps.setValue(INCREMENTAL_THREADS_MAX, String.valueOf(resourceCfg.getIncrementalIndexThreads().getMax())); } if (resourceCfg.getIncrementalIndexThreads().isSetMin()) { resourceProps.setValue(INCREMENTAL_THREADS_MIN, String.valueOf(resourceCfg.getIncrementalIndexThreads().getMin())); } } } }
private RepositoryType getRepositoryType(final String repositoryName) { final RepositoryType[] repositories = AppConfig.getsConfig().getConfigDocument().getConfig().getRepositoryArray(); for (final RepositoryType repository : repositories) { if (repository.getName().equals(repositoryName)) { return repository; } } return null; }
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; }
protected void putActual(String key, String s) { String val; try { val = URLEncoder.encode(s, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } PropertyType type; int index = findPropertyType(key); if (index > -1) type = propertiesType.getPropertyArray(index); else { type = propertiesType.addNewProperty(); type.setName(key); } type.setValue(val); storeConfig(); }
/** * 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(); } }
private int getRepositoryId(final String repositoryName) { final RepositoryType[] repositoryArray = AppConfig.getsConfig().getConfig().getRepositoryArray(); for (int i = 0; i < repositoryArray.length; i++) { final RepositoryType repositoryType = repositoryArray[i]; if (repositoryName.equals(repositoryType.getName())) { return i; } } return -1; }
protected String getActual(String key) { int index = findPropertyType(key); if (index > -1) { String value = propertiesType.getPropertyArray(index).getValue(); try { return URLDecoder.decode(value, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } return null; }
public String getBaseUrl() { RootConfig getsConfig = AppConfig.getsConfig(); String siteURL = getsConfig.getSiteURL(); WebServerType ws = getsConfig.getConfig().getWebServer(); return removeTrailingSlash(siteURL); }
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 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); } }
protected void removeActual(String key) { int index = findPropertyType(key); if (index > -1) { propertiesType.removeProperty(index); } storeConfig(); }
@Override public boolean isMailServerConfigured() { return AppConfig.getsConfig().getConfig().getSmtp() != null; }
/** * @param repname * @return Repository configuration */ private RepositoryType getRepositoryType(final String repname) { final RepositoryType[] repositories = AppConfig.getsConfig().getConfigDocument().getConfig().getRepositoryArray(); for (final RepositoryType rep : repositories) { if (rep.getName().equals(repname)) { return rep; } } return null; }
private int findPropertyType(String key) { for (int x=0; x<propertiesType.sizeOfPropertyArray(); x++) { if (key.equals(propertiesType.getPropertyArray(x).getName())) return x; } return -1; }
protected String getActual(String key) { int index = findPropertyType(key); if (index > -1) { String value = propertiesType.getPropertyArray(index).getValue(); try { return URLDecoder.decode(value, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } return null; }
protected Object removeActual(String key) { int index = findPropertyType(key.toString()); if (index > -1) propertiesType.removeProperty(index); storeConfig(); return key; }
/** * @param repname * @return Repository configuration */ private RepositoryType getRepositoryType(String repname) { RepositoryType[] repositories = AppConfig.getsConfig().getConfigDocument().getConfig().getRepositoryArray(); for (RepositoryType rep : repositories) { if (rep.getName().equals(repname)) { return rep; } } return null; } /**