diff --git a/src/main/java/com/conveyal/analysis/controllers/BundleController.java b/src/main/java/com/conveyal/analysis/controllers/BundleController.java index 269189407..b7fc71cc5 100644 --- a/src/main/java/com/conveyal/analysis/controllers/BundleController.java +++ b/src/main/java/com/conveyal/analysis/controllers/BundleController.java @@ -67,14 +67,11 @@ public class BundleController implements HttpController { private final FileStorage fileStorage; private final GTFSCache gtfsCache; - // FIXME The backend appears to use an osmcache purely to get a file key at which to store incoming OSM. Refactor. - private final OSMCache osmCache; private final TaskScheduler taskScheduler; public BundleController (BackendComponents components) { this.fileStorage = components.fileStorage; this.gtfsCache = components.gtfsCache; - this.osmCache = components.osmCache; this.taskScheduler = components.taskScheduler; } @@ -176,7 +173,7 @@ private Bundle create (Request req, Response res) { osm.close(); checkWgsEnvelopeSize(osmBounds, "OSM data"); // Store the source OSM file. Note that we're not storing the derived MapDB file here. - fileStorage.moveIntoStorage(osmCache.getKey(bundle.osmId), fi.getStoreLocation()); + fileStorage.moveIntoStorage(OSMCache.getKey(bundle.osmId), fi.getStoreLocation()); } if (bundle.feedGroupId == null) { diff --git a/src/main/java/com/conveyal/r5/streets/OSMCache.java b/src/main/java/com/conveyal/r5/streets/OSMCache.java index 77df063ae..e51a6f07c 100644 --- a/src/main/java/com/conveyal/r5/streets/OSMCache.java +++ b/src/main/java/com/conveyal/r5/streets/OSMCache.java @@ -33,11 +33,11 @@ public OSMCache (FileStorage fileStorage) { .maximumSize(10) .build(); - public String cleanId(String id) { + public static String cleanId(String id) { return id.replaceAll("[^A-Za-z0-9]", "-"); } - public FileStorageKey getKey (String id) { + public static FileStorageKey getKey (String id) { // FIXME Transforming IDs each time they're used seems problematic. They should probably only be validated here. String cleanId = cleanId(id); return new FileStorageKey(FileCategory.BUNDLES, cleanId + ".pbf");