From 1e7478a89f2f0460c92705857f4411c21f385b29 Mon Sep 17 00:00:00 2001 From: infeo Date: Sat, 3 Feb 2018 16:43:33 +0100 Subject: [PATCH] commit of the nioAdapter Interface, implementation enum and the commandFailedException --- .../ui/model/CommandFailedException.java | 17 ++++++++++ .../org/cryptomator/ui/model/NioAdapter.java | 31 +++++++++++++++++++ .../cryptomator/ui/model/NioAdapterImpl.java | 10 ++++++ 3 files changed, 58 insertions(+) create mode 100644 main/ui/src/main/java/org/cryptomator/ui/model/CommandFailedException.java create mode 100644 main/ui/src/main/java/org/cryptomator/ui/model/NioAdapter.java create mode 100644 main/ui/src/main/java/org/cryptomator/ui/model/NioAdapterImpl.java diff --git a/main/ui/src/main/java/org/cryptomator/ui/model/CommandFailedException.java b/main/ui/src/main/java/org/cryptomator/ui/model/CommandFailedException.java new file mode 100644 index 000000000..cfac40ab0 --- /dev/null +++ b/main/ui/src/main/java/org/cryptomator/ui/model/CommandFailedException.java @@ -0,0 +1,17 @@ +package org.cryptomator.ui.model; + +public class CommandFailedException extends Exception { + + public CommandFailedException(String message) { + super(message); + } + + public CommandFailedException(Throwable cause) { + super(cause); + } + + public CommandFailedException(String message, Throwable cause){ + super(message,cause); + } + +} diff --git a/main/ui/src/main/java/org/cryptomator/ui/model/NioAdapter.java b/main/ui/src/main/java/org/cryptomator/ui/model/NioAdapter.java new file mode 100644 index 000000000..9cda2c462 --- /dev/null +++ b/main/ui/src/main/java/org/cryptomator/ui/model/NioAdapter.java @@ -0,0 +1,31 @@ +package org.cryptomator.ui.model; + +import org.cryptomator.cryptofs.CryptoFileSystem; + +import java.util.HashMap; + + +public interface NioAdapter { + + void unlock(CryptoFileSystem fs); + + void mount() throws CommandFailedException; + + void unmount() throws CommandFailedException; + + void stop(); + + String getFilesystemRootUrl(); + + default boolean isSupported() { + return false; + } + + default boolean supportsForcedUnmount() { + return false; + } + + default void unmountForced() throws CommandFailedException { + throw new CommandFailedException("Operation not supported"); + } +} diff --git a/main/ui/src/main/java/org/cryptomator/ui/model/NioAdapterImpl.java b/main/ui/src/main/java/org/cryptomator/ui/model/NioAdapterImpl.java new file mode 100644 index 000000000..6b4cedcdd --- /dev/null +++ b/main/ui/src/main/java/org/cryptomator/ui/model/NioAdapterImpl.java @@ -0,0 +1,10 @@ +package org.cryptomator.ui.model; + +import java.util.ArrayList; + +public enum NioAdapterImpl { + + WEBDAV, + FUSE + +}