Compare commits

..

2 Commits

6 changed files with 144 additions and 177 deletions

View File

@ -2,20 +2,20 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for org.gcube.data-access.sh-fuse-integration
## [v2.1.0-SNAPSHOT]
- porting to storagehub-client-2.0.0
## [v2.0.0] 2021-05-19
- porting to uma token [#21441]
## [v1.2.0-SNAPSHOT] 2022-02-10
### Fixes
- removed internal logback.xml #22814
## [v1.1.1] 2021-01-15
### Fixes
- issue on right displayed
- [#20417]
- https://support.d4science.org/issues/20417
## [v1.1.0] 2020-09-07
- Solved issue on data download [#19651]
### Fixes
- Solved issue on data download (https://support.d4science.org/issues/19651)

235
pom.xml
View File

@ -1,133 +1,120 @@
<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>
<groupId>org.gcube.data-access</groupId>
<artifactId>sh-fuse-integration</artifactId>
<version>2.1.0-SNAPSHOT</version>
<name>SHFuseIntegration</name>
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>
<groupId>org.gcube.data-access</groupId>
<artifactId>sh-fuse-integration</artifactId>
<version>1.2.0-SNAPSHOT</version>
<name>SHFuseIntegration</name>
<parent>
<artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId>
<version>1.2.0</version>
<relativePath/>
</parent>
<parent>
<artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId>
<version>1.1.0</version>
<relativePath />
</parent>
<scm>
<connection>scm:git:https://code-repo.d4science.org/gCubeSystem/sh-fuse-integration.git</connection>
<developerConnection>scm:git:https://code-repo.d4science.org/gCubeSystem/sh-fuse-integration.git
</developerConnection>
<url>https://code-repo.d4science.org/gCubeSystem/sh-fuse-integration</url>
</scm>
<scm>
<connection>scm:git:https://code-repo.d4science.org/gCubeSystem/sh-fuse-integration.git</connection>
<developerConnection>scm:git:https://code-repo.d4science.org/gCubeSystem/sh-fuse-integration.git</developerConnection>
<url>https://code-repo.d4science.org/gCubeSystem/sh-fuse-integration</url>
</scm>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<repositories>
<repository>
<id>central</id>
<name>bintray</name>
<url>https://jcenter.bintray.com</url>
</repository>
</repositories>
<repositories>
<repository>
<id>central</id>
<name>bintray</name>
<url>https://jcenter.bintray.com</url>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>gcube-bom</artifactId>
<version>1.5.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>gcube-bom</artifactId>
<version>2.4.1-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.github.serceman</groupId>
<artifactId>jnr-fuse</artifactId>
<version>0.5.4</version>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>gxJRS</artifactId>
</dependency>
<dependencies>
<dependency>
<groupId>com.github.serceman</groupId>
<artifactId>jnr-fuse</artifactId>
<version>0.5.8</version>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>gxJRS</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>storagehub-client-library</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>storagehub-model</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.cache2k</groupId>
<artifactId>cache2k-jcache</artifactId>
<version>1.2.0.Final</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>common-authorization</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
</dependencies>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>storagehub-client-library</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>storagehub-model</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-gcube-calls</artifactId>
</dependency>
<dependency>
<groupId>org.cache2k</groupId>
<artifactId>cache2k-jcache</artifactId>
<version>1.2.0.Final</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>org.gcube.data.access.storagehub.fs.StorageHubFuseLauncher
</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<target>1.8</target>
<source>1.8</source>
</configuration>
</plugin>
</plugins>
</build>
</project>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>org.gcube.data.access.storagehub.fs.StorageHubFuseLauncher
</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<target>1.8</target>
<source>1.8</source>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -10,7 +10,6 @@ import java.util.concurrent.TimeUnit;
import org.cache2k.Cache;
import org.cache2k.Cache2kBuilder;
import org.gcube.common.authorization.library.AuthorizedTasks;
import org.gcube.common.authorization.library.provider.AccessTokenProvider;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.common.storagehub.client.dsl.ContainerType;
@ -64,11 +63,8 @@ public class StorageHubFS extends FuseStubFS {
super();
this.token = token;
this.scope = scope;
logger.debug("using token {} in scope {}", token , scope);
ScopeProvider.instance.set(scope);
AccessTokenProvider.instance.set(token);
SecurityTokenProvider.instance.set(token);
client = new StorageHubClient();
rootDirectory = client.getWSRoot();
cache = new Cache2kBuilder<String, ItemContainer<Item>>() {}
@ -85,7 +81,7 @@ public class StorageHubFS extends FuseStubFS {
@Override
public synchronized int write(String path, Pointer buf, long size, long offset, FuseFileInfo fi) {
ScopeProvider.instance.set(scope);
AccessTokenProvider.instance.set(token);
SecurityTokenProvider.instance.set(token);
logger.trace("{}) calling write {} - {} ",Thread.currentThread().getName(), size , offset);
SHFile file = tempFiles.get(path);
@ -114,7 +110,7 @@ public class StorageHubFS extends FuseStubFS {
@Override
public synchronized int create(final String path, @mode_t long mode, FuseFileInfo fi) {
ScopeProvider.instance.set(scope);
AccessTokenProvider.instance.set(token);
SecurityTokenProvider.instance.set(token);
logger.trace(Thread.currentThread().getName()+" ) calling create "+path);
if (pathUtils.getPath(path) != null) {
@ -167,7 +163,7 @@ public class StorageHubFS extends FuseStubFS {
public int getattr(String path, FileStat stat) {
ScopeProvider.instance.set(scope);
AccessTokenProvider.instance.set(token);
SecurityTokenProvider.instance.set(token);
logger.trace(Thread.currentThread().getName()+" ) calling getattr "+path);
if (Objects.equals(path, "/") || path.contains("Trash") || path.equals("/"+VREFOLDERS_NAME)) {
@ -230,7 +226,7 @@ public class StorageHubFS extends FuseStubFS {
@Override
public int mkdir(String path, @mode_t long mode) {
ScopeProvider.instance.set(scope);
AccessTokenProvider.instance.set(token);
SecurityTokenProvider.instance.set(token);
logger.trace(Thread.currentThread().getName()+" ) calling mkdir");
@ -260,7 +256,7 @@ public class StorageHubFS extends FuseStubFS {
@Override
public int read(String path, Pointer buf, @size_t long size, @off_t long offset, FuseFileInfo fi) {
ScopeProvider.instance.set(scope);
AccessTokenProvider.instance.set(token);
SecurityTokenProvider.instance.set(token);
logger.trace("!!! read called in path {} with size {} and offset {} and pointer address {}",path, size, offset, buf.address());
@ -328,7 +324,7 @@ public class StorageHubFS extends FuseStubFS {
public int readdir(String path, Pointer buf, FuseFillDir filter, @off_t long offset, FuseFileInfo fi) {
logger.trace("readdir called");
ScopeProvider.instance.set(scope);
AccessTokenProvider.instance.set(token);
SecurityTokenProvider.instance.set(token);
logger.trace(Thread.currentThread().getName()+" ) calling readdir "+path);
if (path.contains(".Trash")) return 0;
@ -421,7 +417,7 @@ public class StorageHubFS extends FuseStubFS {
@Override
public int rename(String path, String newName) {
ScopeProvider.instance.set(scope);
AccessTokenProvider.instance.set(token);
SecurityTokenProvider.instance.set(token);
ItemContainer<? extends Item> folder = pathUtils.getPath(path);
if (folder == null) {
@ -459,7 +455,7 @@ public class StorageHubFS extends FuseStubFS {
return -ErrorCodes.EACCES();
ScopeProvider.instance.set(scope);
AccessTokenProvider.instance.set(token);
SecurityTokenProvider.instance.set(token);
ItemContainer<? extends Item> folder = pathUtils.getPath(path);
if (folder == null) {
@ -469,7 +465,7 @@ public class StorageHubFS extends FuseStubFS {
return -ErrorCodes.ENOTDIR();
}
ScopeProvider.instance.set(scope);
AccessTokenProvider.instance.set(token);
SecurityTokenProvider.instance.set(token);
try {
checkSpecialFolderRemove(path);
@ -498,7 +494,7 @@ public class StorageHubFS extends FuseStubFS {
@Override
public int unlink(String path) {
ScopeProvider.instance.set(scope);
AccessTokenProvider.instance.set(token);
SecurityTokenProvider.instance.set(token);
ItemContainer<? extends Item> file = pathUtils.getPath(path);
if (file == null) {
@ -508,7 +504,7 @@ public class StorageHubFS extends FuseStubFS {
return -ErrorCodes.EISDIR();
}
ScopeProvider.instance.set(scope);
AccessTokenProvider.instance.set(token);
SecurityTokenProvider.instance.set(token);
try {
file.delete();
cache.remove(path);
@ -544,7 +540,7 @@ public class StorageHubFS extends FuseStubFS {
logger.info("truncate called {} ",path);
ScopeProvider.instance.set(scope);
AccessTokenProvider.instance.set(token);
SecurityTokenProvider.instance.set(token);
cache.remove(path);
uploadFile(path);
return 0;

View File

@ -1,17 +0,0 @@
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n</pattern>
</encoder>
</appender>
<logger name="org.gcube.data.access.storagehub.fs" level="TRACE" />
<logger name="org.gcube" level="WARN" />
<root level="WARN">
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

@ -1,7 +1,6 @@
package org.gcube.data.access.storagehub.fuse;
import java.nio.file.Paths;
import java.util.Objects;
import org.gcube.data.access.storagehub.fs.StorageHubFS;
import org.junit.Test;
@ -10,17 +9,19 @@ import jnr.ffi.Platform;
public class FuseTest {
@Test
public void mount() {
StorageHubFS memfs = new StorageHubFS("eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJSSklZNEpoNF9qdDdvNmREY0NlUDFfS1l0akcxVExXVW9oMkQ2Tzk1bFNBIn0","/gcube");
StorageHubFS memfs = new StorageHubFS("b7c80297-e4ed-42ab-ab42-fdc0b8b0eabf-98187548","/gcube");
try {
String path;
if (Objects.requireNonNull(Platform.getNativePlatform().getOS()) == Platform.OS.WINDOWS) {
System.out.println("Im here");
path = "J:\\";
} else
path = "/home/lucio/java/mnt";
switch (Platform.getNativePlatform().getOS()) {
case WINDOWS:
System.out.println("Im here");
path = "J:\\";
break;
default:
path = "/home/lucio/java/mnt";
}
memfs.mount(Paths.get(path), true, true);
} finally {
memfs.umount();

View File

@ -7,7 +7,7 @@
</appender>
<logger name="org.gcube.data.access.storagehub.fs" level="WARN" />
<logger name="org.gcube.data.access.storagehub.fs" level="TRACE" />
<logger name="org.gcube" level="WARN" />
<root level="WARN">