git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/branches/data-access/sh-fuse-integration/1.0@181088 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
bfb4fabd69
commit
c7be9c9c9c
|
@ -11,6 +11,7 @@ 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;
|
||||||
|
@ -115,12 +116,12 @@ public class StorageHubFS extends FuseStubFS {
|
||||||
return -ErrorCodes.EEXIST();
|
return -ErrorCodes.EEXIST();
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadFile(path);
|
|
||||||
return 0;
|
return uploadFile(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void uploadFile(String path) {
|
private int uploadFile(String path) {
|
||||||
final ItemContainer<? extends Item> parentContainer;
|
final ItemContainer<? extends Item> parentContainer;
|
||||||
|
|
||||||
if (path.substring(1).contains("/")) {
|
if (path.substring(1).contains("/")) {
|
||||||
|
@ -128,6 +129,13 @@ public class StorageHubFS extends FuseStubFS {
|
||||||
parentContainer= pathUtils.getPath(parentPath);
|
parentContainer= pathUtils.getPath(parentPath);
|
||||||
} else parentContainer = rootDirectory;
|
} else parentContainer = rootDirectory;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!((FolderContainer) parentContainer).canWrite())
|
||||||
|
return -ErrorCodes.EACCES();
|
||||||
|
}catch (Exception e) {
|
||||||
|
return -ErrorCodes.EIO();
|
||||||
|
}
|
||||||
|
|
||||||
final FSInputStream stream = new FSInputStream();
|
final FSInputStream stream = new FSInputStream();
|
||||||
|
|
||||||
FileUpload fileUpload = new FileUpload(stream);
|
FileUpload fileUpload = new FileUpload(stream);
|
||||||
|
@ -146,6 +154,7 @@ public class StorageHubFS extends FuseStubFS {
|
||||||
cache.remove(path);
|
cache.remove(path);
|
||||||
}
|
}
|
||||||
})).start();
|
})).start();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -221,9 +230,6 @@ public class StorageHubFS extends FuseStubFS {
|
||||||
SecurityTokenProvider.instance.set(token);
|
SecurityTokenProvider.instance.set(token);
|
||||||
|
|
||||||
logger.trace(Thread.currentThread().getName()+" ) calling mkdir");
|
logger.trace(Thread.currentThread().getName()+" ) calling mkdir");
|
||||||
if (pathUtils.getPath(path) != null) {
|
|
||||||
return -ErrorCodes.EEXIST();
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemContainer<? extends Item> parentContainer;
|
ItemContainer<? extends Item> parentContainer;
|
||||||
|
|
||||||
|
@ -515,7 +521,7 @@ public class StorageHubFS extends FuseStubFS {
|
||||||
public int readlink(String path, Pointer buf, @size_t long size) {
|
public int readlink(String path, Pointer buf, @size_t long size) {
|
||||||
logger.info("readlink called {}",path);
|
logger.info("readlink called {}",path);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int open(String path, FuseFileInfo fi) {
|
public int open(String path, FuseFileInfo fi) {
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
<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="WARN" />
|
||||||
|
<logger name="org.gcube" level="WARN" />
|
||||||
|
|
||||||
|
<root level="WARN">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</root>
|
||||||
|
|
||||||
|
</configuration>
|
Loading…
Reference in New Issue