shared profile dir

This commit is contained in:
Arndt Brenschede 2018-10-21 11:50:58 +02:00
parent 940abc5ea2
commit b154851f1f
4 changed files with 11 additions and 1 deletions

View file

@ -180,7 +180,10 @@ public class RouteServer extends Thread
serviceContext.segmentDir = args[0]; serviceContext.segmentDir = args[0];
serviceContext.profileDir = args[1]; serviceContext.profileDir = args[1];
System.setProperty( "profileBaseDir", serviceContext.profileDir ); System.setProperty( "profileBaseDir", serviceContext.profileDir );
serviceContext.customProfileDir = args[2]; String dirs = args[2];
StringTokenizer tk = new StringTokenizer( dirs, "," );
serviceContext.customProfileDir = tk.nextToken();
serviceContext.sharedProfileDir = tk.hasMoreTokens() ? tk.nextToken() : serviceContext.customProfileDir;
int maxthreads = Integer.parseInt( args[4] ); int maxthreads = Integer.parseInt( args[4] );

View file

@ -13,6 +13,7 @@ public class ServiceContext
public String segmentDir; public String segmentDir;
public String profileDir; public String profileDir;
public String customProfileDir; public String customProfileDir;
public String sharedProfileDir;
public Map<String,String> profileMap = null; public Map<String,String> profileMap = null;
public List<OsmNodeNamed> nogoList; public List<OsmNodeNamed> nogoList;
} }

View file

@ -22,6 +22,7 @@ public class ProfileUploadHandler
// prefix for custom profile id to distinguish from default profiles // prefix for custom profile id to distinguish from default profiles
public static final String CUSTOM_PREFIX = "custom_"; public static final String CUSTOM_PREFIX = "custom_";
public static final String SHARED_PREFIX = "shared_";
private ServiceContext serviceContext; private ServiceContext serviceContext;

View file

@ -51,6 +51,11 @@ public class ServerHandler extends RequestHandler {
String customProfile = profile.substring( ProfileUploadHandler.CUSTOM_PREFIX.length() ); String customProfile = profile.substring( ProfileUploadHandler.CUSTOM_PREFIX.length() );
profile = new File( serviceContext.customProfileDir, customProfile ).getPath(); profile = new File( serviceContext.customProfileDir, customProfile ).getPath();
} }
else if ( profile.startsWith( ProfileUploadHandler.SHARED_PREFIX ) )
{
String customProfile = profile.substring( ProfileUploadHandler.SHARED_PREFIX.length() );
profile = new File( serviceContext.sharedProfileDir, customProfile ).getPath();
}
rc.localFunction = profile; rc.localFunction = profile;
rc.setAlternativeIdx(Integer.parseInt(params.get( "alternativeidx" ))); rc.setAlternativeIdx(Integer.parseInt(params.get( "alternativeidx" )));