private void init()

in prototype/dispatch/order-dispatcher/src/main/java/com/aws/proto/dispatching/config/RoutingConfig.java [69:95]


    private void init() {
        initLock.lock();
        try {
            if(!this.localOsmDir.toFile().exists()) {
                logger.info("{} dir doesn't exist. Creating local OSM dir.", this.localOsmDir);
                Files.createDirectories(this.localOsmDir);
            }

            if(!this.localGraphhopperDir.toFile().exists()) {
                logger.info("{} dir doesn't exist. Creating local graphhopper dir.", this.localGraphhopperDir);
                Files.createDirectories(this.localGraphhopperDir);
            }

            if (!this.osmFilePath.toFile().exists()) {
                logger.info("{} local osm file doesn't exist. Downloading...", this.osmFilePath);
                S3Utility.downloadFile(routingProperties.s3BucketName(), routingProperties.s3OsmKeyPath(), this.osmFilePath);
            }

            this.hopper = this.importAndLoad();

        } catch (IOException e) {
            throw new DispatcherException("Can't create local OSM and/or Graphhopper dirs", e);
        }
        finally {
            initLock.unlock();
        }
    }