Refs #11288: Made resource-registry more RESTful
Task-Url: https://support.d4science.org/issues/11288 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry-client@167867 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
d0d08bc15c
commit
061d321e30
|
@ -11,10 +11,10 @@ import org.gcube.informationsystem.model.entity.Entity;
|
||||||
import org.gcube.informationsystem.model.entity.Facet;
|
import org.gcube.informationsystem.model.entity.Facet;
|
||||||
import org.gcube.informationsystem.model.entity.Resource;
|
import org.gcube.informationsystem.model.entity.Resource;
|
||||||
import org.gcube.informationsystem.model.relation.ConsistsOf;
|
import org.gcube.informationsystem.model.relation.ConsistsOf;
|
||||||
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException;
|
||||||
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.er.ERAvailableInAnotherContextException;
|
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.er.ERNotFoundException;
|
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.query.InvalidQueryException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.query.InvalidQueryException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException;
|
||||||
import org.gcube.informationsystem.types.TypeBinder.TypeDefinition;
|
import org.gcube.informationsystem.types.TypeBinder.TypeDefinition;
|
||||||
|
@ -25,16 +25,16 @@ import org.gcube.informationsystem.types.TypeBinder.TypeDefinition;
|
||||||
public interface ResourceRegistryClient {
|
public interface ResourceRegistryClient {
|
||||||
|
|
||||||
public <ERType extends ER> boolean exists(Class<ERType> clazz, UUID uuid)
|
public <ERType extends ER> boolean exists(Class<ERType> clazz, UUID uuid)
|
||||||
throws ERNotFoundException, ERAvailableInAnotherContextException, ResourceRegistryException;
|
throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException;
|
||||||
|
|
||||||
public boolean exists(String type, UUID uuid)
|
public boolean exists(String type, UUID uuid)
|
||||||
throws ERNotFoundException, ERAvailableInAnotherContextException, ResourceRegistryException;
|
throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException;
|
||||||
|
|
||||||
public <ERType extends ER> ERType getInstance(Class<ERType> clazz, UUID uuid)
|
public <ERType extends ER> ERType getInstance(Class<ERType> clazz, UUID uuid)
|
||||||
throws ERNotFoundException, ERAvailableInAnotherContextException, ResourceRegistryException;
|
throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException;
|
||||||
|
|
||||||
public String getInstance(String type, UUID uuid)
|
public String getInstance(String type, UUID uuid)
|
||||||
throws ERNotFoundException, ERAvailableInAnotherContextException, ResourceRegistryException;
|
throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException;
|
||||||
|
|
||||||
public <ERType extends ER, R extends Resource> List<R> getInstances(Class<ERType> clazz, Boolean polymorphic)
|
public <ERType extends ER, R extends Resource> List<R> getInstances(Class<ERType> clazz, Boolean polymorphic)
|
||||||
throws ResourceRegistryException;
|
throws ResourceRegistryException;
|
||||||
|
|
|
@ -15,10 +15,10 @@ import org.gcube.informationsystem.model.entity.Entity;
|
||||||
import org.gcube.informationsystem.model.entity.Facet;
|
import org.gcube.informationsystem.model.entity.Facet;
|
||||||
import org.gcube.informationsystem.model.entity.Resource;
|
import org.gcube.informationsystem.model.entity.Resource;
|
||||||
import org.gcube.informationsystem.model.relation.ConsistsOf;
|
import org.gcube.informationsystem.model.relation.ConsistsOf;
|
||||||
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException;
|
||||||
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.er.ERAvailableInAnotherContextException;
|
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.er.ERNotFoundException;
|
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.query.InvalidQueryException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.query.InvalidQueryException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath;
|
import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath;
|
||||||
|
@ -56,14 +56,14 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <ERType extends ER> boolean exists(Class<ERType> clazz, UUID uuid)
|
public <ERType extends ER> boolean exists(Class<ERType> clazz, UUID uuid)
|
||||||
throws ERNotFoundException, ERAvailableInAnotherContextException, ResourceRegistryException {
|
throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException {
|
||||||
String type = Utility.getType(clazz);
|
String type = Utility.getType(clazz);
|
||||||
return exists(type, uuid);
|
return exists(type, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean exists(String type, UUID uuid)
|
public boolean exists(String type, UUID uuid)
|
||||||
throws ERNotFoundException, ERAvailableInAnotherContextException, ResourceRegistryException {
|
throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException {
|
||||||
try {
|
try {
|
||||||
logger.info("Going to check if {} with UUID {} exists", type, uuid);
|
logger.info("Going to check if {} with UUID {} exists", type, uuid);
|
||||||
StringWriter stringWriter = new StringWriter();
|
StringWriter stringWriter = new StringWriter();
|
||||||
|
@ -94,7 +94,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <ERType extends ER> ERType getInstance(Class<ERType> clazz, UUID uuid)
|
public <ERType extends ER> ERType getInstance(Class<ERType> clazz, UUID uuid)
|
||||||
throws ERNotFoundException, ERAvailableInAnotherContextException, ResourceRegistryException {
|
throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException {
|
||||||
String type = Utility.getType(clazz);
|
String type = Utility.getType(clazz);
|
||||||
String ret = getInstance(type, uuid);
|
String ret = getInstance(type, uuid);
|
||||||
try {
|
try {
|
||||||
|
@ -105,7 +105,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getInstance(String type, UUID uuid)
|
public String getInstance(String type, UUID uuid)
|
||||||
throws ERNotFoundException, ERAvailableInAnotherContextException, ResourceRegistryException {
|
throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException {
|
||||||
try {
|
try {
|
||||||
logger.info("Going to get {} with UUID {}", type, uuid);
|
logger.info("Going to get {} with UUID {}", type, uuid);
|
||||||
StringWriter stringWriter = new StringWriter();
|
StringWriter stringWriter = new StringWriter();
|
||||||
|
|
Loading…
Reference in New Issue