Compare commits
10 Commits
Author | SHA1 | Date |
---|---|---|
Giancarlo Panichi | d313488190 | |
Lucio Lelii | 4d1b592ef4 | |
Lucio Lelii | 25a9e4e474 | |
Lucio Lelii | 93c54c3524 | |
Lucio Lelii | 6183c78f6c | |
Lucio Lelii | 5564ce99eb | |
Lucio Lelii | ebe1845fb9 | |
Lucio Lelii | 8f136d8857 | |
Lucio Lelii | a6e686db55 | |
Lucio Lelii | 6c313286b9 |
|
@ -9,6 +9,7 @@
|
|||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="optional" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
|
@ -22,9 +23,10 @@
|
|||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
<attribute name="optional" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
|
||||
org.eclipse.jdt.core.compiler.compliance=11
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
org.eclipse.jdt.core.compiler.source=11
|
||||
|
|
15
CHANGELOG.md
15
CHANGELOG.md
|
@ -2,22 +2,23 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||
|
||||
# Changelog for org.gcube.data-access.sh-fuse-integration
|
||||
|
||||
## [v2.0.0] 2021-05-19
|
||||
## [v3.0.0]
|
||||
|
||||
### Feature
|
||||
- porting to gcube-bom 4.0.0
|
||||
|
||||
## [v2.0.1] 2021-02-09
|
||||
|
||||
- all logs set to WARN [#22814]
|
||||
|
||||
## [v2.0.0] 2021-05-19
|
||||
|
||||
- porting to uma token [#21441]
|
||||
|
||||
|
||||
## [v1.1.1] 2021-01-15
|
||||
|
||||
### Fixes
|
||||
|
||||
- issue on right displayed
|
||||
- [#20417]
|
||||
|
||||
## [v1.1.0] 2020-09-07
|
||||
|
||||
### Fixes
|
||||
|
||||
- Solved issue on data download [#19651]
|
||||
|
|
85
pom.xml
85
pom.xml
|
@ -4,22 +4,19 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.gcube.data-access</groupId>
|
||||
<artifactId>sh-fuse-integration</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<version>3.0.0</version>
|
||||
<name>SHFuseIntegration</name>
|
||||
|
||||
<parent>
|
||||
<artifactId>maven-parent</artifactId>
|
||||
<groupId>org.gcube.tools</groupId>
|
||||
<version>1.1.0</version>
|
||||
<version>1.2.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>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>central</id>
|
||||
|
@ -27,44 +24,46 @@
|
|||
<url>https://jcenter.bintray.com</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
</properties>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>gcube-bom</artifactId>
|
||||
<version>2.0.1</version>
|
||||
<version>4.0.0</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>
|
||||
<version>0.5.8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>gxJRS</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>common-authorization</artifactId>
|
||||
<artifactId>common-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common.security</groupId>
|
||||
<artifactId>gcube-secrets</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.gcube.core</groupId>
|
||||
|
@ -79,7 +78,6 @@
|
|||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
|
@ -91,39 +89,28 @@
|
|||
<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>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.4.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<transformers>
|
||||
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
||||
<mainClass>org.gcube.data.access.storagehub.fs.StorageHubFuseLauncher</mainClass>
|
||||
</transformer>
|
||||
</transformers>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -33,9 +33,7 @@ public class PathUtils {
|
|||
while (path.substring(path.length() - 1).equals("/")) {
|
||||
path = path.substring(0, path.length() - 1);
|
||||
}
|
||||
if (path.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return path.substring(path.lastIndexOf("/") + 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,9 +9,10 @@ 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.scope.api.ScopeProvider;
|
||||
import org.gcube.common.security.AuthorizedTasks;
|
||||
import org.gcube.common.security.providers.SecretManagerProvider;
|
||||
import org.gcube.common.security.secrets.Secret;
|
||||
import org.gcube.common.security.secrets.UmaTokenSecret;
|
||||
import org.gcube.common.storagehub.client.dsl.ContainerType;
|
||||
import org.gcube.common.storagehub.client.dsl.FileContainer;
|
||||
import org.gcube.common.storagehub.client.dsl.FolderContainer;
|
||||
|
@ -43,9 +44,7 @@ public class StorageHubFS extends FuseStubFS {
|
|||
|
||||
StorageHubClient client;
|
||||
|
||||
String token;
|
||||
|
||||
String scope;
|
||||
Secret secret;
|
||||
|
||||
HashMap<String, SHFile> tempFiles = new HashMap<>();
|
||||
|
||||
|
@ -58,16 +57,15 @@ public class StorageHubFS extends FuseStubFS {
|
|||
private FolderContainer rootDirectory;
|
||||
|
||||
|
||||
public StorageHubFS(String token, String scope) {
|
||||
public StorageHubFS(String token) {
|
||||
|
||||
super();
|
||||
this.token = token;
|
||||
this.scope = scope;
|
||||
this.secret = new UmaTokenSecret(token);
|
||||
|
||||
logger.debug("using token {} in scope {}", token , scope);
|
||||
logger.debug("using token {}", token);
|
||||
|
||||
SecretManagerProvider.set(secret);
|
||||
|
||||
ScopeProvider.instance.set(scope);
|
||||
AccessTokenProvider.instance.set(token);
|
||||
client = new StorageHubClient();
|
||||
rootDirectory = client.getWSRoot();
|
||||
cache = new Cache2kBuilder<String, ItemContainer<Item>>() {}
|
||||
|
@ -83,9 +81,8 @@ 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);
|
||||
|
||||
SecretManagerProvider.set(secret);
|
||||
|
||||
logger.trace("{}) calling write {} - {} ",Thread.currentThread().getName(), size , offset);
|
||||
SHFile file = tempFiles.get(path);
|
||||
|
||||
|
@ -112,8 +109,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);
|
||||
SecretManagerProvider.set(secret);
|
||||
|
||||
logger.trace(Thread.currentThread().getName()+" ) calling create "+path);
|
||||
if (pathUtils.getPath(path) != null) {
|
||||
|
@ -165,8 +161,7 @@ public class StorageHubFS extends FuseStubFS {
|
|||
@Override
|
||||
public int getattr(String path, FileStat stat) {
|
||||
|
||||
ScopeProvider.instance.set(scope);
|
||||
AccessTokenProvider.instance.set(token);
|
||||
SecretManagerProvider.set(secret);
|
||||
|
||||
logger.trace(Thread.currentThread().getName()+" ) calling getattr "+path);
|
||||
if (Objects.equals(path, "/") || path.contains("Trash") || path.equals("/"+VREFOLDERS_NAME)) {
|
||||
|
@ -228,9 +223,8 @@ public class StorageHubFS extends FuseStubFS {
|
|||
|
||||
@Override
|
||||
public int mkdir(String path, @mode_t long mode) {
|
||||
ScopeProvider.instance.set(scope);
|
||||
AccessTokenProvider.instance.set(token);
|
||||
|
||||
SecretManagerProvider.set(secret);
|
||||
|
||||
logger.trace(Thread.currentThread().getName()+" ) calling mkdir");
|
||||
|
||||
ItemContainer<? extends Item> parentContainer;
|
||||
|
@ -258,9 +252,8 @@ 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);
|
||||
|
||||
SecretManagerProvider.set(secret);
|
||||
|
||||
logger.trace("!!! read called in path {} with size {} and offset {} and pointer address {}",path, size, offset, buf.address());
|
||||
|
||||
SHFile fileDownload = null;
|
||||
|
@ -326,9 +319,8 @@ public class StorageHubFS extends FuseStubFS {
|
|||
@Override
|
||||
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);
|
||||
|
||||
SecretManagerProvider.set(secret);
|
||||
|
||||
logger.trace(Thread.currentThread().getName()+" ) calling readdir "+path);
|
||||
if (path.contains(".Trash")) return 0;
|
||||
|
||||
|
@ -419,9 +411,8 @@ public class StorageHubFS extends FuseStubFS {
|
|||
|
||||
@Override
|
||||
public int rename(String path, String newName) {
|
||||
ScopeProvider.instance.set(scope);
|
||||
AccessTokenProvider.instance.set(token);
|
||||
|
||||
SecretManagerProvider.set(secret);
|
||||
|
||||
ItemContainer<? extends Item> folder = pathUtils.getPath(path);
|
||||
if (folder == null) {
|
||||
return -ErrorCodes.ENOENT();
|
||||
|
@ -457,9 +448,8 @@ public class StorageHubFS extends FuseStubFS {
|
|||
if (path.equals("/"+VREFOLDERS_NAME))
|
||||
return -ErrorCodes.EACCES();
|
||||
|
||||
ScopeProvider.instance.set(scope);
|
||||
AccessTokenProvider.instance.set(token);
|
||||
|
||||
SecretManagerProvider.set(secret);
|
||||
|
||||
ItemContainer<? extends Item> folder = pathUtils.getPath(path);
|
||||
if (folder == null) {
|
||||
return -ErrorCodes.ENOENT();
|
||||
|
@ -467,8 +457,9 @@ public class StorageHubFS extends FuseStubFS {
|
|||
if (folder.getType()!=ContainerType.FOLDER) {
|
||||
return -ErrorCodes.ENOTDIR();
|
||||
}
|
||||
ScopeProvider.instance.set(scope);
|
||||
AccessTokenProvider.instance.set(token);
|
||||
|
||||
SecretManagerProvider.set(secret);
|
||||
|
||||
try {
|
||||
checkSpecialFolderRemove(path);
|
||||
|
||||
|
@ -496,9 +487,10 @@ public class StorageHubFS extends FuseStubFS {
|
|||
*/
|
||||
@Override
|
||||
public int unlink(String path) {
|
||||
ScopeProvider.instance.set(scope);
|
||||
AccessTokenProvider.instance.set(token);
|
||||
|
||||
|
||||
SecretManagerProvider.set(secret);
|
||||
|
||||
|
||||
ItemContainer<? extends Item> file = pathUtils.getPath(path);
|
||||
if (file == null) {
|
||||
return -ErrorCodes.ENOENT();
|
||||
|
@ -506,8 +498,9 @@ public class StorageHubFS extends FuseStubFS {
|
|||
if (file.getType()!=ContainerType.FILE) {
|
||||
return -ErrorCodes.EISDIR();
|
||||
}
|
||||
ScopeProvider.instance.set(scope);
|
||||
AccessTokenProvider.instance.set(token);
|
||||
|
||||
SecretManagerProvider.set(secret);
|
||||
|
||||
try {
|
||||
file.delete();
|
||||
cache.remove(path);
|
||||
|
@ -542,8 +535,8 @@ public class StorageHubFS extends FuseStubFS {
|
|||
public int truncate(String path, long size) {
|
||||
logger.info("truncate called {} ",path);
|
||||
|
||||
ScopeProvider.instance.set(scope);
|
||||
AccessTokenProvider.instance.set(token);
|
||||
SecretManagerProvider.set(secret);
|
||||
|
||||
cache.remove(path);
|
||||
uploadFile(path);
|
||||
return 0;
|
||||
|
|
|
@ -7,10 +7,9 @@ public class StorageHubFuseLauncher {
|
|||
|
||||
public static void main(String ...args) {
|
||||
String token = args[0];
|
||||
String scope = args[1];
|
||||
String path = args[2];
|
||||
String path = args[1];
|
||||
|
||||
StorageHubFS shFS= new StorageHubFS(token, scope);
|
||||
StorageHubFS shFS= new StorageHubFS(token);
|
||||
shFS.mount(Paths.get(path), true, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
<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" />
|
||||
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
|
||||
<file>./fuse.log</file>
|
||||
<append>true</append>
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger: %msg%n
|
||||
</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
|
||||
<logger name="org.gcube.data.access.storagehub.fs" level="INFO" />
|
||||
<logger name="org.gcube" level="INFO" />
|
||||
|
||||
<root level="WARN">
|
||||
<appender-ref ref="FILE" />
|
||||
</root>
|
||||
|
||||
<root level="WARN">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
|
||||
</configuration>
|
|
@ -11,7 +11,7 @@ public class FuseTest {
|
|||
|
||||
@Test
|
||||
public void mount() {
|
||||
StorageHubFS memfs = new StorageHubFS("AccessToken","/gcube");
|
||||
StorageHubFS memfs = new StorageHubFS("");
|
||||
try {
|
||||
String path;
|
||||
switch (Platform.getNativePlatform().getOS()) {
|
||||
|
@ -20,7 +20,7 @@ public class FuseTest {
|
|||
path = "J:\\";
|
||||
break;
|
||||
default:
|
||||
path = "/home/lucio/java/mnt";
|
||||
path = "/Users/lucio/java/mnt";
|
||||
}
|
||||
memfs.mount(Paths.get(path), true, true);
|
||||
} finally {
|
||||
|
|
Loading…
Reference in New Issue