Using new methods instead of deprecated ones.

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/Common/resource-registry-handlers@154912 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-10-05 13:21:25 +00:00
parent ccf2361a19
commit f7ca18fd79
2 changed files with 7 additions and 12 deletions

View File

@ -304,7 +304,6 @@ public class EServiceManager extends ApplicationLifecycleHandler {
}
@SuppressWarnings("unchecked")
private Hosts<HostingNode, EService> createHostsRelation(EService eService,
ResourceRegistryPublisher resourceRegistryPublisher) throws ResourceRegistryException{
@ -318,7 +317,7 @@ public class EServiceManager extends ApplicationLifecycleHandler {
Hosts<HostingNode, EService> hosts = new HostsImpl<>(hostingNode, eService, propagationConstraint);
try {
hosts = resourceRegistryPublisher.createIsRelatedTo(Hosts.class, hosts);
hosts = resourceRegistryPublisher.createIsRelatedTo(hosts);
} catch (ResourceNotFoundException e) {
logger.error("THIS IS REALLY STRANGE. YOU SHOULD NE BE HERE. Error while creating {}.", hosts, e);
throw e;
@ -394,7 +393,6 @@ public class EServiceManager extends ApplicationLifecycleHandler {
@SuppressWarnings("unchecked")
private void createOrUpdateServiceStateFacet(String state) throws ResourceRegistryException {
ResourceRegistryClient resourceRegistryClient= ResourceRegistryClientFactory
@ -411,7 +409,7 @@ public class EServiceManager extends ApplicationLifecycleHandler {
if(serviceStateFacets !=null && serviceStateFacets.size()>=1){
serviceStateFacet = serviceStateFacets.get(0);
serviceStateFacet.setValue(state);
serviceStateFacet = resourceRegistryPublisher.updateFacet(ServiceStateFacet.class, serviceStateFacet);
serviceStateFacet = resourceRegistryPublisher.updateFacet(serviceStateFacet);
for(int i=1; i<serviceStateFacets.size(); i++){
try {
@ -425,11 +423,11 @@ public class EServiceManager extends ApplicationLifecycleHandler {
}else {
serviceStateFacet = new ServiceStateFacetImpl();
serviceStateFacet.setValue(state);
serviceStateFacet = resourceRegistryPublisher.createFacet(ServiceStateFacet.class, serviceStateFacet);
serviceStateFacet = resourceRegistryPublisher.createFacet(serviceStateFacet);
ConsistsOf<EService, ServiceStateFacet> consistsOf = new ConsistsOfImpl<EService, ServiceStateFacet>(
eService, serviceStateFacet, null);
consistsOf = resourceRegistryPublisher.createConsistsOf(ConsistsOf.class, consistsOf);
consistsOf = resourceRegistryPublisher.createConsistsOf(consistsOf);
// Newly created ServiceStateFacet must be added to all context

View File

@ -270,8 +270,7 @@ public class HostingNodeManager extends ContainerHandler {
try {
hostingNode = resourceRegistryPublisher
.createResource(HostingNode.class,
hostingNode);
.createResource(hostingNode);
share(hostingNode);
// TODO Add a Reference to Site
@ -478,14 +477,12 @@ public class HostingNodeManager extends ContainerHandler {
consistsOfList.removeAll(consistsOfToRemove);
try {
hostingNode = resourceRegistryPublisher.updateResource(
HostingNode.class, hostingNode);
hostingNode = resourceRegistryPublisher.updateResource(hostingNode);
} catch (ResourceNotFoundException e) {
/* Update failed trying to recreate it */
// ReAdding the removed relations to recreate all
consistsOfList.addAll(consistsOfToRemove);
hostingNode = resourceRegistryPublisher.createResource(
HostingNode.class, hostingNode);
hostingNode = resourceRegistryPublisher.createResource(hostingNode);
}
return hostingNode;