49 lines
1.3 KiB
Java
49 lines
1.3 KiB
Java
|
package org.gcube.common.storagehub.client.dls;
|
||
|
|
||
|
import java.io.InputStream;
|
||
|
import java.util.List;
|
||
|
|
||
|
import org.gcube.common.storagehub.client.StreamDescriptor;
|
||
|
import org.gcube.common.storagehub.client.proxies.ItemManagerClient;
|
||
|
import org.gcube.common.storagehub.model.items.AbstractFileItem;
|
||
|
import org.gcube.common.storagehub.model.items.FolderItem;
|
||
|
import org.gcube.common.storagehub.model.items.Item;
|
||
|
|
||
|
public class FolderContainer {
|
||
|
|
||
|
private ItemManagerClient itemclient;
|
||
|
|
||
|
private String folderId = null;
|
||
|
// private String folderPath = null;
|
||
|
|
||
|
protected FolderContainer(ItemManagerClient itemclient) {
|
||
|
this.itemclient = itemclient;
|
||
|
}
|
||
|
|
||
|
protected void setId(String folderId) {
|
||
|
this.folderId = folderId;
|
||
|
// this.folderPath = null;
|
||
|
}
|
||
|
/*
|
||
|
protected void setPath(String folderPath) {
|
||
|
this.folderPath = folderPath;
|
||
|
this.folderId = null;
|
||
|
}*/
|
||
|
|
||
|
public FolderItem get() throws Exception {
|
||
|
return (FolderItem)itemclient.get(folderId);
|
||
|
}
|
||
|
|
||
|
public List<? extends Item> list() {
|
||
|
return itemclient.getChildren(folderId);
|
||
|
}
|
||
|
|
||
|
public <T extends AbstractFileItem> T uploadFile(InputStream stream, String filename, String description) {
|
||
|
return itemclient.uploadFile(stream, this.folderId , filename, description);
|
||
|
}
|
||
|
|
||
|
public StreamDescriptor download(InputStream stream) {
|
||
|
return itemclient.download(this.folderId);
|
||
|
}
|
||
|
}
|