Skip to content

Commit

Permalink
Merge branch 'release/1.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
infeo committed Feb 21, 2023
2 parents a21e678 + 4e572d7 commit 5c7515f
Show file tree
Hide file tree
Showing 19 changed files with 602 additions and 27 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ jobs:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
Expand All @@ -19,12 +19,12 @@ jobs:
- name: Build and Test
id: buildAndTest
run: mvn -B clean install
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: artifacts
path: target/*.jar
- name: Create Release
uses: actions/create-release@v1
uses: actions/create-release@v1 # NOTE: action is unmaintained and repo archived
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }} # release as "cryptobot"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ jobs:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: actions/setup-java@v2
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
cache: 'maven'
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: java
- name: Build
run: mvn -B compile
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
4 changes: 2 additions & 2 deletions .github/workflows/publish-central.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
ref: "refs/tags/${{ github.event.inputs.tag }}"
- uses: actions/setup-java@v2
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ jobs:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/') # only allow publishing tagged versions
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
Expand Down
11 changes: 8 additions & 3 deletions 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.1.0</version>
<version>1.2.0</version>

<name>Cryptomator Integrations API</name>
<description>Defines optional service interfaces that may be used by Cryptomator</description>
Expand Down Expand Up @@ -59,13 +59,13 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.2</version>
<version>5.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>4.3.1</version>
<version>4.8.0</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -92,6 +92,11 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.cryptomator.integrations.mount.MountService;
import org.cryptomator.integrations.revealpath.RevealPathService;
import org.cryptomator.integrations.tray.TrayMenuController;
import org.cryptomator.integrations.autostart.AutoStartProvider;
import org.cryptomator.integrations.keychain.KeychainAccessProvider;
Expand All @@ -12,11 +14,15 @@
exports org.cryptomator.integrations.autostart;
exports org.cryptomator.integrations.common;
exports org.cryptomator.integrations.keychain;
exports org.cryptomator.integrations.mount;
exports org.cryptomator.integrations.revealpath;
exports org.cryptomator.integrations.tray;
exports org.cryptomator.integrations.uiappearance;

uses AutoStartProvider;
uses KeychainAccessProvider;
uses MountService;
uses RevealPathService;
uses TrayIntegrationProvider;
uses TrayMenuController;
uses UiAppearanceProvider;
Expand Down
50 changes: 50 additions & 0 deletions src/main/java/org/cryptomator/integrations/mount/Mount.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package org.cryptomator.integrations.mount;

import java.io.IOException;

/**
* Handle to control the lifecycle of a mounted file system.
* <p>
* Created by {@link MountBuilder}
*/
public interface Mount extends AutoCloseable {

/**
* Returns the absolute OS path, where this mount can be accessed.
*
* @return Absolute path to the mountpoint.
*/
Mountpoint getMountpoint();

/**
* Unmounts the mounted Volume.
* <p>
* If possible, attempt a graceful unmount.
*
* @throws UnmountFailedException If the unmount was not successful.
* @see #unmountForced()
*/
void unmount() throws UnmountFailedException;

/**
* If supported, force-unmount the volume.
*
* @throws UnmountFailedException If the unmount was not successful.
* @throws UnsupportedOperationException If {@link MountCapability#UNMOUNT_FORCED} is not supported
*/
default void unmountForced() throws UnmountFailedException {
throw new UnsupportedOperationException();
}

/**
* Unmounts (if required) and releases any resources.
*
* @throws UnmountFailedException Thrown if unmounting failed
* @throws IOException Thrown if cleaning up resources failed
*/
default void close() throws UnmountFailedException, IOException {
unmount();
}


}
128 changes: 128 additions & 0 deletions src/main/java/org/cryptomator/integrations/mount/MountBuilder.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
package org.cryptomator.integrations.mount;

import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.Range;

import java.nio.file.Path;

/**
* Builder to mount a filesystem.
* <p>
* The setter may attempt to validate the input, but {@link #mount()} may still fail due to missing or invalid (combination of) options.
* This holds especially for {@link MountBuilder#setMountFlags(String)};
*/
public interface MountBuilder {

/**
* Sets the file system name.
*
* @param fileSystemName file system name
* @return <code>this</code>
* @throws UnsupportedOperationException If {@link MountCapability#FILE_SYSTEM_NAME} is not supported
*/
@Contract("_ -> this")
default MountBuilder setFileSystemName(String fileSystemName) {
throw new UnsupportedOperationException();
}

/**
* Use the given host name as the loopback address.
*
* @param hostName string conforming with the uri host part
* @return <code>this</code>
* @throws UnsupportedOperationException If {@link MountCapability#LOOPBACK_HOST_NAME} is not supported
*/
@Contract("_ -> this")
default MountBuilder setLoopbackHostName(String hostName) {
throw new UnsupportedOperationException();
}

/**
* Use the given TCP port of the loopback address.
*
* @param port Fixed TCP port or 0 to use a system-assigned port
* @return <code>this</code>
* @throws UnsupportedOperationException If {@link MountCapability#LOOPBACK_PORT} is not supported
*/
@Contract("_ -> this")
default MountBuilder setLoopbackPort(@Range(from = 0, to = Short.MAX_VALUE) int port) {
throw new UnsupportedOperationException();
}

/**
* Sets the mount point.
* <p>
* Unless the mount service provider supports {@link MountCapability#MOUNT_TO_SYSTEM_CHOSEN_PATH}, setting a mount point is required.
*
* @param mountPoint Where to mount the volume
* @return <code>this</code>
*/
@Contract("_ -> this")
default MountBuilder setMountpoint(Path mountPoint) {
throw new UnsupportedOperationException();
}

/**
* Sets mount flags.
*
* @param mountFlags Mount flags
* @return <code>this</code>
* @throws UnsupportedOperationException If {@link MountCapability#MOUNT_FLAGS} is not supported
* @see MountService#getDefaultMountFlags()
*/
@Contract("_ -> this")
default MountBuilder setMountFlags(String mountFlags) {
throw new UnsupportedOperationException();
}


/**
* Instructs the mount to be read-only.
*
* @param mountReadOnly Whether to mount read-only.
* @return <code>this</code>
* @throws UnsupportedOperationException If {@link MountCapability#READ_ONLY} is not supported
*/
@Contract("_ -> this")
default MountBuilder setReadOnly(boolean mountReadOnly) {
throw new UnsupportedOperationException();
}

/**
* Sets a unique volume id.
* <p>
* The volume id is used as a path component, thus must conform with the os-dependent path component restrictions.
*
* @param volumeId String conforming with the os-dependent path component restrictions
* @return <code>this</code>
* @throws UnsupportedOperationException If {@link MountCapability#VOLUME_ID} is not supported
*/
@Contract("_ -> this")
default MountBuilder setVolumeId(String volumeId) {
throw new UnsupportedOperationException();
}

/**
* Sets a volume name.
* <p>
* The volume name is intended to be human-readable. The input string might be altered to replace non-conforming characters and thus is not suited to identify the volume.
*
* @param volumeName String conforming with the os-dependent naming restrictions
* @return <code>this</code>
* @throws UnsupportedOperationException If {@link MountCapability#VOLUME_NAME} is not supported
*/
@Contract("_ -> this")
default MountBuilder setVolumeName(String volumeName) {
throw new UnsupportedOperationException();
}

/**
* Mounts the file system.
*
* @return A mount handle
* @throws MountFailedException If mounting failed
*/
@Contract(" -> new")
Mount mount() throws MountFailedException;

}
Loading

0 comments on commit 5c7515f

Please sign in to comment.