@Override public boolean isMailServerConfigured() { return AppConfig.getsConfig().getConfig().getSmtp() != null; }
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; }
@Override public String getDefaultFromAddress() { return AppConfig.getsConfig().getConfig().getSmtp().getFrom(); }
public String getBaseUrl() { RootConfig getsConfig = AppConfig.getsConfig(); String siteURL = getsConfig.getSiteURL(); WebServerType ws = getsConfig.getConfig().getWebServer(); return removeTrailingSlash(siteURL); }
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 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; }
@Override protected String getBaseUrl() { String siteURL = super.getBaseUrl(); if (siteURL == null) { // there is no baseUrl set. Lets read confluence one from Applinks Configuration // TODO look at JST-460 and remove following code that reads the base url from Crucible ApplicationInstance primaryCrucible = getApplicationsInstancesInternal(Application.CRUCIBLE).getPrimary(); if (primaryCrucible!=null) { siteURL = primaryCrucible.getUrl(); AppConfig.getsConfig().getConfig().getWebServer().setSiteUrl(siteURL); log.warn("FishEye base url empty. Setting to " +siteURL); siteURL = removeTrailingSlash(siteURL); } } return 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 FisheyeApplicationInfo(ApplicationProperties applicationProperties, I18nResolver i18nResolver, UserManager userManager, TemplateRenderer renderer, SupportInfoAppenderManager supportInfoAppenderManager, SupportInfoXmlKeyResolver supportInfoXmlKeyResolver, PluginAccessor pluginAccessor, com.atlassian.crucible.spi.services.RepositoryService crucibleRepositoryService, com.atlassian.fisheye.spi.services.RepositoryService feRepositoryService, MailUtility mailUtility) { super(applicationProperties, i18nResolver, userManager, renderer, supportInfoAppenderManager, supportInfoXmlKeyResolver, pluginAccessor, mailUtility); this.pluginDataFactory = new PluginDataFactory(pluginAccessor); this.factory = new DBControlFactoryImpl(); // TODO: Investigate replacing these with injected classes this.cfg = AppConfig.getsConfig().getConfig(); this.dbConfig = new DatabaseConfig(this.factory.getCurrentControl().getInfo().getConnectionInfo()); this.crucibleRepositoryService = crucibleRepositoryService; this.feRepositoryService = feRepositoryService; }
/** * 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 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 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 + "'."); } }