1
0

Basic implementation of files API that allows other apps filesystem access

This commit is contained in:
2022-08-13 18:40:13 +02:00
parent bd6f1e43d1
commit a0239ecda6
13 changed files with 237 additions and 34 deletions

27
files-api/pom.xml Normal file
View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.77zzcx7.nbs-cloud</groupId>
<artifactId>nbs-cloud-aggregator</artifactId>
<version>18-SNAPSHOT</version>
</parent>
<groupId>de.77zzcx7.nbs-cloud</groupId>
<artifactId>files-api</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>de.77zzcx7.nbs-cloud</groupId>
<artifactId>web-container-registry</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,33 @@
package de.nbscloud.files.api;
import de.nbscloud.webcontainer.registry.App;
import java.nio.file.Path;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;
public interface FilesService {
record ContentContainer(boolean directory, Path path, String name, long size,
LocalDateTime lastModified) {
}
public void createAppDirectory(App app);
public void createDirectory(App app, Path path);
public void createFile(App app, Path path, byte[] content);
public void delete(App app, Path path);
public void get(App app, Path path);
/**
* Paths in return list are always relative to the appDir.
*
* @param app to list the files for
* @param path in case of {@link Optional#EMPTY} the appDir is used as start dir. If not empty, path has to be relative
* to the appDir
*/
public List<ContentContainer> list(App app, Optional<Path> path);
}