git-svn-id: https://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/Common/storagehub-client@167781 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b39174755f
commit
3627023be8
|
@ -14,11 +14,13 @@ import javax.ws.rs.core.Response;
|
|||
import org.gcube.common.clients.Call;
|
||||
import org.gcube.common.clients.delegates.ProxyDelegate;
|
||||
import org.gcube.common.storagehub.client.StreamDescriptor;
|
||||
import org.gcube.common.storagehub.model.acls.ACL;
|
||||
import org.gcube.common.storagehub.model.items.AbstractFileItem;
|
||||
import org.gcube.common.storagehub.model.items.FolderItem;
|
||||
import org.gcube.common.storagehub.model.items.Item;
|
||||
import org.gcube.common.storagehub.model.service.ItemList;
|
||||
import org.gcube.common.storagehub.model.service.ItemWrapper;
|
||||
import org.gcube.common.storagehub.model.types.ACLList;
|
||||
import org.glassfish.jersey.media.multipart.FormDataMultiPart;
|
||||
import org.glassfish.jersey.media.multipart.MultiPartFeature;
|
||||
|
||||
|
@ -207,4 +209,22 @@ public class DefaultItemManager implements ItemManagerClient {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ACL> getACL(String id) {
|
||||
Call<WebTarget, ACLList> call = new Call<WebTarget, ACLList>() {
|
||||
@Override
|
||||
public ACLList call(WebTarget manager) throws Exception {
|
||||
WebTarget myManager = manager.path(id).path("acls");
|
||||
Invocation.Builder builder = myManager.request(MediaType.APPLICATION_JSON);
|
||||
ACLList response = builder.get(ACLList.class);
|
||||
return response;
|
||||
}
|
||||
};
|
||||
try {
|
||||
return delegate.make(call).getAcls();
|
||||
}catch(Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.io.InputStream;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.common.storagehub.client.StreamDescriptor;
|
||||
import org.gcube.common.storagehub.model.acls.ACL;
|
||||
import org.gcube.common.storagehub.model.items.AbstractFileItem;
|
||||
import org.gcube.common.storagehub.model.items.FolderItem;
|
||||
import org.gcube.common.storagehub.model.items.Item;
|
||||
|
@ -30,4 +31,6 @@ public interface ItemManagerClient {
|
|||
|
||||
FolderItem createFolder(String parentId, String name, String description);
|
||||
|
||||
List<ACL> getACL(String id);
|
||||
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import org.gcube.common.storagehub.client.plugins.AbstractPlugin;
|
|||
import org.gcube.common.storagehub.client.proxies.ItemManagerClient;
|
||||
import org.gcube.common.storagehub.client.proxies.WorkspaceManagerClient;
|
||||
import org.gcube.common.storagehub.model.Paths;
|
||||
import org.gcube.common.storagehub.model.acls.ACL;
|
||||
import org.gcube.common.storagehub.model.expressions.GenericSearchableItem;
|
||||
import org.gcube.common.storagehub.model.expressions.OrderField;
|
||||
import org.gcube.common.storagehub.model.expressions.OrderField.MODE;
|
||||
|
@ -68,6 +69,22 @@ public class TestCall {
|
|||
System.in.read();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getACL() throws Exception{
|
||||
final ItemManagerClient client = AbstractPlugin.item().build();
|
||||
try {
|
||||
List<ACL> acls = client.getACL("790e4c52-fbca-48e9-b267-67ea2ce708c0");
|
||||
|
||||
System.out.println("items are "+acls.size());
|
||||
|
||||
|
||||
for (ACL acl: acls)
|
||||
System.out.println(acl.getPricipal()+ " "+acl.getAccessTypes());
|
||||
}catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void download() throws Exception{
|
||||
ItemManagerClient client = AbstractPlugin.item().build();
|
||||
|
@ -107,10 +124,14 @@ public class TestCall {
|
|||
|
||||
@Test
|
||||
public void createFolder() {
|
||||
long start= System.currentTimeMillis();
|
||||
ItemManagerClient itemclient = AbstractPlugin.item().build();
|
||||
WorkspaceManagerClient wsclient = AbstractPlugin.workspace().build();
|
||||
itemclient.createFolder(wsclient.getWorkspace().getId(),"terzo tentativo","secondo tentativo");
|
||||
String id = wsclient.getWorkspace("hl:accounting", "jcr:content").getId();
|
||||
System.out.println("getting the WS id took "+(System.currentTimeMillis()-start));
|
||||
|
||||
itemclient.createFolder(id,"quinto tentativo","5 tentativo");
|
||||
System.out.println("creating folder took total "+(System.currentTimeMillis()-start));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -121,6 +142,7 @@ public class TestCall {
|
|||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(Calendar.YEAR, 2015);
|
||||
*/
|
||||
|
||||
WorkspaceManagerClient wsclient = AbstractPlugin.workspace().build();
|
||||
String path = wsclient.getVreFolder("hl:accounting").getPath();
|
||||
System.out.println("path is "+path);
|
||||
|
|
Loading…
Reference in New Issue