- issue on right displayed

- https://support.d4science.org/issues/20417
This commit is contained in:
lucio.lelii 2021-01-15 12:10:28 +01:00
parent 6e934d7633
commit 8248bd6111
6 changed files with 19 additions and 13 deletions

View File

@ -2,6 +2,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for org.gcube.data-access.sh-fuse-integration # Changelog for org.gcube.data-access.sh-fuse-integration
## [v1.1.1] 2021-01-15
### Fixes
- issue on right displayed
- https://support.d4science.org/issues/20417
## [v1.1.0] 2020-09-07 ## [v1.1.0] 2020-09-07
### Fixes ### Fixes

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.gcube.data-access</groupId> <groupId>org.gcube.data-access</groupId>
<artifactId>sh-fuse-integration</artifactId> <artifactId>sh-fuse-integration</artifactId>
<version>1.1.0</version> <version>1.1.1</version>
<name>SHFuseIntegration</name> <name>SHFuseIntegration</name>
<parent> <parent>

View File

@ -34,11 +34,15 @@ public class FileDownload implements SHFile{
while ((read=bi.read(buf))!=-1) { while ((read=bi.read(buf))!=-1) {
fo.write(buf, 0, read); fo.write(buf, 0, read);
} }
fo.flush();
} }
fileItem = fileContainer.get(); fileItem = fileContainer.get();
logger.trace("FILE-DOWNLOAD with {} , {}", fileItem.getName(), fileItem.getContent().getSize()); logger.trace("FILE-DOWNLOAD with {} , {}", fileItem.getName(), fileItem.getContent().getSize());
logger.trace("output name is {} ans length {}", output.getAbsolutePath(),output.length());
} }
@ -51,6 +55,7 @@ public class FileDownload implements SHFile{
int readTotal= 0; int readTotal= 0;
try { try {
raf = new RandomAccessFile(output, "r"); raf = new RandomAccessFile(output, "r");
raf.seek(offset);
int read =0; int read =0;
logger.trace("{} BEFORE: bytes to read {} and read total {} and last read {}", fileItem.getName(), bytesToRead, readTotal, read); logger.trace("{} BEFORE: bytes to read {} and read total {} and last read {}", fileItem.getName(), bytesToRead, readTotal, read);
while ((read= raf.read(mybuf, 0 , bytesToRead-readTotal))!=-1 && bytesToRead>readTotal) { while ((read= raf.read(mybuf, 0 , bytesToRead-readTotal))!=-1 && bytesToRead>readTotal) {

View File

@ -1,6 +1,5 @@
package org.gcube.data.access.storagehub.fs; package org.gcube.data.access.storagehub.fs;
import java.awt.Container;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.List; import java.util.List;

View File

@ -1,19 +1,16 @@
package org.gcube.data.access.storagehub.fs; package org.gcube.data.access.storagehub.fs;
import java.io.RandomAccessFile;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Objects; import java.util.Objects;
import java.util.Random;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.cache2k.Cache; import org.cache2k.Cache;
import org.cache2k.Cache2kBuilder; import org.cache2k.Cache2kBuilder;
import org.gcube.common.authorization.library.AuthorizedTasks; import org.gcube.common.authorization.library.AuthorizedTasks;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider; import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.gxrest.response.outbound.ErrorCode;
import org.gcube.common.scope.api.ScopeProvider; import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.common.storagehub.client.dsl.ContainerType; import org.gcube.common.storagehub.client.dsl.ContainerType;
import org.gcube.common.storagehub.client.dsl.FileContainer; import org.gcube.common.storagehub.client.dsl.FileContainer;
@ -212,11 +209,8 @@ public class StorageHubFS extends FuseStubFS {
private void setCommonAttributes(Item item, FileStat stat, int type) { private void setCommonAttributes(Item item, FileStat stat, int type) {
if (item.isShared()) {
stat.st_mode.set(type | FileStat.S_IROTH); stat.st_mode.set(type | 0777);
}else {
stat.st_mode.set(type | 0777);
}
stat.st_mtim.tv_sec.set(item.getLastModificationTime().toInstant().getEpochSecond()); stat.st_mtim.tv_sec.set(item.getLastModificationTime().toInstant().getEpochSecond());
stat.st_mtim.tv_nsec.set(item.getLastModificationTime().toInstant().getNano()); stat.st_mtim.tv_nsec.set(item.getLastModificationTime().toInstant().getNano());
stat.st_ctim.tv_sec.set(item.getLastModificationTime().toInstant().getEpochSecond()); stat.st_ctim.tv_sec.set(item.getLastModificationTime().toInstant().getEpochSecond());
@ -258,7 +252,7 @@ public class StorageHubFS extends FuseStubFS {
* @see ru.serce.jnrfuse.FuseStubFS#write(java.lang.String, jnr.ffi.Pointer, long, long, ru.serce.jnrfuse.struct.FuseFileInfo) * @see ru.serce.jnrfuse.FuseStubFS#write(java.lang.String, jnr.ffi.Pointer, long, long, ru.serce.jnrfuse.struct.FuseFileInfo)
*/ */
@Override @Override
public int read(String path, Pointer buf, @size_t long size, @off_t long offset, FuseFileInfo fi) { public synchronized int read(String path, Pointer buf, @size_t long size, @off_t long offset, FuseFileInfo fi) {
ScopeProvider.instance.set(scope); ScopeProvider.instance.set(scope);
SecurityTokenProvider.instance.set(token); SecurityTokenProvider.instance.set(token);
@ -289,7 +283,7 @@ public class StorageHubFS extends FuseStubFS {
synchronized (tempFiles) { synchronized (tempFiles) {
if (tempFiles.containsKey(path) && tempFiles.get(path) instanceof FileDownload) { if (tempFiles.containsKey(path) && tempFiles.get(path) instanceof FileDownload) {
logger.trace("path {} found in tmpFiles"); logger.trace("path {} found in tmpFiles", path);
fileDownload = tempFiles.get(path); fileDownload = tempFiles.get(path);
} else { } else {
ItemContainer<? extends Item> item = pathUtils.getPath(path); ItemContainer<? extends Item> item = pathUtils.getPath(path);
@ -379,7 +373,7 @@ public class StorageHubFS extends FuseStubFS {
cache.put(path+name, (ItemContainer<Item>) child); cache.put(path+name, (ItemContainer<Item>) child);
}catch (Exception e) { }catch (Exception e) {
logger.error("error riding children ",e); logger.error("error reading children ",e);
} }
} }

View File

@ -16,6 +16,7 @@ public class FuseTest {
String path; String path;
switch (Platform.getNativePlatform().getOS()) { switch (Platform.getNativePlatform().getOS()) {
case WINDOWS: case WINDOWS:
System.out.println("Im here");
path = "J:\\"; path = "J:\\";
break; break;
default: default: