Involved methods thrown SchemaViolationExc. refs #7355 #18216 #20531

This commit is contained in:
Luca Frosini 2021-02-16 17:00:46 +01:00
parent 32f02d057f
commit 54715a0783
2 changed files with 441 additions and 406 deletions

View File

@ -19,6 +19,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.FacetNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceAlreadyPresentException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaViolationException;
/**
* @author Luca Frosini (ISTI - CNR)
@ -26,10 +27,10 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resour
public interface ResourceRegistryPublisher {
public <IE extends IdentifiableElement> IE create(IE er)
throws AlreadyPresentException, ResourceRegistryException;
public String create(String json) throws AlreadyPresentException, ResourceRegistryException;
throws SchemaViolationException, AlreadyPresentException, ResourceRegistryException;
public String create(String json)
throws SchemaViolationException, AlreadyPresentException, ResourceRegistryException;
public <IE extends IdentifiableElement> boolean exists(Class<IE> clazz, UUID uuid)
throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException;
@ -40,162 +41,152 @@ public interface ResourceRegistryPublisher {
public boolean exists(String type, UUID uuid)
throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException;
public <IE extends IdentifiableElement> IE read(IE identifiableElement) throws NotFoundException, ResourceRegistryException;
public <IE extends IdentifiableElement> IE read(IE identifiableElement)
throws NotFoundException, ResourceRegistryException;
public String read(String type, UUID uuid) throws NotFoundException, ResourceRegistryException;
public <IE extends IdentifiableElement> IE update(IE identifiableElement)
throws NotFoundException, ResourceRegistryException;
throws SchemaViolationException, NotFoundException, ResourceRegistryException;
public String update(String type, String json) throws NotFoundException, ResourceRegistryException;
public String update(String type, String json)
throws SchemaViolationException, NotFoundException, ResourceRegistryException;
public String update(String json) throws NotFoundException, ResourceRegistryException;
public String update(String json) throws SchemaViolationException, NotFoundException, ResourceRegistryException;
public <IE extends IdentifiableElement> boolean delete(IE identifiableElement)
throws SchemaViolationException, NotFoundException, ResourceRegistryException;
public <IE extends IdentifiableElement> boolean delete(IE identifiableElement) throws NotFoundException, ResourceRegistryException;
public boolean delete(String type, UUID uuid) throws NotFoundException, ResourceRegistryException;
public boolean delete(String type, UUID uuid)
throws SchemaViolationException, NotFoundException, ResourceRegistryException;
/* ----- */
public <F extends Facet> F createFacet(F facet)
throws FacetAlreadyPresentException, ResourceRegistryException;
public String createFacet(String facet) throws FacetAlreadyPresentException, ResourceRegistryException;
throws SchemaViolationException, FacetAlreadyPresentException, ResourceRegistryException;
public String createFacet(String facet)
throws SchemaViolationException, FacetAlreadyPresentException, ResourceRegistryException;
public <F extends Facet> F readFacet(F facet) throws FacetNotFoundException, ResourceRegistryException;
public String readFacet(String facetType, UUID uuid) throws FacetNotFoundException, ResourceRegistryException;
public <F extends Facet> F updateFacet(F facet)
throws FacetNotFoundException, ResourceRegistryException;
throws SchemaViolationException, FacetNotFoundException, ResourceRegistryException;
public String updateFacet(String facet) throws FacetNotFoundException, ResourceRegistryException;
public String updateFacet(String facet)
throws SchemaViolationException, FacetNotFoundException, ResourceRegistryException;
public <F extends Facet> boolean deleteFacet(F facet)
throws SchemaViolationException, FacetNotFoundException, ResourceRegistryException;
public <F extends Facet> boolean deleteFacet(F facet) throws FacetNotFoundException, ResourceRegistryException;
public boolean deleteFacet(String facetType, UUID uuid) throws FacetNotFoundException, ResourceRegistryException;
public boolean deleteFacet(String facetType, UUID uuid)
throws SchemaViolationException, FacetNotFoundException, ResourceRegistryException;
/* ----- */
public <R extends Resource> R createResource(R resource)
throws ResourceAlreadyPresentException, ResourceRegistryException;
throws SchemaViolationException, ResourceAlreadyPresentException, ResourceRegistryException;
public String createResource(String resource) throws ResourceAlreadyPresentException, ResourceRegistryException;
public String createResource(String resource)
throws SchemaViolationException, ResourceAlreadyPresentException, ResourceRegistryException;
public <R extends Resource> R readResource(R resource) throws ResourceNotFoundException, ResourceRegistryException;
public <R extends Resource> R readResource(R resource)
public String readResource(String resourceType, UUID uuid)
throws ResourceNotFoundException, ResourceRegistryException;
public String readResource(String resourceType, UUID uuid) throws ResourceNotFoundException, ResourceRegistryException;
public <R extends Resource> R updateResource(R resource)
throws ResourceNotFoundException, ResourceRegistryException;
throws SchemaViolationException, ResourceNotFoundException, ResourceRegistryException;
public String updateResource(String resource)
throws ResourceNotFoundException, ResourceRegistryException;
throws SchemaViolationException, ResourceNotFoundException, ResourceRegistryException;
public <R extends Resource> boolean deleteResource(R resource)
throws ResourceNotFoundException, ResourceRegistryException;
public boolean deleteResource(String resourceType, UUID uuid) throws ResourceNotFoundException, ResourceRegistryException;
throws SchemaViolationException, ResourceNotFoundException, ResourceRegistryException;
public boolean deleteResource(String resourceType, UUID uuid)
throws SchemaViolationException, ResourceNotFoundException, ResourceRegistryException;
/* ----- */
public <C extends ConsistsOf<? extends Resource, ? extends Facet>> C createConsistsOf(
C consistsOf) throws NotFoundException, ResourceRegistryException;
public <C extends ConsistsOf<? extends Resource, ? extends Facet>> C createConsistsOf(C consistsOf)
throws SchemaViolationException, NotFoundException, ResourceRegistryException;
public String createConsistsOf(String consistsOf)
throws SchemaViolationException, NotFoundException, ResourceRegistryException;
public <C extends ConsistsOf<? extends Resource, ? extends Facet>> C readConsistsOf(C consistsOf)
throws NotFoundException, ResourceRegistryException;
public <C extends ConsistsOf<? extends Resource, ? extends Facet>> C readConsistsOf(
C consistsOf) throws NotFoundException, ResourceRegistryException;
public String readConsistsOf(String consistsOfType, UUID uuid) throws NotFoundException, ResourceRegistryException;
public <C extends ConsistsOf<? extends Resource, ? extends Facet>> C updateConsistsOf(C consistsOf)
throws NotFoundException, ResourceRegistryException;
throws SchemaViolationException, NotFoundException, ResourceRegistryException;
public String updateConsistsOf(String consistsOf)
throws NotFoundException, ResourceRegistryException;
throws SchemaViolationException, NotFoundException, ResourceRegistryException;
public <C extends ConsistsOf<? extends Resource, ? extends Facet>> boolean deleteConsistsOf(C consistsOf)
throws ResourceRegistryException;
public boolean deleteConsistsOf(String consistsOfType, UUID uuid) throws ResourceRegistryException;
throws SchemaViolationException, ResourceRegistryException;
public boolean deleteConsistsOf(String consistsOfType, UUID uuid)
throws SchemaViolationException, ResourceRegistryException;
/* ----- */
public <I extends IsRelatedTo<? extends Resource, ? extends Resource>> I createIsRelatedTo(
I isRelatedTo) throws ResourceNotFoundException, ResourceRegistryException;
public <I extends IsRelatedTo<? extends Resource, ? extends Resource>> I createIsRelatedTo(I isRelatedTo)
throws SchemaViolationException, ResourceNotFoundException, ResourceRegistryException;
public String createIsRelatedTo(String isRelatedTo)
throws ResourceNotFoundException, ResourceRegistryException;
throws SchemaViolationException, ResourceNotFoundException, ResourceRegistryException;
public <I extends IsRelatedTo<? extends Resource, ? extends Resource>> I readIsRelatedTo(I isRelatedTo)
throws NotFoundException, ResourceRegistryException;
public <I extends IsRelatedTo<? extends Resource, ? extends Resource>> I readIsRelatedTo(
I isRelatedTo) throws NotFoundException, ResourceRegistryException;
public String readIsRelatedTo(String isRelatedToType, UUID uuid) throws NotFoundException, ResourceRegistryException;
public String readIsRelatedTo(String isRelatedToType, UUID uuid)
throws NotFoundException, ResourceRegistryException;
public <I extends IsRelatedTo<? extends Resource, ? extends Resource>> I updateIsRelatedTo(I isRelatedTo)
throws NotFoundException, ResourceRegistryException;
throws SchemaViolationException, NotFoundException, ResourceRegistryException;
public String updateIsRelatedTo(String isRelatedTo)
throws NotFoundException, ResourceRegistryException;
throws SchemaViolationException, NotFoundException, ResourceRegistryException;
public <I extends IsRelatedTo<? extends Resource, ? extends Resource>> boolean deleteIsRelatedTo(I isRelatedTo)
throws ResourceRegistryException;
public boolean deleteIsRelatedTo(String isRelatedToType, UUID uuid) throws ResourceRegistryException;
throws SchemaViolationException, ResourceRegistryException;
public boolean deleteIsRelatedTo(String isRelatedToType, UUID uuid)
throws SchemaViolationException, ResourceRegistryException;
/* ----- */
public boolean addToContext(String type, UUID instanceUUID, UUID contextUUID)
throws NotFoundException, ResourceRegistryException;
throws SchemaViolationException, NotFoundException, ResourceRegistryException;
public <IE extends IdentifiableElement> boolean addToContext(IE identifiableElement, UUID contextUUID)
throws NotFoundException, ResourceRegistryException;
throws SchemaViolationException, NotFoundException, ResourceRegistryException;
public boolean addToCurrentContext(String type, UUID instanceUUID)
throws NotFoundException, ResourceRegistryException;
throws SchemaViolationException, NotFoundException, ResourceRegistryException;
public <IE extends IdentifiableElement> boolean addToCurrentContext(IE identifiableElement)
throws NotFoundException, ResourceRegistryException;
throws SchemaViolationException, NotFoundException, ResourceRegistryException;
public boolean removeFromContext(String type, UUID instanceUUID, UUID contextUUID)
throws NotFoundException, ResourceRegistryException;
throws SchemaViolationException, NotFoundException, ResourceRegistryException;
public <IE extends IdentifiableElement> boolean removeFromContext(IE identifiableElement, UUID contextUUID)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException;
public boolean removeFromCurrentContext(String type, UUID instanceUUID)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
public boolean removeFromCurrentContext(String type, UUID instanceUUID) throws SchemaViolationException,
ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
public <IE extends IdentifiableElement> boolean removeFromCurrentContext(IE identifiableElement)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException;
public Set<UUID> getElementContexts(String type, UUID instanceUUID)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
@ -203,33 +194,36 @@ public interface ResourceRegistryPublisher {
public <IE extends IdentifiableElement> Set<UUID> getElementContexts(IE identifiableElement)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
/* ----- */
public boolean addResourceToContext(String resourceType, UUID resourceUUID, UUID contextUUID)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException;
public <R extends Resource> boolean addResourceToContext(R resource, UUID contextUUID)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException;
public boolean addResourceToCurrentContext(String resourceType, UUID resourceUUID)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
public boolean addResourceToCurrentContext(String resourceType, UUID resourceUUID) throws SchemaViolationException,
ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
public <R extends Resource> boolean addResourceToCurrentContext(R resource)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
public <R extends Resource> boolean addResourceToCurrentContext(R resource) throws SchemaViolationException,
ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
public boolean removeResourceFromContext(String resourceType, UUID resourceUUID, UUID contextUUID)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException;
public <R extends Resource> boolean removeResourceFromContext(R resource, UUID contextUUID)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException;
public boolean removeResourceFromCurrentContext(String resourceType, UUID resourceUUID)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException;
public <R extends Resource> boolean removeResourceFromCurrentContext(R resource)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
public <R extends Resource> boolean removeResourceFromCurrentContext(R resource) throws SchemaViolationException,
ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
public Set<UUID> getResourceContexts(String resourceType, UUID resourceUUID)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
@ -237,10 +231,8 @@ public interface ResourceRegistryPublisher {
public <R extends Resource> Set<UUID> getResourceContexts(R resource)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
/* ----- */
public boolean addFacetToContext(String facetType, UUID facetUUID, UUID contextUUID)
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
@ -254,16 +246,17 @@ public interface ResourceRegistryPublisher {
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
public boolean removeFacetFromContext(String facetType, UUID facetUUID, UUID contextUUID)
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
throws SchemaViolationException, FacetNotFoundException, ContextNotFoundException,
ResourceRegistryException;
public <F extends Facet> boolean removeFacetFromContext(F facet, UUID contextUUID)
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
public <F extends Facet> boolean removeFacetFromContext(F facet, UUID contextUUID) throws SchemaViolationException,
FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
public boolean removeFacetFromCurrentContext(String facetType, UUID facetUUID)
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
public boolean removeFacetFromCurrentContext(String facetType, UUID facetUUID) throws SchemaViolationException,
FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
public <F extends Facet> boolean removeFacetFromCurrentContext(F facet)
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
public <F extends Facet> boolean removeFacetFromCurrentContext(F facet) throws SchemaViolationException,
FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
public Set<UUID> getFacetContexts(String facetType, UUID facetUUID)
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
@ -271,15 +264,12 @@ public interface ResourceRegistryPublisher {
public <F extends Facet> Set<UUID> getFacetContexts(F facet)
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
/* ----- */
public Context getContext(UUID uuid) throws ContextNotFoundException, ResourceRegistryException;
public Context getCurrentContext() throws ContextNotFoundException, ResourceRegistryException;
public List<Context> getAllContext() throws ResourceRegistryException;
}

View File

@ -31,6 +31,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.FacetNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceAlreadyPresentException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaViolationException;
import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath;
import org.gcube.informationsystem.resourceregistry.api.rest.InstancePath;
import org.gcube.informationsystem.resourceregistry.api.rest.SharingPath;
@ -46,18 +47,21 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
protected final String address;
private GXHTTPStringRequest includeAdditionalQueryParameters(GXHTTPStringRequest gxHTTPStringRequest) throws UnsupportedEncodingException{
private GXHTTPStringRequest includeAdditionalQueryParameters(GXHTTPStringRequest gxHTTPStringRequest)
throws UnsupportedEncodingException {
return includeAdditionalQueryParameters(gxHTTPStringRequest, null);
}
private GXHTTPStringRequest includeAdditionalQueryParameters(GXHTTPStringRequest gxHTTPStringRequest, Map<String,String> queryParams) throws UnsupportedEncodingException{
private GXHTTPStringRequest includeAdditionalQueryParameters(GXHTTPStringRequest gxHTTPStringRequest,
Map<String, String> queryParams) throws UnsupportedEncodingException {
gxHTTPStringRequest = checkHierarchicalMode(gxHTTPStringRequest, queryParams);
return checkIncludeContextsInInstanceHeader(gxHTTPStringRequest, queryParams);
}
private GXHTTPStringRequest checkHierarchicalMode(GXHTTPStringRequest gxHTTPStringRequest, Map<String,String> queryParams) throws UnsupportedEncodingException{
if(ResourceRegistryPublisherFactory.isHierarchicalMode()) {
if(queryParams==null) {
private GXHTTPStringRequest checkHierarchicalMode(GXHTTPStringRequest gxHTTPStringRequest,
Map<String, String> queryParams) throws UnsupportedEncodingException {
if (ResourceRegistryPublisherFactory.isHierarchicalMode()) {
if (queryParams == null) {
queryParams = new HashMap<>();
}
queryParams.put(AccessPath.HIERARCHICAL_MODE_PARAM, Boolean.toString(true));
@ -65,9 +69,10 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
return gxHTTPStringRequest.queryParams(queryParams);
}
private GXHTTPStringRequest checkIncludeContextsInInstanceHeader(GXHTTPStringRequest gxHTTPStringRequest, Map<String,String> queryParams) throws UnsupportedEncodingException{
if(ResourceRegistryPublisherFactory.includeContextsInInstanceHeader()) {
if(queryParams==null) {
private GXHTTPStringRequest checkIncludeContextsInInstanceHeader(GXHTTPStringRequest gxHTTPStringRequest,
Map<String, String> queryParams) throws UnsupportedEncodingException {
if (ResourceRegistryPublisherFactory.includeContextsInInstanceHeader()) {
if (queryParams == null) {
queryParams = new HashMap<>();
}
queryParams.put(AccessPath.INCLUDE_CONTEXTS_IN_HEADER_PARAM, Boolean.toString(true));
@ -105,12 +110,12 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
logger.debug("Got Contexts are {}", ret);
return ElementMapper.unmarshalList(Context.class, ret);
} catch(ResourceRegistryException e) {
} catch (ResourceRegistryException e) {
// logger.trace("Error while getting {} schema for {}", polymorphic ?
// AccessPath.POLYMORPHIC_PARAM + " " : "",
// type, e);
throw e;
} catch(Exception e) {
} catch (Exception e) {
// logger.trace("Error while getting {}schema for {}", polymorphic ?
// AccessPath.POLYMORPHIC_PARAM + " " : "",
// type, e);
@ -141,12 +146,12 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
logger.debug("Got Context is {}", ElementMapper.marshal(context));
return context;
} catch(ResourceRegistryException e) {
} catch (ResourceRegistryException e) {
// logger.trace("Error while getting {} schema for {}", polymorphic ?
// AccessPath.POLYMORPHIC_PARAM + " " : "",
// type, e);
throw e;
} catch(Exception e) {
} catch (Exception e) {
// logger.trace("Error while getting {}schema for {}", polymorphic ?
// AccessPath.POLYMORPHIC_PARAM + " " : "",
// type, e);
@ -157,16 +162,19 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
@Override
public Context getContext(UUID uuid) throws ContextNotFoundException, ResourceRegistryException {
ContextCache contextCache = ContextCache.getInstance();
Context context = ContextCache.getInstance().getContextByUUID(uuid);;
if(context == null) {
Context context = ContextCache.getInstance().getContextByUUID(uuid);
;
if (context == null) {
context = getContextFromServer(uuid.toString());
contextCache.cleanCache();
contextCache.refreshContextsIfNeeded();
Context c = contextCache.getContextByUUID(context.getHeader().getUUID());
if(c!=null){
if (c != null) {
context = c;
}else {
logger.error("Context with UUID {} is {}. It is possibile to get it from the server but not from the cache. This is very strange and should not occur.", uuid, context);
} else {
logger.error(
"Context with UUID {} is {}. It is possibile to get it from the server but not from the cache. This is very strange and should not occur.",
uuid, context);
}
}
return context;
@ -178,17 +186,19 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
ContextCache contextCache = ContextCache.getInstance();
UUID uuid = contextCache.getUUIDByFullName(contextFullName);
Context context = null;
if(uuid == null) {
if (uuid == null) {
context = getContextFromServer(AccessPath.CURRENT_CONTEXT);
contextCache.cleanCache();
contextCache.refreshContextsIfNeeded();
Context c = contextCache.getContextByUUID(context.getHeader().getUUID());
if(c!=null){
if (c != null) {
context = c;
}else {
logger.error("Current Context is {}. It is possibile to get it from the server but not from the cache. This is very strange and should not occur.", contextFullName);
} else {
logger.error(
"Current Context is {}. It is possibile to get it from the server but not from the cache. This is very strange and should not occur.",
contextFullName);
}
}else {
} else {
context = contextCache.getContextByUUID(uuid);
}
return context;
@ -199,7 +209,7 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
}
protected String create(String type, String json, UUID uuid)
throws AlreadyPresentException, ResourceRegistryException {
throws SchemaViolationException, AlreadyPresentException, ResourceRegistryException {
try {
logger.trace("Going to create {} : {}", type, json);
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
@ -216,60 +226,63 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
logger.trace("{} successfully created", ret);
return ret;
} catch(ResourceRegistryException e) {
} catch (ResourceRegistryException e) {
// logger.trace("Error Creating {}", facet, e);
throw e;
} catch(Exception e) {
} catch (Exception e) {
// logger.trace("Error Creating {}", facet, e);
throw new RuntimeException(e);
}
}
public <IE extends IdentifiableElement> String internalCreate(IE identifiableElement) throws AlreadyPresentException, ResourceRegistryException {
public <IE extends IdentifiableElement> String internalCreate(IE identifiableElement)
throws SchemaViolationException, AlreadyPresentException, ResourceRegistryException {
try {
String type = org.gcube.informationsystem.resourceregistry.api.utils.Utility.getTypeName(identifiableElement);
String type = org.gcube.informationsystem.resourceregistry.api.utils.Utility
.getTypeName(identifiableElement);
String json = ElementMapper.marshal(identifiableElement);
Header header = identifiableElement.getHeader();
if(header==null) {
if (header == null) {
header = new HeaderImpl(UUID.randomUUID());
identifiableElement.setHeader(header);
}
UUID uuid = identifiableElement.getHeader().getUUID();
return create(type, json, uuid);
} catch(ResourceRegistryException e) {
} catch (ResourceRegistryException e) {
// logger.trace("Error Creating {}", facet, e);
throw e;
} catch(Exception e) {
} catch (Exception e) {
// logger.trace("Error Creating {}", facet, e);
throw new RuntimeException(e);
}
}
@SuppressWarnings("unchecked")
@Override
public <IE extends IdentifiableElement> IE create(IE identifiableElement) throws AlreadyPresentException, ResourceRegistryException {
public <IE extends IdentifiableElement> IE create(IE identifiableElement)
throws SchemaViolationException, AlreadyPresentException, ResourceRegistryException {
try {
String ret = internalCreate(identifiableElement);
return (IE) ElementMapper.unmarshal(IdentifiableElement.class, ret);
} catch(ResourceRegistryException e) {
} catch (ResourceRegistryException e) {
// logger.trace("Error Creating {}", facet, e);
throw e;
} catch(Exception e) {
} catch (Exception e) {
// logger.trace("Error Creating {}", facet, e);
throw new RuntimeException(e);
}
}
@Override
public String create(String json) throws AlreadyPresentException, ResourceRegistryException {
public String create(String json)
throws SchemaViolationException, AlreadyPresentException, ResourceRegistryException {
try {
IdentifiableElement e = ElementMapper.unmarshal(IdentifiableElement.class, json);
return internalCreate(e);
} catch(ResourceRegistryException e) {
} catch (ResourceRegistryException e) {
// logger.trace("Error Creating {}", facet, e);
throw e;
} catch(Exception e) {
} catch (Exception e) {
// logger.trace("Error Creating {}", facet, e);
throw new RuntimeException(e);
}
@ -310,11 +323,11 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
logger.debug("{} with UUID {} exists", type, uuid);
return true;
} catch(ResourceRegistryException e) {
} catch (ResourceRegistryException e) {
// logger.trace("Error while checking if {} with UUID {} exists.", type, uuid,
// e);
throw e;
} catch(Exception e) {
} catch (Exception e) {
// logger.trace("Error while checking if {} with UUID {} exists.", type, uuid,
// e);
throw new RuntimeException(e);
@ -323,16 +336,18 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
@SuppressWarnings("unchecked")
@Override
public <IE extends IdentifiableElement> IE read(IE identifiableElement) throws NotFoundException, ResourceRegistryException {
public <IE extends IdentifiableElement> IE read(IE identifiableElement)
throws NotFoundException, ResourceRegistryException {
try {
String type = org.gcube.informationsystem.resourceregistry.api.utils.Utility.getTypeName(identifiableElement);
String type = org.gcube.informationsystem.resourceregistry.api.utils.Utility
.getTypeName(identifiableElement);
UUID uuid = identifiableElement.getHeader().getUUID();
String ret = read(type, uuid);
return (IE) ElementMapper.unmarshal(IdentifiableElement.class, ret);
} catch(ResourceRegistryException e) {
} catch (ResourceRegistryException e) {
// logger.trace("Error Creating {}", facet, e);
throw e;
} catch(Exception e) {
} catch (Exception e) {
// logger.trace("Error Creating {}", facet, e);
throw new RuntimeException(e);
}
@ -357,17 +372,17 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
logger.debug("Got {} with UUID {} is {}", type, uuid, ret);
return ret;
} catch(ResourceRegistryException e) {
} catch (ResourceRegistryException e) {
// logger.trace("Error Creating {}", facet, e);
throw e;
} catch(Exception e) {
} catch (Exception e) {
// logger.trace("Error Creating {}", facet, e);
throw new RuntimeException(e);
}
}
protected String update(String type, String json, UUID uuid)
throws AlreadyPresentException, ResourceRegistryException {
throws SchemaViolationException, AlreadyPresentException, ResourceRegistryException {
try {
logger.trace("Going to create {} : {}", type, json);
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
@ -384,10 +399,10 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
logger.trace("{} with UUID {} successfully created : {}", type, uuid, ret);
return ret;
} catch(ResourceRegistryException e) {
} catch (ResourceRegistryException e) {
// logger.trace("Error Creating {}", facet, e);
throw e;
} catch(Exception e) {
} catch (Exception e) {
// logger.trace("Error Creating {}", facet, e);
throw new RuntimeException(e);
}
@ -395,67 +410,73 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
@SuppressWarnings("unchecked")
@Override
public <IE extends IdentifiableElement> IE update(IE identifiableElement) throws NotFoundException, ResourceRegistryException {
public <IE extends IdentifiableElement> IE update(IE identifiableElement)
throws SchemaViolationException, NotFoundException, ResourceRegistryException {
try {
String type = org.gcube.informationsystem.resourceregistry.api.utils.Utility.getTypeName(identifiableElement);
String type = org.gcube.informationsystem.resourceregistry.api.utils.Utility
.getTypeName(identifiableElement);
String json = ElementMapper.marshal(identifiableElement);
UUID uuid = identifiableElement.getHeader().getUUID();
String ret = update(type, json, uuid);
return (IE) ElementMapper.unmarshal(Element.class, ret);
} catch(ResourceRegistryException e) {
} catch (ResourceRegistryException e) {
// logger.trace("Error Creating {}", facet, e);
throw e;
} catch(Exception e) {
} catch (Exception e) {
// logger.trace("Error Creating {}", facet, e);
throw new RuntimeException(e);
}
}
@Override
public String update(String type, String json) throws NotFoundException, ResourceRegistryException {
public String update(String type, String json)
throws SchemaViolationException, NotFoundException, ResourceRegistryException {
try {
UUID uuid = Utility.getUUIDFromJSONString(json);
return update(type, json, uuid);
} catch(ResourceRegistryException e) {
} catch (ResourceRegistryException e) {
// logger.trace("Error Creating {}", facet, e);
throw e;
} catch(Exception e) {
} catch (Exception e) {
// logger.trace("Error Creating {}", facet, e);
throw new RuntimeException(e);
}
}
@Override
public String update(String json) throws NotFoundException, ResourceRegistryException {
public String update(String json) throws SchemaViolationException, NotFoundException, ResourceRegistryException {
try {
String type = org.gcube.informationsystem.resourceregistry.api.utils.Utility.getClassFromJsonString(json);
return update(type, json);
} catch(ResourceRegistryException e) {
} catch (ResourceRegistryException e) {
// logger.trace("Error Creating {}", facet, e);
throw e;
} catch(Exception e) {
} catch (Exception e) {
// logger.trace("Error Creating {}", facet, e);
throw new RuntimeException(e);
}
}
@Override
public <IE extends IdentifiableElement> boolean delete(IE identifiableElement) throws NotFoundException, ResourceRegistryException {
public <IE extends IdentifiableElement> boolean delete(IE identifiableElement)
throws SchemaViolationException, NotFoundException, ResourceRegistryException {
try {
String type = org.gcube.informationsystem.resourceregistry.api.utils.Utility.getTypeName(identifiableElement);
String type = org.gcube.informationsystem.resourceregistry.api.utils.Utility
.getTypeName(identifiableElement);
UUID uuid = identifiableElement.getHeader().getUUID();
return delete(type, uuid);
} catch(ResourceRegistryException e) {
} catch (ResourceRegistryException e) {
// logger.trace("Error Creating {}", facet, e);
throw e;
} catch(Exception e) {
} catch (Exception e) {
// logger.trace("Error Creating {}", facet, e);
throw new RuntimeException(e);
}
}
@Override
public boolean delete(String type, UUID uuid) throws NotFoundException, ResourceRegistryException {
public boolean delete(String type, UUID uuid)
throws SchemaViolationException, NotFoundException, ResourceRegistryException {
try {
logger.trace("Going to delete {} with UUID {}", type, uuid);
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
@ -473,22 +494,24 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
logger.info("{} with UUID {} {}", type, uuid, deleted ? " successfully deleted" : "was NOT deleted");
return deleted;
} catch(ResourceRegistryException e) {
} catch (ResourceRegistryException e) {
// logger.trace("Error Creating {}", facet, e);
throw e;
} catch(Exception e) {
} catch (Exception e) {
// logger.trace("Error Creating {}", facet, e);
throw new RuntimeException(e);
}
}
@Override
public <F extends Facet> F createFacet(F facet) throws FacetAlreadyPresentException, ResourceRegistryException {
public <F extends Facet> F createFacet(F facet)
throws SchemaViolationException, FacetAlreadyPresentException, ResourceRegistryException {
return create(facet);
}
@Override
public String createFacet(String facet) throws FacetAlreadyPresentException, ResourceRegistryException {
public String createFacet(String facet)
throws SchemaViolationException, FacetAlreadyPresentException, ResourceRegistryException {
return create(facet);
}
@ -503,33 +526,38 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
}
@Override
public <F extends Facet> F updateFacet(F facet) throws FacetNotFoundException, ResourceRegistryException {
public <F extends Facet> F updateFacet(F facet)
throws SchemaViolationException, FacetNotFoundException, ResourceRegistryException {
return update(facet);
}
@Override
public String updateFacet(String facet) throws FacetNotFoundException, ResourceRegistryException {
public String updateFacet(String facet)
throws SchemaViolationException, FacetNotFoundException, ResourceRegistryException {
return update(facet);
}
@Override
public <F extends Facet> boolean deleteFacet(F facet) throws FacetNotFoundException, ResourceRegistryException {
public <F extends Facet> boolean deleteFacet(F facet)
throws SchemaViolationException, FacetNotFoundException, ResourceRegistryException {
return delete(facet);
}
@Override
public boolean deleteFacet(String facetType, UUID uuid) throws FacetNotFoundException, ResourceRegistryException {
public boolean deleteFacet(String facetType, UUID uuid)
throws SchemaViolationException, FacetNotFoundException, ResourceRegistryException {
return delete(facetType, uuid);
}
@Override
public <R extends Resource> R createResource(R resource)
throws ResourceAlreadyPresentException, ResourceRegistryException {
throws SchemaViolationException, ResourceAlreadyPresentException, ResourceRegistryException {
return create(resource);
}
@Override
public String createResource(String resource) throws ResourceAlreadyPresentException, ResourceRegistryException {
public String createResource(String resource)
throws SchemaViolationException, ResourceAlreadyPresentException, ResourceRegistryException {
return create(resource);
}
@ -546,40 +574,42 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
@Override
public <R extends Resource> R updateResource(R resource)
throws ResourceNotFoundException, ResourceRegistryException {
throws SchemaViolationException, ResourceNotFoundException, ResourceRegistryException {
return update(resource);
}
@Override
public String updateResource(String resource) throws ResourceNotFoundException, ResourceRegistryException {
public String updateResource(String resource)
throws SchemaViolationException, ResourceNotFoundException, ResourceRegistryException {
return update(resource);
}
@Override
public <R extends Resource> boolean deleteResource(R resource)
throws ResourceNotFoundException, ResourceRegistryException {
throws SchemaViolationException, ResourceNotFoundException, ResourceRegistryException {
return delete(resource);
}
@Override
public boolean deleteResource(String resourceType, UUID uuid)
throws ResourceNotFoundException, ResourceRegistryException {
throws SchemaViolationException, ResourceNotFoundException, ResourceRegistryException {
return delete(resourceType, uuid);
}
@Override
public <C extends ConsistsOf<? extends Resource,? extends Facet>> C createConsistsOf(C consistsOf)
throws NotFoundException, ResourceRegistryException {
public <C extends ConsistsOf<? extends Resource, ? extends Facet>> C createConsistsOf(C consistsOf)
throws SchemaViolationException, NotFoundException, ResourceRegistryException {
return create(consistsOf);
}
@Override
public String createConsistsOf(String consistsOf) throws NotFoundException, ResourceRegistryException {
public String createConsistsOf(String consistsOf)
throws SchemaViolationException, NotFoundException, ResourceRegistryException {
return create(consistsOf);
}
@Override
public <C extends ConsistsOf<? extends Resource,? extends Facet>> C readConsistsOf(C consistsOf)
public <C extends ConsistsOf<? extends Resource, ? extends Facet>> C readConsistsOf(C consistsOf)
throws NotFoundException, ResourceRegistryException {
return read(consistsOf);
}
@ -590,40 +620,43 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
}
@Override
public <C extends ConsistsOf<? extends Resource,? extends Facet>> C updateConsistsOf(C consistsOf)
throws NotFoundException, ResourceRegistryException {
public <C extends ConsistsOf<? extends Resource, ? extends Facet>> C updateConsistsOf(C consistsOf)
throws SchemaViolationException, NotFoundException, ResourceRegistryException {
return update(consistsOf);
}
@Override
public String updateConsistsOf(String consistsOf) throws NotFoundException, ResourceRegistryException {
public String updateConsistsOf(String consistsOf)
throws SchemaViolationException, NotFoundException, ResourceRegistryException {
return update(consistsOf);
}
@Override
public <C extends ConsistsOf<? extends Resource,? extends Facet>> boolean deleteConsistsOf(C consistsOf)
throws ResourceRegistryException {
public <C extends ConsistsOf<? extends Resource, ? extends Facet>> boolean deleteConsistsOf(C consistsOf)
throws SchemaViolationException, ResourceRegistryException {
return delete(consistsOf);
}
@Override
public boolean deleteConsistsOf(String consistsOfType, UUID uuid) throws ResourceRegistryException {
public boolean deleteConsistsOf(String consistsOfType, UUID uuid)
throws SchemaViolationException, ResourceRegistryException {
return delete(consistsOfType, uuid);
}
@Override
public <I extends IsRelatedTo<? extends Resource,? extends Resource>> I createIsRelatedTo(I isRelatedTo)
throws ResourceNotFoundException, ResourceRegistryException {
public <I extends IsRelatedTo<? extends Resource, ? extends Resource>> I createIsRelatedTo(I isRelatedTo)
throws SchemaViolationException, ResourceNotFoundException, ResourceRegistryException {
return create(isRelatedTo);
}
@Override
public String createIsRelatedTo(String isRelatedTo) throws ResourceNotFoundException, ResourceRegistryException {
public String createIsRelatedTo(String isRelatedTo)
throws SchemaViolationException, ResourceNotFoundException, ResourceRegistryException {
return create(isRelatedTo);
}
@Override
public <I extends IsRelatedTo<? extends Resource,? extends Resource>> I readIsRelatedTo(I isRelatedTo)
public <I extends IsRelatedTo<? extends Resource, ? extends Resource>> I readIsRelatedTo(I isRelatedTo)
throws NotFoundException, ResourceRegistryException {
return read(isRelatedTo);
}
@ -635,30 +668,32 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
}
@Override
public <I extends IsRelatedTo<? extends Resource,? extends Resource>> I updateIsRelatedTo(I isRelatedTo)
throws NotFoundException, ResourceRegistryException {
public <I extends IsRelatedTo<? extends Resource, ? extends Resource>> I updateIsRelatedTo(I isRelatedTo)
throws SchemaViolationException, NotFoundException, ResourceRegistryException {
return update(isRelatedTo);
}
@Override
public String updateIsRelatedTo(String isRelatedTo) throws NotFoundException, ResourceRegistryException {
public String updateIsRelatedTo(String isRelatedTo)
throws SchemaViolationException, NotFoundException, ResourceRegistryException {
return update(isRelatedTo);
}
@Override
public <I extends IsRelatedTo<? extends Resource,? extends Resource>> boolean deleteIsRelatedTo(I isRelatedTo)
throws ResourceRegistryException {
public <I extends IsRelatedTo<? extends Resource, ? extends Resource>> boolean deleteIsRelatedTo(I isRelatedTo)
throws SchemaViolationException, ResourceRegistryException {
return delete(isRelatedTo);
}
@Override
public boolean deleteIsRelatedTo(String isRelatedToType, UUID uuid) throws ResourceRegistryException {
public boolean deleteIsRelatedTo(String isRelatedToType, UUID uuid)
throws SchemaViolationException, ResourceRegistryException {
return delete(isRelatedToType, uuid);
}
@Override
public boolean addToContext(String type, UUID instanceUUID, UUID contextUUID)
throws NotFoundException, ResourceRegistryException {
throws SchemaViolationException, NotFoundException, ResourceRegistryException {
try {
logger.trace("Going to add {} with UUID {} to {} with UUID {} ", type, instanceUUID, Context.NAME,
contextUUID);
@ -677,10 +712,10 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
added ? " successfully added" : "was NOT added", Context.NAME, contextUUID);
return added;
} catch(ResourceRegistryException e) {
} catch (ResourceRegistryException e) {
// logger.trace("Error Creating {}", facet, e);
throw e;
} catch(Exception e) {
} catch (Exception e) {
// logger.trace("Error Creating {}", facet, e);
throw new RuntimeException(e);
}
@ -688,15 +723,16 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
@Override
public <IE extends IdentifiableElement> boolean addToContext(IE identifiableElement, UUID contextUUID)
throws NotFoundException, ResourceRegistryException {
throws SchemaViolationException, NotFoundException, ResourceRegistryException {
try {
String type = org.gcube.informationsystem.resourceregistry.api.utils.Utility.getTypeName(identifiableElement);
String type = org.gcube.informationsystem.resourceregistry.api.utils.Utility
.getTypeName(identifiableElement);
UUID instanceUUID = identifiableElement.getHeader().getUUID();
return addToContext(type, instanceUUID, contextUUID);
} catch(ResourceRegistryException e) {
} catch (ResourceRegistryException e) {
// logger.trace("Error Creating {}", facet, e);
throw e;
} catch(Exception e) {
} catch (Exception e) {
// logger.trace("Error Creating {}", facet, e);
throw new RuntimeException(e);
}
@ -704,20 +740,21 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
@Override
public boolean addToCurrentContext(String type, UUID instanceUUID)
throws NotFoundException, ResourceRegistryException {
throws SchemaViolationException, NotFoundException, ResourceRegistryException {
UUID contextUUID = getCurrentContextUUID();
return addToContext(type, instanceUUID, contextUUID);
}
@Override
public <IE extends IdentifiableElement> boolean addToCurrentContext(IE identifiableElement) throws NotFoundException, ResourceRegistryException {
public <IE extends IdentifiableElement> boolean addToCurrentContext(IE identifiableElement)
throws SchemaViolationException, NotFoundException, ResourceRegistryException {
UUID contextUUID = getCurrentContextUUID();
return addToContext(identifiableElement, contextUUID);
}
@Override
public boolean removeFromContext(String type, UUID instanceUUID, UUID contextUUID)
throws NotFoundException, ResourceRegistryException {
throws SchemaViolationException, NotFoundException, ResourceRegistryException {
try {
logger.trace("Going to add {} with UUID {} to {} with UUID {} ", type, instanceUUID, Context.NAME,
contextUUID);
@ -736,10 +773,10 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
removed ? " successfully removed" : "was NOT removed", Context.NAME, contextUUID);
return removed;
} catch(ResourceRegistryException e) {
} catch (ResourceRegistryException e) {
// logger.trace("Error Creating {}", facet, e);
throw e;
} catch(Exception e) {
} catch (Exception e) {
// logger.trace("Error Creating {}", facet, e);
throw new RuntimeException(e);
}
@ -747,30 +784,33 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
@Override
public <IE extends IdentifiableElement> boolean removeFromContext(IE identifiableElement, UUID contextUUID)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException {
try {
String type = org.gcube.informationsystem.resourceregistry.api.utils.Utility.getTypeName(identifiableElement);
String type = org.gcube.informationsystem.resourceregistry.api.utils.Utility
.getTypeName(identifiableElement);
UUID instanceUUID = identifiableElement.getHeader().getUUID();
return removeFromContext(type, instanceUUID, contextUUID);
} catch(ResourceRegistryException e) {
} catch (ResourceRegistryException e) {
// logger.trace("Error Creating {}", facet, e);
throw e;
} catch(Exception e) {
} catch (Exception e) {
// logger.trace("Error Creating {}", facet, e);
throw new RuntimeException(e);
}
}
@Override
public boolean removeFromCurrentContext(String type, UUID instanceUUID)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
public boolean removeFromCurrentContext(String type, UUID instanceUUID) throws SchemaViolationException,
ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
UUID contextUUID = getCurrentContextUUID();
return removeFromContext(type, instanceUUID, contextUUID);
}
@Override
public <IE extends IdentifiableElement> boolean removeFromCurrentContext(IE identifiableElement)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException {
UUID contextUUID = getCurrentContextUUID();
return removeFromContext(identifiableElement, contextUUID);
}
@ -795,10 +835,10 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
return contexts;
} catch(ResourceRegistryException e) {
} catch (ResourceRegistryException e) {
// logger.trace("Error Creating {}", facet, e);
throw e;
} catch(Exception e) {
} catch (Exception e) {
// logger.trace("Error Creating {}", facet, e);
throw new RuntimeException(e);
}
@ -812,52 +852,56 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
return getElementContexts(type, instanceUUID);
}
@Override
public boolean addResourceToContext(String resourceType, UUID resourceUUID, UUID contextUUID)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException {
return addToContext(resourceType, resourceUUID, contextUUID);
}
@Override
public <R extends Resource> boolean addResourceToContext(R resource, UUID contextUUID)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException {
return addToContext(resource, contextUUID);
}
@Override
public boolean addResourceToCurrentContext(String resourceType, UUID resourceUUID)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
public boolean addResourceToCurrentContext(String resourceType, UUID resourceUUID) throws SchemaViolationException,
ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
return addToCurrentContext(resourceType, resourceUUID);
}
@Override
public <R extends Resource> boolean addResourceToCurrentContext(R resource)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
public <R extends Resource> boolean addResourceToCurrentContext(R resource) throws SchemaViolationException,
ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
return addToCurrentContext(resource);
}
@Override
public boolean removeResourceFromContext(String resourceType, UUID resourceUUID, UUID contextUUID)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException {
return removeFromContext(resourceType, resourceUUID, contextUUID);
}
@Override
public <R extends Resource> boolean removeResourceFromContext(R resource, UUID contextUUID)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException {
return removeFromContext(resource, contextUUID);
}
@Override
public boolean removeResourceFromCurrentContext(String resourceType, UUID resourceUUID)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException {
return removeFromCurrentContext(resourceType, resourceUUID);
}
@Override
public <R extends Resource> boolean removeResourceFromCurrentContext(R resource)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
public <R extends Resource> boolean removeResourceFromCurrentContext(R resource) throws SchemaViolationException,
ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
return removeFromCurrentContext(resource);
}
@ -887,25 +931,26 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
@Override
public boolean removeFacetFromContext(String facetType, UUID facetUUID, UUID contextUUID)
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException {
throws SchemaViolationException, FacetNotFoundException, ContextNotFoundException,
ResourceRegistryException {
return removeFromContext(facetType, facetUUID, contextUUID);
}
@Override
public <F extends Facet> boolean removeFacetFromContext(F facet, UUID contextUUID)
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException {
public <F extends Facet> boolean removeFacetFromContext(F facet, UUID contextUUID) throws SchemaViolationException,
FacetNotFoundException, ContextNotFoundException, ResourceRegistryException {
return removeFromContext(facet, contextUUID);
}
@Override
public boolean removeFacetFromCurrentContext(String facetType, UUID facetUUID)
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException {
public boolean removeFacetFromCurrentContext(String facetType, UUID facetUUID) throws SchemaViolationException,
FacetNotFoundException, ContextNotFoundException, ResourceRegistryException {
return removeFromCurrentContext(facetType, facetUUID);
}
@Override
public <F extends Facet> boolean removeFacetFromCurrentContext(F facet)
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException {
public <F extends Facet> boolean removeFacetFromCurrentContext(F facet) throws SchemaViolationException,
FacetNotFoundException, ContextNotFoundException, ResourceRegistryException {
return removeFromCurrentContext(facet);
}