Пример #1
0
 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;
 }
Пример #2
0
 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;
 }
Пример #3
0
 /** 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);
   }
 }