@Override public void downloadAndValidate(BundleRequest request, BundleResponse response) { String gtfsDirectory = request.getBundleDirectory() + File.separator + _fileService.getGtfsPath(); _log.info("gtfsDir=" + gtfsDirectory); List<String> files = _fileService.list(gtfsDirectory, -1); if (files == null || files.size() == 0) { response.addStatusMessage("no files found in " + gtfsDirectory); response.setComplete(true); return; } String tmpDir = request.getTmpDirectory(); if (tmpDir == null) { tmpDir = new FileUtils().createTmpDirectory(); request.setTmpDirectory(tmpDir); } response.setTmpDirectory(request.getTmpDirectory()); for (String s3Key : files) { response.addStatusMessage("downloading " + s3Key); _log.info("downloading " + s3Key); String gtfsZipFileName = _fileService.get(s3Key, tmpDir); String outputFile = gtfsZipFileName + _gtfsValidationService.getOutputExtension(); response.addStatusMessage("validating " + s3Key); _log.info("validating " + s3Key); if (installAndValidateGtfs(gtfsZipFileName, outputFile) != 0) { _log.error("Failed to successfully validate: " + gtfsZipFileName); response.addStatusMessage("validation failed for " + s3Key); continue; } _log.info("results of " + gtfsZipFileName + " at " + outputFile); response.addValidationFile(new FileUtils().parseFileName(outputFile)); upload(request, response); response.addStatusMessage("complete"); } }
public void downloadFeedValidator() { _gtfsValidationService.downloadFeedValidator(); }
@Override public int validateGtfs(String gtfsZipFileName, String outputFile) { return _gtfsValidationService.validateGtfs(gtfsZipFileName, outputFile); }