exposed api to get the list of contexts
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry-context-client@160114 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0f15f0e4d4
commit
c8ca8d7186
|
@ -1,5 +1,6 @@
|
||||||
package org.gcube.informationsystem.resourceregistry.context;
|
package org.gcube.informationsystem.resourceregistry.context;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.gcube.informationsystem.model.entity.Context;
|
import org.gcube.informationsystem.model.entity.Context;
|
||||||
|
@ -45,4 +46,6 @@ public interface ResourceRegistryContextClient {
|
||||||
public boolean delete(String uuid)
|
public boolean delete(String uuid)
|
||||||
throws ContextNotFoundException, ResourceRegistryException;
|
throws ContextNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
public List<Context> all() throws ResourceRegistryException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.gcube.informationsystem.resourceregistry.context;
|
||||||
|
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.gcube.informationsystem.impl.utils.ISMapper;
|
import org.gcube.informationsystem.impl.utils.ISMapper;
|
||||||
|
@ -196,5 +197,30 @@ public class ResourceRegistryContextClientImpl implements ResourceRegistryContex
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Context> all() throws ResourceRegistryException {
|
||||||
|
try {
|
||||||
|
logger.trace("Going to read {} with UUID {}", Context.NAME);
|
||||||
|
StringWriter stringWriter = new StringWriter();
|
||||||
|
stringWriter.append(PATH_SEPARATOR);
|
||||||
|
stringWriter.append(ContextPath.CONTEXT_PATH_PART);
|
||||||
|
stringWriter.append(PATH_SEPARATOR);
|
||||||
|
stringWriter.append(ContextPath.ALL_PATH_PART);
|
||||||
|
|
||||||
|
HTTPCall httpCall = getHTTPCall();
|
||||||
|
String all = httpCall.call(String.class, stringWriter.toString(), HTTPMETHOD.GET);
|
||||||
|
|
||||||
|
logger.debug("Got contexts are {}", Context.NAME, all);
|
||||||
|
return ISMapper.unmarshalList(Context.class, all);
|
||||||
|
|
||||||
|
} catch (ResourceRegistryException e) {
|
||||||
|
// logger.trace("Error Creating {}", facet, e);
|
||||||
|
throw e;
|
||||||
|
} catch (Exception e) {
|
||||||
|
// logger.trace("Error Creating {}", facet, e);
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue