private void fetchStops(File root, Repositories repo) throws IOException { final String stopsText = "STOPS"; final File stopsRoot = repo.getStopsURI(root); URI stopsURI = repo.getUri(stopsText); String linesUriContent = uriContentProvider.getURIContent(stopsURI); File stopsFile = new File(stopsRoot, getFileName(stopsText)); FileUtils.writeStringToFile(stopsFile, linesUriContent, encoding); }
private void fetchLines(File root, Repositories repo) throws IOException { final String linesText = "LINES"; final File linesRoot = repo.getLinesURI(root); URI linesURI = repo.getUri(linesText); String stopsUriContent = uriContentProvider.getURIContent(linesURI); File linesFile = new File(linesRoot, getFileName(linesText)); FileUtils.writeStringToFile(linesFile, stopsUriContent, encoding); }
private void fetchSchedule(File root, Repositories repo) throws IOException { final File scheduleRoot = repo.getScheduleURI(root); List<String> lines = getLines(String.format("/%s", repo.getRepositoryName())); FileUtils.deleteDirectory(scheduleRoot); for (String line : lines) { String uriContent = uriContentProvider.getURIContent(repo.getUri(line)); File file = new File(scheduleRoot, getFileName(line)); FileUtils.writeStringToFile(file, uriContent, encoding); } }
public void grabXMLs(File root) throws IOException { for (Repositories repo : Repositories.values()) { fetchSchedule(root, repo); fetchLines(root, repo); fetchStops(root, repo); } }