public GoConfigRevision getConfigAtVersion(String version) { GoConfigRevision goConfigRevision = null; try { goConfigRevision = configRepository.getRevision(version); } catch (Exception e) { LOGGER.info("[Go Config Service] Could not fetch cruise config xml at version=" + version, e); } return goConfigRevision; }
public String configChangesFor( String laterMd5, String earlierMd5, LocalizedOperationResult result) { try { return configRepository.configChangesFor(laterMd5, earlierMd5); } catch (IllegalArgumentException e) { result.badRequest(LocalizedMessage.string("CONFIG_VERSION_NOT_FOUND")); } catch (Exception e) { result.internalServerError(LocalizedMessage.string("COULD_NOT_RETRIEVE_CONFIG_DIFF")); } return null; }
/** Creates config dao that accesses single file */ public static GoConfigDao createTestingDao() { SystemEnvironment systemEnvironment = new SystemEnvironment(); try { ServerHealthService serverHealthService = new ServerHealthService(); ConfigRepository configRepository = new ConfigRepository(systemEnvironment); configRepository.initialize(); ConfigCache configCache = new ConfigCache(); ConfigElementImplementationRegistry configElementImplementationRegistry = ConfigElementImplementationRegistryMother.withNoPlugins(); CachedGoPartials cachedGoPartials = new CachedGoPartials(serverHealthService); FullConfigSaveNormalFlow normalFlow = new FullConfigSaveNormalFlow( configCache, configElementImplementationRegistry, systemEnvironment, new ServerVersion(), new TimeProvider(), configRepository, cachedGoPartials); GoFileConfigDataSource dataSource = new GoFileConfigDataSource( new DoNotUpgrade(), configRepository, systemEnvironment, new TimeProvider(), configCache, new ServerVersion(), configElementImplementationRegistry, serverHealthService, cachedGoPartials, null, normalFlow); dataSource.upgradeIfNecessary(); CachedGoConfig cachedConfigService = new CachedGoConfig(serverHealthService, dataSource, cachedGoPartials, null, null); cachedConfigService.loadConfigIfNull(); return new GoConfigDao(cachedConfigService); } catch (IOException e) { throw new RuntimeException(e); } }