foundServices.add(service);
}
}
if (foundServices.size() == 0) {
throw new UnexpectedLiquibaseException("Cannot find ChangeLogHistoryService for " + database.getShortName());
}
try {
ChangeLogHistoryService exampleService = foundServices.iterator().next();
Class<? extends ChangeLogHistoryService> aClass = exampleService.getClass();
ChangeLogHistoryService service;
try {
aClass.getConstructor();
service = aClass.newInstance();
service.setDatabase(database);
} catch (NoSuchMethodException e) {
// must have been manually added to the registry and so already configured.
service = exampleService;
}
services.put(database, service);
return service;
} catch (Exception e) {
throw new UnexpectedLiquibaseException(e);
}
}