private GraphHopper process ( String graphHopperLocation ) { setGraphHopperLocation ( graphHopperLocation ) ; GHLock lock = null ; try { if ( ghStorage . getDirectory ( ) . getDefaultType ( ) . isStoring ( ) ) { lockFactory . setLockDir ( new File ( graphHopperLocation ) ) ; lock = lockFactory . create ( fileLockName , true ) ; if ( ! lock . tryLock ( ) ) throw new RuntimeException ( "To avoid multiple writers we need to obtain a write lock but it failed. In " + graphHopperLocation , lock . getObtainFailedReason ( ) ) ; } try { DataReader reader = importData ( ) ; DateFormat f = createFormatter ( ) ; ghStorage . getProperties ( ) . put ( "datareader.import.date" , f . format ( new Date ( ) ) ) ; if ( reader . getDataDate ( ) != null ) ghStorage . getProperties ( ) . put ( "datareader.data.date" , f . format ( reader . getDataDate ( ) ) ) ; } catch ( IOException ex ) { throw new RuntimeException ( "Cannot read file " + getDataReaderFile ( ) , ex ) ; } cleanUp ( ) ; postProcessing ( ) ; flush ( ) ; } finally { if ( lock != null ) lock . release ( ) ; } return this ; }
Creates the graph from OSM data .