fixing issue using an individual mountPath, renaming mountPath-Property, fixing gui issues with mountPath,

This commit is contained in:
infeo
2018-03-01 23:27:01 +01:00
parent c8387c7e3c
commit 41358e6715
7 changed files with 51 additions and 46 deletions
@@ -36,7 +36,7 @@ public class VaultSettings {
private final BooleanProperty unlockAfterStartup = new SimpleBooleanProperty(DEFAULT_UNLOCK_AFTER_STARTUP);
private final BooleanProperty mountAfterUnlock = new SimpleBooleanProperty(DEFAULT_MOUNT_AFTER_UNLOCK);
private final BooleanProperty revealAfterMount = new SimpleBooleanProperty(DEFAULT_REAVEAL_AFTER_MOUNT);
private final StringProperty mountPath = new SimpleStringProperty();
private final StringProperty individualMountPath = new SimpleStringProperty();
public VaultSettings(String id) {
this.id = Objects.requireNonNull(id);
@@ -45,7 +45,7 @@ public class VaultSettings {
}
Observable[] observables() {
return new Observable[]{path, mountName, winDriveLetter, unlockAfterStartup, mountAfterUnlock, revealAfterMount};
return new Observable[]{path, mountName, winDriveLetter, unlockAfterStartup, mountAfterUnlock, revealAfterMount, individualMountPath};
}
private void deriveMountNameFromPath(Path path) {
@@ -124,8 +124,8 @@ public class VaultSettings {
return revealAfterMount;
}
public StringProperty mountPath() {
return mountPath;
public StringProperty individualMountPath() {
return individualMountPath;
}
/* Hashcode/Equals */
@@ -27,7 +27,9 @@ class VaultSettingsJsonAdapter {
out.name("unlockAfterStartup").value(value.unlockAfterStartup().get());
out.name("mountAfterUnlock").value(value.mountAfterUnlock().get());
out.name("revealAfterMount").value(value.revealAfterMount().get());
out.name("mountPath").value(value.mountPath().get());
if(value.individualMountPath().isNotEmpty().get()){
out.name("individualMountPath").value(value.individualMountPath().get());
}
out.endObject();
}
@@ -35,7 +37,7 @@ class VaultSettingsJsonAdapter {
String id = null;
String path = null;
String mountName = null;
String mountPath = null;
String individualMountPath = null;
String winDriveLetter = null;
boolean unlockAfterStartup = VaultSettings.DEFAULT_UNLOCK_AFTER_STARTUP;
boolean mountAfterUnlock = VaultSettings.DEFAULT_MOUNT_AFTER_UNLOCK;
@@ -66,8 +68,8 @@ class VaultSettingsJsonAdapter {
case "revealAfterMount":
revealAfterMount = in.nextBoolean();
break;
case "mountPath":
mountPath = in.nextString();
case "individualMountPath":
individualMountPath = in.nextString();
break;
default:
LOG.warn("Unsupported vault setting found in JSON: " + name);
@@ -83,7 +85,7 @@ class VaultSettingsJsonAdapter {
vaultSettings.unlockAfterStartup().set(unlockAfterStartup);
vaultSettings.mountAfterUnlock().set(mountAfterUnlock);
vaultSettings.revealAfterMount().set(revealAfterMount);
vaultSettings.mountPath().set(mountPath);
vaultSettings.individualMountPath().set(individualMountPath);
return vaultSettings;
}
@@ -28,7 +28,7 @@ public class VaultSettingsJsonAdapterTest {
Assert.assertEquals(Paths.get("/foo/bar"), vaultSettings.path().get());
Assert.assertEquals("test", vaultSettings.mountName().get());
Assert.assertEquals("X", vaultSettings.winDriveLetter().get());
Assert.assertEquals("/home/test/crypto", vaultSettings.mountPath().get());
Assert.assertEquals("/home/test/crypto", vaultSettings.individualMountPath().get());
}
}