If i’m understanding it right, you want to create your own server to calculate distances or routes?
You can create a java webservice (for example with spring-boot and the spring rest api) and integrate graphhopper into it.
You can use the following tutorial to create a graphhopper instance: Stable 0.9 Java development
Put it in your constructor:
GraphHopper hopper = new GraphHopperOSM().forServer();
// where to store graphhopper files?
// now this can take minutes if it imports or a few seconds for loading
// of course this is dependent on the area you import
Put that in your REST endpoint:
GHRequest req = new GHRequest(latFrom, lonFrom, latTo, lonTo).
GHResponse rsp = hopper.route(req);
// first check for errors
// handle them!
// use the best path, see the GHResponse class for more possibilities.
PathWrapper path = rsp.getBest();
// points, distance in meters and time in millis of the full path
PointList pointList = path.getPoints();
double distance = path.getDistance();
long timeInMs = path.getTime();
If you have to create a new flagEncoder (a flagEncoder decides if you can use a route or which routes you can use. To understand it, use the
CarflagEncoder.java as an example. Also use the osm wiki to understand the different flags and maybe what flags you need to discribe a way as acceptable(usable) or not. Also look at
DataFlagEncoder.java if you want to know how to store data for later use for example.
Hopefully that will answer your questions.