Fixing library

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/Common/resource-registry-handlers@177268 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2019-02-26 09:16:10 +00:00
parent 870924d756
commit 38a033c7be
2 changed files with 13 additions and 14 deletions

View File

@ -36,9 +36,9 @@ import org.gcube.informationsystem.model.reference.properties.PropagationConstra
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.RemoveConstraint;
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
import org.gcube.informationsystem.model.reference.relations.IsIdentifiedBy;
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.entity.resource.ResourceAvailableInAnotherContextException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceNotFoundException;
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClient;
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientFactory;
import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisher;
@ -325,7 +325,7 @@ public class EServiceManager extends ApplicationLifecycleHandler {
try {
activates = resourceRegistryPublisher.createIsRelatedTo(activates);
} catch (ResourceNotFoundException e) {
} catch (NotFoundException e) {
logger.error("THIS IS REALLY STRANGE. YOU SHOULD NE BE HERE. Error while creating {}.", activates, e);
throw e;
} catch (ResourceRegistryException e) {
@ -348,10 +348,10 @@ public class EServiceManager extends ApplicationLifecycleHandler {
try {
resourceRegistryClient.exists(EService.class, eServiceUUID);
eService = resourceRegistryClient.getInstance(EService.class, eServiceUUID);
} catch (ResourceNotFoundException e) {
} catch (NotFoundException e) {
eService = instantiateEService(eServiceUUID);
eService = createActivatesRelation(eService, resourceRegistryPublisher).getTarget();
} catch (ResourceAvailableInAnotherContextException e) {
} catch (AvailableInAnotherContextException e) {
addToContext(resourceRegistryPublisher);
eService = resourceRegistryClient.getInstance(EService.class, eServiceUUID);
} catch (ResourceRegistryException e) {

View File

@ -47,11 +47,10 @@ import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.model.reference.properties.Header;
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
import org.gcube.informationsystem.model.reference.relations.IsIdentifiedBy;
import org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException;
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.entity.resource.ResourceAlreadyPresentException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceAvailableInAnotherContextException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.relation.RelationAvailableInAnotherContextException;
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClient;
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientFactory;
import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisher;
@ -68,10 +67,10 @@ import org.gcube.resourcemanagement.model.impl.relations.consistsof.HasVolatileM
import org.gcube.resourcemanagement.model.reference.entities.facets.CPUFacet;
import org.gcube.resourcemanagement.model.reference.entities.facets.ContainerStateFacet;
import org.gcube.resourcemanagement.model.reference.entities.facets.MemoryFacet;
import org.gcube.resourcemanagement.model.reference.entities.facets.MemoryFacet.MemoryUnit;
import org.gcube.resourcemanagement.model.reference.entities.facets.NetworkingFacet;
import org.gcube.resourcemanagement.model.reference.entities.facets.SimplePropertyFacet;
import org.gcube.resourcemanagement.model.reference.entities.facets.SoftwareFacet;
import org.gcube.resourcemanagement.model.reference.entities.facets.MemoryFacet.MemoryUnit;
import org.gcube.resourcemanagement.model.reference.entities.resources.HostingNode;
import org.gcube.resourcemanagement.model.reference.relations.consistsof.HasPersistentMemory;
import org.gcube.resourcemanagement.model.reference.relations.consistsof.HasVolatileMemory;
@ -290,14 +289,14 @@ public class HostingNodeManager extends ContainerHandler {
* ()).domain(domainIn(cfg.hostname()));
*/
} catch (ResourceAlreadyPresentException e) {
} catch (AlreadyPresentException e) {
ResourceRegistryClient registryClient = ResourceRegistryClientFactory
.create();
hostingNode = registryClient.getInstance(
HostingNode.class, hostingNode.getHeader()
.getUUID());
updateHostingNode(hostingNode);
} catch (ResourceAvailableInAnotherContextException e) {
} catch (AvailableInAnotherContextException e) {
addToContext(hostingNode, token);
}
@ -486,12 +485,12 @@ public class HostingNodeManager extends ContainerHandler {
try {
hostingNode = resourceRegistryPublisher.updateResource(hostingNode);
} catch (ResourceNotFoundException e) {
} catch (NotFoundException e) {
/* Update failed trying to recreate it */
// ReAdding the removed relations to recreate all
consistsOfList.addAll(consistsOfToRemove);
hostingNode = resourceRegistryPublisher.createResource(hostingNode);
} catch (ResourceAvailableInAnotherContextException | RelationAvailableInAnotherContextException e) {
} catch (AvailableInAnotherContextException e) {
addToContext(hostingNode, SecurityTokenProvider.instance.get());
hostingNode = resourceRegistryPublisher.updateResource(hostingNode);
} catch (ResourceRegistryException e) {