Conversation
| private String parseLocalUrl(final String url) { | ||
| return databaseDirectory + url.replaceFirst("file://", ""); | ||
| if(url.startsWith(LOCAL_PREFIX + "//")) { | ||
| return url.replaceFirst(LOCAL_PREFIX + "//", "/"); |
There was a problem hiding this comment.
This forces the path tp be absolute, because it prefix the path with /. Is this wanted or a bug?
There was a problem hiding this comment.
The paths are supposed to be absolute. The intention is to not rely on the current work-directory. Any not-absolute path would always be relative to the CWD. The URL without the LOCAL_PREFIX is still supported and allows to connect to a db relative to the database directory.
|
|
||
| @Test | ||
| public void testDropCreateWithLocalUrl() throws IOException { | ||
| String localUrl = "local:/" + absoluteDBPath + "/" + DB_NAME; |
There was a problem hiding this comment.
Are you prefixing with local:/ because the absolute path already starts with /?
|
The build-error is: Is it possible that the test uses a JDK version not supported by Gremlin? I cannot see any cause in my small coding additions that might be responsible for this kind of error. |
|
Merged, thanks @gfinger ! |
What does this PR do?
A local URL like :
local:<absolutePathToDB>/DBcan be used within the Console to connect to a local DB, to create and drop it.Motivation
It should be possible to use the Console not relying on the current work-directory. It might also be advantageous not to depend on a global setting like when using the
-Darcadedb.server.databaseDirectoryparameter at startup of the console.Related issues
Introduction of the
-Darcadedb.server.databaseDirectoryparameter for the Console.Additional Notes
The commit also contains Unit Tests for the local connect, as well as a test whether the local URL can also be used with the
CREATE DBand theDROP DBcommands.I used JDK 19 for compiling and testing, but the code is compatible with Java 8.
Checklist
mvn clean packagecommand