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.gcube.common.authorization.library.AuthorizedTasks;
|
||||
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.storagehub.client.dsl.ContainerType;
|
||||
import org.gcube.common.storagehub.client.dsl.FileContainer;
|
||||
|
@ -115,12 +116,12 @@ public class StorageHubFS extends FuseStubFS {
|
|||
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;
|
||||
|
||||
if (path.substring(1).contains("/")) {
|
||||
|
@ -128,6 +129,13 @@ public class StorageHubFS extends FuseStubFS {
|
|||
parentContainer= pathUtils.getPath(parentPath);
|
||||
} else parentContainer = rootDirectory;
|
||||
|
||||
try {
|
||||
if (!((FolderContainer) parentContainer).canWrite())
|
||||
return -ErrorCodes.EACCES();
|
||||
}catch (Exception e) {
|
||||
return -ErrorCodes.EIO();
|
||||
}
|
||||
|
||||
final FSInputStream stream = new FSInputStream();
|
||||
|
||||
FileUpload fileUpload = new FileUpload(stream);
|
||||
|
@ -146,6 +154,7 @@ public class StorageHubFS extends FuseStubFS {
|
|||
cache.remove(path);
|
||||
}
|
||||
})).start();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -221,9 +230,6 @@ public class StorageHubFS extends FuseStubFS {
|
|||
SecurityTokenProvider.instance.set(token);
|
||||
|
||||
logger.trace(Thread.currentThread().getName()+" ) calling mkdir");
|
||||
if (pathUtils.getPath(path) != null) {
|
||||
return -ErrorCodes.EEXIST();
|
||||
}
|
||||
|
||||
ItemContainer<? extends Item> parentContainer;
|
||||
|
||||
|
|
|
@ -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