|
@@ -1,7 +1,5 @@
|
|
|
package org.cryptomator.common.vaults;
|
|
|
|
|
|
-import com.google.common.base.Joiner;
|
|
|
-import com.google.common.collect.ImmutableSet;
|
|
|
import org.cryptomator.common.mountpoint.InvalidMountPointException;
|
|
|
import org.cryptomator.common.mountpoint.MountPointChooser;
|
|
|
import org.cryptomator.common.settings.VaultSettings;
|
|
@@ -19,7 +17,7 @@ import java.util.Optional;
|
|
|
import java.util.Set;
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
|
|
|
-public class DokanyVolume implements Volume {
|
|
|
+public class DokanyVolume extends AbstractVolume {
|
|
|
|
|
|
private static final Logger LOG = LoggerFactory.getLogger(DokanyVolume.class);
|
|
|
|
|
@@ -44,11 +42,6 @@ public class DokanyVolume implements Volume {
|
|
|
this.choosers = choosers;
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public boolean isSupported() {
|
|
|
- return DokanyVolume.isSupportedStatic();
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public void mount(CryptoFileSystem fs, String mountFlags) throws InvalidMountPointException, VolumeException {
|
|
|
this.mountPoint = determineMountPoint();
|
|
@@ -63,23 +56,6 @@ public class DokanyVolume implements Volume {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private Path determineMountPoint() throws InvalidMountPointException {
|
|
|
- for (MountPointChooser chooser : this.choosers) {
|
|
|
- Optional<Path> chosenPath = chooser.chooseMountPoint();
|
|
|
- if (chosenPath.isEmpty()) {
|
|
|
- //Chooser was applicable, but couldn't find a feasible mountpoint
|
|
|
- continue;
|
|
|
- }
|
|
|
- this.cleanupRequired = chooser.prepare(chosenPath.get()); //Fail entirely if an Exception occurs
|
|
|
- this.usedChooser = chooser;
|
|
|
- return chosenPath.get();
|
|
|
- }
|
|
|
- String tried = Joiner.on(", ").join(this.choosers.stream()
|
|
|
- .map((mpc) -> mpc.getClass().getTypeName())
|
|
|
- .collect(ImmutableSet.toImmutableSet()));
|
|
|
- throw new InvalidMountPointException(String.format("No feasible MountPoint found! Tried %s", tried));
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public void reveal() throws VolumeException {
|
|
|
boolean success = mount.reveal();
|
|
@@ -100,6 +76,11 @@ public class DokanyVolume implements Volume {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public boolean isSupported() {
|
|
|
+ return DokanyVolume.isSupportedStatic();
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Optional<Path> getMountPoint() {
|
|
|
return Optional.ofNullable(mountPoint);
|