Skip to content

Commit 6340bdb

Browse files
committed
rename API to quickAccess
1 parent 6a7f964 commit 6340bdb

6 files changed

Lines changed: 69 additions & 67 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66
<groupId>org.cryptomator</groupId>
77
<artifactId>integrations-api</artifactId>
8-
<version>1.4.0-sidebar</version>
8+
<version>1.4.0-quickaccess</version>
99

1010
<name>Cryptomator Integrations API</name>
1111
<description>Defines optional service interfaces that may be used by Cryptomator</description>

src/main/java/module-info.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import org.cryptomator.integrations.sidebar.SidebarService;
1+
import org.cryptomator.integrations.quickaccess.QuickAccessService;
22
import org.cryptomator.integrations.mount.MountService;
33
import org.cryptomator.integrations.revealpath.RevealPathService;
44
import org.cryptomator.integrations.tray.TrayMenuController;
@@ -19,7 +19,7 @@
1919
exports org.cryptomator.integrations.revealpath;
2020
exports org.cryptomator.integrations.tray;
2121
exports org.cryptomator.integrations.uiappearance;
22-
exports org.cryptomator.integrations.sidebar;
22+
exports org.cryptomator.integrations.quickaccess;
2323

2424
uses AutoStartProvider;
2525
uses KeychainAccessProvider;
@@ -28,5 +28,5 @@
2828
uses TrayIntegrationProvider;
2929
uses TrayMenuController;
3030
uses UiAppearanceProvider;
31-
uses SidebarService;
31+
uses QuickAccessService;
3232
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package org.cryptomator.integrations.quickaccess;
2+
3+
import org.cryptomator.integrations.common.IntegrationsLoader;
4+
import org.jetbrains.annotations.Blocking;
5+
import org.jetbrains.annotations.NotNull;
6+
7+
import java.nio.file.Path;
8+
import java.util.stream.Stream;
9+
10+
/**
11+
* Service adding a system path link to a quick access area of the OS or an application (e.g. file manager).
12+
*
13+
* @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.
14+
*/
15+
public interface QuickAccessService {
16+
17+
/**
18+
* Creates an entry in the quick access area.
19+
*
20+
* @param target The filesystem path the quick access entry points to
21+
* @param displayName The display name of the quick access entry
22+
* @return a {@link QuickAccessEntry }, used to remove the entry again
23+
* @throws QuickAccessServiceException if adding an entry to the quick access area fails
24+
* @apiNote It depends on the service implementation wether the display name is used or not.
25+
*/
26+
@Blocking
27+
QuickAccessEntry add(@NotNull Path target, @NotNull String displayName) throws QuickAccessServiceException;
28+
29+
/**
30+
* An entry of the quick access area, created by a service implementation.
31+
*/
32+
interface QuickAccessEntry {
33+
34+
/**
35+
* Removes this entry from the quick access area.
36+
*
37+
* @throws QuickAccessServiceException if removal fails.
38+
* @implSpec Service implementations should make this function <em>idempotent</em>, i.e. after the method is called once and succeeded, consecutive calls should not change anything or throw an error.
39+
*/
40+
@Blocking
41+
void remove() throws QuickAccessServiceException;
42+
43+
}
44+
45+
/**
46+
* Loads all supported service providers.
47+
*
48+
* @return Stream of supported {@link QuickAccessService} implementations (may be empty)
49+
*/
50+
static Stream<QuickAccessService> get() {
51+
return IntegrationsLoader.loadAll(QuickAccessService.class);
52+
}
53+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package org.cryptomator.integrations.quickaccess;
2+
3+
public class QuickAccessServiceException extends Exception {
4+
5+
public QuickAccessServiceException(String message) {
6+
super(message);
7+
}
8+
9+
public QuickAccessServiceException(String message, Throwable t) {
10+
super(message, t);
11+
}
12+
}

src/main/java/org/cryptomator/integrations/sidebar/SidebarService.java

Lines changed: 0 additions & 51 deletions
This file was deleted.

src/main/java/org/cryptomator/integrations/sidebar/SidebarServiceException.java

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)