Skip to content

Commit

Permalink
rename API to quickAccess
Browse files Browse the repository at this point in the history
  • Loading branch information
infeo committed Jun 20, 2024
1 parent 6a7f964 commit 6340bdb
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 67 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.cryptomator</groupId>
<artifactId>integrations-api</artifactId>
<version>1.4.0-sidebar</version>
<version>1.4.0-quickaccess</version>

<name>Cryptomator Integrations API</name>
<description>Defines optional service interfaces that may be used by Cryptomator</description>
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand All @@ -28,5 +28,5 @@
uses TrayIntegrationProvider;
uses TrayMenuController;
uses UiAppearanceProvider;
uses SidebarService;
uses QuickAccessService;
}
Original file line number Diff line number Diff line change
@@ -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 <em>idempotent</em>, 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<QuickAccessService> get() {
return IntegrationsLoader.loadAll(QuickAccessService.class);
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}

This file was deleted.

This file was deleted.

0 comments on commit 6340bdb

Please sign in to comment.