Refs #11902: Use new REST interface in Resource Registry Client
Task-Url: https://support.d4science.org/issues/11902 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry-client@169040 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
cb961b7ea0
commit
296d22363e
|
@ -113,6 +113,8 @@ public interface ResourceRegistryClient {
|
||||||
|
|
||||||
public Context getContext(UUID uuid) throws ContextNotFoundException, ResourceRegistryException;
|
public Context getContext(UUID uuid) throws ContextNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
public Context getCurrentContext() throws ContextNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
public List<Context> getAllContext() throws ResourceRegistryException;
|
public List<Context> getAllContext() throws ResourceRegistryException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,37 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
||||||
return httpCall;
|
return httpCall;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Context getCurrentContext() throws ContextNotFoundException, ResourceRegistryException {
|
||||||
|
try {
|
||||||
|
logger.info("Going to get current {} ", Context.NAME);
|
||||||
|
StringWriter stringWriter = new StringWriter();
|
||||||
|
stringWriter.append(PATH_SEPARATOR);
|
||||||
|
stringWriter.append(AccessPath.ACCESS_PATH_PART);
|
||||||
|
stringWriter.append(PATH_SEPARATOR);
|
||||||
|
stringWriter.append(AccessPath.CONTEXTS_PATH_PART);
|
||||||
|
stringWriter.append(PATH_SEPARATOR);
|
||||||
|
stringWriter.append(AccessPath.CURRENT_CONTEXT);
|
||||||
|
|
||||||
|
HTTPCall httpCall = getHTTPCall();
|
||||||
|
Context context = httpCall.call(Context.class, stringWriter.toString(), HTTPMETHOD.GET);
|
||||||
|
|
||||||
|
logger.debug("Got Context is {}", ISMapper.marshal(context));
|
||||||
|
return context;
|
||||||
|
} catch(ResourceRegistryException e) {
|
||||||
|
// logger.trace("Error while getting {} schema for {}", polymorphic ?
|
||||||
|
// AccessPath.POLYMORPHIC_PARAM + " " : "",
|
||||||
|
// type, e);
|
||||||
|
throw e;
|
||||||
|
} catch(Exception e) {
|
||||||
|
// logger.trace("Error while getting {}schema for {}", polymorphic ?
|
||||||
|
// AccessPath.POLYMORPHIC_PARAM + " " : "",
|
||||||
|
// type, e);
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Context getContext(UUID uuid) throws ContextNotFoundException, ResourceRegistryException {
|
public Context getContext(UUID uuid) throws ContextNotFoundException, ResourceRegistryException {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue