From 7fda7659fb308981e018b70d4fb0e6068c0d1218 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Apr 2024 08:15:38 +0000 Subject: [PATCH 01/27] Bump the github-actions group with 1 update (#30) --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 794888a..28d8104 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,7 @@ jobs: name: artifacts path: target/*.jar - name: Create Release - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/') with: prerelease: true From ef988e6b81ad0da5d099ecad89f09599bcc69125 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Apr 2024 08:18:02 +0000 Subject: [PATCH 02/27] Bump the maven-build-plugins group with 2 updates (#29) --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 5e37c94..dc00c46 100644 --- a/pom.xml +++ b/pom.xml @@ -75,7 +75,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.12.1 + 3.13.0 17 @@ -148,7 +148,7 @@ maven-gpg-plugin - 3.1.0 + 3.2.2 sign-artifacts From f7b329ebabfbf0c4634f1a8963049932d5183156 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Apr 2024 08:18:29 +0000 Subject: [PATCH 03/27] Bump the java-test-dependencies group with 1 update (#28) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index dc00c46..29a6903 100644 --- a/pom.xml +++ b/pom.xml @@ -65,7 +65,7 @@ org.mockito mockito-core - 5.10.0 + 5.11.0 test From cc685d948a2175c06cecc218fa2094217e923ec6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Jun 2024 09:32:24 +0000 Subject: [PATCH 04/27] Bump the maven-build-plugins group across 1 directory with 4 updates (#34) --- pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 29a6903..44b0fa7 100644 --- a/pom.xml +++ b/pom.xml @@ -82,7 +82,7 @@ maven-source-plugin - 3.3.0 + 3.3.1 attach-sources @@ -99,7 +99,7 @@ maven-javadoc-plugin - 3.6.3 + 3.7.0 attach-javadocs @@ -148,7 +148,7 @@ maven-gpg-plugin - 3.2.2 + 3.2.4 sign-artifacts @@ -183,7 +183,7 @@ org.sonatype.plugins nexus-staging-maven-plugin - 1.6.13 + 1.7.0 true ossrh From a44d0f1ba523dd98268ebb786ed9eb325fe73838 Mon Sep 17 00:00:00 2001 From: Julian Raufelder Date: Fri, 7 Jun 2024 14:09:59 +0000 Subject: [PATCH 05/27] Hardening the CI in relation to PRs --- .github/workflows/build.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 28d8104..cb6510f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,8 @@ name: Build on: - [push] + push: + pull_request_target: + types: [labeled] jobs: build: name: Build and Test @@ -29,4 +31,4 @@ jobs: with: prerelease: true token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }} - generate_release_notes: true \ No newline at end of file + generate_release_notes: true From 3108a43f049099e82926d90312e761e214e31cad Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Mon, 10 Jun 2024 09:01:56 +0200 Subject: [PATCH 06/27] draft --- pom.xml | 2 +- src/main/java/module-info.java | 3 +++ .../filemanagersidebar/SidebarService.java | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarService.java diff --git a/pom.xml b/pom.xml index 44b0fa7..c05dc9a 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.cryptomator integrations-api - 1.4.0-SNAPSHOT + 1.4.0-sidebar Cryptomator Integrations API Defines optional service interfaces that may be used by Cryptomator diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 7108775..f0221cf 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -1,3 +1,4 @@ +import org.cryptomator.integrations.filemanagersidebar.SidebarService; import org.cryptomator.integrations.mount.MountService; import org.cryptomator.integrations.revealpath.RevealPathService; import org.cryptomator.integrations.tray.TrayMenuController; @@ -18,6 +19,7 @@ exports org.cryptomator.integrations.revealpath; exports org.cryptomator.integrations.tray; exports org.cryptomator.integrations.uiappearance; + exports org.cryptomator.integrations.filemanagersidebar; uses AutoStartProvider; uses KeychainAccessProvider; @@ -26,4 +28,5 @@ uses TrayIntegrationProvider; uses TrayMenuController; uses UiAppearanceProvider; + uses SidebarService; } \ No newline at end of file diff --git a/src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarService.java b/src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarService.java new file mode 100644 index 0000000..55e621d --- /dev/null +++ b/src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarService.java @@ -0,0 +1,18 @@ +package org.cryptomator.integrations.filemanagersidebar; + +import org.cryptomator.integrations.common.IntegrationsLoader; + +import java.util.Optional; + +public interface SidebarService { + + SidebarEntry add(); + + interface SidebarEntry { + void remove(); + } + + static Optional get() { + return IntegrationsLoader.load(SidebarService.class); + } +} From 82d9342f1b3c51619f135db158cb51c86139e4ca Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Fri, 14 Jun 2024 18:00:23 +0200 Subject: [PATCH 07/27] change parameter to be the mountpoint path --- .../integrations/filemanagersidebar/SidebarService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarService.java b/src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarService.java index 55e621d..f80bb95 100644 --- a/src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarService.java +++ b/src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarService.java @@ -2,11 +2,12 @@ import org.cryptomator.integrations.common.IntegrationsLoader; +import java.nio.file.Path; import java.util.Optional; public interface SidebarService { - SidebarEntry add(); + SidebarEntry add(Path mountpoint); interface SidebarEntry { void remove(); From 957fdcb18ab6c3a51d5dc46b193dccc319e14a32 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 18 Jun 2024 11:36:55 +0200 Subject: [PATCH 08/27] Adjust SidebarService: * add doc * extend "add" method with displayName parameter * add service specific exception --- .../filemanagersidebar/SidebarService.java | 29 +++++++++++++++++-- .../SidebarServiceException.java | 4 +++ 2 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarServiceException.java diff --git a/src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarService.java b/src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarService.java index f80bb95..dfda8f1 100644 --- a/src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarService.java +++ b/src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarService.java @@ -1,16 +1,39 @@ package org.cryptomator.integrations.filemanagersidebar; import org.cryptomator.integrations.common.IntegrationsLoader; +import org.jetbrains.annotations.NotNull; +import java.io.Closeable; import java.nio.file.Path; import java.util.Optional; +/** + * Service for integrating a given path into the sidebar/quick access bar of a filemanager. + */ public interface SidebarService { - SidebarEntry add(Path mountpoint); + /** + * Creates an entry in the filemanager sidebar. + * + * @param displayName The display name of the sidebar entry + * @param target The filesystem path the sidebar entry points to. + * @return a @{link SidebarEntry } object + */ + SidebarEntry add(@NotNull String displayName, @NotNull Path target) throws SidebarServiceException; - interface SidebarEntry { - void remove(); + /** + * An entry of the filemanager sidebar, created with this service. + */ + interface SidebarEntry extends Closeable { + + /** + * Removes this entry from the sidebar. Once removed, this object cannot be added again. + */ + void remove() throws SidebarServiceException; + + default void close() { + remove(); + } } static Optional get() { diff --git a/src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarServiceException.java b/src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarServiceException.java new file mode 100644 index 0000000..e341f13 --- /dev/null +++ b/src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarServiceException.java @@ -0,0 +1,4 @@ +package org.cryptomator.integrations.filemanagersidebar; + +public class SidebarServiceException extends RuntimeException { +} From c96ecebe0f03f87ad0c3f38526f5419ae73a2134 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 18 Jun 2024 17:33:49 +0200 Subject: [PATCH 09/27] changing API * sidebar entries do not have be closable * make sidebarService exception checked --- .../filemanagersidebar/SidebarService.java | 14 ++++++-------- .../SidebarServiceException.java | 10 +++++++++- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarService.java b/src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarService.java index dfda8f1..96424bb 100644 --- a/src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarService.java +++ b/src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarService.java @@ -17,23 +17,21 @@ public interface SidebarService { * * @param displayName The display name of the sidebar entry * @param target The filesystem path the sidebar entry points to. - * @return a @{link SidebarEntry } object + * @return a @{link SidebarEntry } object, used to remove the entry again + * @apiNote Depending on the implemenation, the display name may not be used. */ - SidebarEntry add(@NotNull String displayName, @NotNull Path target) throws SidebarServiceException; + SidebarEntry add(@NotNull Path target, @NotNull String displayName) throws SidebarServiceException; /** - * An entry of the filemanager sidebar, created with this service. + * An entry of the filemanager sidebar, created by an implementation of this service. */ - interface SidebarEntry extends Closeable { + interface SidebarEntry { /** * Removes this entry from the sidebar. Once removed, this object cannot be added again. */ - void remove() throws SidebarServiceException; + void remove(); - default void close() { - remove(); - } } static Optional get() { diff --git a/src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarServiceException.java b/src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarServiceException.java index e341f13..b3b1953 100644 --- a/src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarServiceException.java +++ b/src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarServiceException.java @@ -1,4 +1,12 @@ package org.cryptomator.integrations.filemanagersidebar; -public class SidebarServiceException extends RuntimeException { +public class SidebarServiceException extends Exception { + + public SidebarServiceException(String message) { + super(message); + } + + public SidebarServiceException(String message, Throwable t) { + super(message, t); + } } From 3d94f24ddff4dc177a6d93954f10efb0850b566e Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 19 Jun 2024 12:35:12 +0200 Subject: [PATCH 10/27] refined API --- src/main/java/module-info.java | 4 ++-- .../SidebarService.java | 20 ++++++++++++------- .../SidebarServiceException.java | 2 +- 3 files changed, 16 insertions(+), 10 deletions(-) rename src/main/java/org/cryptomator/integrations/{filemanagersidebar => sidebar}/SidebarService.java (53%) rename src/main/java/org/cryptomator/integrations/{filemanagersidebar => sidebar}/SidebarServiceException.java (79%) diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index f0221cf..25aadf1 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -1,4 +1,4 @@ -import org.cryptomator.integrations.filemanagersidebar.SidebarService; +import org.cryptomator.integrations.sidebar.SidebarService; import org.cryptomator.integrations.mount.MountService; import org.cryptomator.integrations.revealpath.RevealPathService; import org.cryptomator.integrations.tray.TrayMenuController; @@ -19,7 +19,7 @@ exports org.cryptomator.integrations.revealpath; exports org.cryptomator.integrations.tray; exports org.cryptomator.integrations.uiappearance; - exports org.cryptomator.integrations.filemanagersidebar; + exports org.cryptomator.integrations.sidebar; uses AutoStartProvider; uses KeychainAccessProvider; diff --git a/src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarService.java b/src/main/java/org/cryptomator/integrations/sidebar/SidebarService.java similarity index 53% rename from src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarService.java rename to src/main/java/org/cryptomator/integrations/sidebar/SidebarService.java index 96424bb..eb1c279 100644 --- a/src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarService.java +++ b/src/main/java/org/cryptomator/integrations/sidebar/SidebarService.java @@ -1,9 +1,9 @@ -package org.cryptomator.integrations.filemanagersidebar; +package org.cryptomator.integrations.sidebar; import org.cryptomator.integrations.common.IntegrationsLoader; +import org.jetbrains.annotations.Blocking; import org.jetbrains.annotations.NotNull; -import java.io.Closeable; import java.nio.file.Path; import java.util.Optional; @@ -15,11 +15,13 @@ public interface SidebarService { /** * Creates an entry in the filemanager sidebar. * + * @param target The filesystem path the sidebar entry points to * @param displayName The display name of the sidebar entry - * @param target The filesystem path the sidebar entry points to. - * @return a @{link SidebarEntry } object, used to remove the entry again - * @apiNote Depending on the implemenation, the display name may not be used. + * @return a {@link SidebarEntry }, used to remove the entry again + * @throws SidebarServiceException if adding an entry to the filemanager sidebar fails + * @apiNote It depends on the service implementation wether the display name is used or not. */ + @Blocking SidebarEntry add(@NotNull Path target, @NotNull String displayName) throws SidebarServiceException; /** @@ -28,9 +30,13 @@ public interface SidebarService { interface SidebarEntry { /** - * Removes this entry from the sidebar. Once removed, this object cannot be added again. + * Removes this entry from the sidebar. + * + * @throws SidebarServiceException if removal fails. + * @implSpec ServiceProviders should make this function idempotent, i.e. after the method is called once and succeeded, consecutive calls should not change anything or throw an error. */ - void remove(); + @Blocking + void remove() throws SidebarServiceException; } diff --git a/src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarServiceException.java b/src/main/java/org/cryptomator/integrations/sidebar/SidebarServiceException.java similarity index 79% rename from src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarServiceException.java rename to src/main/java/org/cryptomator/integrations/sidebar/SidebarServiceException.java index b3b1953..e78f825 100644 --- a/src/main/java/org/cryptomator/integrations/filemanagersidebar/SidebarServiceException.java +++ b/src/main/java/org/cryptomator/integrations/sidebar/SidebarServiceException.java @@ -1,4 +1,4 @@ -package org.cryptomator.integrations.filemanagersidebar; +package org.cryptomator.integrations.sidebar; public class SidebarServiceException extends Exception { From 6a7f9641bbcf844b18d92fc886ee59076d211ad4 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Thu, 20 Jun 2024 16:51:15 +0200 Subject: [PATCH 11/27] change interface to return a list of sidebar service impls --- .../integrations/sidebar/SidebarService.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/cryptomator/integrations/sidebar/SidebarService.java b/src/main/java/org/cryptomator/integrations/sidebar/SidebarService.java index eb1c279..749b1cb 100644 --- a/src/main/java/org/cryptomator/integrations/sidebar/SidebarService.java +++ b/src/main/java/org/cryptomator/integrations/sidebar/SidebarService.java @@ -5,7 +5,7 @@ import org.jetbrains.annotations.NotNull; import java.nio.file.Path; -import java.util.Optional; +import java.util.stream.Stream; /** * Service for integrating a given path into the sidebar/quick access bar of a filemanager. @@ -40,7 +40,12 @@ interface SidebarEntry { } - static Optional get() { - return IntegrationsLoader.load(SidebarService.class); + /** + * Loads all supported mount providers. + * + * @return Stream of supported MountProviders (may be empty) + */ + static Stream get() { + return IntegrationsLoader.loadAll(SidebarService.class); } } From 6340bdb6f5600bdc3b486e2d9973ed3416882bad Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Thu, 20 Jun 2024 17:22:15 +0200 Subject: [PATCH 12/27] rename API to quickAccess --- pom.xml | 2 +- src/main/java/module-info.java | 6 +-- .../quickaccess/QuickAccessService.java | 53 +++++++++++++++++++ .../QuickAccessServiceException.java | 12 +++++ .../integrations/sidebar/SidebarService.java | 51 ------------------ .../sidebar/SidebarServiceException.java | 12 ----- 6 files changed, 69 insertions(+), 67 deletions(-) create mode 100644 src/main/java/org/cryptomator/integrations/quickaccess/QuickAccessService.java create mode 100644 src/main/java/org/cryptomator/integrations/quickaccess/QuickAccessServiceException.java delete mode 100644 src/main/java/org/cryptomator/integrations/sidebar/SidebarService.java delete mode 100644 src/main/java/org/cryptomator/integrations/sidebar/SidebarServiceException.java diff --git a/pom.xml b/pom.xml index c05dc9a..20a7b44 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.cryptomator integrations-api - 1.4.0-sidebar + 1.4.0-quickaccess Cryptomator Integrations API Defines optional service interfaces that may be used by Cryptomator diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 25aadf1..9925772 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -1,4 +1,4 @@ -import org.cryptomator.integrations.sidebar.SidebarService; +import org.cryptomator.integrations.quickaccess.QuickAccessService; import org.cryptomator.integrations.mount.MountService; import org.cryptomator.integrations.revealpath.RevealPathService; import org.cryptomator.integrations.tray.TrayMenuController; @@ -19,7 +19,7 @@ exports org.cryptomator.integrations.revealpath; exports org.cryptomator.integrations.tray; exports org.cryptomator.integrations.uiappearance; - exports org.cryptomator.integrations.sidebar; + exports org.cryptomator.integrations.quickaccess; uses AutoStartProvider; uses KeychainAccessProvider; @@ -28,5 +28,5 @@ uses TrayIntegrationProvider; uses TrayMenuController; uses UiAppearanceProvider; - uses SidebarService; + uses QuickAccessService; } \ No newline at end of file diff --git a/src/main/java/org/cryptomator/integrations/quickaccess/QuickAccessService.java b/src/main/java/org/cryptomator/integrations/quickaccess/QuickAccessService.java new file mode 100644 index 0000000..3970983 --- /dev/null +++ b/src/main/java/org/cryptomator/integrations/quickaccess/QuickAccessService.java @@ -0,0 +1,53 @@ +package org.cryptomator.integrations.quickaccess; + +import org.cryptomator.integrations.common.IntegrationsLoader; +import org.jetbrains.annotations.Blocking; +import org.jetbrains.annotations.NotNull; + +import java.nio.file.Path; +import java.util.stream.Stream; + +/** + * Service adding a system path link to a quick access area of the OS or an application (e.g. file manager). + * + * @apiNote On purpose this service does not define, what an "link to a quick access area" is. The defintion depends on the OS. For example, the quick access area can be the home screen/desktop and the link would be an icon leading to the linked path. + */ +public interface QuickAccessService { + + /** + * Creates an entry in the quick access area. + * + * @param target The filesystem path the quick access entry points to + * @param displayName The display name of the quick access entry + * @return a {@link QuickAccessEntry }, used to remove the entry again + * @throws QuickAccessServiceException if adding an entry to the quick access area fails + * @apiNote It depends on the service implementation wether the display name is used or not. + */ + @Blocking + QuickAccessEntry add(@NotNull Path target, @NotNull String displayName) throws QuickAccessServiceException; + + /** + * An entry of the quick access area, created by a service implementation. + */ + interface QuickAccessEntry { + + /** + * Removes this entry from the quick access area. + * + * @throws QuickAccessServiceException if removal fails. + * @implSpec Service implementations should make this function idempotent, i.e. after the method is called once and succeeded, consecutive calls should not change anything or throw an error. + */ + @Blocking + void remove() throws QuickAccessServiceException; + + } + + /** + * Loads all supported service providers. + * + * @return Stream of supported {@link QuickAccessService} implementations (may be empty) + */ + static Stream get() { + return IntegrationsLoader.loadAll(QuickAccessService.class); + } +} diff --git a/src/main/java/org/cryptomator/integrations/quickaccess/QuickAccessServiceException.java b/src/main/java/org/cryptomator/integrations/quickaccess/QuickAccessServiceException.java new file mode 100644 index 0000000..38612f0 --- /dev/null +++ b/src/main/java/org/cryptomator/integrations/quickaccess/QuickAccessServiceException.java @@ -0,0 +1,12 @@ +package org.cryptomator.integrations.quickaccess; + +public class QuickAccessServiceException extends Exception { + + public QuickAccessServiceException(String message) { + super(message); + } + + public QuickAccessServiceException(String message, Throwable t) { + super(message, t); + } +} diff --git a/src/main/java/org/cryptomator/integrations/sidebar/SidebarService.java b/src/main/java/org/cryptomator/integrations/sidebar/SidebarService.java deleted file mode 100644 index 749b1cb..0000000 --- a/src/main/java/org/cryptomator/integrations/sidebar/SidebarService.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.cryptomator.integrations.sidebar; - -import org.cryptomator.integrations.common.IntegrationsLoader; -import org.jetbrains.annotations.Blocking; -import org.jetbrains.annotations.NotNull; - -import java.nio.file.Path; -import java.util.stream.Stream; - -/** - * Service for integrating a given path into the sidebar/quick access bar of a filemanager. - */ -public interface SidebarService { - - /** - * Creates an entry in the filemanager sidebar. - * - * @param target The filesystem path the sidebar entry points to - * @param displayName The display name of the sidebar entry - * @return a {@link SidebarEntry }, used to remove the entry again - * @throws SidebarServiceException if adding an entry to the filemanager sidebar fails - * @apiNote It depends on the service implementation wether the display name is used or not. - */ - @Blocking - SidebarEntry add(@NotNull Path target, @NotNull String displayName) throws SidebarServiceException; - - /** - * An entry of the filemanager sidebar, created by an implementation of this service. - */ - interface SidebarEntry { - - /** - * Removes this entry from the sidebar. - * - * @throws SidebarServiceException if removal fails. - * @implSpec ServiceProviders should make this function idempotent, i.e. after the method is called once and succeeded, consecutive calls should not change anything or throw an error. - */ - @Blocking - void remove() throws SidebarServiceException; - - } - - /** - * Loads all supported mount providers. - * - * @return Stream of supported MountProviders (may be empty) - */ - static Stream get() { - return IntegrationsLoader.loadAll(SidebarService.class); - } -} diff --git a/src/main/java/org/cryptomator/integrations/sidebar/SidebarServiceException.java b/src/main/java/org/cryptomator/integrations/sidebar/SidebarServiceException.java deleted file mode 100644 index e78f825..0000000 --- a/src/main/java/org/cryptomator/integrations/sidebar/SidebarServiceException.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.cryptomator.integrations.sidebar; - -public class SidebarServiceException extends Exception { - - public SidebarServiceException(String message) { - super(message); - } - - public SidebarServiceException(String message, Throwable t) { - super(message, t); - } -} From 7c9e7a3e7dcc688f55d3bea7d5c8e38ae99062f1 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Thu, 27 Jun 2024 11:43:16 +0200 Subject: [PATCH 13/27] Annotate with @FunctionalInterface Co-authored-by: Sebastian Stenzel --- .../integrations/quickaccess/QuickAccessService.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/org/cryptomator/integrations/quickaccess/QuickAccessService.java b/src/main/java/org/cryptomator/integrations/quickaccess/QuickAccessService.java index 3970983..cc6b1f3 100644 --- a/src/main/java/org/cryptomator/integrations/quickaccess/QuickAccessService.java +++ b/src/main/java/org/cryptomator/integrations/quickaccess/QuickAccessService.java @@ -12,6 +12,7 @@ * * @apiNote On purpose this service does not define, what an "link to a quick access area" is. The defintion depends on the OS. For example, the quick access area can be the home screen/desktop and the link would be an icon leading to the linked path. */ +@FunctionalInterface public interface QuickAccessService { /** @@ -29,6 +30,7 @@ public interface QuickAccessService { /** * An entry of the quick access area, created by a service implementation. */ + @FunctionalInterface interface QuickAccessEntry { /** From 6572fe466d9f5818ae35c00d9ed2f502baf203d0 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Thu, 27 Jun 2024 11:45:58 +0200 Subject: [PATCH 14/27] prepare merge --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 20a7b44..44b0fa7 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.cryptomator integrations-api - 1.4.0-quickaccess + 1.4.0-SNAPSHOT Cryptomator Integrations API Defines optional service interfaces that may be used by Cryptomator From fe623e01c44a490a1ff126a81799aa93af0f4d56 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 27 Jun 2024 09:49:40 +0000 Subject: [PATCH 15/27] Bump org.mockito:mockito-core in the java-test-dependencies group (#33) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 44b0fa7..1ac95f4 100644 --- a/pom.xml +++ b/pom.xml @@ -65,7 +65,7 @@ org.mockito mockito-core - 5.11.0 + 5.12.0 test From d3b9a68303c30092a0cc0506694b916bbc397347 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 27 Jun 2024 09:50:43 +0000 Subject: [PATCH 16/27] Bump the java-production-dependencies group with 2 updates (#32) --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 1ac95f4..2040b8a 100644 --- a/pom.xml +++ b/pom.xml @@ -41,7 +41,7 @@ org.slf4j slf4j-api - 2.0.12 + 2.0.13 @@ -53,7 +53,7 @@ org.slf4j slf4j-simple - 2.0.12 + 2.0.13 test From c78999c98921bccf1717a31229999bf2234c215e Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Thu, 27 Jun 2024 11:52:31 +0200 Subject: [PATCH 17/27] prepare 1.4.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2040b8a..101e1b9 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.cryptomator integrations-api - 1.4.0-SNAPSHOT + 1.4.0 Cryptomator Integrations API Defines optional service interfaces that may be used by Cryptomator From 4bfb945a08267d6b2038363ad6024690f9a91d9a Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Thu, 27 Jun 2024 12:21:09 +0200 Subject: [PATCH 18/27] Exclude dependabot "push" events from codeql Analysis --- .github/workflows/codeql-analysis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index debd498..efb0bc4 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -13,7 +13,8 @@ jobs: analyse: name: Analyse runs-on: ubuntu-latest - if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')" + # dependeabot has on push events only read-only access, but codeql requires write access + if: ${{ !(github.actor == 'dependabot[bot]' && contains(fromJSON('["push"]'), github.event_name)) }} steps: - uses: actions/checkout@v4 with: @@ -30,4 +31,4 @@ jobs: - name: Build run: mvn -B compile - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 \ No newline at end of file + uses: github/codeql-action/analyze@v3 From aad9c043ec0bfe352263b044ca1f1b928621ff89 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Mon, 1 Jul 2024 11:21:14 +0200 Subject: [PATCH 19/27] add display method interface --- .../integrations/common/DisplayName.java | 21 ++++++++++++++++ .../common/NamedServiceProvider.java | 24 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 src/main/java/org/cryptomator/integrations/common/DisplayName.java create mode 100644 src/main/java/org/cryptomator/integrations/common/NamedServiceProvider.java diff --git a/src/main/java/org/cryptomator/integrations/common/DisplayName.java b/src/main/java/org/cryptomator/integrations/common/DisplayName.java new file mode 100644 index 0000000..f34321e --- /dev/null +++ b/src/main/java/org/cryptomator/integrations/common/DisplayName.java @@ -0,0 +1,21 @@ +package org.cryptomator.integrations.common; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.jetbrains.annotations.ApiStatus; + +/** + * A humanreadable name of the annotated class. + */ +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +@ApiStatus.Experimental +public @interface DisplayName { + String value(); + +} diff --git a/src/main/java/org/cryptomator/integrations/common/NamedServiceProvider.java b/src/main/java/org/cryptomator/integrations/common/NamedServiceProvider.java new file mode 100644 index 0000000..1404c5b --- /dev/null +++ b/src/main/java/org/cryptomator/integrations/common/NamedServiceProvider.java @@ -0,0 +1,24 @@ +package org.cryptomator.integrations.common; + +/** + * A service provider with a specific, human-readable name. + * + */ +public interface NamedServiceProvider { + + /** + * Get the name of this service provider. + * @implNote The default implementation looks for the {@link DisplayName} annotation and uses its value. If the annotation is not present, it falls back to the qualified class name. + * @return The name of the service provider + * + * @see DisplayName + */ + default public String getName() { + var displayName = this.getClass().getAnnotation(DisplayName.class); + if(displayName != null) { + return displayName.value(); + } else { + return this.getClass().getName(); + } + } +} From 750bb022e381619496cac402072f94a50dec9dfa Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Thu, 11 Jul 2024 16:09:37 +0200 Subject: [PATCH 20/27] refactor to make localization an own annotation --- .../integrations/common/DisplayName.java | 5 +-- .../common/LocalizedDisplayName.java | 34 ++++++++++++++ .../common/NamedServiceProvider.java | 44 +++++++++++-------- 3 files changed, 62 insertions(+), 21 deletions(-) create mode 100644 src/main/java/org/cryptomator/integrations/common/LocalizedDisplayName.java diff --git a/src/main/java/org/cryptomator/integrations/common/DisplayName.java b/src/main/java/org/cryptomator/integrations/common/DisplayName.java index f34321e..61afd53 100644 --- a/src/main/java/org/cryptomator/integrations/common/DisplayName.java +++ b/src/main/java/org/cryptomator/integrations/common/DisplayName.java @@ -1,13 +1,13 @@ package org.cryptomator.integrations.common; +import org.jetbrains.annotations.ApiStatus; + import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import org.jetbrains.annotations.ApiStatus; - /** * A humanreadable name of the annotated class. */ @@ -17,5 +17,4 @@ @ApiStatus.Experimental public @interface DisplayName { String value(); - } diff --git a/src/main/java/org/cryptomator/integrations/common/LocalizedDisplayName.java b/src/main/java/org/cryptomator/integrations/common/LocalizedDisplayName.java new file mode 100644 index 0000000..ff8e325 --- /dev/null +++ b/src/main/java/org/cryptomator/integrations/common/LocalizedDisplayName.java @@ -0,0 +1,34 @@ +package org.cryptomator.integrations.common; + +import org.jetbrains.annotations.ApiStatus; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * A humanreadable, localized name of the annotated class. + */ +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +@ApiStatus.Experimental +public @interface LocalizedDisplayName { + + /** + * Name of the localization bundle, where the display name is loaded from. + * + * @return Name of the localization bundle + */ + String bundle(); + + /** + * The localization key containing the display name. + * + * @return Localization key to use + */ + String key(); + +} diff --git a/src/main/java/org/cryptomator/integrations/common/NamedServiceProvider.java b/src/main/java/org/cryptomator/integrations/common/NamedServiceProvider.java index 1404c5b..d9b47e2 100644 --- a/src/main/java/org/cryptomator/integrations/common/NamedServiceProvider.java +++ b/src/main/java/org/cryptomator/integrations/common/NamedServiceProvider.java @@ -1,24 +1,32 @@ package org.cryptomator.integrations.common; +import java.util.ResourceBundle; + /** - * A service provider with a specific, human-readable name. - * + * A service provider with a human-readable, possibly localized name. */ public interface NamedServiceProvider { - - /** - * Get the name of this service provider. - * @implNote The default implementation looks for the {@link DisplayName} annotation and uses its value. If the annotation is not present, it falls back to the qualified class name. - * @return The name of the service provider - * - * @see DisplayName - */ - default public String getName() { - var displayName = this.getClass().getAnnotation(DisplayName.class); - if(displayName != null) { - return displayName.value(); - } else { - return this.getClass().getName(); - } - } + + /** + * Get the name of this service provider. + * + * @return The name of the service provider + * @implNote The default implementation looks first for a {@link LocalizedDisplayName} and loads the name from the specified resource bundle/key. If the annotation is not present, the code looks for {@link DisplayName} and uses its value. If none of the former annotations are present, it falls back to the qualified class name. + * @see DisplayName + * @see LocalizedDisplayName + */ + default String getName() { + var localizedDisplayName = this.getClass().getAnnotation(LocalizedDisplayName.class); + if (localizedDisplayName != null) { + return ResourceBundle.getBundle(localizedDisplayName.bundle()) // + .getString(localizedDisplayName.key()); + } + + var displayName = this.getClass().getAnnotation(DisplayName.class); + if (displayName != null) { + return displayName.value(); + } else { + return this.getClass().getName(); + } + } } From de3997aa881e8bc85c1b9c3d0be6f68e7c1f3748 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Thu, 11 Jul 2024 16:43:02 +0200 Subject: [PATCH 21/27] doc doc doc --- .../org/cryptomator/integrations/common/DisplayName.java | 5 +++++ .../integrations/common/LocalizedDisplayName.java | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/main/java/org/cryptomator/integrations/common/DisplayName.java b/src/main/java/org/cryptomator/integrations/common/DisplayName.java index 61afd53..7389220 100644 --- a/src/main/java/org/cryptomator/integrations/common/DisplayName.java +++ b/src/main/java/org/cryptomator/integrations/common/DisplayName.java @@ -10,6 +10,11 @@ /** * A humanreadable name of the annotated class. + *

+ * Checked in the default implementation of the {@link NamedServiceProvider#getName()} with lower priority. + * + * @see NamedServiceProvider + * @see LocalizedDisplayName */ @Documented @Retention(RetentionPolicy.RUNTIME) diff --git a/src/main/java/org/cryptomator/integrations/common/LocalizedDisplayName.java b/src/main/java/org/cryptomator/integrations/common/LocalizedDisplayName.java index ff8e325..3a05603 100644 --- a/src/main/java/org/cryptomator/integrations/common/LocalizedDisplayName.java +++ b/src/main/java/org/cryptomator/integrations/common/LocalizedDisplayName.java @@ -10,6 +10,11 @@ /** * A humanreadable, localized name of the annotated class. + *

+ * Checked in the default implementation of the {@link NamedServiceProvider#getName()} with highest priority. + * + * @see NamedServiceProvider + * @see DisplayName */ @Documented @Retention(RetentionPolicy.RUNTIME) From def56feafa0c1e91eba0949a9eab71f479a37d16 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Thu, 11 Jul 2024 16:44:37 +0200 Subject: [PATCH 22/27] implement and document fallback strategy --- .../common/NamedServiceProvider.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/cryptomator/integrations/common/NamedServiceProvider.java b/src/main/java/org/cryptomator/integrations/common/NamedServiceProvider.java index d9b47e2..c9344a0 100644 --- a/src/main/java/org/cryptomator/integrations/common/NamedServiceProvider.java +++ b/src/main/java/org/cryptomator/integrations/common/NamedServiceProvider.java @@ -1,5 +1,8 @@ package org.cryptomator.integrations.common; +import org.slf4j.LoggerFactory; + +import java.util.MissingResourceException; import java.util.ResourceBundle; /** @@ -11,15 +14,22 @@ public interface NamedServiceProvider { * Get the name of this service provider. * * @return The name of the service provider - * @implNote The default implementation looks first for a {@link LocalizedDisplayName} and loads the name from the specified resource bundle/key. If the annotation is not present, the code looks for {@link DisplayName} and uses its value. If none of the former annotations are present, it falls back to the qualified class name. + * @implNote The default implementation looks first for a {@link LocalizedDisplayName} and loads the name from the specified resource bundle/key. If the annotation is not present or loading the resource throws an exception, the code looks for {@link DisplayName} and uses its value. If none of the former annotations are present, it falls back to the qualified class name. * @see DisplayName * @see LocalizedDisplayName */ default String getName() { var localizedDisplayName = this.getClass().getAnnotation(LocalizedDisplayName.class); if (localizedDisplayName != null) { - return ResourceBundle.getBundle(localizedDisplayName.bundle()) // - .getString(localizedDisplayName.key()); + try { + return ResourceBundle.getBundle(localizedDisplayName.bundle()) // + .getString(localizedDisplayName.key()); + } catch (MissingResourceException e) { + var clazz = this.getClass(); + var logger = LoggerFactory.getLogger(clazz); + logger.warn("Failed to load localized display name for {}. Falling back to not-localized display name/class name.", clazz.getName()); + logger.debug("Reason for failure of {}.", clazz.getName(), e); + } } var displayName = this.getClass().getAnnotation(DisplayName.class); From 9508ee5ea4d344a3c538a51621a53044c47f199b Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Thu, 11 Jul 2024 17:17:10 +0200 Subject: [PATCH 23/27] one line logging --- .../cryptomator/integrations/common/NamedServiceProvider.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/org/cryptomator/integrations/common/NamedServiceProvider.java b/src/main/java/org/cryptomator/integrations/common/NamedServiceProvider.java index c9344a0..692192b 100644 --- a/src/main/java/org/cryptomator/integrations/common/NamedServiceProvider.java +++ b/src/main/java/org/cryptomator/integrations/common/NamedServiceProvider.java @@ -27,8 +27,7 @@ default String getName() { } catch (MissingResourceException e) { var clazz = this.getClass(); var logger = LoggerFactory.getLogger(clazz); - logger.warn("Failed to load localized display name for {}. Falling back to not-localized display name/class name.", clazz.getName()); - logger.debug("Reason for failure of {}.", clazz.getName(), e); + logger.warn("Failed to load localized display name for {}. Falling back to not-localized display name/class name.", clazz.getName(), e); } } From d1c262304121d25dec1bd8aac3d23c3d54ae993d Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Fri, 12 Jul 2024 13:09:39 +0200 Subject: [PATCH 24/27] make quickAccessService a named SPI --- .../integrations/quickaccess/QuickAccessService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/cryptomator/integrations/quickaccess/QuickAccessService.java b/src/main/java/org/cryptomator/integrations/quickaccess/QuickAccessService.java index cc6b1f3..bf084b2 100644 --- a/src/main/java/org/cryptomator/integrations/quickaccess/QuickAccessService.java +++ b/src/main/java/org/cryptomator/integrations/quickaccess/QuickAccessService.java @@ -1,6 +1,7 @@ package org.cryptomator.integrations.quickaccess; import org.cryptomator.integrations.common.IntegrationsLoader; +import org.cryptomator.integrations.common.NamedServiceProvider; import org.jetbrains.annotations.Blocking; import org.jetbrains.annotations.NotNull; @@ -13,7 +14,7 @@ * @apiNote On purpose this service does not define, what an "link to a quick access area" is. The defintion depends on the OS. For example, the quick access area can be the home screen/desktop and the link would be an icon leading to the linked path. */ @FunctionalInterface -public interface QuickAccessService { +public interface QuickAccessService extends NamedServiceProvider { /** * Creates an entry in the quick access area. From 0cafab229f6114cd7954973304794eb074bd6527 Mon Sep 17 00:00:00 2001 From: Ralph Plawetzki Date: Fri, 16 Aug 2024 10:23:05 +0200 Subject: [PATCH 25/27] Widen API to allow storing keychain entries for an authenticated user (#41) Overlead and extend method storePassphrase() with requiresAuth flag --- .../keychain/KeychainAccessProvider.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/cryptomator/integrations/keychain/KeychainAccessProvider.java b/src/main/java/org/cryptomator/integrations/keychain/KeychainAccessProvider.java index 3099528..979e38c 100644 --- a/src/main/java/org/cryptomator/integrations/keychain/KeychainAccessProvider.java +++ b/src/main/java/org/cryptomator/integrations/keychain/KeychainAccessProvider.java @@ -56,7 +56,24 @@ default void storePassphrase(String key, CharSequence passphrase) throws Keychai * @throws KeychainAccessException If storing the password failed */ @Blocking - void storePassphrase(String key, @Nullable String displayName, CharSequence passphrase) throws KeychainAccessException; + default void storePassphrase(String key, @Nullable String displayName, CharSequence passphrase) throws KeychainAccessException { + storePassphrase(key, displayName, passphrase, false); + } + + /** + * Associates a passphrase with a given key and a name for that key. + * + * @param key Key used to retrieve the passphrase via {@link #loadPassphrase(String)}. + * @param displayName The according name to the key. That's the name of the vault displayed in the UI. + * It's passed to the keychain as an additional information about the vault besides the key. + * The parameter does not need to be unique or be checked by the keychain. + * @param passphrase The secret to store in this keychain. + * @param requireOsAuthentication Defines, whether the user needs to authenticate to store a passphrase. + * The authentication mechanism is provided by the operating system dependent + * implementations of this API. + * @throws KeychainAccessException If storing the password failed + */ + void storePassphrase(String key, @Nullable String displayName, CharSequence passphrase, boolean requireOsAuthentication) throws KeychainAccessException; /** * @param key Unique key previously used while {@link #storePassphrase(String, String, CharSequence)} storing a passphrase}. From 6ffd61a2ab35a9317435ad8203250fb915ed269d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Aug 2024 15:29:26 +0000 Subject: [PATCH 26/27] Bump the maven-build-plugins group across 1 directory with 2 updates (#40) --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 2040b8a..2d393b3 100644 --- a/pom.xml +++ b/pom.xml @@ -95,11 +95,11 @@ org.apache.maven.plugins maven-surefire-plugin - 3.2.5 + 3.3.1 maven-javadoc-plugin - 3.7.0 + 3.8.0 attach-javadocs From fe1edcde28931ae5c42e7be6140618ecf5bab4dc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Aug 2024 15:29:40 +0000 Subject: [PATCH 27/27] Bump org.junit.jupiter:junit-jupiter in the java-test-dependencies group (#37) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2d393b3..b8921a2 100644 --- a/pom.xml +++ b/pom.xml @@ -59,7 +59,7 @@ org.junit.jupiter junit-jupiter - 5.10.2 + 5.10.3 test